@@ -4,36 +4,36 @@ discard block |
||
4 | 4 | |
5 | 5 | class Form extends Control |
6 | 6 | { |
7 | - public $class = 'System.Windows.Forms.Form'; |
|
7 | + public $class = 'System.Windows.Forms.Form'; |
|
8 | 8 | |
9 | - public function get_icon () |
|
10 | - { |
|
11 | - return new FormIcon ($this->selector); |
|
12 | - } |
|
9 | + public function get_icon () |
|
10 | + { |
|
11 | + return new FormIcon ($this->selector); |
|
12 | + } |
|
13 | 13 | |
14 | - public function get_clientSize () |
|
15 | - { |
|
16 | - $obj = $this->getProperty ('ClientSize'); |
|
14 | + public function get_clientSize () |
|
15 | + { |
|
16 | + $obj = $this->getProperty ('ClientSize'); |
|
17 | 17 | |
18 | - $w = VoidEngine::getProperty ($obj, 'Width'); |
|
19 | - $h = VoidEngine::getProperty ($obj, 'Height'); |
|
18 | + $w = VoidEngine::getProperty ($obj, 'Width'); |
|
19 | + $h = VoidEngine::getProperty ($obj, 'Height'); |
|
20 | 20 | |
21 | - VoidEngine::removeObjects ($obj); |
|
21 | + VoidEngine::removeObjects ($obj); |
|
22 | 22 | |
23 | - return [$w, $h]; |
|
24 | - } |
|
23 | + return [$w, $h]; |
|
24 | + } |
|
25 | 25 | |
26 | - public function set_clientSize (array $size) |
|
27 | - { |
|
28 | - $obj = $this->getProperty ('ClientSize'); |
|
26 | + public function set_clientSize (array $size) |
|
27 | + { |
|
28 | + $obj = $this->getProperty ('ClientSize'); |
|
29 | 29 | |
30 | - VoidEngine::setProperty ($obj, 'Width', array_shift ($size)); |
|
31 | - VoidEngine::setProperty ($obj, 'Height', array_shift ($size)); |
|
30 | + VoidEngine::setProperty ($obj, 'Width', array_shift ($size)); |
|
31 | + VoidEngine::setProperty ($obj, 'Height', array_shift ($size)); |
|
32 | 32 | |
33 | - $this->setProperty ('ClientSize', $obj); |
|
33 | + $this->setProperty ('ClientSize', $obj); |
|
34 | 34 | |
35 | - VoidEngine::removeObjects ($obj); |
|
36 | - } |
|
35 | + VoidEngine::removeObjects ($obj); |
|
36 | + } |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | class FormIcon extends Icon |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | public function loadFromFile (string $file) |
49 | - { |
|
49 | + { |
|
50 | 50 | $icon = VoidEngine::createObject ('System.Drawing.Icon', 'System.Drawing', $file); |
51 | 51 | |
52 | 52 | VoidEngine::setProperty ($this->formSelector, 'Icon', $icon); |
53 | 53 | |
54 | - if (!isset ($this->selector)) |
|
55 | - $this->selector = $icon; |
|
56 | - } |
|
54 | + if (!isset ($this->selector)) |
|
55 | + $this->selector = $icon; |
|
56 | + } |
|
57 | 57 | } |
@@ -6,33 +6,33 @@ discard block |
||
6 | 6 | { |
7 | 7 | public $class = 'System.Windows.Forms.Form'; |
8 | 8 | |
9 | - public function get_icon () |
|
9 | + public function get_icon() |
|
10 | 10 | { |
11 | - return new FormIcon ($this->selector); |
|
11 | + return new FormIcon($this->selector); |
|
12 | 12 | } |
13 | 13 | |
14 | - public function get_clientSize () |
|
14 | + public function get_clientSize() |
|
15 | 15 | { |
16 | - $obj = $this->getProperty ('ClientSize'); |
|
16 | + $obj = $this->getProperty('ClientSize'); |
|
17 | 17 | |
18 | - $w = VoidEngine::getProperty ($obj, 'Width'); |
|
19 | - $h = VoidEngine::getProperty ($obj, 'Height'); |
|
18 | + $w = VoidEngine::getProperty($obj, 'Width'); |
|
19 | + $h = VoidEngine::getProperty($obj, 'Height'); |
|
20 | 20 | |
21 | - VoidEngine::removeObjects ($obj); |
|
21 | + VoidEngine::removeObjects($obj); |
|
22 | 22 | |
23 | 23 | return [$w, $h]; |
24 | 24 | } |
25 | 25 | |
26 | - public function set_clientSize (array $size) |
|
26 | + public function set_clientSize(array $size) |
|
27 | 27 | { |
28 | - $obj = $this->getProperty ('ClientSize'); |
|
28 | + $obj = $this->getProperty('ClientSize'); |
|
29 | 29 | |
30 | - VoidEngine::setProperty ($obj, 'Width', array_shift ($size)); |
|
31 | - VoidEngine::setProperty ($obj, 'Height', array_shift ($size)); |
|
30 | + VoidEngine::setProperty($obj, 'Width', array_shift($size)); |
|
31 | + VoidEngine::setProperty($obj, 'Height', array_shift($size)); |
|
32 | 32 | |
33 | - $this->setProperty ('ClientSize', $obj); |
|
33 | + $this->setProperty('ClientSize', $obj); |
|
34 | 34 | |
35 | - VoidEngine::removeObjects ($obj); |
|
35 | + VoidEngine::removeObjects($obj); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
@@ -40,16 +40,16 @@ discard block |
||
40 | 40 | { |
41 | 41 | protected $formSelector; |
42 | 42 | |
43 | - public function __construct (int $formSelector) |
|
43 | + public function __construct(int $formSelector) |
|
44 | 44 | { |
45 | 45 | $this->formSelector = $formSelector; |
46 | 46 | } |
47 | 47 | |
48 | - public function loadFromFile (string $file) |
|
48 | + public function loadFromFile(string $file) |
|
49 | 49 | { |
50 | - $icon = VoidEngine::createObject ('System.Drawing.Icon', 'System.Drawing', $file); |
|
50 | + $icon = VoidEngine::createObject('System.Drawing.Icon', 'System.Drawing', $file); |
|
51 | 51 | |
52 | - VoidEngine::setProperty ($this->formSelector, 'Icon', $icon); |
|
52 | + VoidEngine::setProperty($this->formSelector, 'Icon', $icon); |
|
53 | 53 | |
54 | 54 | if (!isset ($this->selector)) |
55 | 55 | $this->selector = $icon; |
@@ -51,7 +51,8 @@ |
||
51 | 51 | |
52 | 52 | VoidEngine::setProperty ($this->formSelector, 'Icon', $icon); |
53 | 53 | |
54 | - if (!isset ($this->selector)) |
|
55 | - $this->selector = $icon; |
|
54 | + if (!isset ($this->selector)) { |
|
55 | + $this->selector = $icon; |
|
56 | + } |
|
56 | 57 | } |
57 | 58 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | protected $items; |
10 | 10 | |
11 | 11 | public function __construct (Component $parent = null) |
12 | - { |
|
12 | + { |
|
13 | 13 | parent::__construct ($parent, $this->class); |
14 | 14 | |
15 | 15 | $this->items = new WFObject ($this->getProperty ('TabPages')); |
@@ -8,11 +8,11 @@ discard block |
||
8 | 8 | |
9 | 9 | protected $items; |
10 | 10 | |
11 | - public function __construct (Component $parent = null) |
|
11 | + public function __construct(Component $parent = null) |
|
12 | 12 | { |
13 | - parent::__construct ($parent, $this->class); |
|
13 | + parent::__construct($parent, $this->class); |
|
14 | 14 | |
15 | - $this->items = new WFObject ($this->getProperty ('TabPages')); |
|
15 | + $this->items = new WFObject($this->getProperty('TabPages')); |
|
16 | 16 | } |
17 | 17 | } |
18 | 18 | |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | { |
21 | 21 | public $class = 'System.Windows.Forms.TabPage'; |
22 | 22 | |
23 | - public function __construct (string $text = '') |
|
23 | + public function __construct(string $text = '') |
|
24 | 24 | { |
25 | - parent::__construct (null, $this->class); |
|
25 | + parent::__construct(null, $this->class); |
|
26 | 26 | |
27 | 27 | $this->text = $text; |
28 | 28 | } |
@@ -4,48 +4,48 @@ |
||
4 | 4 | |
5 | 5 | class PictureBox extends Control |
6 | 6 | { |
7 | - public $class = 'System.Windows.Forms.PictureBox'; |
|
7 | + public $class = 'System.Windows.Forms.PictureBox'; |
|
8 | 8 | |
9 | - protected $image; |
|
9 | + protected $image; |
|
10 | 10 | |
11 | - public function __construct (Component $parent = null) |
|
12 | - { |
|
11 | + public function __construct (Component $parent = null) |
|
12 | + { |
|
13 | 13 | parent::__construct ($parent, $this->class); |
14 | 14 | |
15 | - $this->image = new PictureBoxImage ($this->selector); |
|
16 | - } |
|
15 | + $this->image = new PictureBoxImage ($this->selector); |
|
16 | + } |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | class PictureBoxImage |
20 | 20 | { |
21 | - protected $selector; |
|
21 | + protected $selector; |
|
22 | 22 | protected $pictureBoxSelector; |
23 | 23 | protected $clipboard; |
24 | 24 | |
25 | - public function __construct (int $pictureBoxSelector) |
|
26 | - { |
|
27 | - $this->pictureBoxSelector = $pictureBoxSelector; |
|
28 | - $this->selector = VoidEngine::getProperty ($pictureBoxSelector, 'Image'); |
|
29 | - $this->clipboard = new WFClass ('System.Windows.Forms.Clipboard'); |
|
30 | - } |
|
25 | + public function __construct (int $pictureBoxSelector) |
|
26 | + { |
|
27 | + $this->pictureBoxSelector = $pictureBoxSelector; |
|
28 | + $this->selector = VoidEngine::getProperty ($pictureBoxSelector, 'Image'); |
|
29 | + $this->clipboard = new WFClass ('System.Windows.Forms.Clipboard'); |
|
30 | + } |
|
31 | 31 | |
32 | - public function loadFromFile (string $file) |
|
33 | - { |
|
32 | + public function loadFromFile (string $file) |
|
33 | + { |
|
34 | 34 | VoidEngine::setProperty ($this->pictureBoxSelector, 'Image', (new Image ())->loadFromFile ($file)->selector); |
35 | - } |
|
35 | + } |
|
36 | 36 | |
37 | - public function saveToFile (string $file) |
|
38 | - { |
|
39 | - VoidEngine::callMethod ($this->selector, 'Save', $file); |
|
40 | - } |
|
37 | + public function saveToFile (string $file) |
|
38 | + { |
|
39 | + VoidEngine::callMethod ($this->selector, 'Save', $file); |
|
40 | + } |
|
41 | 41 | |
42 | - public function loadFromClipboard () |
|
43 | - { |
|
44 | - VoidEngine::setProperty ($this->pictureBoxSelector, 'Image', $this->clipboard->getImage ()); |
|
45 | - } |
|
42 | + public function loadFromClipboard () |
|
43 | + { |
|
44 | + VoidEngine::setProperty ($this->pictureBoxSelector, 'Image', $this->clipboard->getImage ()); |
|
45 | + } |
|
46 | 46 | |
47 | - public function saveToClipboard () |
|
48 | - { |
|
49 | - $this->clipboard->setImage (VoidEngine::getProperty ($this->pictureBoxSelector, 'Image')); |
|
50 | - } |
|
47 | + public function saveToClipboard () |
|
48 | + { |
|
49 | + $this->clipboard->setImage (VoidEngine::getProperty ($this->pictureBoxSelector, 'Image')); |
|
50 | + } |
|
51 | 51 | } |
@@ -8,11 +8,11 @@ discard block |
||
8 | 8 | |
9 | 9 | protected $image; |
10 | 10 | |
11 | - public function __construct (Component $parent = null) |
|
11 | + public function __construct(Component $parent = null) |
|
12 | 12 | { |
13 | - parent::__construct ($parent, $this->class); |
|
13 | + parent::__construct($parent, $this->class); |
|
14 | 14 | |
15 | - $this->image = new PictureBoxImage ($this->selector); |
|
15 | + $this->image = new PictureBoxImage($this->selector); |
|
16 | 16 | } |
17 | 17 | } |
18 | 18 | |
@@ -22,30 +22,30 @@ discard block |
||
22 | 22 | protected $pictureBoxSelector; |
23 | 23 | protected $clipboard; |
24 | 24 | |
25 | - public function __construct (int $pictureBoxSelector) |
|
25 | + public function __construct(int $pictureBoxSelector) |
|
26 | 26 | { |
27 | 27 | $this->pictureBoxSelector = $pictureBoxSelector; |
28 | - $this->selector = VoidEngine::getProperty ($pictureBoxSelector, 'Image'); |
|
29 | - $this->clipboard = new WFClass ('System.Windows.Forms.Clipboard'); |
|
28 | + $this->selector = VoidEngine::getProperty($pictureBoxSelector, 'Image'); |
|
29 | + $this->clipboard = new WFClass('System.Windows.Forms.Clipboard'); |
|
30 | 30 | } |
31 | 31 | |
32 | - public function loadFromFile (string $file) |
|
32 | + public function loadFromFile(string $file) |
|
33 | 33 | { |
34 | - VoidEngine::setProperty ($this->pictureBoxSelector, 'Image', (new Image ())->loadFromFile ($file)->selector); |
|
34 | + VoidEngine::setProperty($this->pictureBoxSelector, 'Image', (new Image())->loadFromFile($file)->selector); |
|
35 | 35 | } |
36 | 36 | |
37 | - public function saveToFile (string $file) |
|
37 | + public function saveToFile(string $file) |
|
38 | 38 | { |
39 | - VoidEngine::callMethod ($this->selector, 'Save', $file); |
|
39 | + VoidEngine::callMethod($this->selector, 'Save', $file); |
|
40 | 40 | } |
41 | 41 | |
42 | - public function loadFromClipboard () |
|
42 | + public function loadFromClipboard() |
|
43 | 43 | { |
44 | - VoidEngine::setProperty ($this->pictureBoxSelector, 'Image', $this->clipboard->getImage ()); |
|
44 | + VoidEngine::setProperty($this->pictureBoxSelector, 'Image', $this->clipboard->getImage()); |
|
45 | 45 | } |
46 | 46 | |
47 | - public function saveToClipboard () |
|
47 | + public function saveToClipboard() |
|
48 | 48 | { |
49 | - $this->clipboard->setImage (VoidEngine::getProperty ($this->pictureBoxSelector, 'Image')); |
|
49 | + $this->clipboard->setImage(VoidEngine::getProperty($this->pictureBoxSelector, 'Image')); |
|
50 | 50 | } |
51 | 51 | } |
@@ -4,36 +4,36 @@ |
||
4 | 4 | |
5 | 5 | class Chart extends Control |
6 | 6 | { |
7 | - public $class = 'System.Windows.Forms.DataVisualization.Charting.Chart'; |
|
8 | - public $namespace = 'System.Windows.Forms.DataVisualization'; |
|
7 | + public $class = 'System.Windows.Forms.DataVisualization.Charting.Chart'; |
|
8 | + public $namespace = 'System.Windows.Forms.DataVisualization'; |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | class Annotation extends Control |
12 | 12 | { |
13 | - public $class = 'System.Windows.Forms.DataVisualization.Charting.Annotation'; |
|
14 | - public $namespace = 'System.Windows.Forms.DataVisualization'; |
|
13 | + public $class = 'System.Windows.Forms.DataVisualization.Charting.Annotation'; |
|
14 | + public $namespace = 'System.Windows.Forms.DataVisualization'; |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | class ChartArea extends Control |
18 | 18 | { |
19 | - public $class = 'System.Windows.Forms.DataVisualization.Charting.ChartArea'; |
|
20 | - public $namespace = 'System.Windows.Forms.DataVisualization'; |
|
19 | + public $class = 'System.Windows.Forms.DataVisualization.Charting.ChartArea'; |
|
20 | + public $namespace = 'System.Windows.Forms.DataVisualization'; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | class Legend extends Control |
24 | 24 | { |
25 | - public $class = 'System.Windows.Forms.DataVisualization.Charting.Legend'; |
|
26 | - public $namespace = 'System.Windows.Forms.DataVisualization'; |
|
25 | + public $class = 'System.Windows.Forms.DataVisualization.Charting.Legend'; |
|
26 | + public $namespace = 'System.Windows.Forms.DataVisualization'; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | class Series extends Control |
30 | 30 | { |
31 | - public $class = 'System.Windows.Forms.DataVisualization.Charting.Series'; |
|
32 | - public $namespace = 'System.Windows.Forms.DataVisualization'; |
|
31 | + public $class = 'System.Windows.Forms.DataVisualization.Charting.Series'; |
|
32 | + public $namespace = 'System.Windows.Forms.DataVisualization'; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | class Title extends Control |
36 | 36 | { |
37 | - public $class = 'System.Windows.Forms.DataVisualization.Charting.Title'; |
|
38 | - public $namespace = 'System.Windows.Forms.DataVisualization'; |
|
37 | + public $class = 'System.Windows.Forms.DataVisualization.Charting.Title'; |
|
38 | + public $namespace = 'System.Windows.Forms.DataVisualization'; |
|
39 | 39 | } |
@@ -4,36 +4,36 @@ |
||
4 | 4 | |
5 | 5 | class Chart extends Control |
6 | 6 | { |
7 | - public $class = 'System.Windows.Forms.DataVisualization.Charting.Chart'; |
|
7 | + public $class = 'System.Windows.Forms.DataVisualization.Charting.Chart'; |
|
8 | 8 | public $namespace = 'System.Windows.Forms.DataVisualization'; |
9 | 9 | } |
10 | 10 | |
11 | 11 | class Annotation extends Control |
12 | 12 | { |
13 | - public $class = 'System.Windows.Forms.DataVisualization.Charting.Annotation'; |
|
13 | + public $class = 'System.Windows.Forms.DataVisualization.Charting.Annotation'; |
|
14 | 14 | public $namespace = 'System.Windows.Forms.DataVisualization'; |
15 | 15 | } |
16 | 16 | |
17 | 17 | class ChartArea extends Control |
18 | 18 | { |
19 | - public $class = 'System.Windows.Forms.DataVisualization.Charting.ChartArea'; |
|
19 | + public $class = 'System.Windows.Forms.DataVisualization.Charting.ChartArea'; |
|
20 | 20 | public $namespace = 'System.Windows.Forms.DataVisualization'; |
21 | 21 | } |
22 | 22 | |
23 | 23 | class Legend extends Control |
24 | 24 | { |
25 | - public $class = 'System.Windows.Forms.DataVisualization.Charting.Legend'; |
|
25 | + public $class = 'System.Windows.Forms.DataVisualization.Charting.Legend'; |
|
26 | 26 | public $namespace = 'System.Windows.Forms.DataVisualization'; |
27 | 27 | } |
28 | 28 | |
29 | 29 | class Series extends Control |
30 | 30 | { |
31 | - public $class = 'System.Windows.Forms.DataVisualization.Charting.Series'; |
|
31 | + public $class = 'System.Windows.Forms.DataVisualization.Charting.Series'; |
|
32 | 32 | public $namespace = 'System.Windows.Forms.DataVisualization'; |
33 | 33 | } |
34 | 34 | |
35 | 35 | class Title extends Control |
36 | 36 | { |
37 | - public $class = 'System.Windows.Forms.DataVisualization.Charting.Title'; |
|
37 | + public $class = 'System.Windows.Forms.DataVisualization.Charting.Title'; |
|
38 | 38 | public $namespace = 'System.Windows.Forms.DataVisualization'; |
39 | 39 | } |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | const ENGINE_VERSION = '3.4.1 build-2019/09/07'; |
37 | 37 | const ENGINE_DIR = __DIR__; |
38 | 38 | |
39 | -chdir (ENGINE_DIR); |
|
39 | +chdir(ENGINE_DIR); |
|
40 | 40 | |
41 | 41 | $GLOBALS['error_status'] = true; |
42 | 42 | |
43 | 43 | $GLOBALS['__debug'] = [ |
44 | - 'start_time' => microtime (true) |
|
44 | + 'start_time' => microtime(true) |
|
45 | 45 | ]; |
46 | 46 | |
47 | -$GLOBALS['__ub_write_handler'] = function (...$args) |
|
47 | +$GLOBALS['__ub_write_handler'] = function(...$args) |
|
48 | 48 | { |
49 | - pre (...$args); |
|
49 | + pre(...$args); |
|
50 | 50 | }; |
51 | 51 | |
52 | 52 | require 'common/EngineInterfaces.php'; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | require 'common/Others.php'; |
56 | 56 | require 'common/Events.php'; |
57 | 57 | |
58 | -define ('VoidEngine\CORE_VERSION', $APPLICATION->productVersion); |
|
58 | +define('VoidEngine\CORE_VERSION', $APPLICATION->productVersion); |
|
59 | 59 | |
60 | 60 | require 'components/Component.php'; |
61 | 61 | require 'components/Control.php'; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | require 'components/FastColoredTextBox.php'; |
105 | 105 | require 'components/Scintilla.php'; |
106 | 106 | |
107 | -if (is_dir ('extensions')) |
|
108 | - foreach (scandir ('extensions') as $ext) |
|
109 | - if (is_dir ('extensions/'. $ext) && file_exists ($ext = 'extensions/'. $ext .'/main.php')) |
|
107 | +if (is_dir('extensions')) |
|
108 | + foreach (scandir('extensions') as $ext) |
|
109 | + if (is_dir('extensions/'.$ext) && file_exists($ext = 'extensions/'.$ext.'/main.php')) |
|
110 | 110 | require $ext; |
@@ -104,7 +104,8 @@ |
||
104 | 104 | require 'components/FastColoredTextBox.php'; |
105 | 105 | require 'components/Scintilla.php'; |
106 | 106 | |
107 | -if (is_dir ('extensions')) |
|
107 | +if (is_dir ('extensions')) { |
|
108 | 108 | foreach (scandir ('extensions') as $ext) |
109 | 109 | if (is_dir ('extensions/'. $ext) && file_exists ($ext = 'extensions/'. $ext .'/main.php')) |
110 | 110 | require $ext; |
111 | +} |
@@ -8,57 +8,57 @@ discard block |
||
8 | 8 | { |
9 | 9 | public $appDir; |
10 | 10 | |
11 | - public function __construct (string $appDir) |
|
11 | + public function __construct(string $appDir) |
|
12 | 12 | { |
13 | - if (!is_dir ($appDir)) |
|
14 | - throw new \Exception ('Wrong $appDir param'); |
|
13 | + if (!is_dir($appDir)) |
|
14 | + throw new \Exception('Wrong $appDir param'); |
|
15 | 15 | |
16 | 16 | $this->appDir = $appDir; |
17 | 17 | } |
18 | 18 | |
19 | - public function build (string $outputDir, string $iconPath = null, bool $union = true): array |
|
19 | + public function build(string $outputDir, string $iconPath = null, bool $union = true): array |
|
20 | 20 | { |
21 | - \VoidEngine\dir_clean ($outputDir .'/build'); |
|
22 | - \VoidEngine\dir_copy (\VoidEngine\CORE_DIR, $outputDir .'/build'); |
|
21 | + \VoidEngine\dir_clean($outputDir.'/build'); |
|
22 | + \VoidEngine\dir_copy(\VoidEngine\CORE_DIR, $outputDir.'/build'); |
|
23 | 23 | |
24 | - unlink ($outputDir .'/build/script.php'); |
|
25 | - unlink ($outputDir .'/build/VoidCore.exe'); |
|
24 | + unlink($outputDir.'/build/script.php'); |
|
25 | + unlink($outputDir.'/build/VoidCore.exe'); |
|
26 | 26 | |
27 | - return VoidEngine::compile ($outputDir .'/build/app.exe', \VoidEngine\text ($iconPath ?? dirname (__DIR__) .'/system/Icon.ico'), \VoidEngine\str_replace_assoc (file_get_contents (dirname (__DIR__) .'/system/preset.php'), [ |
|
28 | - '%VoidEngine%' => self::generateCode (self::getReferences (\VoidEngine\ENGINE_DIR .'/VoidEngine.php')), |
|
29 | - '%APP%' => base64_encode (gzdeflate (serialize ($union ? array_merge ( |
|
30 | - self::getFiles ($this->appDir), |
|
31 | - self::getFiles (dirname ($this->appDir) .'/qero-packages', 'qero-packages/KRypt0nn/VoidFramework') |
|
27 | + return VoidEngine::compile($outputDir.'/build/app.exe', \VoidEngine\text($iconPath ?? dirname(__DIR__).'/system/Icon.ico'), \VoidEngine\str_replace_assoc(file_get_contents(dirname(__DIR__).'/system/preset.php'), [ |
|
28 | + '%VoidEngine%' => self::generateCode(self::getReferences(\VoidEngine\ENGINE_DIR.'/VoidEngine.php')), |
|
29 | + '%APP%' => base64_encode(gzdeflate(serialize($union ? array_merge ( |
|
30 | + self::getFiles($this->appDir), |
|
31 | + self::getFiles(dirname($this->appDir).'/qero-packages', 'qero-packages/KRypt0nn/VoidFramework') |
|
32 | 32 | ) : []), 9)) |
33 | 33 | ]), null, null, null, null, null, '', ''); |
34 | 34 | } |
35 | 35 | |
36 | - public static function generateCode (array $references, bool $removeNamespaces = true): string |
|
36 | + public static function generateCode(array $references, bool $removeNamespaces = true): string |
|
37 | 37 | { |
38 | - $code = "/*\n\n\t". join ("\n\t", explode ("\n", file_get_contents (dirname (\VoidEngine\ENGINE_DIR) .'/license.txt'))) ."\n\n*/\n\n"; |
|
38 | + $code = "/*\n\n\t".join("\n\t", explode("\n", file_get_contents(dirname(\VoidEngine\ENGINE_DIR).'/license.txt')))."\n\n*/\n\n"; |
|
39 | 39 | |
40 | 40 | foreach ($references as $path) |
41 | - $code .= join (array_slice (array_map (function ($line) |
|
41 | + $code .= join(array_slice(array_map(function($line) |
|
42 | 42 | { |
43 | - return substr ($line, 0, 7) != 'require' ? $line : ''; |
|
44 | - }, file ($path)), 1)); |
|
43 | + return substr($line, 0, 7) != 'require' ? $line : ''; |
|
44 | + }, file($path)), 1)); |
|
45 | 45 | |
46 | 46 | return $removeNamespaces ? |
47 | - preg_replace ('/'. "\n" .'namespace [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*;'. "\n" .'/', "\n\n", $code) : $code; |
|
47 | + preg_replace ('/'."\n".'namespace [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*;'."\n".'/', "\n\n", $code) : $code; |
|
48 | 48 | } |
49 | 49 | |
50 | - public static function getReferences (string $file, bool $parseExtensions = true): array |
|
50 | + public static function getReferences(string $file, bool $parseExtensions = true): array |
|
51 | 51 | { |
52 | 52 | $references = []; |
53 | 53 | |
54 | - foreach (file ($file) as $id => $line) |
|
55 | - if (substr ($line, 0, 7) == 'require') |
|
54 | + foreach (file($file) as $id => $line) |
|
55 | + if (substr($line, 0, 7) == 'require') |
|
56 | 56 | try |
57 | 57 | { |
58 | - $begin = strpos ($line, "'"); |
|
59 | - $end = strrpos ($line, "'") - $begin + 1; |
|
58 | + $begin = strpos($line, "'"); |
|
59 | + $end = strrpos($line, "'") - $begin + 1; |
|
60 | 60 | |
61 | - $references = array_merge ($references, self::getReferences (dirname ($file) .'/'. eval ('namespace VoidEngine; return '. substr ($line, $begin, $end) .';'), false)); |
|
61 | + $references = array_merge($references, self::getReferences(dirname($file).'/'.eval ('namespace VoidEngine; return '.substr($line, $begin, $end).';'), false)); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | catch (\Throwable $e) |
@@ -67,30 +67,30 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | if ($parseExtensions) |
70 | - if (is_dir (\VoidEngine\ENGINE_DIR .'/extensions') && is_array ($exts = scandir (\VoidEngine\ENGINE_DIR .'/extensions'))) |
|
70 | + if (is_dir(\VoidEngine\ENGINE_DIR.'/extensions') && is_array($exts = scandir(\VoidEngine\ENGINE_DIR.'/extensions'))) |
|
71 | 71 | foreach ($exts as $id => $ext) |
72 | - if (is_dir (\VoidEngine\ENGINE_DIR .'/extensions/'. $ext) && file_exists ($ext = \VoidEngine\ENGINE_DIR .'/extensions/'. $ext .'/main.php')) |
|
73 | - $references = array_merge ($references, self::getReferences ($ext, false)); |
|
72 | + if (is_dir(\VoidEngine\ENGINE_DIR.'/extensions/'.$ext) && file_exists($ext = \VoidEngine\ENGINE_DIR.'/extensions/'.$ext.'/main.php')) |
|
73 | + $references = array_merge($references, self::getReferences($ext, false)); |
|
74 | 74 | |
75 | 75 | $references[] = $file; |
76 | 76 | |
77 | 77 | return $references; |
78 | 78 | } |
79 | 79 | |
80 | - public static function getFiles (string $path, string $prefixBlacklist = null, array $files = [], int $originalPathLength = -1): array |
|
80 | + public static function getFiles(string $path, string $prefixBlacklist = null, array $files = [], int $originalPathLength = -1): array |
|
81 | 81 | { |
82 | 82 | if ($originalPathLength == -1) |
83 | - $originalPathLength = strlen (dirname ($path)) + 1; |
|
83 | + $originalPathLength = strlen(dirname($path)) + 1; |
|
84 | 84 | |
85 | - $len = strlen ($prefixBlacklist); |
|
85 | + $len = strlen($prefixBlacklist); |
|
86 | 86 | |
87 | - foreach (array_slice (scandir ($path), 2) as $name) |
|
88 | - if ($prefixBlacklist === null || substr ($path .'/'. $name, $originalPathLength, $len) != $prefixBlacklist) |
|
87 | + foreach (array_slice(scandir($path), 2) as $name) |
|
88 | + if ($prefixBlacklist === null || substr($path.'/'.$name, $originalPathLength, $len) != $prefixBlacklist) |
|
89 | 89 | { |
90 | - if (is_dir ($file = $path .'/'. $name)) |
|
91 | - $files = self::getFiles ($file, $prefixBlacklist, $files, $originalPathLength); |
|
90 | + if (is_dir($file = $path.'/'.$name)) |
|
91 | + $files = self::getFiles($file, $prefixBlacklist, $files, $originalPathLength); |
|
92 | 92 | |
93 | - else $files[substr ($file, $originalPathLength)] = file_get_contents ($file); |
|
93 | + else $files[substr($file, $originalPathLength)] = file_get_contents($file); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | return $files; |
@@ -10,8 +10,9 @@ discard block |
||
10 | 10 | |
11 | 11 | public function __construct (string $appDir) |
12 | 12 | { |
13 | - if (!is_dir ($appDir)) |
|
14 | - throw new \Exception ('Wrong $appDir param'); |
|
13 | + if (!is_dir ($appDir)) { |
|
14 | + throw new \Exception ('Wrong $appDir param'); |
|
15 | + } |
|
15 | 16 | |
16 | 17 | $this->appDir = $appDir; |
17 | 18 | } |
@@ -37,10 +38,11 @@ discard block |
||
37 | 38 | { |
38 | 39 | $code = "/*\n\n\t". join ("\n\t", explode ("\n", file_get_contents (dirname (\VoidEngine\ENGINE_DIR) .'/license.txt'))) ."\n\n*/\n\n"; |
39 | 40 | |
40 | - foreach ($references as $path) |
|
41 | - $code .= join (array_slice (array_map (function ($line) |
|
41 | + foreach ($references as $path) { |
|
42 | + $code .= join (array_slice (array_map (function ($line) |
|
42 | 43 | { |
43 | 44 | return substr ($line, 0, 7) != 'require' ? $line : ''; |
45 | + } |
|
44 | 46 | }, file ($path)), 1)); |
45 | 47 | |
46 | 48 | return $removeNamespaces ? |
@@ -51,26 +53,26 @@ discard block |
||
51 | 53 | { |
52 | 54 | $references = []; |
53 | 55 | |
54 | - foreach (file ($file) as $id => $line) |
|
55 | - if (substr ($line, 0, 7) == 'require') |
|
56 | + foreach (file ($file) as $id => $line) { |
|
57 | + if (substr ($line, 0, 7) == 'require') |
|
56 | 58 | try |
57 | 59 | { |
58 | 60 | $begin = strpos ($line, "'"); |
61 | + } |
|
59 | 62 | $end = strrpos ($line, "'") - $begin + 1; |
60 | 63 | |
61 | 64 | $references = array_merge ($references, self::getReferences (dirname ($file) .'/'. eval ('namespace VoidEngine; return '. substr ($line, $begin, $end) .';'), false)); |
62 | - } |
|
63 | - |
|
64 | - catch (\Throwable $e) |
|
65 | + } catch (\Throwable $e) |
|
65 | 66 | { |
66 | 67 | continue; |
67 | 68 | } |
68 | 69 | |
69 | - if ($parseExtensions) |
|
70 | - if (is_dir (\VoidEngine\ENGINE_DIR .'/extensions') && is_array ($exts = scandir (\VoidEngine\ENGINE_DIR .'/extensions'))) |
|
70 | + if ($parseExtensions) { |
|
71 | + if (is_dir (\VoidEngine\ENGINE_DIR .'/extensions') && is_array ($exts = scandir (\VoidEngine\ENGINE_DIR .'/extensions'))) |
|
71 | 72 | foreach ($exts as $id => $ext) |
72 | 73 | if (is_dir (\VoidEngine\ENGINE_DIR .'/extensions/'. $ext) && file_exists ($ext = \VoidEngine\ENGINE_DIR .'/extensions/'. $ext .'/main.php')) |
73 | 74 | $references = array_merge ($references, self::getReferences ($ext, false)); |
75 | + } |
|
74 | 76 | |
75 | 77 | $references[] = $file; |
76 | 78 | |
@@ -79,18 +81,22 @@ discard block |
||
79 | 81 | |
80 | 82 | public static function getFiles (string $path, string $prefixBlacklist = null, array $files = [], int $originalPathLength = -1): array |
81 | 83 | { |
82 | - if ($originalPathLength == -1) |
|
83 | - $originalPathLength = strlen (dirname ($path)) + 1; |
|
84 | + if ($originalPathLength == -1) { |
|
85 | + $originalPathLength = strlen (dirname ($path)) + 1; |
|
86 | + } |
|
84 | 87 | |
85 | 88 | $len = strlen ($prefixBlacklist); |
86 | 89 | |
87 | - foreach (array_slice (scandir ($path), 2) as $name) |
|
88 | - if ($prefixBlacklist === null || substr ($path .'/'. $name, $originalPathLength, $len) != $prefixBlacklist) |
|
90 | + foreach (array_slice (scandir ($path), 2) as $name) { |
|
91 | + if ($prefixBlacklist === null || substr ($path .'/'. $name, $originalPathLength, $len) != $prefixBlacklist) |
|
89 | 92 | { |
90 | 93 | if (is_dir ($file = $path .'/'. $name)) |
91 | 94 | $files = self::getFiles ($file, $prefixBlacklist, $files, $originalPathLength); |
95 | + } |
|
92 | 96 | |
93 | - else $files[substr ($file, $originalPathLength)] = file_get_contents ($file); |
|
97 | + else { |
|
98 | + $files[substr ($file, $originalPathLength)] = file_get_contents ($file); |
|
99 | + } |
|
94 | 100 | } |
95 | 101 | |
96 | 102 | return $files; |
@@ -6,17 +6,17 @@ discard block |
||
6 | 6 | { |
7 | 7 | public $path; |
8 | 8 | |
9 | - public function __construct (string $path) |
|
9 | + public function __construct(string $path) |
|
10 | 10 | { |
11 | - if (!is_file ($path)) |
|
12 | - throw new \Exception ('Wrong $path paeam'); |
|
11 | + if (!is_file($path)) |
|
12 | + throw new \Exception('Wrong $path paeam'); |
|
13 | 13 | |
14 | 14 | $this->path = $path; |
15 | 15 | } |
16 | 16 | |
17 | - public function toXML (): string |
|
17 | + public function toXML(): string |
|
18 | 18 | { |
19 | - return '<File><Type>2</Type><Name>'. basename ($this->path) .'</Name><File>'. $this->path .'</File><ActiveX>False</ActiveX><ActiveXInstall>False</ActiveXInstall><Action>0</Action><OverwriteDateTime>False</OverwriteDateTime><OverwriteAttributes>False</OverwriteAttributes><PassCommandLine>False</PassCommandLine><HideFromDialogs>0</HideFromDialogs></File>'; |
|
19 | + return '<File><Type>2</Type><Name>'.basename($this->path).'</Name><File>'.$this->path.'</File><ActiveX>False</ActiveX><ActiveXInstall>False</ActiveXInstall><Action>0</Action><OverwriteDateTime>False</OverwriteDateTime><OverwriteAttributes>False</OverwriteAttributes><PassCommandLine>False</PassCommandLine><HideFromDialogs>0</HideFromDialogs></File>'; |
|
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
@@ -25,24 +25,24 @@ discard block |
||
25 | 25 | public $path; |
26 | 26 | public $files = []; |
27 | 27 | |
28 | - public function __construct (string $path) |
|
28 | + public function __construct(string $path) |
|
29 | 29 | { |
30 | - if (!is_dir ($path)) |
|
31 | - throw new \Exception ('Wrong $path param'); |
|
30 | + if (!is_dir($path)) |
|
31 | + throw new \Exception('Wrong $path param'); |
|
32 | 32 | |
33 | 33 | $this->path = $path; |
34 | 34 | |
35 | - foreach (array_slice (scandir ($path), 2) as $file) |
|
36 | - $this->files[] = is_dir ($file = $path .'/'. $file) ? |
|
37 | - new Folder ($file) : new File ($file); |
|
35 | + foreach (array_slice(scandir($path), 2) as $file) |
|
36 | + $this->files[] = is_dir($file = $path.'/'.$file) ? |
|
37 | + new Folder($file) : new File($file); |
|
38 | 38 | } |
39 | 39 | |
40 | - public function toXML (): string |
|
40 | + public function toXML(): string |
|
41 | 41 | { |
42 | - return '<File><Type>3</Type><Name>'. basename ($this->path) .'</Name><Action>0</Action><OverwriteDateTime>False</OverwriteDateTime><OverwriteAttributes>False</OverwriteAttributes><HideFromDialogs>0</HideFromDialogs><Files>'. implode ('', array_map (function ($item) |
|
42 | + return '<File><Type>3</Type><Name>'.basename($this->path).'</Name><Action>0</Action><OverwriteDateTime>False</OverwriteDateTime><OverwriteAttributes>False</OverwriteAttributes><HideFromDialogs>0</HideFromDialogs><Files>'.implode('', array_map(function($item) |
|
43 | 43 | { |
44 | - return $item->toXML (); |
|
45 | - }, $this->files)) .'</Files></File>'; |
|
44 | + return $item->toXML(); |
|
45 | + }, $this->files)).'</Files></File>'; |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
@@ -52,44 +52,44 @@ discard block |
||
52 | 52 | public $output; |
53 | 53 | public $files = []; |
54 | 54 | |
55 | - public function __construct (string $input, string $output) |
|
55 | + public function __construct(string $input, string $output) |
|
56 | 56 | { |
57 | - if (!is_file ($input)) |
|
58 | - throw new \Exception ('Wrong $input param'); |
|
57 | + if (!is_file($input)) |
|
58 | + throw new \Exception('Wrong $input param'); |
|
59 | 59 | |
60 | 60 | $this->input = $input; |
61 | 61 | $this->output = $output; |
62 | 62 | } |
63 | 63 | |
64 | - public function add (string $path): Joiner |
|
64 | + public function add(string $path): Joiner |
|
65 | 65 | { |
66 | - $this->files[] = is_dir ($path) ? |
|
67 | - new Folder ($path) : new File ($path); |
|
66 | + $this->files[] = is_dir($path) ? |
|
67 | + new Folder($path) : new File($path); |
|
68 | 68 | |
69 | 69 | return $this; |
70 | 70 | } |
71 | 71 | |
72 | - public function getEVB (): string |
|
72 | + public function getEVB(): string |
|
73 | 73 | { |
74 | - return str_replace ([ |
|
74 | + return str_replace([ |
|
75 | 75 | '%INPUT_FILE%', |
76 | 76 | '%OUTPUT_FILE%', |
77 | 77 | '%FILES%' |
78 | 78 | ], [ |
79 | 79 | $this->input, |
80 | 80 | $this->output, |
81 | - implode ('', array_map (function ($item) |
|
81 | + implode('', array_map(function($item) |
|
82 | 82 | { |
83 | - return $item->toXML (); |
|
83 | + return $item->toXML(); |
|
84 | 84 | }, $this->files)) |
85 | - ], file_get_contents (dirname (__DIR__) .'/system/stub.evb')); |
|
85 | + ], file_get_contents(dirname(__DIR__).'/system/stub.evb')); |
|
86 | 86 | } |
87 | 87 | |
88 | - public function join (): string |
|
88 | + public function join(): string |
|
89 | 89 | { |
90 | - file_put_contents (dirname (__DIR__) .'/system/temp.evb', $this->getEVB ()); |
|
91 | - $return = shell_exec ('"'. dirname (__DIR__) .'/system/enigmavbconsole.exe" "system/temp.evb"'); |
|
92 | - unlink (dirname (__DIR__) .'/system/temp.evb'); |
|
90 | + file_put_contents(dirname(__DIR__).'/system/temp.evb', $this->getEVB()); |
|
91 | + $return = shell_exec('"'.dirname(__DIR__).'/system/enigmavbconsole.exe" "system/temp.evb"'); |
|
92 | + unlink(dirname(__DIR__).'/system/temp.evb'); |
|
93 | 93 | |
94 | 94 | return $return; |
95 | 95 | } |
@@ -8,8 +8,9 @@ discard block |
||
8 | 8 | |
9 | 9 | public function __construct (string $path) |
10 | 10 | { |
11 | - if (!is_file ($path)) |
|
12 | - throw new \Exception ('Wrong $path paeam'); |
|
11 | + if (!is_file ($path)) { |
|
12 | + throw new \Exception ('Wrong $path paeam'); |
|
13 | + } |
|
13 | 14 | |
14 | 15 | $this->path = $path; |
15 | 16 | } |
@@ -27,14 +28,16 @@ discard block |
||
27 | 28 | |
28 | 29 | public function __construct (string $path) |
29 | 30 | { |
30 | - if (!is_dir ($path)) |
|
31 | - throw new \Exception ('Wrong $path param'); |
|
31 | + if (!is_dir ($path)) { |
|
32 | + throw new \Exception ('Wrong $path param'); |
|
33 | + } |
|
32 | 34 | |
33 | 35 | $this->path = $path; |
34 | 36 | |
35 | - foreach (array_slice (scandir ($path), 2) as $file) |
|
36 | - $this->files[] = is_dir ($file = $path .'/'. $file) ? |
|
37 | + foreach (array_slice (scandir ($path), 2) as $file) { |
|
38 | + $this->files[] = is_dir ($file = $path .'/'. $file) ? |
|
37 | 39 | new Folder ($file) : new File ($file); |
40 | + } |
|
38 | 41 | } |
39 | 42 | |
40 | 43 | public function toXML (): string |
@@ -54,8 +57,9 @@ discard block |
||
54 | 57 | |
55 | 58 | public function __construct (string $input, string $output) |
56 | 59 | { |
57 | - if (!is_file ($input)) |
|
58 | - throw new \Exception ('Wrong $input param'); |
|
60 | + if (!is_file ($input)) { |
|
61 | + throw new \Exception ('Wrong $input param'); |
|
62 | + } |
|
59 | 63 | |
60 | 64 | $this->input = $input; |
61 | 65 | $this->output = $output; |
@@ -22,7 +22,7 @@ |
||
22 | 22 | |
23 | 23 | namespace VoidBuilder; |
24 | 24 | |
25 | -if (is_dir ('qero-packages')) |
|
25 | +if (is_dir('qero-packages')) |
|
26 | 26 | require_once 'qero-packages/autoload.php'; |
27 | 27 | |
28 | 28 | require 'php/Builder.php'; |
@@ -22,8 +22,9 @@ |
||
22 | 22 | |
23 | 23 | namespace VoidBuilder; |
24 | 24 | |
25 | -if (is_dir ('qero-packages')) |
|
25 | +if (is_dir ('qero-packages')) { |
|
26 | 26 | require_once 'qero-packages/autoload.php'; |
27 | +} |
|
27 | 28 | |
28 | 29 | require 'php/Builder.php'; |
29 | 30 | require 'php/Joiner.php'; |
@@ -14,85 +14,85 @@ |
||
14 | 14 | if (!isset ($argv)) |
15 | 15 | { |
16 | 16 | $argv = [__FILE__]; |
17 | - $params = json_decode (file_get_contents ('params.json'), true); |
|
17 | + $params = json_decode(file_get_contents('params.json'), true); |
|
18 | 18 | |
19 | 19 | foreach ($params as $name => $param) |
20 | 20 | { |
21 | - if (!is_array ($param)) |
|
21 | + if (!is_array($param)) |
|
22 | 22 | $param = [$param]; |
23 | 23 | |
24 | 24 | foreach ($param as $arg) |
25 | - if (strlen ($arg) > 0) |
|
25 | + if (strlen($arg) > 0) |
|
26 | 26 | { |
27 | 27 | $argv[] = $name; |
28 | 28 | $argv[] = $arg; |
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | - unlink ('params.json'); |
|
32 | + unlink('params.json'); |
|
33 | 33 | |
34 | - define ('VoidEngine\ENGINE_DIR', $params['--engine-dir']); |
|
35 | - define ('VoidEngine\CORE_DIR', dirname (ENGINE_DIR) .'/core'); |
|
34 | + define('VoidEngine\ENGINE_DIR', $params['--engine-dir']); |
|
35 | + define('VoidEngine\CORE_DIR', dirname(ENGINE_DIR).'/core'); |
|
36 | 36 | |
37 | - require $params['--engine-dir'] .'/VoidEngine.php'; |
|
37 | + require $params['--engine-dir'].'/VoidEngine.php'; |
|
38 | 38 | } |
39 | 39 | |
40 | -(new Manager ([], (new DefaultCommand (function ($args, $params) |
|
40 | +(new Manager([], (new DefaultCommand(function($args, $params) |
|
41 | 41 | { |
42 | 42 | foreach (['--app-dir', '--output-dir', '--icon-path'] as $param) |
43 | - if (is_array ($params[$param])) |
|
44 | - $params[$param] = end ($params[$param]); |
|
43 | + if (is_array($params[$param])) |
|
44 | + $params[$param] = end($params[$param]); |
|
45 | 45 | |
46 | - if (class_exists ('VoidEngine\VoidEngine')) |
|
46 | + if (class_exists('VoidEngine\VoidEngine')) |
|
47 | 47 | { |
48 | - $errors = (new Builder ($params['--app-dir']))->build ($params['--output-dir'], $params['--icon-path'], !$params['--no-compress']); |
|
48 | + $errors = (new Builder($params['--app-dir']))->build($params['--output-dir'], $params['--icon-path'], !$params['--no-compress']); |
|
49 | 49 | |
50 | - if (sizeof ($errors) > 0) |
|
51 | - print_r ($errors); |
|
50 | + if (sizeof($errors) > 0) |
|
51 | + print_r($errors); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | else |
55 | 55 | { |
56 | 56 | echo PHP_EOL; |
57 | - echo ' Building ['. dirname (str_replace (dirname ($params['--app-dir'], 2) .'\\', '', $params['--app-dir'])) .']...'. PHP_EOL . PHP_EOL; |
|
57 | + echo ' Building ['.dirname(str_replace(dirname($params['--app-dir'], 2).'\\', '', $params['--app-dir'])).']...'.PHP_EOL.PHP_EOL; |
|
58 | 58 | |
59 | - $begin = microtime (true); |
|
59 | + $begin = microtime(true); |
|
60 | 60 | |
61 | - $package = json_decode (file_get_contents (dirname ($params['--app-dir']) .'/qero-packages/packages.json'), true)['github:KRypt0nn/VoidFramework']['basefolder']; |
|
61 | + $package = json_decode(file_get_contents(dirname($params['--app-dir']).'/qero-packages/packages.json'), true)['github:KRypt0nn/VoidFramework']['basefolder']; |
|
62 | 62 | |
63 | - $params['--engine-dir'] = dirname ($params['--app-dir']) .'/qero-packages/KRypt0nn/VoidFramework/'. $package .'/engine'; |
|
64 | - file_put_contents ('params.json', json_encode ($params, JSON_PRETTY_PRINT)); |
|
63 | + $params['--engine-dir'] = dirname($params['--app-dir']).'/qero-packages/KRypt0nn/VoidFramework/'.$package.'/engine'; |
|
64 | + file_put_contents('params.json', json_encode($params, JSON_PRETTY_PRINT)); |
|
65 | 65 | |
66 | - shell_exec ('"'. dirname ($params['--app-dir']) .'/qero-packages/KRypt0nn/VoidFramework/'. $package .'/core/VoidCore.exe" "'. __FILE__ .'"'); |
|
66 | + shell_exec('"'.dirname($params['--app-dir']).'/qero-packages/KRypt0nn/VoidFramework/'.$package.'/core/VoidCore.exe" "'.__FILE__.'"'); |
|
67 | 67 | |
68 | - echo ' Building completed after '. round (microtime (true) - $begin, 6) .' seconds'. PHP_EOL; |
|
69 | - echo ' Saved at '. $params['--output-dir'] .'/build'. PHP_EOL . PHP_EOL; |
|
68 | + echo ' Building completed after '.round(microtime(true) - $begin, 6).' seconds'.PHP_EOL; |
|
69 | + echo ' Saved at '.$params['--output-dir'].'/build'.PHP_EOL.PHP_EOL; |
|
70 | 70 | |
71 | 71 | if (isset ($params['--join'])) |
72 | 72 | { |
73 | - if (!is_array ($params['--join'])) |
|
73 | + if (!is_array($params['--join'])) |
|
74 | 74 | $params['--join'] = [$params['--join']]; |
75 | 75 | |
76 | - if (($size = sizeof ($params['--join'])) > 0) |
|
76 | + if (($size = sizeof($params['--join'])) > 0) |
|
77 | 77 | { |
78 | - echo ' Union '. $size .' files...'. PHP_EOL; |
|
78 | + echo ' Union '.$size.' files...'.PHP_EOL; |
|
79 | 79 | |
80 | - $begin = microtime (true); |
|
81 | - $joiner = new Joiner ($params['--output-dir'] .'/build/app.exe', $params['--output-dir'] .'/app.exe'); |
|
80 | + $begin = microtime(true); |
|
81 | + $joiner = new Joiner($params['--output-dir'].'/build/app.exe', $params['--output-dir'].'/app.exe'); |
|
82 | 82 | |
83 | 83 | foreach ($params['--join'] as $file) |
84 | - $joiner->add (file_exists ($file) ? $file : $params['--output-dir'] .'/build/'. $file); |
|
84 | + $joiner->add(file_exists($file) ? $file : $params['--output-dir'].'/build/'.$file); |
|
85 | 85 | |
86 | - echo str_replace ("\n", "\n ", $joiner->join ()) . PHP_EOL; |
|
87 | - echo ' Union completed after '. round (microtime (true) - $begin, 6) .' seconds'. PHP_EOL; |
|
88 | - echo ' Saved at '. $params['--output-dir'] . PHP_EOL; |
|
86 | + echo str_replace("\n", "\n ", $joiner->join()).PHP_EOL; |
|
87 | + echo ' Union completed after '.round(microtime(true) - $begin, 6).' seconds'.PHP_EOL; |
|
88 | + echo ' Saved at '.$params['--output-dir'].PHP_EOL; |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
92 | -}))->addParams ([ |
|
93 | - (new Param ('--app-dir', null, true))->addAliase ('-d'), |
|
94 | - (new Param ('--output-dir', __DIR__ .'/build'))->addAliase ('-o'), |
|
95 | - (new Param ('--icon-path', __DIR__ .'/system/Icon.ico'))->addAliase ('-i'), |
|
96 | - (new Param ('--join'))->addAliase ('-j'), |
|
97 | - (new Flag ('--no-compress'))->addAliase ('-nc') |
|
98 | -])))->execute ($argv); |
|
92 | +}))->addParams([ |
|
93 | + (new Param('--app-dir', null, true))->addAliase('-d'), |
|
94 | + (new Param('--output-dir', __DIR__.'/build'))->addAliase('-o'), |
|
95 | + (new Param('--icon-path', __DIR__.'/system/Icon.ico'))->addAliase('-i'), |
|
96 | + (new Param('--join'))->addAliase('-j'), |
|
97 | + (new Flag('--no-compress'))->addAliase('-nc') |
|
98 | +])))->execute($argv); |
@@ -18,13 +18,15 @@ discard block |
||
18 | 18 | |
19 | 19 | foreach ($params as $name => $param) |
20 | 20 | { |
21 | - if (!is_array ($param)) |
|
22 | - $param = [$param]; |
|
21 | + if (!is_array ($param)) { |
|
22 | + $param = [$param]; |
|
23 | + } |
|
23 | 24 | |
24 | - foreach ($param as $arg) |
|
25 | - if (strlen ($arg) > 0) |
|
25 | + foreach ($param as $arg) { |
|
26 | + if (strlen ($arg) > 0) |
|
26 | 27 | { |
27 | 28 | $argv[] = $name; |
29 | + } |
|
28 | 30 | $argv[] = $arg; |
29 | 31 | } |
30 | 32 | } |
@@ -39,19 +41,19 @@ discard block |
||
39 | 41 | |
40 | 42 | (new Manager ([], (new DefaultCommand (function ($args, $params) |
41 | 43 | { |
42 | - foreach (['--app-dir', '--output-dir', '--icon-path'] as $param) |
|
43 | - if (is_array ($params[$param])) |
|
44 | + foreach (['--app-dir', '--output-dir', '--icon-path'] as $param) { |
|
45 | + if (is_array ($params[$param])) |
|
44 | 46 | $params[$param] = end ($params[$param]); |
47 | + } |
|
45 | 48 | |
46 | 49 | if (class_exists ('VoidEngine\VoidEngine')) |
47 | 50 | { |
48 | 51 | $errors = (new Builder ($params['--app-dir']))->build ($params['--output-dir'], $params['--icon-path'], !$params['--no-compress']); |
49 | 52 | |
50 | - if (sizeof ($errors) > 0) |
|
51 | - print_r ($errors); |
|
52 | - } |
|
53 | - |
|
54 | - else |
|
53 | + if (sizeof ($errors) > 0) { |
|
54 | + print_r ($errors); |
|
55 | + } |
|
56 | + } else |
|
55 | 57 | { |
56 | 58 | echo PHP_EOL; |
57 | 59 | echo ' Building ['. dirname (str_replace (dirname ($params['--app-dir'], 2) .'\\', '', $params['--app-dir'])) .']...'. PHP_EOL . PHP_EOL; |
@@ -70,8 +72,9 @@ discard block |
||
70 | 72 | |
71 | 73 | if (isset ($params['--join'])) |
72 | 74 | { |
73 | - if (!is_array ($params['--join'])) |
|
74 | - $params['--join'] = [$params['--join']]; |
|
75 | + if (!is_array ($params['--join'])) { |
|
76 | + $params['--join'] = [$params['--join']]; |
|
77 | + } |
|
75 | 78 | |
76 | 79 | if (($size = sizeof ($params['--join'])) > 0) |
77 | 80 | { |
@@ -80,8 +83,9 @@ discard block |
||
80 | 83 | $begin = microtime (true); |
81 | 84 | $joiner = new Joiner ($params['--output-dir'] .'/build/app.exe', $params['--output-dir'] .'/app.exe'); |
82 | 85 | |
83 | - foreach ($params['--join'] as $file) |
|
84 | - $joiner->add (file_exists ($file) ? $file : $params['--output-dir'] .'/build/'. $file); |
|
86 | + foreach ($params['--join'] as $file) { |
|
87 | + $joiner->add (file_exists ($file) ? $file : $params['--output-dir'] .'/build/'. $file); |
|
88 | + } |
|
85 | 89 | |
86 | 90 | echo str_replace ("\n", "\n ", $joiner->join ()) . PHP_EOL; |
87 | 91 | echo ' Union completed after '. round (microtime (true) - $begin, 6) .' seconds'. PHP_EOL; |