clrghouz/app/Console/Commands/BBS/ANSIEncode.php
Deon George 1e617bb8be
Some checks failed
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 35s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m44s
Create Docker Image / Final Docker Image Manifest (push) Has been cancelled
Move ANSI* commands to BBS/
2024-05-28 12:43:58 +10:00

42 lines
699 B
PHP

<?php
namespace App\Console\Commands\BBS;
use Illuminate\Console\Command;
use App\Classes\ANSI;
class ANSIEncode extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'bbs:ansi:encode'
.' {file : ANS file to encode}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Encode ANS file to custom binary';
/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
foreach (ANSI::binary($this->argument('file')) as $line) {
foreach (str_split(bin2hex($line),2) as $y)
echo hex2bin($y);
echo "\r";
}
return self::SUCCESS;
}
}