Skip to content

Commit

Permalink
v2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
AbyssMorgan committed Dec 23, 2023
1 parent 37d30ea commit 149a2d3
Show file tree
Hide file tree
Showing 18 changed files with 236 additions and 41 deletions.
2 changes: 1 addition & 1 deletion 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.0"
#define MyAppVersion "2.0.1"
#define MyAppPublisher "Abyss Morgan"
#define MyAppURL "https://github.com/AbyssMorgan"
#define MyAppExeName "AVE-PHP.cmd"
Expand Down
6 changes: 6 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
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)
- Added tool: ADM File Converter > Ini converter (INI <=> GZ-INI)
- Added tool: ADM File Converter > ADM Journal converter (ADM-JOURNAL => Text)

v2.0.0:
- MySQL tool now support multiple data base into one connection label, you need set data base value to * for use that feature
- Fixed FTP Tools > Import FileZilla XML (Now you can import xml with single server)
Expand Down
8 changes: 7 additions & 1 deletion includes/AVE.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use App\Tools\MySQLTools;
use App\Tools\FileEditor;
use App\Tools\FtpTools;
use App\Tools\AdmFileConverter;

class AVE extends AveCore {

Expand All @@ -25,7 +26,7 @@ class AVE extends AveCore {
public string $app_data;
public bool $abort = false;
public string $app_name = "AVE-PHP";
public string $version = "2.0.0";
public string $version = "2.0.1";

private array $folders_to_scan = [
'bin',
Expand Down Expand Up @@ -203,6 +204,7 @@ public function select_tool() : bool {
' 6 - MySQL Tools',
' 7 - File Editor',
' 8 - FTP Tools',
' 9 - ADM File Converter',
' H - Help',
];
if(!$this->windows) array_push($options, ' # - Close program');
Expand Down Expand Up @@ -247,6 +249,10 @@ public function select_tool() : bool {
$this->tool = new FtpTools($this);
break;
}
case '9': {
$this->tool = new AdmFileConverter($this);
break;
}
case 'H': {
$this->tool = new AveSettings($this);
break;
Expand Down
1 change: 1 addition & 0 deletions includes/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
require_once("$includes_path/tools/MySQLTools.php");
require_once("$includes_path/tools/FileEditor.php");
require_once("$includes_path/tools/FtpTools.php");
require_once("$includes_path/tools/AdmFileConverter.php");

$ave = new AVE($argv);
if(!$ave->abort) $ave->execute();
Expand Down
2 changes: 1 addition & 1 deletion includes/services/JournalService.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function read(bool $json = false) : ?array {
$fp = fopen($this->path, "rb");
if(!$fp) return null;
$header = fread($fp, 11);
if($header != self::FILE_HEADER_DATA) return null;
if(!in_array($header, [self::FILE_HEADER_DATA, 'EMU-JOURNAL'])) return null;
fseek($fp, 12);
while(!feof($fp)){
$l = fread($fp, 4);
Expand Down
173 changes: 173 additions & 0 deletions includes/tools/AdmFileConverter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<?php

declare(strict_types=1);

namespace App\Tools;

use AVE;
use Exception;
use App\Services\IniFile;
use App\Services\JournalService;

class AdmFileConverter {

private string $name = "ADM File Converter";

private array $params = [];
private string $action;
private AVE $ave;

public function __construct(AVE $ave){
$this->ave = $ave;
$this->ave->set_tool($this->name);
}

public function help() : void {
$this->ave->print_help([
' Actions:',
' 0 - Ini converter (INI <=> GZ-INI)',
' 1 - ADM Journal converter (ADM-JOURNAL => Text)',
]);
}

public function action(string $action) : bool {
$this->params = [];
$this->action = $action;
switch($this->action){
case '0': return $this->ToolIniConverter();
case '1': return $this->ToolAdmJournalConverter();
}
return false;
}

public function ToolIniConverter() : bool {
$this->ave->set_subtool("Ini converter");

set_mode:
$this->ave->clear();
$this->ave->print_help([
' Modes:',
' 0 - Convert INI to GZ-INI',
' 1 - Convert GZ-INI to INI',
' 2 - Print GZ-INI/INI',
]);

$line = $this->ave->get_input(" Mode: ");
if($line == '#') return false;

$this->params = [
'mode' => strtolower($line[0] ?? '?'),
];

if(!in_array($this->params['mode'], ['0', '1', '2'])) goto set_mode;

$this->ave->clear();

set_input:
$line = $this->ave->get_input(" Input: ");
if($line == '#') return false;
$folders = $this->ave->get_input_folders($line);
if(!isset($folders[0])) goto set_input;
$input = $folders[0];

if(!file_exists($input) || is_dir($input)){
$this->ave->echo(" Invalid input file");
goto set_input;
}

try {
$ini = new IniFile($input, true, $this->params['mode'] == '0');
}
catch(Exception $e){
$this->ave->echo(" Failed parse file: ".$e->getMessage());
goto set_input;
}

if($this->params['mode'] == '2'){
$this->ave->write_data(print_r($ini->getAll(), true));
$this->ave->open_logs();
} else {
set_output:
$line = $this->ave->get_input(" Output: ");
if($line == '#') return false;
$folders = $this->ave->get_input_folders($line);
if(!isset($folders[0])) goto set_output;
$output = $folders[0];

if(file_exists($output) && is_dir($output)){
$this->ave->echo(" Invalid output file");
goto set_output;
}

if(file_exists($output)){
if(!$this->ave->get_confirm(" Output file exists, overwrite (Y/N): ")) goto set_output;
}

if($input == $output){
$ini->save();
} else {
$new = new IniFile($output, true, $this->params['mode'] == '0');
$new->setAll($ini->getAll());
$new->save();
}
}

$this->ave->pause(" Operation done, press any key to back to menu");
return false;
}

public function ToolAdmJournalConverter() : bool {
$this->ave->clear();
$this->ave->set_subtool("ADM Journal converter");

set_input:
$line = $this->ave->get_input(" Input: ");
if($line == '#') return false;
$folders = $this->ave->get_input_folders($line);
if(!isset($folders[0])) goto set_input;
$input = $folders[0];

if(!file_exists($input) || is_dir($input)){
$this->ave->echo(" Invalid input file");
goto set_input;
}

try {
$journal = new JournalService($input);
}
catch(Exception $e){
$this->ave->echo(" Failed parse file: ".$e->getMessage());
goto set_input;
}

set_output:
$line = $this->ave->get_input(" Output: ");
if($line == '#') return false;
$folders = $this->ave->get_input_folders($line);
if(!isset($folders[0])) goto set_output;
$output = $folders[0];

if(file_exists($output) && is_dir($output)){
$this->ave->echo(" Invalid output file");
goto set_output;
}

if(file_exists($output)){
if(!$this->ave->get_confirm(" Output file exists, overwrite (Y/N): ")) goto set_output;
}

$directory = pathinfo($output, PATHINFO_DIRNAME);
if(!file_exists($directory) && !$this->ave->mkdir($directory)){
$this->ave->echo(" Failed create destination directory \"$directory\"");
goto set_output;
}

file_put_contents($output, implode("\r\n", $journal->read()));

$this->ave->pause(" Operation done, press any key to back to menu");
return false;
}

}

?>
2 changes: 1 addition & 1 deletion includes/tools/AveConsole.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class AveConsole {

private string $name = "AveConsole";
private string $name = "Ave Console";

private AVE $ave;

Expand Down
2 changes: 1 addition & 1 deletion includes/tools/AveSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class AveSettings {

private string $name = "AveSettings";
private string $name = "Ave Settings";

private array $params = [];
private string $action;
Expand Down
18 changes: 9 additions & 9 deletions includes/tools/CheckFileIntegrity.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class CheckFileIntegrity {

private string $name = "CheckFileIntegrity";
private string $name = "Check File Integrity";

private array $params = [];
private string $action;
Expand Down Expand Up @@ -54,7 +54,7 @@ public function action(string $action) : bool {

public function ToolCreatePattern() : bool {
$this->ave->clear();
$this->ave->set_subtool("CreatePattern");
$this->ave->set_subtool("Create pattern");

set_input:
$line = $this->ave->get_input(" Input (Folder): ");
Expand Down Expand Up @@ -124,7 +124,7 @@ public function ToolCreatePattern() : bool {

public function ToolGuardGenerate() : bool {
$this->ave->clear();
$this->ave->set_subtool("GuardGenerate");
$this->ave->set_subtool("Guard generate");

set_pattern:
$line = $this->ave->get_input(" Pattern (.ave-pat): ");
Expand Down Expand Up @@ -167,7 +167,7 @@ public function ToolGuardGenerate() : bool {

public function ToolCheckIntegrity() : bool {
$this->ave->clear();
$this->ave->set_subtool("CheckIntegrity");
$this->ave->set_subtool("Check integrity");

set_guard:
$line = $this->ave->get_input(" Guard (.ave-guard): ");
Expand Down Expand Up @@ -241,7 +241,7 @@ public function ToolCheckIntegrity() : bool {

public function ToolGetFilesTree() : bool {
$this->ave->clear();
$this->ave->set_subtool("GetFilesTree");
$this->ave->set_subtool("Get files tree");

set_guard:
$line = $this->ave->get_input(" Guard (.ave-guard): ");
Expand Down Expand Up @@ -275,7 +275,7 @@ public function ToolGetFilesTree() : bool {

public function ToolUpdateRemoveMissing() : bool {
$this->ave->clear();
$this->ave->set_subtool("UpdateRemoveMissing");
$this->ave->set_subtool("Update remove missing");
$guard_file = $this->ToolGuardSetFile();
if(is_null($guard_file)) return false;
$this->ToolGuardUpdate($guard_file, ['damaged' => false, 'unknown' => false, 'missing' => true]);
Expand All @@ -286,7 +286,7 @@ public function ToolUpdateRemoveMissing() : bool {

public function ToolUpdateAddUnknown() : bool {
$this->ave->clear();
$this->ave->set_subtool("UpdateAddUnknown");
$this->ave->set_subtool("Update add unknown");
$guard_file = $this->ToolGuardSetFile();
if(is_null($guard_file)) return false;
$this->ToolGuardUpdate($guard_file, ['damaged' => false, 'unknown' => true, 'missing' => false]);
Expand All @@ -297,7 +297,7 @@ public function ToolUpdateAddUnknown() : bool {

public function ToolUpdateChanged() : bool {
$this->ave->clear();
$this->ave->set_subtool("UpdateChanged");
$this->ave->set_subtool("Update changed");
$guard_file = $this->ToolGuardSetFile();
if(is_null($guard_file)) return false;
$this->ToolGuardUpdate($guard_file, ['damaged' => true, 'unknown' => false, 'missing' => false]);
Expand All @@ -308,7 +308,7 @@ public function ToolUpdateChanged() : bool {

public function ToolUpdateMissingAndUnknown() : bool {
$this->ave->clear();
$this->ave->set_subtool("UpdateMissingAndUnknown");
$this->ave->set_subtool("Update missing and unknown");
$guard_file = $this->ToolGuardSetFile();
if(is_null($guard_file)) return false;
$this->ToolGuardUpdate($guard_file, ['damaged' => false, 'unknown' => true, 'missing' => true]);
Expand Down
10 changes: 5 additions & 5 deletions includes/tools/DirectoryFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class DirectoryFunctions {

private string $name = "DirectoryFunctions";
private string $name = "Directory Functions";

private array $params = [];
private string $action;
Expand Down Expand Up @@ -44,7 +44,7 @@ public function action(string $action) : bool {

public function ToolDeleteEmptyFolders() : bool {
$this->ave->clear();
$this->ave->set_subtool("DeleteEmptyFolders");
$this->ave->set_subtool("Delete empty folders");
$line = $this->ave->get_input(" Folders: ");
if($line == '#') return false;
$folders = $this->ave->get_input_folders($line);
Expand Down Expand Up @@ -83,7 +83,7 @@ public function ToolDeleteEmptyFolders() : bool {

public function ToolForceLoadIcon() : bool {
$this->ave->clear();
$this->ave->set_subtool("ForceLoadIcon");
$this->ave->set_subtool("Force load icon");
if(!$this->ave->windows) return $this->ave->windows_only();

$line = $this->ave->get_input(" Folders: ");
Expand Down Expand Up @@ -119,7 +119,7 @@ public function ToolForceLoadIcon() : bool {

public function ToolCountFiles() : bool {
$this->ave->clear();
$this->ave->set_subtool("CountFiles");
$this->ave->set_subtool("Count files");

$line = $this->ave->get_input(" Folders: ");
if($line == '#') return false;
Expand Down Expand Up @@ -170,7 +170,7 @@ public function ToolCountFiles() : bool {

public function ToolCloneFolderStructure() : bool {
$this->ave->clear();
$this->ave->set_subtool("CloneFolderStructure");
$this->ave->set_subtool("Clone folder structure");

set_input:
$line = $this->ave->get_input(" Input (Folder): ");
Expand Down
Loading

0 comments on commit 149a2d3

Please sign in to comment.