Skip to content

Commit

Permalink
v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AbyssMorgan committed Mar 3, 2024
1 parent 99a874e commit 9ded3ff
Show file tree
Hide file tree
Showing 38 changed files with 1,791 additions and 1,047 deletions.
4 changes: 1 addition & 3 deletions AVE-PHP.iss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define MyAppName "AVE-PHP"
#define MyAppVersion "2.0.1"
#define MyAppVersion "2.1.0"
#define MyAppPublisher "Abyss Morgan"
#define MyAppURL "https://github.com/AbyssMorgan"
#define MyAppExeName "AVE-PHP.cmd"
Expand Down Expand Up @@ -41,9 +41,7 @@ Source: "{#SourcePath}\commands\*"; DestDir: "{app}\commands"; Flags: ignorevers
Source: "{#SourcePath}\AVE-PHP.cmd"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}\LICENSE"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}\ave-php.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}\ave-php.png"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}\Changelog.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}\example.ave-php"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}\composer.json"; DestDir: "{app}"; Flags: ignoreversion

[Icons]
Expand Down
10 changes: 10 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
v2.1.0:
- Added tool: Media Tools > Ident mime type: Images
- Added tool: Directory Names Editor > Escape directory name (WWW)
- Added tool: Directory Names Editor > Pretty directory name
- Added tool: Directory Names Editor > Add directory name prefix/suffix
- Added tool: Directory Names Editor > Remove keywords from directory name
- Added tool: Directory Names Editor > Insert string into directory name
- Added tool: Directory Names Editor > Replace keywords in directory name
- Rebuild AveCore and separated libraries that can be used without AVE-PHP

v2.0.1:
- Improved tool: File Functions > Anti Duplicates (added mode a3 and b3 - detect duplicates and write logs only)
- Improved tool: Media Tools > Video: Fetch media info (added FPS and codec)
Expand Down
65 changes: 36 additions & 29 deletions includes/AVE.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,32 @@

declare(strict_types=1);

use App\Services\IniFile;
use App\Services\AveCore;
use App\Services\AppBuffer;
use AveCore\Core;
use AveCore\IniFile;
use AveCore\AppBuffer;

use App\Tools\AveSettings;
use App\Tools\AdmFileConverter;
use App\Tools\AveConsole;
use App\Tools\FileNamesEditor;
use App\Tools\AveSettings;
use App\Tools\CheckFileIntegrity;
use App\Tools\DirectoryFunctions;
use App\Tools\DirectoryNamesEditor;
use App\Tools\FileEditor;
use App\Tools\FileFunctions;
use App\Tools\FileNamesEditor;
use App\Tools\FtpTools;
use App\Tools\MediaSorter;
use App\Tools\DirectoryFunctions;
use App\Tools\MediaTools;
use App\Tools\CheckFileIntegrity;
use App\Tools\MySQLTools;
use App\Tools\FileEditor;
use App\Tools\FtpTools;
use App\Tools\AdmFileConverter;

class AVE extends AveCore {
class AVE extends Core {

public IniFile $mkvmerge;
public AppBuffer $app_buffer;
public string $app_data;
public bool $abort = false;
public string $app_name = "AVE-PHP";
public string $version = "2.0.1";
public string $version = "2.1.0";

private array $folders_to_scan = [
'bin',
Expand All @@ -40,6 +41,7 @@ public function __construct(array $arguments){
$config_default = new IniFile($this->get_file_path("$this->path/includes/config/default.ini"), true);
if($this->windows){
dl('php_imagick.dll');
dl('php_exif.dll');
$config_default_system = new IniFile($this->get_file_path("$this->path/includes/config/windows.ini"), true);
$old_app_data = $this->get_file_path($this->get_variable("%LOCALAPPDATA%")."/AVE");
$this->app_data = $this->get_file_path($this->get_variable("%LOCALAPPDATA%")."/AVE-PHP");
Expand All @@ -57,7 +59,7 @@ public function __construct(array $arguments){
$config_default_system->set('AVE_OPEN_FILE_BINARY', $open_file_binary);
}

$config_default->update($config_default_system->getAll());
$config_default->update($config_default_system->get_all());

$this->logo = "\r\n $this->app_name Toolkit v$this->version by Abyss Morgan\r\n";
$changed = false;
Expand All @@ -80,15 +82,15 @@ public function __construct(array $arguments){
$this->config->unset(['AVE_DATA_FOLDER','AVE_LOG_FOLDER']);
}

foreach($config_default->getAll() as $key => $value){
if(!$this->config->isSet($key)){
foreach($config_default->get_all() as $key => $value){
if(!$this->config->is_set($key)){
$this->config->set($key, $value);
$changed = true;
}
}

foreach($this->config->allExcept(['APP_NEXT_CHECK_FOR_UPDATE', 'APP_VERSION']) as $key => $value){
if(!$config_default->isSet($key)){
foreach($this->config->all_except(['APP_NEXT_CHECK_FOR_UPDATE', 'APP_VERSION']) as $key => $value){
if(!$config_default->is_set($key)){
$this->config->unset($key);
$changed = true;
}
Expand Down Expand Up @@ -195,17 +197,18 @@ public function select_tool() : bool {
$this->tool_name = '';
$options = [
' Tools:',
' 0 - File Names Editor',
' 1 - File Functions',
' 2 - Media Sorter',
' 3 - Directory Functions',
' 4 - Media Tools',
' 5 - Check File Integrity',
' 6 - MySQL Tools',
' 7 - File Editor',
' 8 - FTP Tools',
' 9 - ADM File Converter',
' H - Help',
' 0 - File Names Editor',
' 1 - File Functions',
' 2 - Media Sorter',
' 3 - Directory Functions',
' 4 - Media Tools',
' 5 - Check File Integrity',
' 6 - MySQL Tools',
' 7 - File Editor',
' 8 - FTP Tools',
' 9 - ADM File Converter',
' 10 - Directory Names Editor',
' H - Help',
];
if(!$this->windows) array_push($options, ' # - Close program');
$this->print_help($options);
Expand Down Expand Up @@ -253,12 +256,16 @@ public function select_tool() : bool {
$this->tool = new AdmFileConverter($this);
break;
}
case '10': {
$this->tool = new DirectoryNamesEditor($this);
break;
}
case 'H': {
$this->tool = new AveSettings($this);
break;
}
case '#': {
if($this->can_exit) return true;
if($this->can_exit || !$this->windows) return true;
}
}
if(!$this->abort && !is_null($this->tool)){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,30 @@

declare(strict_types=1);

namespace App\Services;
namespace AveCore;

use Exception;

class AppBuffer {

protected string $path;

public int $version = 10000;

function __construct(string $path){
$this->path = $path;
if(!file_exists($this->path)) mkdir($this->path, 0755, true);
}

public function getPath() : string {
public function get_path() : string {
return $this->path;
}

public function getFile(string $key) : string {
public function get_file(string $key) : string {
$key = hash('sha256', $key);
return $this->path.DIRECTORY_SEPARATOR."$key.json";
}

public function get(string $key, int|bool|string|array|float|null $default = null) : mixed {
$file = $this->getFile($key);
$file = $this->get_file($key);
if(!file_exists($file)) return $default;
$buffer = json_decode(file_get_contents($file), true);
if(!isset($buffer['expire']) || !isset($buffer['type'])) return $default;
Expand All @@ -44,7 +42,7 @@ public function get(string $key, int|bool|string|array|float|null $default = nul
}

public function set(string $key, int|bool|string|array|float|null $value, int $expire = -1) : void {
$file = $this->getFile($key);
$file = $this->get_file($key);
if($expire > 0) $expire = time() + $expire;
$type = strtolower(gettype($value));
switch($type){
Expand Down Expand Up @@ -75,10 +73,10 @@ public function set(string $key, int|bool|string|array|float|null $value, int $e
}

public function forget(string $key) : void {
$this->delete($this->getFile($key));
$this->delete($this->get_file($key));
}

public function clearExpired() : void {
public function clear_expired() : void {
$files = scandir($this->path);
foreach($files as $file){
$buffer = json_decode(file_get_contents($this->path.DIRECTORY_SEPARATOR.$file), true);
Expand Down
71 changes: 71 additions & 0 deletions includes/avecore/BinaryFile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php

declare(strict_types=1);

namespace AveCore;

class BinaryFile {

private mixed $file = null;
private ?string $path = null;

function __construct(?string $path = null, ?int $allocate = null){
$this->path = $path;
if(!is_null($path)) $this->open($path, $allocate);
}

public function create(string $path, ?int $allocate = null) : bool {
if(file_exists($path)) return false;
$folder = pathinfo($path, PATHINFO_DIRNAME);
if(!file_exists($folder) && !@mkdir($folder, 0755, true)) return false;
$file = @fopen($path, "wb");
if(!$file) return false;
if(!is_null($allocate) && $allocate > 0){
fseek($file, $allocate - 1);
fwrite($file, "\0");
} else {
fwrite($file, "");
}
fclose($file);
return file_exists($path);
}

public function open(string $path, ?int $allocate = null) : bool {
if(!is_null($this->file)) return false;
if(!file_exists($path) && !$this->create($path, $allocate)) return false;
$this->file = fopen($path, "r+b");
if(!$this->file) return false;
$this->path = $path;
return true;
}

public function close() : bool {
if(is_null($this->file)) return false;
fclose($this->file);
$this->file = null;
$this->path = null;
return true;
}

public function read(int $offset = 0, ?int $length = null) : string|false {
if(is_null($this->file)) return false;
fseek($this->file, $offset);
if(is_null($length)) $length = filesize($this->path) - $offset;
if($length <= 0) return "";
return fread($this->file, $length);
}

public function write(string $data, int $offset = 0, ?int $length = null) : int|false {
if(is_null($this->file)) return false;
fseek($this->file, $offset);
return fwrite($this->file, $data, $length);
}

public function size() : int|false {
if(is_null($this->file)) return false;
return filesize($this->path);
}

}

?>
Loading

0 comments on commit 9ded3ff

Please sign in to comment.