Increase page length for ANSI, and minor updates

This commit is contained in:
Deon George
2019-01-02 20:56:03 +11:00
parent 390f52a460
commit f2e6a250cc
8 changed files with 51 additions and 38 deletions

View File

@@ -346,7 +346,7 @@ abstract class Frame
*/
private function render_page(int $num,string $frame)
{
if ($num > 999999999)
if ($num > (int)str_repeat(9,static::$pagenum_length))
throw new \Exception('Page Number too big',500);
if (strlen($frame) !== 1)
@@ -400,7 +400,7 @@ abstract class Frame
// Header
$sid = R_RED.'T'.R_BLUE.'E'.R_GREEN.'S'.R_YELLOW.'T';
$content .= substr($sid.'-'.str_repeat('12345678901234567890',4),0,static::$header_length+(strlen($sid)-$so->strlenv($sid))).
R_WHITE.'999999999a'.R_RED.sprintf('%07.0f',999).'u';
R_WHITE.str_repeat('9',static::$pagenum_length).'a'.R_RED.sprintf('%07.0f',999).'u';
$content .= R_WHITE.str_repeat('+-',static::$frame_width/2-3).' '.R_RED.'01';
$content .= R_WHITE.'Name: '.ESC.str_repeat('t',5).' |'.str_repeat('+-',static::$frame_width/2-8).'|';

View File

@@ -12,8 +12,8 @@ class Ansi extends AbstractFrame
public static $frame_length = 22;
public static $frame_width = 80;
public static $header_length = 60;
public static $pagenum_length = 9;
public static $header_length = 58;
public static $pagenum_length = 11;
public static $cost_length = 7;
public static $cost_unit = 'u';

View File

@@ -584,10 +584,18 @@ abstract class Server {
break;
}
// Bookmark page
if ($cmd === '05') {
$this->sendBaseline($client, RED.'NOT IMPLEMENTED YET?');
$mode = FALSE;
break;
}
// Report a problem
if ($cmd === '08') {
$this->sendBaseline($client, RED.'NOT IMPLEMENTED YET?');
$read = STAR;
$mode = FALSE;
break;
}
@@ -617,7 +625,7 @@ abstract class Server {
$current['fieldreset'] = TRUE;
} else {
$mode = false;
$mode = FALSE;
}
break;

View File

@@ -76,16 +76,21 @@ class FrameImport extends Command
$o->frame = $this->argument('frame');
$o->index = $this->argument('index');
$o->mode_id = $mo->id;
$o->access = $this->option('access');
$o->public = $this->option('public');
$o->cost = $this->option('cost');
$o->type = $this->option('type');
}
// We need to escape any back slashes.
$o->content = str_replace('\\','\\\\',($this->option('trim'))
? substr(file_get_contents($this->argument('file')),40)
: file_get_contents($this->argument('file')));
$o->access = $this->option('access');
$o->public = $this->option('public');
$o->cost = $this->option('cost');
$o->type = $this->option('type');
// If we have 0x1aSAUCE, we'll discard the sauce.
if ($x = strpos($o->content,chr(0x1a).'SAUCE')) {
$o->content = substr($o->content,0,$x-1).chr(0x0a);
}
$o->save();
}