@@ -31,14 +31,14 @@ |
||
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function applyToObject (int $selector): void |
| 34 | - { |
|
| 35 | - \VoidCore::setProperty ($selector, 'Icon', $this->selector); |
|
| 36 | - } |
|
| 34 | + { |
|
| 35 | + \VoidCore::setProperty ($selector, 'Icon', $this->selector); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - public function saveToFile (string $file): void |
|
| 39 | - { |
|
| 40 | - \VoidCore::callMethod ($this->selector, 'Save', $file); |
|
| 41 | - } |
|
| 38 | + public function saveToFile (string $file): void |
|
| 39 | + { |
|
| 40 | + \VoidCore::callMethod ($this->selector, 'Save', $file); |
|
| 41 | + } |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | class Bitmap extends WFObject |
@@ -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 = \VoidCore::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 = \VoidCore::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 | \VoidCore::setProperty ($this->pictureBoxSelector, 'Image', (new Image ())->loadFromFile ($file)->selector); |
| 35 | - } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - public function saveToFile (string $file) |
|
| 38 | - { |
|
| 39 | - \VoidCore::callMethod ($this->selector, 'Save', $file); |
|
| 40 | - } |
|
| 37 | + public function saveToFile (string $file) |
|
| 38 | + { |
|
| 39 | + \VoidCore::callMethod ($this->selector, 'Save', $file); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - public function loadFromClipboard () |
|
| 43 | - { |
|
| 44 | - \VoidCore::setProperty ($this->pictureBoxSelector, 'Image', $this->clipboard->getImage ()); |
|
| 45 | - } |
|
| 42 | + public function loadFromClipboard () |
|
| 43 | + { |
|
| 44 | + \VoidCore::setProperty ($this->pictureBoxSelector, 'Image', $this->clipboard->getImage ()); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - public function saveToClipboard () |
|
| 48 | - { |
|
| 49 | - $this->clipboard->setImage (\VoidCore::getProperty ($this->pictureBoxSelector, 'Image')); |
|
| 50 | - } |
|
| 47 | + public function saveToClipboard () |
|
| 48 | + { |
|
| 49 | + $this->clipboard->setImage (\VoidCore::getProperty ($this->pictureBoxSelector, 'Image')); |
|
| 50 | + } |
|
| 51 | 51 | } |
@@ -4,28 +4,28 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Process extends Component |
| 6 | 6 | { |
| 7 | - public $class = 'System.Diagnostics.Process'; |
|
| 8 | - public $namespace = 'System'; |
|
| 7 | + public $class = 'System.Diagnostics.Process'; |
|
| 8 | + public $namespace = 'System'; |
|
| 9 | 9 | |
| 10 | - public function __construct (int $pid = null) |
|
| 11 | - { |
|
| 10 | + public function __construct (int $pid = null) |
|
| 11 | + { |
|
| 12 | 12 | $this->selector = \VoidCore::createClass ($this->class, $this->namespace); |
| 13 | 13 | |
| 14 | - if ($pid !== null) |
|
| 14 | + if ($pid !== null) |
|
| 15 | 15 | $this->selector = $pid == getmypid () ? |
| 16 | 16 | \VoidCore::callMethod ($this->selector, 'GetCurrentProcess') : |
| 17 | 17 | \VoidCore::callMethod ($this->selector, 'GetProcessById', $pid); |
| 18 | 18 | |
| 19 | - Components::addComponent ($this->selector, $this); |
|
| 20 | - } |
|
| 19 | + Components::addComponent ($this->selector, $this); |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - public static function getProcessById (int $pid) |
|
| 23 | - { |
|
| 24 | - return new self ($pid); |
|
| 25 | - } |
|
| 22 | + public static function getProcessById (int $pid) |
|
| 23 | + { |
|
| 24 | + return new self ($pid); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public static function getCurrentProcess () |
|
| 28 | - { |
|
| 29 | - return new self (getmypid ()); |
|
| 30 | - } |
|
| 27 | + public static function getCurrentProcess () |
|
| 28 | + { |
|
| 29 | + return new self (getmypid ()); |
|
| 30 | + } |
|
| 31 | 31 | } |
@@ -4,37 +4,37 @@ 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 | - $size = $this->getProperty ('ClientSize'); |
|
| 14 | + public function get_clientSize () |
|
| 15 | + { |
|
| 16 | + $size = $this->getProperty ('ClientSize'); |
|
| 17 | 17 | |
| 18 | - return [ |
|
| 19 | - \VoidCore::getProperty ($size, 'Width'), |
|
| 20 | - \VoidCore::getProperty ($size, 'Height') |
|
| 21 | - ]; |
|
| 22 | - } |
|
| 18 | + return [ |
|
| 19 | + \VoidCore::getProperty ($size, 'Width'), |
|
| 20 | + \VoidCore::getProperty ($size, 'Height') |
|
| 21 | + ]; |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - public function set_clientSize ($size) |
|
| 25 | - { |
|
| 26 | - if (is_array ($size)) |
|
| 27 | - { |
|
| 28 | - $clientSize = $this->getProperty ('ClientSize'); |
|
| 24 | + public function set_clientSize ($size) |
|
| 25 | + { |
|
| 26 | + if (is_array ($size)) |
|
| 27 | + { |
|
| 28 | + $clientSize = $this->getProperty ('ClientSize'); |
|
| 29 | 29 | |
| 30 | - \VoidCore::setProperty ($clientSize, 'Width', array_shift ($size)); |
|
| 31 | - \VoidCore::setProperty ($clientSize, 'Height', array_shift ($size)); |
|
| 30 | + \VoidCore::setProperty ($clientSize, 'Width', array_shift ($size)); |
|
| 31 | + \VoidCore::setProperty ($clientSize, 'Height', array_shift ($size)); |
|
| 32 | 32 | |
| 33 | - $this->setProperty ('ClientSize', $clientSize); |
|
| 34 | - } |
|
| 33 | + $this->setProperty ('ClientSize', $clientSize); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - else $this->setProperty ('ClientSize', EngineAdditions::uncoupleSelector ($size)); |
|
| 37 | - } |
|
| 36 | + else $this->setProperty ('ClientSize', EngineAdditions::uncoupleSelector ($size)); |
|
| 37 | + } |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | class FormIcon extends Icon |
@@ -47,12 +47,12 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | public function loadFromFile (string $file) |
| 50 | - { |
|
| 50 | + { |
|
| 51 | 51 | $icon = \VoidCore::createObject ('System.Drawing.Icon', 'System.Drawing', $file); |
| 52 | 52 | |
| 53 | 53 | \VoidCore::setProperty ($this->formSelector, 'Icon', $icon); |
| 54 | 54 | |
| 55 | - if (!isset ($this->selector)) |
|
| 56 | - $this->selector = $icon; |
|
| 57 | - } |
|
| 55 | + if (!isset ($this->selector)) |
|
| 56 | + $this->selector = $icon; |
|
| 57 | + } |
|
| 58 | 58 | } |
@@ -7,9 +7,9 @@ discard block |
||
| 7 | 7 | public static function setObjectEvent (int $object, string $eventName, callable $function) |
| 8 | 8 | { |
| 9 | 9 | \VoidCore::setEvent ($object, $eventName, function ($sender, ...$args) use ($function) |
| 10 | - { |
|
| 10 | + { |
|
| 11 | 11 | try |
| 12 | - { |
|
| 12 | + { |
|
| 13 | 13 | foreach ($args as $id => $arg) |
| 14 | 14 | $args[$id] = EngineAdditions::coupleSelector ($arg); |
| 15 | 15 | |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | $e : new WFObject ($sender), ...$args); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - catch (\Throwable $e) |
|
| 21 | - { |
|
| 20 | + catch (\Throwable $e) |
|
| 21 | + { |
|
| 22 | 22 | message ([ |
| 23 | 23 | 'type' => get_class ($e), |
| 24 | 24 | 'text' => $e->getMessage (), |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | public function __get ($name) |
| 200 | - { |
|
| 200 | + { |
|
| 201 | 201 | if (method_exists ($this, $method = "get_$name")) |
| 202 | 202 | $value = $this->$method (); |
| 203 | 203 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | $size = $this->count; |
| 227 | 227 | $list = []; |
| 228 | 228 | |
| 229 | - for ($i = 0; $i < $size; ++$i) |
|
| 229 | + for ($i = 0; $i < $size; ++$i) |
|
| 230 | 230 | $list[] = EngineAdditions::coupleSelector (\VoidCore::getArrayValue ($this->selector, $i)); |
| 231 | 231 | |
| 232 | 232 | return $list; |
@@ -256,10 +256,10 @@ discard block |
||
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | return EngineAdditions::coupleSelector ($value, $this->selector); |
| 259 | - } |
|
| 259 | + } |
|
| 260 | 260 | |
| 261 | - public function __set ($name, $value) |
|
| 262 | - { |
|
| 261 | + public function __set ($name, $value) |
|
| 262 | + { |
|
| 263 | 263 | if (method_exists ($this, $method = "set_$name")) |
| 264 | 264 | try |
| 265 | 265 | { |
@@ -287,8 +287,8 @@ discard block |
||
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - public function __call ($method, $args) |
|
| 291 | - { |
|
| 290 | + public function __call ($method, $args) |
|
| 291 | + { |
|
| 292 | 292 | $args = array_map (function ($arg) |
| 293 | 293 | { |
| 294 | 294 | return EngineAdditions::uncoupleSelector ($arg); |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | public function offsetSet ($index, $value) |
| 310 | - { |
|
| 310 | + { |
|
| 311 | 311 | try |
| 312 | 312 | { |
| 313 | 313 | return $index === null ? |
@@ -323,14 +323,14 @@ discard block |
||
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - public function offsetGet ($index) |
|
| 327 | - { |
|
| 328 | - return EngineAdditions::coupleSelector (\VoidCore::getArrayValue ($this->selector, $index), $this->selector); |
|
| 326 | + public function offsetGet ($index) |
|
| 327 | + { |
|
| 328 | + return EngineAdditions::coupleSelector (\VoidCore::getArrayValue ($this->selector, $index), $this->selector); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | - public function offsetUnset ($index): void |
|
| 332 | - { |
|
| 333 | - $this->callMethod ('RemoveAt', $index); |
|
| 331 | + public function offsetUnset ($index): void |
|
| 332 | + { |
|
| 333 | + $this->callMethod ('RemoveAt', $index); |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | public function offsetExists ($index): bool |
@@ -348,19 +348,19 @@ discard block |
||
| 348 | 348 | return true; |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | - public function indexOf ($value): int |
|
| 352 | - { |
|
| 353 | - return $this->callMethod ('IndexOf', EngineAdditions::uncoupleSelector ($value)); |
|
| 351 | + public function indexOf ($value): int |
|
| 352 | + { |
|
| 353 | + return $this->callMethod ('IndexOf', EngineAdditions::uncoupleSelector ($value)); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | public function lastIndexOf ($value): int |
| 357 | - { |
|
| 358 | - return $this->callMethod ('LastIndexOf', EngineAdditions::uncoupleSelector ($value)); |
|
| 359 | - } |
|
| 357 | + { |
|
| 358 | + return $this->callMethod ('LastIndexOf', EngineAdditions::uncoupleSelector ($value)); |
|
| 359 | + } |
|
| 360 | 360 | |
| 361 | - public function contains ($value): bool |
|
| 362 | - { |
|
| 363 | - return $this->callMethod ('Contains', EngineAdditions::uncoupleSelector ($value)); |
|
| 361 | + public function contains ($value): bool |
|
| 362 | + { |
|
| 363 | + return $this->callMethod ('Contains', EngineAdditions::uncoupleSelector ($value)); |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | public function foreach (callable $callback, string $type = null): void |
@@ -414,45 +414,45 @@ discard block |
||
| 414 | 414 | return \VoidCore::callMethod ($this->selector, $method, ...$args); |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | - protected function getArrayProperty ($name, string $type = null) |
|
| 418 | - { |
|
| 417 | + protected function getArrayProperty ($name, string $type = null) |
|
| 418 | + { |
|
| 419 | 419 | $array = $this->getProperty ($name); |
| 420 | 420 | $size = \VoidCore::getProperty ($array, 'Length'); |
| 421 | 421 | $return = []; |
| 422 | 422 | |
| 423 | - for ($i = 0; $i < $size; ++$i) |
|
| 423 | + for ($i = 0; $i < $size; ++$i) |
|
| 424 | 424 | $return[] = \VoidCore::getArrayValue ($array, $type === null ? $i : [$i, $type]); |
| 425 | 425 | |
| 426 | 426 | \VoidCore::removeObjects ($array); |
| 427 | 427 | |
| 428 | - return $return; |
|
| 428 | + return $return; |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | public function get_name () |
| 432 | - { |
|
| 433 | - try |
|
| 434 | - { |
|
| 435 | - return $this->getProperty ('Name'); |
|
| 432 | + { |
|
| 433 | + try |
|
| 434 | + { |
|
| 435 | + return $this->getProperty ('Name'); |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | - catch (\Throwable $e) |
|
| 439 | - { |
|
| 440 | - return $this->name; |
|
| 441 | - } |
|
| 442 | - } |
|
| 438 | + catch (\Throwable $e) |
|
| 439 | + { |
|
| 440 | + return $this->name; |
|
| 441 | + } |
|
| 442 | + } |
|
| 443 | 443 | |
| 444 | - public function set_name (string $name) |
|
| 445 | - { |
|
| 446 | - try |
|
| 447 | - { |
|
| 448 | - $this->setProperty ('Name', $name); |
|
| 444 | + public function set_name (string $name) |
|
| 445 | + { |
|
| 446 | + try |
|
| 447 | + { |
|
| 448 | + $this->setProperty ('Name', $name); |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | - catch (\Throwable $e) |
|
| 452 | - { |
|
| 453 | - $this->name = $name; |
|
| 454 | - } |
|
| 455 | - } |
|
| 451 | + catch (\Throwable $e) |
|
| 452 | + { |
|
| 453 | + $this->name = $name; |
|
| 454 | + } |
|
| 455 | + } |
|
| 456 | 456 | |
| 457 | 457 | public function __toString (): string |
| 458 | 458 | { |