Added converting ANSI to a binary format, and custom font rendering
This commit is contained in:
35
app/Console/Commands/ANSIDecode.php
Normal file
35
app/Console/Commands/ANSIDecode.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
use App\Classes\ANSI;
|
||||
|
||||
class ANSIDecode extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'ansi:decode'
|
||||
.' {file : ANS file to decode}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Encode ANS file to custom binary';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
echo ANSI::ansi($this->argument('file'));
|
||||
}
|
||||
}
|
40
app/Console/Commands/ANSIEncode.php
Normal file
40
app/Console/Commands/ANSIEncode.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
use App\Classes\ANSI;
|
||||
|
||||
class ANSIEncode extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = '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 mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
foreach (ANSI::binary($this->argument('file')) as $line) {
|
||||
foreach (str_split(bin2hex($line),2) as $y)
|
||||
echo hex2bin($y);
|
||||
|
||||
echo "\r";
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user