Added file areas and TIC processing

This commit is contained in:
Deon George
2022-11-01 22:24:36 +11:00
parent 702c5fb4f2
commit 029a8a9d73
20 changed files with 908 additions and 35 deletions

View File

@@ -4,7 +4,7 @@ namespace App\Classes\File;
use Exception;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use League\Flysystem\UnreadableFileException;
use League\Flysystem\UnreadableFileEncountered;
/**
* A file we are sending or receiving
@@ -22,6 +22,7 @@ class Item
protected const IS_FILE = (1<<3);
protected const IS_FLO = (1<<4);
protected const IS_REQ = (1<<5);
protected const IS_TIC = (1<<6);
protected const I_RECV = (1<<6);
protected const I_SEND = (1<<7);
@@ -38,7 +39,7 @@ class Item
/**
* @throws FileNotFoundException
* @throws UnreadableFileException
* @throws UnreadableFileEncountered
* @throws Exception
*/
public function __construct($file,int $action)
@@ -54,7 +55,7 @@ class Item
throw new FileNotFoundException('Item doesnt exist: '.$file);
if (! is_readable($file))
throw new UnreadableFileException('Item cannot be read: '.$file);
throw new UnreadableFileEncountered('Item cannot be read: '.$file);
$this->file_name = $file;
$x = stat($file);
@@ -130,6 +131,9 @@ class Item
if (strcasecmp(substr($x,1),'req') == 0)
return self::IS_REQ;
if (strcasecmp(substr($x,1),'tic') == 0)
return self::IS_TIC;
for ($i=0;$i<count($ext);$i++)
if (! strncasecmp($x,'.'.$ext[$i],strlen($ext[$i])) && (preg_match('/^[0-9a-z]/',strtolower(substr($x,3,1)))))
return self::IS_ARC;