From e5491d4ca23ed30b962d2cf9ea3960befc78ad7f Mon Sep 17 00:00:00 2001 From: Netkas Date: Fri, 28 Oct 2022 01:24:01 -0400 Subject: [PATCH] Minor changes --- .idea/php.xml | 5 +++++ src/ncc/Abstracts/RegexPatterns.php | 2 +- src/ncc/Interfaces/CompilerInterface.php | 6 ++---- src/ncc/Objects/Package/Component.php | 9 +++++++++ src/ncc/Objects/ProjectConfiguration/Assembly.php | 3 +-- src/ncc/Utilities/Console.php | 4 +++- 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.idea/php.xml b/.idea/php.xml index 97a38d7..a87bd36 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -1,5 +1,10 @@ + + + + + diff --git a/src/ncc/Abstracts/RegexPatterns.php b/src/ncc/Abstracts/RegexPatterns.php index 7c53bd1..7fef226 100644 --- a/src/ncc/Abstracts/RegexPatterns.php +++ b/src/ncc/Abstracts/RegexPatterns.php @@ -8,7 +8,7 @@ */ abstract class RegexPatterns { - const UUIDv4 = '/[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-4[0-9A-Za-z]{3}-[89ABab][0-9A-Za-z]{3}-[0-9A-Za-z]{12}/m'; + const UUID = '{^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$}Di'; const PackageNameFormat = '/^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$/'; diff --git a/src/ncc/Interfaces/CompilerInterface.php b/src/ncc/Interfaces/CompilerInterface.php index 35eaab6..4fa160d 100644 --- a/src/ncc/Interfaces/CompilerInterface.php +++ b/src/ncc/Interfaces/CompilerInterface.php @@ -9,19 +9,17 @@ /** * Prepares the package for the build process, this method is called before build() * - * @param array $options Options to pass on to the compiler * @param string $path The path that the project file is located in (project.json) * @param string $build_configuration The build configuration to use to build the project * @return void */ - public function prepare(array $options, string $path, string $build_configuration=BuildConfigurationValues::DefaultConfiguration): void; + public function prepare(string $path, string $build_configuration=BuildConfigurationValues::DefaultConfiguration): void; /** * Builds the package, returns the output path of the build * - * @param array $options Options to pass on to the compiler * @param string $path The path that the project file is located in (project.json) * @return string Returns the output path of the build */ - public function build(array $options, string $path): string; + public function build(string $path): string; } \ No newline at end of file diff --git a/src/ncc/Objects/Package/Component.php b/src/ncc/Objects/Package/Component.php index 8752cd4..75406f7 100644 --- a/src/ncc/Objects/Package/Component.php +++ b/src/ncc/Objects/Package/Component.php @@ -20,6 +20,13 @@ */ public $Flags; + /** + * The data type of the component + * + * @var string + */ + public $DataType; + /** * A sha1 hash checksum of the component, this will be compared against the data to determine * the integrity of the component to ensure that the component is not corrupted. @@ -66,6 +73,7 @@ return [ ($bytecode ? Functions::cbc('name') : 'name') => $this->Name, ($bytecode ? Functions::cbc('flags') : 'flags') => $this->Flags, + ($bytecode ? Functions::cbc('data_type') : 'data_type') => $this->DataType, ($bytecode ? Functions::cbc('checksum') : 'checksum') => $this->Checksum, ($bytecode ? Functions::cbc('data') : 'data') => $this->Data, ]; @@ -83,6 +91,7 @@ $Object->Name = Functions::array_bc($data, 'name'); $Object->Flags = Functions::array_bc($data, 'flags'); + $Object->DataType = Functions::array_bc($data, 'data_type'); $Object->Checksum = Functions::array_bc($data, 'checksum'); $Object->Data = Functions::array_bc($data, 'data'); diff --git a/src/ncc/Objects/ProjectConfiguration/Assembly.php b/src/ncc/Objects/ProjectConfiguration/Assembly.php index f87c0cb..4836ef7 100644 --- a/src/ncc/Objects/ProjectConfiguration/Assembly.php +++ b/src/ncc/Objects/ProjectConfiguration/Assembly.php @@ -85,11 +85,10 @@ */ public function validate(bool $throw_exception=True): bool { - if(!preg_match(RegexPatterns::UUIDv4, $this->UUID)) + if(!preg_match(RegexPatterns::UUID, $this->UUID)) { if($throw_exception) throw new InvalidProjectConfigurationException('The UUID is not a valid v4 UUID', 'Assembly.UUID'); - return false; } diff --git a/src/ncc/Utilities/Console.php b/src/ncc/Utilities/Console.php index 3f5b2a5..870eeb9 100644 --- a/src/ncc/Utilities/Console.php +++ b/src/ncc/Utilities/Console.php @@ -11,7 +11,6 @@ /** * Inline Progress bar, created by dealnews.com. * - * // TODO: Add non-inline option * @param int $value * @param int $total * @param int $size @@ -21,6 +20,9 @@ */ public static function inlineProgressBar(int $value, int $total, int $size=38, array $options=[]): void { + if(!ncc::cliMode()) + return; + static $start_time; // if we go over our bound, just ignore it