@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @return Stack - возвращает сам себя |
19 | 19 | */ |
20 | - public function push ($item): Stack |
|
20 | + public function push($item): Stack |
|
21 | 21 | { |
22 | 22 | $this->items[] = $item; |
23 | 23 | |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @return mixed - возвращает текущий элемент |
31 | 31 | */ |
32 | - public function current () |
|
32 | + public function current() |
|
33 | 33 | { |
34 | - return end ($this->items); |
|
34 | + return end($this->items); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @return mixed - возвращает текущий элемент |
41 | 41 | */ |
42 | - public function pop () |
|
42 | + public function pop() |
|
43 | 43 | { |
44 | - return array_pop ($this->items); |
|
44 | + return array_pop($this->items); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @return int - возвращает размер стэка |
51 | 51 | */ |
52 | - public function size (): int |
|
52 | + public function size(): int |
|
53 | 53 | { |
54 | - return sizeof ($this->items); |
|
54 | + return sizeof($this->items); |
|
55 | 55 | } |
56 | 56 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | protected $WinAPI; |
29 | 29 | |
30 | - public function __construct () |
|
30 | + public function __construct() |
|
31 | 31 | { |
32 | 32 | /** |
33 | 33 | * Большинство функций было взято из класса "WinAPI" проекта "DevelStudio XL" |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @see <https://vk.com/evsoft> |
37 | 37 | * @see <https://vk.com/magic.breeze> |
38 | 38 | */ |
39 | - $this->WinAPI = \FFI::cdef (' |
|
39 | + $this->WinAPI = \FFI::cdef(' |
|
40 | 40 | struct LPCTSTR |
41 | 41 | { |
42 | 42 | char string; |
@@ -72,10 +72,9 @@ discard block |
||
72 | 72 | ', 'User32.dll'); |
73 | 73 | } |
74 | 74 | |
75 | - public function __call ($method, $args) |
|
75 | + public function __call($method, $args) |
|
76 | 76 | { |
77 | - return method_exists ($this, $method) ? |
|
78 | - $this->$method (...$args) : |
|
79 | - $this->WinAPI->$method (...$args); |
|
77 | + return method_exists($this, $method) ? |
|
78 | + $this->$method(...$args) : $this->WinAPI->$method(...$args); |
|
80 | 79 | } |
81 | 80 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | const ENGINE_VERSION = '4.0.0dev'; |
35 | 35 | const ENGINE_DIR = __DIR__; |
36 | 36 | |
37 | -chdir (ENGINE_DIR); |
|
37 | +chdir(ENGINE_DIR); |
|
38 | 38 | |
39 | 39 | require 'common/Events.php'; |
40 | 40 | require 'common/EngineInterfaces.php'; |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | require 'common/Components.php'; |
44 | 44 | require 'common/Others.php'; |
45 | 45 | |
46 | -define ('VoidEngine\CORE_VERSION', $APPLICATION->productVersion); |
|
46 | +define('VoidEngine\CORE_VERSION', $APPLICATION->productVersion); |
|
47 | 47 | |
48 | 48 | require 'components/Component.php'; |
49 | 49 | require 'components/Control.php'; |
50 | 50 | |
51 | -foreach (glob ('components/*/*.php') as $name) |
|
51 | +foreach (glob('components/*/*.php') as $name) |
|
52 | 52 | require $name; |
53 | 53 | |
54 | -if (file_exists ('extensions')) |
|
55 | - foreach (scandir ('extensions') as $ext) |
|
56 | - if (file_exists ($ext = 'extensions/'. $ext .'/main.php')) |
|
54 | +if (file_exists('extensions')) |
|
55 | + foreach (scandir('extensions') as $ext) |
|
56 | + if (file_exists($ext = 'extensions/'.$ext.'/main.php')) |
|
57 | 57 | require $ext; |
@@ -48,10 +48,12 @@ |
||
48 | 48 | require 'components/Component.php'; |
49 | 49 | require 'components/Control.php'; |
50 | 50 | |
51 | -foreach (glob ('components/*/*.php') as $name) |
|
51 | +foreach (glob ('components/*/*.php') as $name) { |
|
52 | 52 | require $name; |
53 | +} |
|
53 | 54 | |
54 | -if (file_exists ('extensions')) |
|
55 | +if (file_exists ('extensions')) { |
|
55 | 56 | foreach (scandir ('extensions') as $ext) |
56 | 57 | if (file_exists ($ext = 'extensions/'. $ext .'/main.php')) |
57 | 58 | require $ext; |
59 | +} |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $size = $this->count; |
56 | 56 | $list = []; |
57 | 57 | |
58 | - for ($i = 0; $i < $size; ++$i) |
|
58 | + for ($i = 0; $i < $size; ++$i) |
|
59 | 59 | $list[] = EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $i)); |
60 | 60 | |
61 | 61 | return $list; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | # ArrayAccess |
125 | 125 | |
126 | 126 | public function offsetSet ($index, $value) |
127 | - { |
|
127 | + { |
|
128 | 128 | try |
129 | 129 | { |
130 | 130 | $index === null ? |
@@ -140,14 +140,14 @@ discard block |
||
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | - public function offsetGet ($index) |
|
144 | - { |
|
145 | - return EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $index), $this->selector); |
|
143 | + public function offsetGet ($index) |
|
144 | + { |
|
145 | + return EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $index), $this->selector); |
|
146 | 146 | } |
147 | 147 | |
148 | - public function offsetUnset ($index): void |
|
149 | - { |
|
150 | - $this->callMethod ('RemoveAt', $index); |
|
148 | + public function offsetUnset ($index): void |
|
149 | + { |
|
150 | + $this->callMethod ('RemoveAt', $index); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | public function offsetExists ($index): bool |
@@ -10,44 +10,44 @@ discard block |
||
10 | 10 | // protected ?string $name = null; |
11 | 11 | // protected bool $isCollection = false; |
12 | 12 | |
13 | - public function __construct ($name, $assembly = false, ...$args) |
|
13 | + public function __construct($name, $assembly = false, ...$args) |
|
14 | 14 | { |
15 | 15 | foreach ($args as $id => $arg) |
16 | - $args[$id] = EngineAdditions::uncoupleSelector ($arg); |
|
16 | + $args[$id] = EngineAdditions::uncoupleSelector($arg); |
|
17 | 17 | |
18 | - if (is_int ($name) && VoidCore::objectExists ($name)) |
|
18 | + if (is_int($name) && VoidCore::objectExists($name)) |
|
19 | 19 | $this->selector = $name; |
20 | 20 | |
21 | - elseif (is_string ($name)) |
|
22 | - $this->selector = VoidCore::createObject ($name, $assembly, ...$args); |
|
21 | + elseif (is_string($name)) |
|
22 | + $this->selector = VoidCore::createObject($name, $assembly, ...$args); |
|
23 | 23 | |
24 | - else throw new \Exception ('Incorrect params passed'); |
|
24 | + else throw new \Exception('Incorrect params passed'); |
|
25 | 25 | |
26 | 26 | /*$this->isCollection = $this->getType () |
27 | 27 | ->isSubclassOf (VoidCore::typeof ('System.Collectons.Generic.ICollection'));*/ |
28 | 28 | } |
29 | 29 | |
30 | - public function dispose (): void |
|
30 | + public function dispose(): void |
|
31 | 31 | { |
32 | - VoidCore::removeObjects ($this->selector); |
|
32 | + VoidCore::removeObjects($this->selector); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | # Основные магические методы |
36 | 36 | |
37 | - public function __get (string $name) |
|
37 | + public function __get(string $name) |
|
38 | 38 | { |
39 | - switch (strtolower ($name)) |
|
39 | + switch (strtolower($name)) |
|
40 | 40 | { |
41 | 41 | case 'count': |
42 | 42 | case 'length': |
43 | 43 | try |
44 | 44 | { |
45 | - return $this->getProperty ('Count'); |
|
45 | + return $this->getProperty('Count'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | catch (\WinformsException $e) |
49 | 49 | { |
50 | - return $this->getProperty ('Length'); |
|
50 | + return $this->getProperty('Length'); |
|
51 | 51 | } |
52 | 52 | break; |
53 | 53 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $list = []; |
57 | 57 | |
58 | 58 | for ($i = 0; $i < $size; ++$i) |
59 | - $list[] = EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $i)); |
|
59 | + $list[] = EngineAdditions::coupleSelector(VoidCore::getArrayValue($this->selector, $i)); |
|
60 | 60 | |
61 | 61 | return $list; |
62 | 62 | break; |
@@ -68,93 +68,91 @@ discard block |
||
68 | 68 | for ($i = 0; $i < $size; ++$i) |
69 | 69 | try |
70 | 70 | { |
71 | - $names[] = VoidCore::getProperty (VoidCore::getArrayValue ($this->selector, [$i, VC_OBJECT]), 'Text'); |
|
71 | + $names[] = VoidCore::getProperty(VoidCore::getArrayValue($this->selector, [$i, VC_OBJECT]), 'Text'); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | catch (\WinformsException $e) |
75 | 75 | { |
76 | - $names[] = VoidCore::getArrayValue ($this->selector, [$i, VC_STRING]); |
|
76 | + $names[] = VoidCore::getArrayValue($this->selector, [$i, VC_STRING]); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | return $names; |
80 | 80 | break; |
81 | 81 | } |
82 | 82 | |
83 | - if (method_exists ($this, $method = 'get_'. $name)) |
|
84 | - return $this->$method (); |
|
83 | + if (method_exists($this, $method = 'get_'.$name)) |
|
84 | + return $this->$method(); |
|
85 | 85 | |
86 | 86 | return isset ($this->$name) ? |
87 | - $this->$name : EngineAdditions::coupleSelector ($this->getProperty ($name)); |
|
87 | + $this->$name : EngineAdditions::coupleSelector($this->getProperty($name)); |
|
88 | 88 | } |
89 | 89 | |
90 | - public function __set (string $name, $value): void |
|
90 | + public function __set(string $name, $value): void |
|
91 | 91 | { |
92 | - if (substr ($name, -5) == 'Event') |
|
93 | - Events::setEvent ($this->selector, substr ($name, 0, -5), $value); |
|
92 | + if (substr($name, -5) == 'Event') |
|
93 | + Events::setEvent($this->selector, substr($name, 0, -5), $value); |
|
94 | 94 | |
95 | - elseif (method_exists ($this, $method = 'set_'. $name)) |
|
96 | - $this->$method ($value); |
|
95 | + elseif (method_exists($this, $method = 'set_'.$name)) |
|
96 | + $this->$method($value); |
|
97 | 97 | |
98 | - else $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value)); |
|
98 | + else $this->setProperty($name, EngineAdditions::uncoupleSelector($value)); |
|
99 | 99 | } |
100 | 100 | |
101 | - public function __call (string $name, array $args) |
|
101 | + public function __call(string $name, array $args) |
|
102 | 102 | { |
103 | - return EngineAdditions::coupleSelector ($this->callMethod ($name, array_map ( |
|
104 | - fn ($arg) => EngineAdditions::uncoupleSelector ($arg), $args))); |
|
103 | + return EngineAdditions::coupleSelector($this->callMethod($name, array_map( |
|
104 | + fn($arg) => EngineAdditions::uncoupleSelector($arg), $args))); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | # Управление VoidCore |
108 | 108 | |
109 | - protected function getProperty (string $name) |
|
109 | + protected function getProperty(string $name) |
|
110 | 110 | { |
111 | - return VoidCore::getProperty ($this->selector, $name); |
|
111 | + return VoidCore::getProperty($this->selector, $name); |
|
112 | 112 | } |
113 | 113 | |
114 | - protected function setProperty (string $name, $value): void |
|
114 | + protected function setProperty(string $name, $value): void |
|
115 | 115 | { |
116 | - VoidCore::setProperty ($this->selector, $name, $value); |
|
116 | + VoidCore::setProperty($this->selector, $name, $value); |
|
117 | 117 | } |
118 | 118 | |
119 | - protected function callMethod (string $name, array $args = []) |
|
119 | + protected function callMethod(string $name, array $args = []) |
|
120 | 120 | { |
121 | - return VoidCore::callMethod ($this->selector, $name, ...$args); |
|
121 | + return VoidCore::callMethod($this->selector, $name, ...$args); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | # ArrayAccess |
125 | 125 | |
126 | - public function offsetSet ($index, $value) |
|
126 | + public function offsetSet($index, $value) |
|
127 | 127 | { |
128 | 128 | try |
129 | 129 | { |
130 | 130 | $index === null ? |
131 | - $this->callMethod ('Add', EngineAdditions::uncoupleSelector ($value)) : |
|
132 | - $this->callMethod ('Insert', $index, EngineAdditions::uncoupleSelector ($value)); |
|
131 | + $this->callMethod('Add', EngineAdditions::uncoupleSelector($value)) : $this->callMethod('Insert', $index, EngineAdditions::uncoupleSelector($value)); |
|
133 | 132 | } |
134 | 133 | |
135 | 134 | catch (\Throwable $e) |
136 | 135 | { |
137 | 136 | $index === null ? |
138 | - VoidCore::setArrayValue ($this->selector, $this->count, EngineAdditions::uncoupleSelector ($value)) : |
|
139 | - VoidCore::setArrayValue ($this->selector, $index, EngineAdditions::uncoupleSelector ($value)); |
|
137 | + VoidCore::setArrayValue($this->selector, $this->count, EngineAdditions::uncoupleSelector($value)) : VoidCore::setArrayValue($this->selector, $index, EngineAdditions::uncoupleSelector($value)); |
|
140 | 138 | } |
141 | 139 | } |
142 | 140 | |
143 | - public function offsetGet ($index) |
|
141 | + public function offsetGet($index) |
|
144 | 142 | { |
145 | - return EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $index), $this->selector); |
|
143 | + return EngineAdditions::coupleSelector(VoidCore::getArrayValue($this->selector, $index), $this->selector); |
|
146 | 144 | } |
147 | 145 | |
148 | - public function offsetUnset ($index): void |
|
146 | + public function offsetUnset($index): void |
|
149 | 147 | { |
150 | - $this->callMethod ('RemoveAt', $index); |
|
148 | + $this->callMethod('RemoveAt', $index); |
|
151 | 149 | } |
152 | 150 | |
153 | - public function offsetExists ($index): bool |
|
151 | + public function offsetExists($index): bool |
|
154 | 152 | { |
155 | 153 | try |
156 | 154 | { |
157 | - $this->offsetGet ($index); |
|
155 | + $this->offsetGet($index); |
|
158 | 156 | } |
159 | 157 | |
160 | 158 | catch (\WinformsException $e) |
@@ -172,16 +170,16 @@ discard block |
||
172 | 170 | $size = $this->count; |
173 | 171 | |
174 | 172 | for ($i = 0; $i < $size; ++$i) |
175 | - $callback (EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i); |
|
173 | + $callback(EngineAdditions::coupleSelector(VoidCore::getArrayValue($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i); |
|
176 | 174 | } |
177 | 175 | |
178 | - public function where (callable $comparator, string $type = null): array |
|
176 | + public function where(callable $comparator, string $type = null): array |
|
179 | 177 | { |
180 | 178 | $size = $this->count; |
181 | 179 | $return = []; |
182 | 180 | |
183 | 181 | for ($i = 0; $i < $size; ++$i) |
184 | - if ($comparator ($value = EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i)) |
|
182 | + if ($comparator($value = EngineAdditions::coupleSelector(VoidCore::getArrayValue($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i)) |
|
185 | 183 | $return[] = $value; |
186 | 184 | |
187 | 185 | return $return; |
@@ -189,30 +187,30 @@ discard block |
||
189 | 187 | |
190 | 188 | # Магические методы |
191 | 189 | |
192 | - public function __destruct () |
|
190 | + public function __destruct() |
|
193 | 191 | { |
194 | - VoidCore::destructObject ($this->selector); |
|
192 | + VoidCore::destructObject($this->selector); |
|
195 | 193 | } |
196 | 194 | |
197 | - public function __toString (): string |
|
195 | + public function __toString(): string |
|
198 | 196 | { |
199 | 197 | return $this->selector; |
200 | 198 | } |
201 | 199 | |
202 | - public function __debugInfo (): array |
|
200 | + public function __debugInfo(): array |
|
203 | 201 | { |
204 | 202 | $info = ['selector' => $this->selector]; |
205 | 203 | |
206 | 204 | try |
207 | 205 | { |
208 | - $info['name'] = $this->getProperty ('Name'); |
|
206 | + $info['name'] = $this->getProperty('Name'); |
|
209 | 207 | } |
210 | 208 | |
211 | 209 | catch (\WinformsException $e) {} |
212 | 210 | |
213 | 211 | try |
214 | 212 | { |
215 | - $info['info'] = $this->callMethod ('ToString'); |
|
213 | + $info['info'] = $this->callMethod('ToString'); |
|
216 | 214 | } |
217 | 215 | |
218 | 216 | catch (\WinformsException $e) {} |
@@ -223,29 +221,29 @@ discard block |
||
223 | 221 | |
224 | 222 | class NetClass extends NetObject |
225 | 223 | { |
226 | - public function __construct ($name, $assembly = false, ...$args) |
|
224 | + public function __construct($name, $assembly = false, ...$args) |
|
227 | 225 | { |
228 | - if (is_int ($name) && VoidCore::objectExists ($name)) |
|
226 | + if (is_int($name) && VoidCore::objectExists($name)) |
|
229 | 227 | $this->selector = $name; |
230 | 228 | |
231 | - elseif (is_string ($name)) |
|
232 | - $this->selector = VoidCore::getClass ($name, $assembly, ...$args); |
|
229 | + elseif (is_string($name)) |
|
230 | + $this->selector = VoidCore::getClass($name, $assembly, ...$args); |
|
233 | 231 | |
234 | - else throw new \Exception ('Incorrect params passed'); |
|
232 | + else throw new \Exception('Incorrect params passed'); |
|
235 | 233 | } |
236 | 234 | } |
237 | 235 | |
238 | 236 | class EngineAdditions |
239 | 237 | { |
240 | - public static function coupleSelector ($selector) |
|
238 | + public static function coupleSelector($selector) |
|
241 | 239 | { |
242 | - return is_int ($selector) && VoidCore::objectExists ($selector) ? |
|
243 | - new NetObject ($selector) : $selector; |
|
240 | + return is_int($selector) && VoidCore::objectExists($selector) ? |
|
241 | + new NetObject($selector) : $selector; |
|
244 | 242 | } |
245 | 243 | |
246 | - public static function uncoupleSelector ($object) |
|
244 | + public static function uncoupleSelector($object) |
|
247 | 245 | { |
248 | - return is_object ($object) && $object instanceof NetObject ? |
|
246 | + return is_object($object) && $object instanceof NetObject ? |
|
249 | 247 | $object->selector : $object; |
250 | 248 | } |
251 | 249 | } |
@@ -12,16 +12,17 @@ discard block |
||
12 | 12 | |
13 | 13 | public function __construct ($name, $assembly = false, ...$args) |
14 | 14 | { |
15 | - foreach ($args as $id => $arg) |
|
16 | - $args[$id] = EngineAdditions::uncoupleSelector ($arg); |
|
15 | + foreach ($args as $id => $arg) { |
|
16 | + $args[$id] = EngineAdditions::uncoupleSelector ($arg); |
|
17 | + } |
|
17 | 18 | |
18 | - if (is_int ($name) && VoidCore::objectExists ($name)) |
|
19 | - $this->selector = $name; |
|
20 | - |
|
21 | - elseif (is_string ($name)) |
|
22 | - $this->selector = VoidCore::createObject ($name, $assembly, ...$args); |
|
23 | - |
|
24 | - else throw new \Exception ('Incorrect params passed'); |
|
19 | + if (is_int ($name) && VoidCore::objectExists ($name)) { |
|
20 | + $this->selector = $name; |
|
21 | + } elseif (is_string ($name)) { |
|
22 | + $this->selector = VoidCore::createObject ($name, $assembly, ...$args); |
|
23 | + } else { |
|
24 | + throw new \Exception ('Incorrect params passed'); |
|
25 | + } |
|
25 | 26 | |
26 | 27 | /*$this->isCollection = $this->getType () |
27 | 28 | ->isSubclassOf (VoidCore::typeof ('System.Collectons.Generic.ICollection'));*/ |
@@ -43,9 +44,7 @@ discard block |
||
43 | 44 | try |
44 | 45 | { |
45 | 46 | return $this->getProperty ('Count'); |
46 | - } |
|
47 | - |
|
48 | - catch (\WinformsException $e) |
|
47 | + } catch (\WinformsException $e) |
|
49 | 48 | { |
50 | 49 | return $this->getProperty ('Length'); |
51 | 50 | } |
@@ -55,8 +54,9 @@ discard block |
||
55 | 54 | $size = $this->count; |
56 | 55 | $list = []; |
57 | 56 | |
58 | - for ($i = 0; $i < $size; ++$i) |
|
59 | - $list[] = EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $i)); |
|
57 | + for ($i = 0; $i < $size; ++$i) { |
|
58 | + $list[] = EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $i)); |
|
59 | + } |
|
60 | 60 | |
61 | 61 | return $list; |
62 | 62 | break; |
@@ -65,13 +65,12 @@ discard block |
||
65 | 65 | $size = $this->count; |
66 | 66 | $names = []; |
67 | 67 | |
68 | - for ($i = 0; $i < $size; ++$i) |
|
69 | - try |
|
68 | + for ($i = 0; $i < $size; ++$i) { |
|
69 | + try |
|
70 | 70 | { |
71 | 71 | $names[] = VoidCore::getProperty (VoidCore::getArrayValue ($this->selector, [$i, VC_OBJECT]), 'Text'); |
72 | - } |
|
73 | - |
|
74 | - catch (\WinformsException $e) |
|
72 | + } |
|
73 | + } catch (\WinformsException $e) |
|
75 | 74 | { |
76 | 75 | $names[] = VoidCore::getArrayValue ($this->selector, [$i, VC_STRING]); |
77 | 76 | } |
@@ -80,8 +79,9 @@ discard block |
||
80 | 79 | break; |
81 | 80 | } |
82 | 81 | |
83 | - if (method_exists ($this, $method = 'get_'. $name)) |
|
84 | - return $this->$method (); |
|
82 | + if (method_exists ($this, $method = 'get_'. $name)) { |
|
83 | + return $this->$method (); |
|
84 | + } |
|
85 | 85 | |
86 | 86 | return isset ($this->$name) ? |
87 | 87 | $this->$name : EngineAdditions::coupleSelector ($this->getProperty ($name)); |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | |
90 | 90 | public function __set (string $name, $value): void |
91 | 91 | { |
92 | - if (substr ($name, -5) == 'Event') |
|
93 | - Events::setEvent ($this->selector, substr ($name, 0, -5), $value); |
|
94 | - |
|
95 | - elseif (method_exists ($this, $method = 'set_'. $name)) |
|
96 | - $this->$method ($value); |
|
97 | - |
|
98 | - else $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value)); |
|
92 | + if (substr ($name, -5) == 'Event') { |
|
93 | + Events::setEvent ($this->selector, substr ($name, 0, -5), $value); |
|
94 | + } elseif (method_exists ($this, $method = 'set_'. $name)) { |
|
95 | + $this->$method ($value); |
|
96 | + } else { |
|
97 | + $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value)); |
|
98 | + } |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | public function __call (string $name, array $args) |
@@ -130,9 +130,7 @@ discard block |
||
130 | 130 | $index === null ? |
131 | 131 | $this->callMethod ('Add', EngineAdditions::uncoupleSelector ($value)) : |
132 | 132 | $this->callMethod ('Insert', $index, EngineAdditions::uncoupleSelector ($value)); |
133 | - } |
|
134 | - |
|
135 | - catch (\Throwable $e) |
|
133 | + } catch (\Throwable $e) |
|
136 | 134 | { |
137 | 135 | $index === null ? |
138 | 136 | VoidCore::setArrayValue ($this->selector, $this->count, EngineAdditions::uncoupleSelector ($value)) : |
@@ -155,9 +153,7 @@ discard block |
||
155 | 153 | try |
156 | 154 | { |
157 | 155 | $this->offsetGet ($index); |
158 | - } |
|
159 | - |
|
160 | - catch (\WinformsException $e) |
|
156 | + } catch (\WinformsException $e) |
|
161 | 157 | { |
162 | 158 | return false; |
163 | 159 | } |
@@ -171,8 +167,9 @@ discard block |
||
171 | 167 | { |
172 | 168 | $size = $this->count; |
173 | 169 | |
174 | - for ($i = 0; $i < $size; ++$i) |
|
175 | - $callback (EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i); |
|
170 | + for ($i = 0; $i < $size; ++$i) { |
|
171 | + $callback (EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i); |
|
172 | + } |
|
176 | 173 | } |
177 | 174 | |
178 | 175 | public function where (callable $comparator, string $type = null): array |
@@ -180,9 +177,10 @@ discard block |
||
180 | 177 | $size = $this->count; |
181 | 178 | $return = []; |
182 | 179 | |
183 | - for ($i = 0; $i < $size; ++$i) |
|
184 | - if ($comparator ($value = EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i)) |
|
180 | + for ($i = 0; $i < $size; ++$i) { |
|
181 | + if ($comparator ($value = EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i)) |
|
185 | 182 | $return[] = $value; |
183 | + } |
|
186 | 184 | |
187 | 185 | return $return; |
188 | 186 | } |
@@ -206,16 +204,12 @@ discard block |
||
206 | 204 | try |
207 | 205 | { |
208 | 206 | $info['name'] = $this->getProperty ('Name'); |
209 | - } |
|
210 | - |
|
211 | - catch (\WinformsException $e) {} |
|
207 | + } catch (\WinformsException $e) {} |
|
212 | 208 | |
213 | 209 | try |
214 | 210 | { |
215 | 211 | $info['info'] = $this->callMethod ('ToString'); |
216 | - } |
|
217 | - |
|
218 | - catch (\WinformsException $e) {} |
|
212 | + } catch (\WinformsException $e) {} |
|
219 | 213 | |
220 | 214 | return $info; |
221 | 215 | } |
@@ -225,13 +219,13 @@ discard block |
||
225 | 219 | { |
226 | 220 | public function __construct ($name, $assembly = false, ...$args) |
227 | 221 | { |
228 | - if (is_int ($name) && VoidCore::objectExists ($name)) |
|
229 | - $this->selector = $name; |
|
230 | - |
|
231 | - elseif (is_string ($name)) |
|
232 | - $this->selector = VoidCore::getClass ($name, $assembly, ...$args); |
|
233 | - |
|
234 | - else throw new \Exception ('Incorrect params passed'); |
|
222 | + if (is_int ($name) && VoidCore::objectExists ($name)) { |
|
223 | + $this->selector = $name; |
|
224 | + } elseif (is_string ($name)) { |
|
225 | + $this->selector = VoidCore::getClass ($name, $assembly, ...$args); |
|
226 | + } else { |
|
227 | + throw new \Exception ('Incorrect params passed'); |
|
228 | + } |
|
235 | 229 | } |
236 | 230 | } |
237 | 231 |
@@ -9,17 +9,17 @@ |
||
9 | 9 | public static function setEvent (int $selector, string $eventName, callable $function): void |
10 | 10 | { |
11 | 11 | VoidCore::setEvent ($selector, $eventName, function ($sender, ...$args) use ($function) |
12 | - { |
|
12 | + { |
|
13 | 13 | try |
14 | - { |
|
14 | + { |
|
15 | 15 | foreach ($args as $id => $arg) |
16 | 16 | $args[$id] = EngineAdditions::coupleSelector ($arg); |
17 | 17 | |
18 | 18 | return $function (_c ($sender) ?: new NetObject ($sender), ...$args); |
19 | 19 | } |
20 | 20 | |
21 | - catch (\Throwable $e) |
|
22 | - { |
|
21 | + catch (\Throwable $e) |
|
22 | + { |
|
23 | 23 | message ([ |
24 | 24 | 'type' => get_class ($e), |
25 | 25 | 'text' => $e->getMessage (), |
@@ -6,34 +6,34 @@ |
||
6 | 6 | |
7 | 7 | class Events |
8 | 8 | { |
9 | - public static function setEvent (int $selector, string $eventName, callable $function): void |
|
9 | + public static function setEvent(int $selector, string $eventName, callable $function): void |
|
10 | 10 | { |
11 | - VoidCore::setEvent ($selector, $eventName, function ($sender, ...$args) use ($function) |
|
11 | + VoidCore::setEvent($selector, $eventName, function($sender, ...$args) use ($function) |
|
12 | 12 | { |
13 | 13 | try |
14 | 14 | { |
15 | 15 | foreach ($args as $id => $arg) |
16 | - $args[$id] = EngineAdditions::coupleSelector ($arg); |
|
16 | + $args[$id] = EngineAdditions::coupleSelector($arg); |
|
17 | 17 | |
18 | - return $function (_c ($sender) ?: new NetObject ($sender), ...$args); |
|
18 | + return $function(_c($sender) ?: new NetObject($sender), ...$args); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | catch (\Throwable $e) |
22 | 22 | { |
23 | - message ([ |
|
24 | - 'type' => get_class ($e), |
|
25 | - 'text' => $e->getMessage (), |
|
26 | - 'file' => $e->getFile (), |
|
27 | - 'line' => $e->getLine (), |
|
28 | - 'code' => $e->getCode (), |
|
29 | - 'trace' => $e->getTraceAsString () |
|
23 | + message([ |
|
24 | + 'type' => get_class($e), |
|
25 | + 'text' => $e->getMessage(), |
|
26 | + 'file' => $e->getFile(), |
|
27 | + 'line' => $e->getLine(), |
|
28 | + 'code' => $e->getCode(), |
|
29 | + 'trace' => $e->getTraceAsString() |
|
30 | 30 | ], 'PHP Critical Error'); |
31 | 31 | } |
32 | 32 | }); |
33 | 33 | } |
34 | 34 | |
35 | - public static function removeEvent (int $selector, string $eventName): void |
|
35 | + public static function removeEvent(int $selector, string $eventName): void |
|
36 | 36 | { |
37 | - VoidCore::removeEvent ($selector, $eventName); |
|
37 | + VoidCore::removeEvent($selector, $eventName); |
|
38 | 38 | } |
39 | 39 | } |
@@ -12,13 +12,12 @@ |
||
12 | 12 | { |
13 | 13 | try |
14 | 14 | { |
15 | - foreach ($args as $id => $arg) |
|
16 | - $args[$id] = EngineAdditions::coupleSelector ($arg); |
|
15 | + foreach ($args as $id => $arg) { |
|
16 | + $args[$id] = EngineAdditions::coupleSelector ($arg); |
|
17 | + } |
|
17 | 18 | |
18 | 19 | return $function (_c ($sender) ?: new NetObject ($sender), ...$args); |
19 | - } |
|
20 | - |
|
21 | - catch (\Throwable $e) |
|
20 | + } catch (\Throwable $e) |
|
22 | 21 | { |
23 | 22 | message ([ |
24 | 23 | 'type' => get_class ($e), |
@@ -8,338 +8,338 @@ |
||
8 | 8 | $converter = new NetClass ('System.Drawing.ColorTranslator'); |
9 | 9 | |
10 | 10 | $constants = [ |
11 | - # Информация об окружении |
|
11 | + # Информация об окружении |
|
12 | 12 | |
13 | - 'EXE_NAME' => $APPLICATION->executablePath, |
|
14 | - 'DOC_ROOT' => dirname ($APPLICATION->executablePath), |
|
15 | - 'IS_ADMIN' => is_writable (getenv ('SystemRoot')), |
|
16 | - 'START_PARAMS' => $params, |
|
17 | - 'USERNAME' => $env->username, |
|
13 | + 'EXE_NAME' => $APPLICATION->executablePath, |
|
14 | + 'DOC_ROOT' => dirname ($APPLICATION->executablePath), |
|
15 | + 'IS_ADMIN' => is_writable (getenv ('SystemRoot')), |
|
16 | + 'START_PARAMS' => $params, |
|
17 | + 'USERNAME' => $env->username, |
|
18 | 18 | |
19 | - # Константы MessageBox'а |
|
19 | + # Константы MessageBox'а |
|
20 | 20 | |
21 | - 'MB_YESNO' => 4, |
|
22 | - 'MB_YESNOCANCEL' => 3, |
|
23 | - 'MB_OK' => 0, |
|
24 | - 'MB_OKCANCEL' => 1, |
|
25 | - 'MB_RETRYCANCEL' => 5, |
|
26 | - 'MB_ABORTRETRYIGNORE' => 2, |
|
27 | - 'MBI_ASTERISK' => 64, |
|
28 | - 'MBI_ERROR' => 16, |
|
29 | - 'MBI_EXCLAMATION' => 48, |
|
30 | - 'MBI_HAND' => 16, |
|
31 | - 'MBI_INFORMATION' => 64, |
|
32 | - 'MBI_NONE' => 0, |
|
33 | - 'MBI_QUESTION' => 32, |
|
34 | - 'MBI_STOP' => 16, |
|
35 | - 'MBI_WARNING' => 48, |
|
36 | - 'MBDB_1' => 0, |
|
37 | - 'MBDB_2' => 256, |
|
38 | - 'MBDB_3' => 512, |
|
21 | + 'MB_YESNO' => 4, |
|
22 | + 'MB_YESNOCANCEL' => 3, |
|
23 | + 'MB_OK' => 0, |
|
24 | + 'MB_OKCANCEL' => 1, |
|
25 | + 'MB_RETRYCANCEL' => 5, |
|
26 | + 'MB_ABORTRETRYIGNORE' => 2, |
|
27 | + 'MBI_ASTERISK' => 64, |
|
28 | + 'MBI_ERROR' => 16, |
|
29 | + 'MBI_EXCLAMATION' => 48, |
|
30 | + 'MBI_HAND' => 16, |
|
31 | + 'MBI_INFORMATION' => 64, |
|
32 | + 'MBI_NONE' => 0, |
|
33 | + 'MBI_QUESTION' => 32, |
|
34 | + 'MBI_STOP' => 16, |
|
35 | + 'MBI_WARNING' => 48, |
|
36 | + 'MBDB_1' => 0, |
|
37 | + 'MBDB_2' => 256, |
|
38 | + 'MBDB_3' => 512, |
|
39 | 39 | |
40 | - # Константы DialogResult |
|
40 | + # Константы DialogResult |
|
41 | 41 | |
42 | - 'drOk' => 1, |
|
43 | - 'drYes' => 6, |
|
44 | - 'drNo' => 7, |
|
45 | - 'drCancel' => 2, |
|
46 | - 'drRetry' => 4, |
|
47 | - 'drAbort' => 3, |
|
48 | - 'drIgnore' => 5, |
|
49 | - 'drNone' => 0, |
|
42 | + 'drOk' => 1, |
|
43 | + 'drYes' => 6, |
|
44 | + 'drNo' => 7, |
|
45 | + 'drCancel' => 2, |
|
46 | + 'drRetry' => 4, |
|
47 | + 'drAbort' => 3, |
|
48 | + 'drIgnore' => 5, |
|
49 | + 'drNone' => 0, |
|
50 | 50 | |
51 | - # Константы форм |
|
51 | + # Константы форм |
|
52 | 52 | |
53 | - 'fbsNone' => 0, |
|
54 | - 'fbsSingle' => 1, |
|
55 | - 'fbs3D' => 2, |
|
56 | - 'fbsDialog' => 3, |
|
57 | - 'fbsSizable' => 4, |
|
58 | - 'fbsToolWindow' => 5, |
|
59 | - 'fbsSizableToolWindow' => 6, |
|
60 | - |
|
61 | - 'fwsNormal' => 0, |
|
62 | - 'fwsMinimized' => 1, |
|
63 | - 'fwsMaximized' => 2, |
|
64 | - |
|
65 | - 'fspManual' => 0, |
|
66 | - 'fspCenterScreen' => 1, |
|
67 | - 'fspWindowsDefaultLocation' => 2, |
|
68 | - 'fspWindowsDefaultBounds' => 3, |
|
69 | - 'fspCenterParent' => 4, |
|
70 | - |
|
71 | - # Константы стиля оконтовки |
|
72 | - |
|
73 | - 'bsNone' => 0, |
|
74 | - 'bsFixedSingle' => 1, |
|
75 | - 'bsFixed3D' => 2, |
|
76 | - |
|
77 | - # Константы выравнивания |
|
78 | - |
|
79 | - 'alTopLeft' => 1, |
|
80 | - 'alTopCenter' => 2, |
|
81 | - 'alTopRight' => 4, |
|
82 | - 'alMiddleLeft' => 16, |
|
83 | - 'alMiddleCenter' => 32, |
|
84 | - 'alMiddleRight' => 64, |
|
85 | - 'alBottomLeft' => 256, |
|
86 | - 'alBottomCenter' => 512, |
|
87 | - 'alBottomRight' => 1024, |
|
88 | - |
|
89 | - # Константы притягивания (Anchor) |
|
90 | - |
|
91 | - 'acNone' => 0, |
|
92 | - 'acTop' => 1, |
|
93 | - 'acBottom' => 2, |
|
94 | - 'acLeft' => 4, |
|
95 | - 'acRight' => 8, |
|
96 | - |
|
97 | - # Константы SizeMode-параметра PictureBox'а |
|
98 | - |
|
99 | - 'smNormal' => 0, |
|
100 | - 'smStretchImage' => 1, |
|
101 | - 'smAutoSize' => 2, |
|
102 | - 'smCenterImage' => 3, |
|
103 | - 'smZoom' => 4, |
|
104 | - |
|
105 | - # Константы View-параметра ListView'а |
|
53 | + 'fbsNone' => 0, |
|
54 | + 'fbsSingle' => 1, |
|
55 | + 'fbs3D' => 2, |
|
56 | + 'fbsDialog' => 3, |
|
57 | + 'fbsSizable' => 4, |
|
58 | + 'fbsToolWindow' => 5, |
|
59 | + 'fbsSizableToolWindow' => 6, |
|
60 | + |
|
61 | + 'fwsNormal' => 0, |
|
62 | + 'fwsMinimized' => 1, |
|
63 | + 'fwsMaximized' => 2, |
|
64 | + |
|
65 | + 'fspManual' => 0, |
|
66 | + 'fspCenterScreen' => 1, |
|
67 | + 'fspWindowsDefaultLocation' => 2, |
|
68 | + 'fspWindowsDefaultBounds' => 3, |
|
69 | + 'fspCenterParent' => 4, |
|
70 | + |
|
71 | + # Константы стиля оконтовки |
|
72 | + |
|
73 | + 'bsNone' => 0, |
|
74 | + 'bsFixedSingle' => 1, |
|
75 | + 'bsFixed3D' => 2, |
|
76 | + |
|
77 | + # Константы выравнивания |
|
78 | + |
|
79 | + 'alTopLeft' => 1, |
|
80 | + 'alTopCenter' => 2, |
|
81 | + 'alTopRight' => 4, |
|
82 | + 'alMiddleLeft' => 16, |
|
83 | + 'alMiddleCenter' => 32, |
|
84 | + 'alMiddleRight' => 64, |
|
85 | + 'alBottomLeft' => 256, |
|
86 | + 'alBottomCenter' => 512, |
|
87 | + 'alBottomRight' => 1024, |
|
88 | + |
|
89 | + # Константы притягивания (Anchor) |
|
90 | + |
|
91 | + 'acNone' => 0, |
|
92 | + 'acTop' => 1, |
|
93 | + 'acBottom' => 2, |
|
94 | + 'acLeft' => 4, |
|
95 | + 'acRight' => 8, |
|
96 | + |
|
97 | + # Константы SizeMode-параметра PictureBox'а |
|
98 | + |
|
99 | + 'smNormal' => 0, |
|
100 | + 'smStretchImage' => 1, |
|
101 | + 'smAutoSize' => 2, |
|
102 | + 'smCenterImage' => 3, |
|
103 | + 'smZoom' => 4, |
|
104 | + |
|
105 | + # Константы View-параметра ListView'а |
|
106 | 106 | |
107 | - 'vwLargeIcon' => 0, |
|
108 | - 'vwDetails' => 1, |
|
109 | - 'vwSmallIcon' => 2, |
|
110 | - 'vwList' => 3, |
|
111 | - 'vwTile' => 4, |
|
107 | + 'vwLargeIcon' => 0, |
|
108 | + 'vwDetails' => 1, |
|
109 | + 'vwSmallIcon' => 2, |
|
110 | + 'vwList' => 3, |
|
111 | + 'vwTile' => 4, |
|
112 | 112 | |
113 | - # Константы dropDownStyle компонента ComboBox |
|
113 | + # Константы dropDownStyle компонента ComboBox |
|
114 | 114 | |
115 | - 'ddSimple' => 0, |
|
116 | - 'ddDropDown' => 1, |
|
117 | - 'ddDropDownList' => 2, |
|
115 | + 'ddSimple' => 0, |
|
116 | + 'ddDropDown' => 1, |
|
117 | + 'ddDropDownList' => 2, |
|
118 | 118 | |
119 | - # Константы причины закрытия формы |
|
119 | + # Константы причины закрытия формы |
|
120 | 120 | |
121 | - 'fcrNone' => 0, |
|
122 | - 'fcrWindowsShutDown' => 1, |
|
123 | - 'fcrMdiFormClosing' => 2, |
|
124 | - 'fcrUserClosing' => 3, |
|
125 | - 'fcrTaskManagerClosing' => 4, |
|
126 | - 'fcrFormOwnerClosing' => 5, |
|
127 | - 'fcrApplicationExitCall' => 6, |
|
121 | + 'fcrNone' => 0, |
|
122 | + 'fcrWindowsShutDown' => 1, |
|
123 | + 'fcrMdiFormClosing' => 2, |
|
124 | + 'fcrUserClosing' => 3, |
|
125 | + 'fcrTaskManagerClosing' => 4, |
|
126 | + 'fcrFormOwnerClosing' => 5, |
|
127 | + 'fcrApplicationExitCall' => 6, |
|
128 | 128 | |
129 | - # Константы дока |
|
129 | + # Константы дока |
|
130 | 130 | |
131 | - 'dsBottom' => 2, |
|
132 | - 'dsFill' => 5, |
|
133 | - 'dsLeft' => 3, |
|
134 | - 'dsNone' => 0, |
|
135 | - 'dsRight' => 4, |
|
136 | - 'dsTop' => 1, |
|
131 | + 'dsBottom' => 2, |
|
132 | + 'dsFill' => 5, |
|
133 | + 'dsLeft' => 3, |
|
134 | + 'dsNone' => 0, |
|
135 | + 'dsRight' => 4, |
|
136 | + 'dsTop' => 1, |
|
137 | 137 | |
138 | - # Константы FCTB.Language |
|
138 | + # Константы FCTB.Language |
|
139 | 139 | |
140 | - 'langCSharp' => 1, |
|
141 | - 'langCustom' => 2, |
|
142 | - 'langHTML' => 3, |
|
143 | - 'langJS' => 4, |
|
144 | - 'langLua' => 5, |
|
145 | - 'langPHP' => 6, |
|
146 | - 'langSQL' => 7, |
|
147 | - 'langVB' => 8, |
|
148 | - 'langXML' => 9, |
|
140 | + 'langCSharp' => 1, |
|
141 | + 'langCustom' => 2, |
|
142 | + 'langHTML' => 3, |
|
143 | + 'langJS' => 4, |
|
144 | + 'langLua' => 5, |
|
145 | + 'langPHP' => 6, |
|
146 | + 'langSQL' => 7, |
|
147 | + 'langVB' => 8, |
|
148 | + 'langXML' => 9, |
|
149 | 149 | |
150 | - # Константы видимости окна процесса |
|
150 | + # Константы видимости окна процесса |
|
151 | 151 | |
152 | - 'pwsHidden' => 0, |
|
153 | - 'pwsMaximized' => 3, |
|
154 | - 'pwsMinimized' => 2, |
|
155 | - 'pwsNormal' => 1, |
|
152 | + 'pwsHidden' => 0, |
|
153 | + 'pwsMaximized' => 3, |
|
154 | + 'pwsMinimized' => 2, |
|
155 | + 'pwsNormal' => 1, |
|
156 | 156 | |
157 | - # Константы запуска |
|
157 | + # Константы запуска |
|
158 | 158 | |
159 | - 'runNo' => 0, |
|
160 | - 'runYes' => 1, |
|
161 | - 'runThread' => 2, |
|
159 | + 'runNo' => 0, |
|
160 | + 'runYes' => 1, |
|
161 | + 'runThread' => 2, |
|
162 | 162 | |
163 | - # Константы стиля ProgressBar'а |
|
163 | + # Константы стиля ProgressBar'а |
|
164 | 164 | |
165 | - 'pbBlocks' => 0, |
|
166 | - 'pbContinuous' => 1, |
|
167 | - 'pbMarquee' => 2, |
|
165 | + 'pbBlocks' => 0, |
|
166 | + 'pbContinuous' => 1, |
|
167 | + 'pbMarquee' => 2, |
|
168 | 168 | |
169 | - # Константы свойства FlatStyle |
|
169 | + # Константы свойства FlatStyle |
|
170 | 170 | |
171 | - 'flFlat' => 0, |
|
172 | - 'flPopup' => 1, |
|
173 | - 'flStandard' => 2, |
|
174 | - 'flSystem' => 3, |
|
171 | + 'flFlat' => 0, |
|
172 | + 'flPopup' => 1, |
|
173 | + 'flStandard' => 2, |
|
174 | + 'flSystem' => 3, |
|
175 | 175 | |
176 | - # Константы свойства DrawMode |
|
176 | + # Константы свойства DrawMode |
|
177 | 177 | |
178 | - 'dwNormal' => 0, |
|
179 | - 'dwOwnerDrawFixed' => 1, |
|
180 | - 'dwOwnerDrawVariable' => 2, |
|
178 | + 'dwNormal' => 0, |
|
179 | + 'dwOwnerDrawFixed' => 1, |
|
180 | + 'dwOwnerDrawVariable' => 2, |
|
181 | 181 | |
182 | - # Константы свойства SizeMode PictureBox'а |
|
182 | + # Константы свойства SizeMode PictureBox'а |
|
183 | 183 | |
184 | - 'smNormal' => 0, |
|
185 | - 'smStretchImage' => 1, |
|
186 | - 'smAutoSize' => 2, |
|
187 | - 'smCenterImage' => 3, |
|
188 | - 'smZoom' => 4, |
|
184 | + 'smNormal' => 0, |
|
185 | + 'smStretchImage' => 1, |
|
186 | + 'smAutoSize' => 2, |
|
187 | + 'smCenterImage' => 3, |
|
188 | + 'smZoom' => 4, |
|
189 | 189 | |
190 | - # Цветовые константы |
|
190 | + # Цветовые константы |
|
191 | 191 | |
192 | - 'clAliceBlue' => 0xFFF0F8FF, |
|
193 | - 'clAntiqueWhite' => 0xFFFAEBD7, |
|
194 | - 'clAqua' => 0xFF00FFFF, |
|
195 | - 'clAquamarine' => 0xFF7FFFD4, |
|
196 | - 'clAzure' => 0xFFF0FFFF, |
|
197 | - 'clBeige' => 0xFFF5F5DC, |
|
198 | - 'clBisque' => 0xFFFFE4C4, |
|
199 | - 'clBlack' => 0xFF000000, |
|
200 | - 'clBlanchedAlmond' => 0xFFFFEBCD, |
|
201 | - 'clBlue' => 0xFF0000FF, |
|
202 | - 'clBlueViolet' => 0xFF8A2BE2, |
|
203 | - 'clBrown' => 0xFFA52A2A, |
|
204 | - 'clBurlyWood' => 0xFFDEB887, |
|
205 | - 'clCadetBlue' => 0xFF5F9EA0, |
|
206 | - 'clChartreuse' => 0xFF7FFF00, |
|
207 | - 'clChocolate' => 0xFFD2691E, |
|
208 | - 'clCoral' => 0xFFFF7F50, |
|
209 | - 'clCornflowerBlue' => 0xFF6495ED, |
|
210 | - 'clCornsilk' => 0xFFFFF8DC, |
|
211 | - 'clCrimson' => 0xFFDC143C, |
|
212 | - 'clCyan' => 0xFF00FFFF, |
|
213 | - 'clDarkBlue' => 0xFF00008B, |
|
214 | - 'clDarkCyan' => 0xFF008B8B, |
|
215 | - 'clDarkGoldenrod' => 0xFFB8860B, |
|
216 | - 'clDarkGray' => 0xFFA9A9A9, |
|
217 | - 'clDarkGreen' => 0xFF006400, |
|
218 | - 'clDarkKhaki' => 0xFFBDB76B, |
|
219 | - 'clDarkMagenta' => 0xFF8B008B, |
|
220 | - 'clDarkOliveGreen' => 0xFF556B2F, |
|
221 | - 'clDarkOrange' => 0xFFFF8C00, |
|
222 | - 'clDarkOrchid' => 0xFF9932CC, |
|
223 | - 'clDarkRed' => 0xFF8B0000, |
|
224 | - 'clDarkSalmon' => 0xFFE9967A, |
|
225 | - 'clDarkSeaGreen' => 0xFF8FBC8F, |
|
226 | - 'clDarkSlateBlue' => 0xFF483D8B, |
|
227 | - 'clDarkSlateGray' => 0xFF2F4F4F, |
|
228 | - 'clDarkTurquoise' => 0xFF00CED1, |
|
229 | - 'clDarkViolet' => 0xFF9400D3, |
|
230 | - 'clDeepPink' => 0xFFFF1493, |
|
231 | - 'clDeepSkyBlue' => 0xFF00BFFF, |
|
232 | - 'clDimGray' => 0xFF696969, |
|
233 | - 'clDodgerBlue' => 0xFF1E90FF, |
|
234 | - 'clFirebrick' => 0xFFB22222, |
|
235 | - 'clFloralWhite' => 0xFFFFFAF0, |
|
236 | - 'clForestGreen' => 0xFF228B22, |
|
237 | - 'clFuchsia' => 0xFFFF00FF, |
|
238 | - 'clGainsboro' => 0xFFDCDCDC, |
|
239 | - 'clGhostWhite' => 0xFFF8F8FF, |
|
240 | - 'clGold' => 0xFFFFD700, |
|
241 | - 'clGoldenrod' => 0xFFDAA520, |
|
242 | - 'clGray' => 0xFF808080, |
|
243 | - 'clGreen' => 0xFF008000, |
|
244 | - 'clGreenYellow' => 0xFFADFF2F, |
|
245 | - 'clHoneydew' => 0xFFF0FFF0, |
|
246 | - 'clHotPink' => 0xFFFF69B4, |
|
247 | - 'clIndianRed' => 0xFFCD5C5C, |
|
248 | - 'clIndigo' => 0xFF4B0082, |
|
249 | - 'clIvory' => 0xFFFFFFF0, |
|
250 | - 'clKhaki' => 0xFFF0E68C, |
|
251 | - 'clLavender' => 0xFFE6E6FA, |
|
252 | - 'clLavenderBlush' => 0xFFFFF0F5, |
|
253 | - 'clLawnGreen' => 0xFF7CFC00, |
|
254 | - 'clLemonChiffon' => 0xFFFFFACD, |
|
255 | - 'clLightBlue' => 0xFFADD8E6, |
|
256 | - 'clLightCoral' => 0xFFF08080, |
|
257 | - 'clLightCyan' => 0xFFE0FFFF, |
|
258 | - 'clLightGoldenrodYellow' => 0xFFFAFAD2, |
|
259 | - 'clLightGray' => 0xFFD3D3D3, |
|
260 | - 'clLightGreen' => 0xFF90EE90, |
|
261 | - 'clLightPink' => 0xFFFFB6C1, |
|
262 | - 'clLightSalmon' => 0xFFFFA07A, |
|
263 | - 'clLightSeaGreen' => 0xFF20B2AA, |
|
264 | - 'clLightSkyBlue' => 0xFF87CEFA, |
|
265 | - 'clLightSlateGray' => 0xFF778899, |
|
266 | - 'clLightSteelBlue' => 0xFFB0C4DE, |
|
267 | - 'clLightYellow' => 0xFFFFFFE0, |
|
268 | - 'clLime' => 0xFF00FF00, |
|
269 | - 'clLimeGreen' => 0xFF32CD32, |
|
270 | - 'clLinen' => 0xFFFAF0E6, |
|
271 | - 'clMagenta' => 0xFFFF00FF, |
|
272 | - 'clMaroon' => 0xFF800000, |
|
273 | - 'clMediumAquamarine' => 0xFF66CDAA, |
|
274 | - 'clMediumBlue' => 0xFF0000CD, |
|
275 | - 'clMediumOrchid' => 0xFFBA55D3, |
|
276 | - 'clMediumPurple' => 0xFF9370DB, |
|
277 | - 'clMediumSeaGreen' => 0xFF3CB371, |
|
278 | - 'clMediumSlateBlue' => 0xFF7B68EE, |
|
279 | - 'clMediumSpringGreen' => 0xFF00FA9A, |
|
280 | - 'clMediumTurquoise' => 0xFF48D1CC, |
|
281 | - 'clMediumVioletRed' => 0xFFC71585, |
|
282 | - 'clMidnightBlue' => 0xFF191970, |
|
283 | - 'clMintCream' => 0xFFF5FFFA, |
|
284 | - 'clMistyRose' => 0xFFFFE4E1, |
|
285 | - 'clMoccasin' => 0xFFFFE4B5, |
|
286 | - 'clNavajoWhite' => 0xFFFFDEAD, |
|
287 | - 'clNavy' => 0xFF000080, |
|
288 | - 'clOldLace' => 0xFFFDF5E6, |
|
289 | - 'clOlive' => 0xFF808000, |
|
290 | - 'clOliveDrab' => 0xFF6B8E23, |
|
291 | - 'clOrange' => 0xFFFFA500, |
|
292 | - 'clOrangeRed' => 0xFFFF4500, |
|
293 | - 'clOrchid' => 0xFFDA70D6, |
|
294 | - 'clPaleGoldenrod' => 0xFFEEE8AA, |
|
295 | - 'clPaleGreen' => 0xFF98FB98, |
|
296 | - 'clPaleTurquoise' => 0xFFAFEEEE, |
|
297 | - 'clPaleVioletRed' => 0xFFDB7093, |
|
298 | - 'clPapayaWhip' => 0xFFFFEFD5, |
|
299 | - 'clPeachPuff' => 0xFFFFDAB9, |
|
300 | - 'clPeru' => 0xFFCD853F, |
|
301 | - 'clPink' => 0xFFFFC0CB, |
|
302 | - 'clPlum' => 0xFFDDA0DD, |
|
303 | - 'clPowderBlue' => 0xFFB0E0E6, |
|
304 | - 'clPurple' => 0xFF800080, |
|
305 | - 'clRed' => 0xFFFF0000, |
|
306 | - 'clRosyBrown' => 0xFFBC8F8F, |
|
307 | - 'clRoyalBlue' => 0xFF4169E1, |
|
308 | - 'clSaddleBrown' => 0xFF8B4513, |
|
309 | - 'clSalmon' => 0xFFFA8072, |
|
310 | - 'clSandyBrown' => 0xFFF4A460, |
|
311 | - 'clSeaGreen' => 0xFF2E8B57, |
|
312 | - 'clSeaShell' => 0xFFFFF5EE, |
|
313 | - 'clSienna' => 0xFFA0522D, |
|
314 | - 'clSilver' => 0xFFC0C0C0, |
|
315 | - 'clSkyBlue' => 0xFF87CEEB, |
|
316 | - 'clSlateBlue' => 0xFF6A5ACD, |
|
317 | - 'clSlateGray' => 0xFF708090, |
|
318 | - 'clSnow' => 0xFFFFFAFA, |
|
319 | - 'clSpringGreen' => 0xFF00FF7F, |
|
320 | - 'clSteelBlue' => 0xFF4682B4, |
|
321 | - 'clTan' => 0xFFD2B48C, |
|
322 | - 'clTeal' => 0xFF008080, |
|
323 | - 'clThistle' => 0xFFD8BFD8, |
|
324 | - 'clTomato' => 0xFFFF6347, |
|
325 | - 'clTurquoise' => 0xFF40E0D0, |
|
326 | - 'clViolet' => 0xFFEE82EE, |
|
327 | - 'clWheat' => 0xFFF5DEB3, |
|
328 | - 'clWhite' => 0xFFFFFFFF, |
|
329 | - 'clWhiteSmoke' => 0xFFF5F5F5, |
|
330 | - 'clYellow' => 0xFFFFFF00, |
|
331 | - 'clYellowGreen' => 0xFF9ACD32, |
|
332 | - |
|
333 | - # Моя подборка цветов |
|
334 | - |
|
335 | - 'clDark' => $converter->fromHtml ('#0D0F12'), |
|
336 | - 'clDark2' => $converter->fromHtml ('#121416'), |
|
337 | - 'clTurquoise' => $converter->fromHtml ('#00ADB5'), |
|
338 | - 'clLight' => $converter->fromHtml ('#EEEEEE') |
|
192 | + 'clAliceBlue' => 0xFFF0F8FF, |
|
193 | + 'clAntiqueWhite' => 0xFFFAEBD7, |
|
194 | + 'clAqua' => 0xFF00FFFF, |
|
195 | + 'clAquamarine' => 0xFF7FFFD4, |
|
196 | + 'clAzure' => 0xFFF0FFFF, |
|
197 | + 'clBeige' => 0xFFF5F5DC, |
|
198 | + 'clBisque' => 0xFFFFE4C4, |
|
199 | + 'clBlack' => 0xFF000000, |
|
200 | + 'clBlanchedAlmond' => 0xFFFFEBCD, |
|
201 | + 'clBlue' => 0xFF0000FF, |
|
202 | + 'clBlueViolet' => 0xFF8A2BE2, |
|
203 | + 'clBrown' => 0xFFA52A2A, |
|
204 | + 'clBurlyWood' => 0xFFDEB887, |
|
205 | + 'clCadetBlue' => 0xFF5F9EA0, |
|
206 | + 'clChartreuse' => 0xFF7FFF00, |
|
207 | + 'clChocolate' => 0xFFD2691E, |
|
208 | + 'clCoral' => 0xFFFF7F50, |
|
209 | + 'clCornflowerBlue' => 0xFF6495ED, |
|
210 | + 'clCornsilk' => 0xFFFFF8DC, |
|
211 | + 'clCrimson' => 0xFFDC143C, |
|
212 | + 'clCyan' => 0xFF00FFFF, |
|
213 | + 'clDarkBlue' => 0xFF00008B, |
|
214 | + 'clDarkCyan' => 0xFF008B8B, |
|
215 | + 'clDarkGoldenrod' => 0xFFB8860B, |
|
216 | + 'clDarkGray' => 0xFFA9A9A9, |
|
217 | + 'clDarkGreen' => 0xFF006400, |
|
218 | + 'clDarkKhaki' => 0xFFBDB76B, |
|
219 | + 'clDarkMagenta' => 0xFF8B008B, |
|
220 | + 'clDarkOliveGreen' => 0xFF556B2F, |
|
221 | + 'clDarkOrange' => 0xFFFF8C00, |
|
222 | + 'clDarkOrchid' => 0xFF9932CC, |
|
223 | + 'clDarkRed' => 0xFF8B0000, |
|
224 | + 'clDarkSalmon' => 0xFFE9967A, |
|
225 | + 'clDarkSeaGreen' => 0xFF8FBC8F, |
|
226 | + 'clDarkSlateBlue' => 0xFF483D8B, |
|
227 | + 'clDarkSlateGray' => 0xFF2F4F4F, |
|
228 | + 'clDarkTurquoise' => 0xFF00CED1, |
|
229 | + 'clDarkViolet' => 0xFF9400D3, |
|
230 | + 'clDeepPink' => 0xFFFF1493, |
|
231 | + 'clDeepSkyBlue' => 0xFF00BFFF, |
|
232 | + 'clDimGray' => 0xFF696969, |
|
233 | + 'clDodgerBlue' => 0xFF1E90FF, |
|
234 | + 'clFirebrick' => 0xFFB22222, |
|
235 | + 'clFloralWhite' => 0xFFFFFAF0, |
|
236 | + 'clForestGreen' => 0xFF228B22, |
|
237 | + 'clFuchsia' => 0xFFFF00FF, |
|
238 | + 'clGainsboro' => 0xFFDCDCDC, |
|
239 | + 'clGhostWhite' => 0xFFF8F8FF, |
|
240 | + 'clGold' => 0xFFFFD700, |
|
241 | + 'clGoldenrod' => 0xFFDAA520, |
|
242 | + 'clGray' => 0xFF808080, |
|
243 | + 'clGreen' => 0xFF008000, |
|
244 | + 'clGreenYellow' => 0xFFADFF2F, |
|
245 | + 'clHoneydew' => 0xFFF0FFF0, |
|
246 | + 'clHotPink' => 0xFFFF69B4, |
|
247 | + 'clIndianRed' => 0xFFCD5C5C, |
|
248 | + 'clIndigo' => 0xFF4B0082, |
|
249 | + 'clIvory' => 0xFFFFFFF0, |
|
250 | + 'clKhaki' => 0xFFF0E68C, |
|
251 | + 'clLavender' => 0xFFE6E6FA, |
|
252 | + 'clLavenderBlush' => 0xFFFFF0F5, |
|
253 | + 'clLawnGreen' => 0xFF7CFC00, |
|
254 | + 'clLemonChiffon' => 0xFFFFFACD, |
|
255 | + 'clLightBlue' => 0xFFADD8E6, |
|
256 | + 'clLightCoral' => 0xFFF08080, |
|
257 | + 'clLightCyan' => 0xFFE0FFFF, |
|
258 | + 'clLightGoldenrodYellow' => 0xFFFAFAD2, |
|
259 | + 'clLightGray' => 0xFFD3D3D3, |
|
260 | + 'clLightGreen' => 0xFF90EE90, |
|
261 | + 'clLightPink' => 0xFFFFB6C1, |
|
262 | + 'clLightSalmon' => 0xFFFFA07A, |
|
263 | + 'clLightSeaGreen' => 0xFF20B2AA, |
|
264 | + 'clLightSkyBlue' => 0xFF87CEFA, |
|
265 | + 'clLightSlateGray' => 0xFF778899, |
|
266 | + 'clLightSteelBlue' => 0xFFB0C4DE, |
|
267 | + 'clLightYellow' => 0xFFFFFFE0, |
|
268 | + 'clLime' => 0xFF00FF00, |
|
269 | + 'clLimeGreen' => 0xFF32CD32, |
|
270 | + 'clLinen' => 0xFFFAF0E6, |
|
271 | + 'clMagenta' => 0xFFFF00FF, |
|
272 | + 'clMaroon' => 0xFF800000, |
|
273 | + 'clMediumAquamarine' => 0xFF66CDAA, |
|
274 | + 'clMediumBlue' => 0xFF0000CD, |
|
275 | + 'clMediumOrchid' => 0xFFBA55D3, |
|
276 | + 'clMediumPurple' => 0xFF9370DB, |
|
277 | + 'clMediumSeaGreen' => 0xFF3CB371, |
|
278 | + 'clMediumSlateBlue' => 0xFF7B68EE, |
|
279 | + 'clMediumSpringGreen' => 0xFF00FA9A, |
|
280 | + 'clMediumTurquoise' => 0xFF48D1CC, |
|
281 | + 'clMediumVioletRed' => 0xFFC71585, |
|
282 | + 'clMidnightBlue' => 0xFF191970, |
|
283 | + 'clMintCream' => 0xFFF5FFFA, |
|
284 | + 'clMistyRose' => 0xFFFFE4E1, |
|
285 | + 'clMoccasin' => 0xFFFFE4B5, |
|
286 | + 'clNavajoWhite' => 0xFFFFDEAD, |
|
287 | + 'clNavy' => 0xFF000080, |
|
288 | + 'clOldLace' => 0xFFFDF5E6, |
|
289 | + 'clOlive' => 0xFF808000, |
|
290 | + 'clOliveDrab' => 0xFF6B8E23, |
|
291 | + 'clOrange' => 0xFFFFA500, |
|
292 | + 'clOrangeRed' => 0xFFFF4500, |
|
293 | + 'clOrchid' => 0xFFDA70D6, |
|
294 | + 'clPaleGoldenrod' => 0xFFEEE8AA, |
|
295 | + 'clPaleGreen' => 0xFF98FB98, |
|
296 | + 'clPaleTurquoise' => 0xFFAFEEEE, |
|
297 | + 'clPaleVioletRed' => 0xFFDB7093, |
|
298 | + 'clPapayaWhip' => 0xFFFFEFD5, |
|
299 | + 'clPeachPuff' => 0xFFFFDAB9, |
|
300 | + 'clPeru' => 0xFFCD853F, |
|
301 | + 'clPink' => 0xFFFFC0CB, |
|
302 | + 'clPlum' => 0xFFDDA0DD, |
|
303 | + 'clPowderBlue' => 0xFFB0E0E6, |
|
304 | + 'clPurple' => 0xFF800080, |
|
305 | + 'clRed' => 0xFFFF0000, |
|
306 | + 'clRosyBrown' => 0xFFBC8F8F, |
|
307 | + 'clRoyalBlue' => 0xFF4169E1, |
|
308 | + 'clSaddleBrown' => 0xFF8B4513, |
|
309 | + 'clSalmon' => 0xFFFA8072, |
|
310 | + 'clSandyBrown' => 0xFFF4A460, |
|
311 | + 'clSeaGreen' => 0xFF2E8B57, |
|
312 | + 'clSeaShell' => 0xFFFFF5EE, |
|
313 | + 'clSienna' => 0xFFA0522D, |
|
314 | + 'clSilver' => 0xFFC0C0C0, |
|
315 | + 'clSkyBlue' => 0xFF87CEEB, |
|
316 | + 'clSlateBlue' => 0xFF6A5ACD, |
|
317 | + 'clSlateGray' => 0xFF708090, |
|
318 | + 'clSnow' => 0xFFFFFAFA, |
|
319 | + 'clSpringGreen' => 0xFF00FF7F, |
|
320 | + 'clSteelBlue' => 0xFF4682B4, |
|
321 | + 'clTan' => 0xFFD2B48C, |
|
322 | + 'clTeal' => 0xFF008080, |
|
323 | + 'clThistle' => 0xFFD8BFD8, |
|
324 | + 'clTomato' => 0xFFFF6347, |
|
325 | + 'clTurquoise' => 0xFF40E0D0, |
|
326 | + 'clViolet' => 0xFFEE82EE, |
|
327 | + 'clWheat' => 0xFFF5DEB3, |
|
328 | + 'clWhite' => 0xFFFFFFFF, |
|
329 | + 'clWhiteSmoke' => 0xFFF5F5F5, |
|
330 | + 'clYellow' => 0xFFFFFF00, |
|
331 | + 'clYellowGreen' => 0xFF9ACD32, |
|
332 | + |
|
333 | + # Моя подборка цветов |
|
334 | + |
|
335 | + 'clDark' => $converter->fromHtml ('#0D0F12'), |
|
336 | + 'clDark2' => $converter->fromHtml ('#121416'), |
|
337 | + 'clTurquoise' => $converter->fromHtml ('#00ADB5'), |
|
338 | + 'clLight' => $converter->fromHtml ('#EEEEEE') |
|
339 | 339 | ]; |
340 | 340 | |
341 | 341 | foreach ($constants as $name => $value) |
342 | - define ($name, $value); |
|
342 | + define ($name, $value); |
|
343 | 343 | |
344 | 344 | $argv = START_PARAMS; |
345 | 345 | $argc = sizeof ($argv); |
@@ -2,17 +2,17 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace VoidEngine; |
4 | 4 | |
5 | -$env = new NetClass ('System.Environment', 'mscorlib'); |
|
6 | -$params = $env->getCommandLineArgs ()->list; |
|
5 | +$env = new NetClass('System.Environment', 'mscorlib'); |
|
6 | +$params = $env->getCommandLineArgs()->list; |
|
7 | 7 | |
8 | -$converter = new NetClass ('System.Drawing.ColorTranslator'); |
|
8 | +$converter = new NetClass('System.Drawing.ColorTranslator'); |
|
9 | 9 | |
10 | 10 | $constants = [ |
11 | 11 | # Информация об окружении |
12 | 12 | |
13 | 13 | 'EXE_NAME' => $APPLICATION->executablePath, |
14 | - 'DOC_ROOT' => dirname ($APPLICATION->executablePath), |
|
15 | - 'IS_ADMIN' => is_writable (getenv ('SystemRoot')), |
|
14 | + 'DOC_ROOT' => dirname($APPLICATION->executablePath), |
|
15 | + 'IS_ADMIN' => is_writable(getenv('SystemRoot')), |
|
16 | 16 | 'START_PARAMS' => $params, |
17 | 17 | 'USERNAME' => $env->username, |
18 | 18 | |
@@ -332,17 +332,17 @@ discard block |
||
332 | 332 | |
333 | 333 | # Моя подборка цветов |
334 | 334 | |
335 | - 'clDark' => $converter->fromHtml ('#0D0F12'), |
|
336 | - 'clDark2' => $converter->fromHtml ('#121416'), |
|
337 | - 'clTurquoise' => $converter->fromHtml ('#00ADB5'), |
|
338 | - 'clLight' => $converter->fromHtml ('#EEEEEE') |
|
335 | + 'clDark' => $converter->fromHtml('#0D0F12'), |
|
336 | + 'clDark2' => $converter->fromHtml('#121416'), |
|
337 | + 'clTurquoise' => $converter->fromHtml('#00ADB5'), |
|
338 | + 'clLight' => $converter->fromHtml('#EEEEEE') |
|
339 | 339 | ]; |
340 | 340 | |
341 | 341 | foreach ($constants as $name => $value) |
342 | - define ($name, $value); |
|
342 | + define($name, $value); |
|
343 | 343 | |
344 | 344 | $argv = START_PARAMS; |
345 | -$argc = sizeof ($argv); |
|
345 | +$argc = sizeof($argv); |
|
346 | 346 | |
347 | -\VoidCore::removeObjects ($converter->selector); |
|
347 | +\VoidCore::removeObjects($converter->selector); |
|
348 | 348 | unset ($constants, $env, $params, $converter); |
@@ -2,50 +2,50 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace VoidEngine; |
4 | 4 | |
5 | -register_superglobals ('APPLICATION', 'SCREEN'); |
|
5 | +register_superglobals('APPLICATION', 'SCREEN'); |
|
6 | 6 | |
7 | 7 | $APPLICATION = new class |
8 | 8 | { |
9 | 9 | public NetClass $application; |
10 | 10 | public string $executablePath; |
11 | 11 | |
12 | - public function __construct () |
|
12 | + public function __construct() |
|
13 | 13 | { |
14 | - $this->application = new NetClass ('System.Windows.Forms.Application'); |
|
14 | + $this->application = new NetClass('System.Windows.Forms.Application'); |
|
15 | 15 | $this->executablePath = $this->application->executablePath; |
16 | 16 | } |
17 | 17 | |
18 | - public function run ($form = null): void |
|
18 | + public function run($form = null): void |
|
19 | 19 | { |
20 | 20 | if ($form instanceof NetObject) |
21 | - $this->application->run ($form->selector); |
|
21 | + $this->application->run($form->selector); |
|
22 | 22 | |
23 | - elseif (is_int ($form) && \VoidCore::objectExists ($form)) |
|
24 | - $this->application->run ($form); |
|
23 | + elseif (is_int($form) && \VoidCore::objectExists($form)) |
|
24 | + $this->application->run($form); |
|
25 | 25 | |
26 | 26 | elseif ($form === null) |
27 | - $this->application->run (); |
|
27 | + $this->application->run(); |
|
28 | 28 | |
29 | - else throw new \Exception ('$form param must be instance of "VoidEngine\NetObject" ("VoidEngine\Form"), be null or object selector'); |
|
29 | + else throw new \Exception('$form param must be instance of "VoidEngine\NetObject" ("VoidEngine\Form"), be null or object selector'); |
|
30 | 30 | } |
31 | 31 | |
32 | - public function restart (): void |
|
32 | + public function restart(): void |
|
33 | 33 | { |
34 | - $this->application->restart (); |
|
35 | - $this->close (); |
|
34 | + $this->application->restart(); |
|
35 | + $this->close(); |
|
36 | 36 | } |
37 | 37 | |
38 | - public function close (): void |
|
38 | + public function close(): void |
|
39 | 39 | { |
40 | - $this->application->exit (); |
|
40 | + $this->application->exit(); |
|
41 | 41 | } |
42 | 42 | |
43 | - public function __call (string $name, array $args) |
|
43 | + public function __call(string $name, array $args) |
|
44 | 44 | { |
45 | - return $this->application->$name (...$args); |
|
45 | + return $this->application->$name(...$args); |
|
46 | 46 | } |
47 | 47 | |
48 | - public function __get (string $name) |
|
48 | + public function __get(string $name) |
|
49 | 49 | { |
50 | 50 | return $this->application->$name; |
51 | 51 | } |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | { |
56 | 56 | public NetClass $screen; |
57 | 57 | |
58 | - public function __construct () |
|
58 | + public function __construct() |
|
59 | 59 | { |
60 | - $this->screen = new NetClass ('System.Windows.Forms.Screen'); |
|
60 | + $this->screen = new NetClass('System.Windows.Forms.Screen'); |
|
61 | 61 | } |
62 | 62 | |
63 | - public function __get ($name) |
|
63 | + public function __get($name) |
|
64 | 64 | { |
65 | - switch (strtolower ($name)) |
|
65 | + switch (strtolower($name)) |
|
66 | 66 | { |
67 | 67 | case 'width': |
68 | 68 | case 'w': |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | - public function __debugInfo (): array |
|
83 | + public function __debugInfo(): array |
|
84 | 84 | { |
85 | 85 | return [ |
86 | 86 | $this->w, |
@@ -17,16 +17,15 @@ |
||
17 | 17 | |
18 | 18 | public function run ($form = null): void |
19 | 19 | { |
20 | - if ($form instanceof NetObject) |
|
21 | - $this->application->run ($form->selector); |
|
22 | - |
|
23 | - elseif (is_int ($form) && \VoidCore::objectExists ($form)) |
|
24 | - $this->application->run ($form); |
|
25 | - |
|
26 | - elseif ($form === null) |
|
27 | - $this->application->run (); |
|
28 | - |
|
29 | - else throw new \Exception ('$form param must be instance of "VoidEngine\NetObject" ("VoidEngine\Form"), be null or object selector'); |
|
20 | + if ($form instanceof NetObject) { |
|
21 | + $this->application->run ($form->selector); |
|
22 | + } elseif (is_int ($form) && \VoidCore::objectExists ($form)) { |
|
23 | + $this->application->run ($form); |
|
24 | + } elseif ($form === null) { |
|
25 | + $this->application->run (); |
|
26 | + } else { |
|
27 | + throw new \Exception ('$form param must be instance of "VoidEngine\NetObject" ("VoidEngine\Form"), be null or object selector'); |
|
28 | + } |
|
30 | 29 | } |
31 | 30 | |
32 | 31 | public function restart (): void |
@@ -6,61 +6,61 @@ |
||
6 | 6 | { |
7 | 7 | protected static array $objects = []; |
8 | 8 | |
9 | - public static function add (NetObject $object): void |
|
9 | + public static function add(NetObject $object): void |
|
10 | 10 | { |
11 | - self::$objects[$object->selector] = \WeakReference::create ($object); |
|
11 | + self::$objects[$object->selector] = \WeakReference::create($object); |
|
12 | 12 | } |
13 | 13 | |
14 | - public static function get (int $selector): ?NetObject |
|
14 | + public static function get(int $selector): ?NetObject |
|
15 | 15 | { |
16 | 16 | if (!isset (self::$objects[$selector])) |
17 | 17 | return null; |
18 | 18 | |
19 | - $object = self::$objects[$selector]->get (); |
|
19 | + $object = self::$objects[$selector]->get(); |
|
20 | 20 | |
21 | 21 | if ($object === null) |
22 | - self::remove ($selector); |
|
22 | + self::remove($selector); |
|
23 | 23 | |
24 | 24 | return $object; |
25 | 25 | } |
26 | 26 | |
27 | - public static function exists (int $selector): bool |
|
27 | + public static function exists(int $selector): bool |
|
28 | 28 | { |
29 | 29 | return isset (self::$objects[$selector]); |
30 | 30 | } |
31 | 31 | |
32 | - public static function getObjects (): array |
|
32 | + public static function getObjects(): array |
|
33 | 33 | { |
34 | 34 | return self::$objects; |
35 | 35 | } |
36 | 36 | |
37 | - public static function remove (int $selector): void |
|
37 | + public static function remove(int $selector): void |
|
38 | 38 | { |
39 | 39 | unset (self::$objects[$selector]); |
40 | 40 | } |
41 | 41 | |
42 | - public static function clean (): void |
|
42 | + public static function clean(): void |
|
43 | 43 | { |
44 | 44 | foreach (self::$objects as $selector => $reference) |
45 | - if ($reference->get () === null) |
|
45 | + if ($reference->get() === null) |
|
46 | 46 | unset (self::$objects[$selector]); |
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | -function _c (int $selector): ?NetObject |
|
50 | +function _c(int $selector): ?NetObject |
|
51 | 51 | { |
52 | - return Components::get ($selector); |
|
52 | + return Components::get($selector); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | // TODO: поддержка многоуровневых ссылок вида родитель->родитель->объект |
56 | -function c (string $name): ?NetObject |
|
56 | +function c(string $name): ?NetObject |
|
57 | 57 | { |
58 | 58 | if (($object = _c($name)) !== null) |
59 | 59 | return $object; |
60 | 60 | |
61 | - foreach (Components::getObjects () as $selector => $reference) |
|
61 | + foreach (Components::getObjects() as $selector => $reference) |
|
62 | 62 | { |
63 | - $object = $reference->get (); |
|
63 | + $object = $reference->get(); |
|
64 | 64 | |
65 | 65 | if ($object === null) |
66 | 66 | continue; |
@@ -13,13 +13,15 @@ discard block |
||
13 | 13 | |
14 | 14 | public static function get (int $selector): ?NetObject |
15 | 15 | { |
16 | - if (!isset (self::$objects[$selector])) |
|
17 | - return null; |
|
16 | + if (!isset (self::$objects[$selector])) { |
|
17 | + return null; |
|
18 | + } |
|
18 | 19 | |
19 | 20 | $object = self::$objects[$selector]->get (); |
20 | 21 | |
21 | - if ($object === null) |
|
22 | - self::remove ($selector); |
|
22 | + if ($object === null) { |
|
23 | + self::remove ($selector); |
|
24 | + } |
|
23 | 25 | |
24 | 26 | return $object; |
25 | 27 | } |
@@ -41,9 +43,10 @@ discard block |
||
41 | 43 | |
42 | 44 | public static function clean (): void |
43 | 45 | { |
44 | - foreach (self::$objects as $selector => $reference) |
|
45 | - if ($reference->get () === null) |
|
46 | + foreach (self::$objects as $selector => $reference) { |
|
47 | + if ($reference->get () === null) |
|
46 | 48 | unset (self::$objects[$selector]); |
49 | + } |
|
47 | 50 | } |
48 | 51 | } |
49 | 52 | |
@@ -55,23 +58,24 @@ discard block |
||
55 | 58 | // TODO: поддержка многоуровневых ссылок вида родитель->родитель->объект |
56 | 59 | function c (string $name): ?NetObject |
57 | 60 | { |
58 | - if (($object = _c($name)) !== null) |
|
59 | - return $object; |
|
61 | + if (($object = _c($name)) !== null) { |
|
62 | + return $object; |
|
63 | + } |
|
60 | 64 | |
61 | 65 | foreach (Components::getObjects () as $selector => $reference) |
62 | 66 | { |
63 | 67 | $object = $reference->get (); |
64 | 68 | |
65 | - if ($object === null) |
|
66 | - continue; |
|
69 | + if ($object === null) { |
|
70 | + continue; |
|
71 | + } |
|
67 | 72 | |
68 | 73 | try |
69 | 74 | { |
70 | - if ($object->name == $name) |
|
71 | - return $object; |
|
72 | - } |
|
73 | - |
|
74 | - catch (\WinformsException $e) {} |
|
75 | + if ($object->name == $name) { |
|
76 | + return $object; |
|
77 | + } |
|
78 | + } catch (\WinformsException $e) {} |
|
75 | 79 | } |
76 | 80 | |
77 | 81 | return null; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | function pre (...$args): void |
135 | 135 | { |
136 | - message (sizeof ($args) < 2 ? current ($args) : $args); |
|
136 | + message (sizeof ($args) < 2 ? current ($args) : $args); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | function messageBox (string $message, string $caption = '', ...$args): int |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $timer->interval = $interval; |
153 | 153 | $timer->tickEvent = fn ($self) => $function ($self); |
154 | 154 | |
155 | - $timer->start (); |
|
155 | + $timer->start (); |
|
156 | 156 | |
157 | 157 | return $timer; |
158 | 158 | } |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | $function ($self); |
169 | 169 | }; |
170 | 170 | |
171 | - $timer->start (); |
|
171 | + $timer->start (); |
|
172 | 172 | |
173 | - return $timer; |
|
173 | + return $timer; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | set_error_handler (function ($no, $str, $file, $line) |
@@ -4,176 +4,176 @@ discard block |
||
4 | 4 | |
5 | 5 | use VoidCore; |
6 | 6 | |
7 | -function dn (...$args): NetObject |
|
7 | +function dn(...$args): NetObject |
|
8 | 8 | { |
9 | 9 | try |
10 | 10 | { |
11 | - $object = new NetObject (...$args); |
|
11 | + $object = new NetObject(...$args); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | catch (\WinformsException $e) |
15 | 15 | { |
16 | - if ((new NetObject ($e->getNetException ()))->toString () == 'System.MemberAccessException') |
|
16 | + if ((new NetObject($e->getNetException()))->toString() == 'System.MemberAccessException') |
|
17 | 17 | throw $e; |
18 | 18 | |
19 | - $object = new NetClass (...$args); |
|
19 | + $object = new NetClass(...$args); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | return $object; |
23 | 23 | } |
24 | 24 | |
25 | -function thread (callable $callable): NetObject |
|
25 | +function thread(callable $callable): NetObject |
|
26 | 26 | { |
27 | - return new NetObject (VoidCore::createThread ($callable)); |
|
27 | + return new NetObject(VoidCore::createThread($callable)); |
|
28 | 28 | } |
29 | 29 | |
30 | -function enum (string $baseType, string $value) |
|
30 | +function enum(string $baseType, string $value) |
|
31 | 31 | { |
32 | 32 | try |
33 | 33 | { |
34 | - return VoidCore::callMethod (VoidCore::getClass ('System.Enum'), ['parse', VC_OBJECT], VoidCore::typeof ($baseType), $value, true); |
|
34 | + return VoidCore::callMethod(VoidCore::getClass('System.Enum'), ['parse', VC_OBJECT], VoidCore::typeof($baseType), $value, true); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | catch (\WinformsException $e) |
38 | 38 | { |
39 | - return (new NetClass ($baseType))->$value; |
|
39 | + return (new NetClass($baseType))->$value; |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | -function getNetArray (string $type, array $items = []): NetObject |
|
43 | +function getNetArray(string $type, array $items = []): NetObject |
|
44 | 44 | { |
45 | - $array = (new NetClass ('System.Array')) |
|
46 | - ->createInstance (VoidCore::typeof ($type), $size = sizeof ($items)); |
|
45 | + $array = (new NetClass('System.Array')) |
|
46 | + ->createInstance(VoidCore::typeof($type), $size = sizeof($items)); |
|
47 | 47 | |
48 | 48 | for ($i = 0; $i < $size; ++$i) |
49 | - $array[$i] = array_shift ($items); |
|
49 | + $array[$i] = array_shift($items); |
|
50 | 50 | |
51 | 51 | return $array; |
52 | 52 | } |
53 | 53 | |
54 | -function dir_create (string $path, int $mode = 0777): void |
|
54 | +function dir_create(string $path, int $mode = 0777): void |
|
55 | 55 | { |
56 | - if (!is_dir ($path)) |
|
57 | - mkdir ($path, $mode, true); |
|
56 | + if (!is_dir($path)) |
|
57 | + mkdir($path, $mode, true); |
|
58 | 58 | } |
59 | 59 | |
60 | -function dir_delete (string $path): bool |
|
60 | +function dir_delete(string $path): bool |
|
61 | 61 | { |
62 | - if (!is_dir ($path)) |
|
62 | + if (!is_dir($path)) |
|
63 | 63 | return false; |
64 | 64 | |
65 | - foreach (array_slice (scandir ($path), 2) as $file) |
|
66 | - if (is_dir ($file = $path .'/'. $file)) |
|
65 | + foreach (array_slice(scandir($path), 2) as $file) |
|
66 | + if (is_dir($file = $path.'/'.$file)) |
|
67 | 67 | { |
68 | - dir_delete ($file); |
|
68 | + dir_delete($file); |
|
69 | 69 | |
70 | - if (is_dir ($file)) |
|
71 | - rmdir ($file); |
|
70 | + if (is_dir($file)) |
|
71 | + rmdir($file); |
|
72 | 72 | } |
73 | 73 | |
74 | - else unlink ($file); |
|
74 | + else unlink($file); |
|
75 | 75 | |
76 | - rmdir ($path); |
|
76 | + rmdir($path); |
|
77 | 77 | |
78 | 78 | return true; |
79 | 79 | } |
80 | 80 | |
81 | -function dir_clean (string $path): void |
|
81 | +function dir_clean(string $path): void |
|
82 | 82 | { |
83 | - dir_delete ($path); |
|
84 | - dir_create ($path); |
|
83 | + dir_delete($path); |
|
84 | + dir_create($path); |
|
85 | 85 | } |
86 | 86 | |
87 | -function dir_copy (string $from, string $to): bool |
|
87 | +function dir_copy(string $from, string $to): bool |
|
88 | 88 | { |
89 | - if (!is_dir ($from)) |
|
89 | + if (!is_dir($from)) |
|
90 | 90 | return false; |
91 | 91 | |
92 | - if (!is_dir ($to)) |
|
93 | - dir_create ($to); |
|
92 | + if (!is_dir($to)) |
|
93 | + dir_create($to); |
|
94 | 94 | |
95 | - foreach (array_slice (scandir ($from), 2) as $file) |
|
96 | - if (is_dir ($f = $from .'/'. $file)) |
|
97 | - dir_copy ($f, $to .'/'. $file); |
|
95 | + foreach (array_slice(scandir($from), 2) as $file) |
|
96 | + if (is_dir($f = $from.'/'.$file)) |
|
97 | + dir_copy($f, $to.'/'.$file); |
|
98 | 98 | |
99 | - else copy ($f, $to .'/'. $file); |
|
99 | + else copy($f, $to.'/'.$file); |
|
100 | 100 | |
101 | 101 | return true; |
102 | 102 | } |
103 | 103 | |
104 | -function argb (string $color) |
|
104 | +function argb(string $color) |
|
105 | 105 | { |
106 | - return (new NetClass ('System.Drawing.ColorTranslator'))->fromHtml ($color); |
|
106 | + return (new NetClass('System.Drawing.ColorTranslator'))->fromHtml($color); |
|
107 | 107 | } |
108 | 108 | |
109 | -function replaceSl (string $string): string |
|
109 | +function replaceSl(string $string): string |
|
110 | 110 | { |
111 | - return str_replace ('\\', '/', $string); |
|
111 | + return str_replace('\\', '/', $string); |
|
112 | 112 | } |
113 | 113 | |
114 | -function replaceSr (string $string): string |
|
114 | +function replaceSr(string $string): string |
|
115 | 115 | { |
116 | - return str_replace ('/', '\\', $string); |
|
116 | + return str_replace('/', '\\', $string); |
|
117 | 117 | } |
118 | 118 | |
119 | -function basenameNoExt (string $path): string |
|
119 | +function basenameNoExt(string $path): string |
|
120 | 120 | { |
121 | - return pathinfo ($path, PATHINFO_FILENAME); |
|
121 | + return pathinfo($path, PATHINFO_FILENAME); |
|
122 | 122 | } |
123 | 123 | |
124 | -function file_ext (string $path): string |
|
124 | +function file_ext(string $path): string |
|
125 | 125 | { |
126 | - return strtolower (pathinfo ($path, PATHINFO_EXTENSION)); |
|
126 | + return strtolower(pathinfo($path, PATHINFO_EXTENSION)); |
|
127 | 127 | } |
128 | 128 | |
129 | -function filepathNoExt (string $path): string |
|
129 | +function filepathNoExt(string $path): string |
|
130 | 130 | { |
131 | - return dirname ($path) .'/'. basenameNoExt ($path); |
|
131 | + return dirname($path).'/'.basenameNoExt($path); |
|
132 | 132 | } |
133 | 133 | |
134 | -function pre (...$args): void |
|
134 | +function pre(...$args): void |
|
135 | 135 | { |
136 | - message (sizeof ($args) < 2 ? current ($args) : $args); |
|
136 | + message(sizeof($args) < 2 ? current ($args) : $args); |
|
137 | 137 | } |
138 | 138 | |
139 | -function messageBox (string $message, string $caption = '', ...$args): int |
|
139 | +function messageBox(string $message, string $caption = '', ...$args): int |
|
140 | 140 | { |
141 | - return (new MessageBox)->show ($message, $caption, ...$args); |
|
141 | + return (new MessageBox)->show($message, $caption, ...$args); |
|
142 | 142 | } |
143 | 143 | |
144 | -function run (string $path, ...$args) |
|
144 | +function run(string $path, ...$args) |
|
145 | 145 | { |
146 | - return (new Process)->start ($path, ...$args); |
|
146 | + return (new Process)->start($path, ...$args); |
|
147 | 147 | } |
148 | 148 | |
149 | -function setTimer (int $interval, callable $function): Timer |
|
149 | +function setTimer(int $interval, callable $function): Timer |
|
150 | 150 | { |
151 | 151 | $timer = new Timer; |
152 | 152 | $timer->interval = $interval; |
153 | - $timer->tickEvent = fn ($self) => $function ($self); |
|
153 | + $timer->tickEvent = fn($self) => $function($self); |
|
154 | 154 | |
155 | - $timer->start (); |
|
155 | + $timer->start(); |
|
156 | 156 | |
157 | 157 | return $timer; |
158 | 158 | } |
159 | 159 | |
160 | -function setTimeout (int $timeout, callable $function): Timer |
|
160 | +function setTimeout(int $timeout, callable $function): Timer |
|
161 | 161 | { |
162 | 162 | $timer = new Timer; |
163 | 163 | $timer->interval = $timeout; |
164 | - $timer->tickEvent = function ($self) use ($function) |
|
164 | + $timer->tickEvent = function($self) use ($function) |
|
165 | 165 | { |
166 | - $self->stop (); |
|
166 | + $self->stop(); |
|
167 | 167 | |
168 | - $function ($self); |
|
168 | + $function($self); |
|
169 | 169 | }; |
170 | 170 | |
171 | - $timer->start (); |
|
171 | + $timer->start(); |
|
172 | 172 | |
173 | 173 | return $timer; |
174 | 174 | } |
175 | 175 | |
176 | -set_error_handler (function ($no, $str, $file, $line) |
|
176 | +set_error_handler(function($no, $str, $file, $line) |
|
177 | 177 | { |
178 | 178 | // Мог ли я здесь сделать более адекватный код с использованием pow/sqrt? Да, мог |
179 | 179 | // Почему не сделал? Скорость важнее |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | 16384 => 'E_USER_DEPRECATED' |
196 | 196 | ]; |
197 | 197 | |
198 | - message ([ |
|
198 | + message([ |
|
199 | 199 | 'type' => $errarr[$no], |
200 | 200 | 'text' => $str, |
201 | 201 | 'file' => $file, |
@@ -9,12 +9,11 @@ discard block |
||
9 | 9 | try |
10 | 10 | { |
11 | 11 | $object = new NetObject (...$args); |
12 | - } |
|
13 | - |
|
14 | - catch (\WinformsException $e) |
|
12 | + } catch (\WinformsException $e) |
|
15 | 13 | { |
16 | - if ((new NetObject ($e->getNetException ()))->toString () == 'System.MemberAccessException') |
|
17 | - throw $e; |
|
14 | + if ((new NetObject ($e->getNetException ()))->toString () == 'System.MemberAccessException') { |
|
15 | + throw $e; |
|
16 | + } |
|
18 | 17 | |
19 | 18 | $object = new NetClass (...$args); |
20 | 19 | } |
@@ -32,9 +31,7 @@ discard block |
||
32 | 31 | try |
33 | 32 | { |
34 | 33 | return VoidCore::callMethod (VoidCore::getClass ('System.Enum'), ['parse', VC_OBJECT], VoidCore::typeof ($baseType), $value, true); |
35 | - } |
|
36 | - |
|
37 | - catch (\WinformsException $e) |
|
34 | + } catch (\WinformsException $e) |
|
38 | 35 | { |
39 | 36 | return (new NetClass ($baseType))->$value; |
40 | 37 | } |
@@ -45,34 +42,39 @@ discard block |
||
45 | 42 | $array = (new NetClass ('System.Array')) |
46 | 43 | ->createInstance (VoidCore::typeof ($type), $size = sizeof ($items)); |
47 | 44 | |
48 | - for ($i = 0; $i < $size; ++$i) |
|
49 | - $array[$i] = array_shift ($items); |
|
45 | + for ($i = 0; $i < $size; ++$i) { |
|
46 | + $array[$i] = array_shift ($items); |
|
47 | + } |
|
50 | 48 | |
51 | 49 | return $array; |
52 | 50 | } |
53 | 51 | |
54 | 52 | function dir_create (string $path, int $mode = 0777): void |
55 | 53 | { |
56 | - if (!is_dir ($path)) |
|
57 | - mkdir ($path, $mode, true); |
|
58 | -} |
|
54 | + if (!is_dir ($path)) { |
|
55 | + mkdir ($path, $mode, true); |
|
56 | + } |
|
57 | + } |
|
59 | 58 | |
60 | 59 | function dir_delete (string $path): bool |
61 | 60 | { |
62 | - if (!is_dir ($path)) |
|
63 | - return false; |
|
61 | + if (!is_dir ($path)) { |
|
62 | + return false; |
|
63 | + } |
|
64 | 64 | |
65 | - foreach (array_slice (scandir ($path), 2) as $file) |
|
66 | - if (is_dir ($file = $path .'/'. $file)) |
|
65 | + foreach (array_slice (scandir ($path), 2) as $file) { |
|
66 | + if (is_dir ($file = $path .'/'. $file)) |
|
67 | 67 | { |
68 | 68 | dir_delete ($file); |
69 | + } |
|
69 | 70 | |
70 | - if (is_dir ($file)) |
|
71 | - rmdir ($file); |
|
71 | + if (is_dir ($file)) { |
|
72 | + rmdir ($file); |
|
73 | + } |
|
74 | + } else { |
|
75 | + unlink ($file); |
|
72 | 76 | } |
73 | 77 | |
74 | - else unlink ($file); |
|
75 | - |
|
76 | 78 | rmdir ($path); |
77 | 79 | |
78 | 80 | return true; |
@@ -86,17 +88,22 @@ discard block |
||
86 | 88 | |
87 | 89 | function dir_copy (string $from, string $to): bool |
88 | 90 | { |
89 | - if (!is_dir ($from)) |
|
90 | - return false; |
|
91 | + if (!is_dir ($from)) { |
|
92 | + return false; |
|
93 | + } |
|
91 | 94 | |
92 | - if (!is_dir ($to)) |
|
93 | - dir_create ($to); |
|
95 | + if (!is_dir ($to)) { |
|
96 | + dir_create ($to); |
|
97 | + } |
|
94 | 98 | |
95 | - foreach (array_slice (scandir ($from), 2) as $file) |
|
96 | - if (is_dir ($f = $from .'/'. $file)) |
|
99 | + foreach (array_slice (scandir ($from), 2) as $file) { |
|
100 | + if (is_dir ($f = $from .'/'. $file)) |
|
97 | 101 | dir_copy ($f, $to .'/'. $file); |
102 | + } |
|
98 | 103 | |
99 | - else copy ($f, $to .'/'. $file); |
|
104 | + else { |
|
105 | + copy ($f, $to .'/'. $file); |
|
106 | + } |
|
100 | 107 | |
101 | 108 | return true; |
102 | 109 | } |