Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Кусок на шарпе
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Net.Sockets;
- using System.Net;
- using System.Diagnostics;
- using System.IO;
- using System.Windows.Forms;
- using System.Runtime.InteropServices;
- namespace Xphp
- {
- class PhpWrapper
- {
- // wrapper instance
- private static PhpWrapper _instance = null;
- // process
- private int _port;
- public int port
- {
- get { return _port; }
- }
- // wrapper path
- private String _path;
- // process
- private Process _process = null;
- public Process process
- {
- get { return _process; }
- }
- public static PhpWrapper getInstance()
- {
- if (_instance == null) {
- _instance = new PhpWrapper();
- }
- return _instance;
- }
- public PhpWrapper()
- {
- _port = this._getPort();
- _path = Config.path + Config.phpPath;
- this.run();
- }
- public static void halt()
- {
- if (getInstance().process != null)
- {
- System.Console.WriteLine("Stop server.");
- getInstance().process.Kill();
- }
- }
- // Кусок на пыхе
- use System;
- use System\Collections\Generic;
- use System\Linq;
- use System\Text;
- use System\Net\Sockets;
- use System\Net;
- use System\Diagnostics;
- use System\IO;
- use System\Windows\Forms;
- use System\Runtime\InteropServices;
- namespace Xphp
- {
- class PhpWrapper
- {
- // wrapper instance
- private static $_instance = null;
- // process
- private $_port;
- // wrapper path
- private $_path;
- // process
- private $_process = null;
- public static function getInstance()
- {
- if ($this->_instance == null) {
- $this->_instance = new PhpWrapper();
- }
- return $this->_instance;
- }
- public function __construct()
- {
- _port = $this->_getPort();
- _path = Config::$path . Config::$phpPath;
- $this->run();
- }
- public static halt()
- {
- if ($this->getInstance()->_process != null)
- {
- System\Console::WriteLine("Stop server.");
- $this->getInstance()->process->Kill();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement