From 2dd7a6ebd3a80bf57c649e3ad20a41b9d514c03f Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 28 May 2024 12:43:58 +1000 Subject: [PATCH] Move ANSI* commands to BBS/ --- app/Console/Commands/BBS/ANSIDecode.php | 37 +++++++++++++++++ app/Console/Commands/BBS/ANSIEncode.php | 42 +++++++++++++++++++ app/Console/Commands/BBS/FrameDelete.php | 53 ++++++++++++++++++++++++ app/Console/Commands/BBS/FrameImport.php | 2 +- 4 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 app/Console/Commands/BBS/ANSIDecode.php create mode 100644 app/Console/Commands/BBS/ANSIEncode.php create mode 100644 app/Console/Commands/BBS/FrameDelete.php diff --git a/app/Console/Commands/BBS/ANSIDecode.php b/app/Console/Commands/BBS/ANSIDecode.php new file mode 100644 index 0000000..94c53db --- /dev/null +++ b/app/Console/Commands/BBS/ANSIDecode.php @@ -0,0 +1,37 @@ +argument('file')); + + return self::SUCCESS; + } +} \ No newline at end of file diff --git a/app/Console/Commands/BBS/ANSIEncode.php b/app/Console/Commands/BBS/ANSIEncode.php new file mode 100644 index 0000000..80595f3 --- /dev/null +++ b/app/Console/Commands/BBS/ANSIEncode.php @@ -0,0 +1,42 @@ +argument('file')) as $line) { + foreach (str_split(bin2hex($line),2) as $y) + echo hex2bin($y); + + echo "\r"; + } + + return self::SUCCESS; + } +} \ No newline at end of file diff --git a/app/Console/Commands/BBS/FrameDelete.php b/app/Console/Commands/BBS/FrameDelete.php new file mode 100644 index 0000000..e0111c6 --- /dev/null +++ b/app/Console/Commands/BBS/FrameDelete.php @@ -0,0 +1,53 @@ +argument('frame'))) + throw new \Exception('Frame is not numeric: '.$this->argument('frame')); + + if (strlen($this->argument('index')) != 1 OR ! preg_match('/^[a-z]$/',$this->argument('index'))) + throw new \Exception('Subframe failed validation'); + + try { + $o = Frame::where('frame',$this->argument('frame')) + ->where('index',$this->argument('index')) + ->firstOrFail(); + + } catch (ModelNotFoundException $e) { + $this->error('Page not found to delete: '.$this->argument('frame').$this->argument('index')); + die(1); + } + + $o->delete(); + $this->info('Page deleted: '.$this->argument('frame').$this->argument('index')); + + return self::SUCCESS; + } +} \ No newline at end of file diff --git a/app/Console/Commands/BBS/FrameImport.php b/app/Console/Commands/BBS/FrameImport.php index 2e6176b..81c5795 100644 --- a/app/Console/Commands/BBS/FrameImport.php +++ b/app/Console/Commands/BBS/FrameImport.php @@ -15,7 +15,7 @@ class FrameImport extends Command * * @var string */ - protected $signature = 'frame:import {frame} {file} '. + protected $signature = 'bbs:frame:import {frame} {file} '. '{--index=a : The frame index }'. '{--access=0 : Is frame accessible }'. '{--public=0 : Is frame limited to CUG }'.