Ejemplo n.º 1
0
 public OpenVPNservice(OpenVPNserviceRunner openVPNserviceRunner, String config)
 {
     this.openVPNserviceRunner = openVPNserviceRunner;
     this.config = config;
     this.configID = counter++;
     terminatorEventName = "OpenVPNManager_OpenVPNClientsReset_" + configID.ToString();
     terminateOpenVPNclient = new EventWaitHandle(false, EventResetMode.ManualReset, terminatorEventName);
 }
Ejemplo n.º 2
0
 public OpenVPNservice(OpenVPNserviceRunner openVPNserviceRunner, String config)
 {
     this.openVPNserviceRunner = openVPNserviceRunner;
     this.config            = config;
     this.configID          = counter++;
     terminatorEventName    = "OpenVPNManager_OpenVPNClientsReset_" + configID.ToString();
     terminateOpenVPNclient = new EventWaitHandle(false, EventResetMode.ManualReset, terminatorEventName);
 }
Ejemplo n.º 3
0
        internal static void executeServiceAsConsole()
        {
            NativeMethods.AllocConsole();
            service = new OpenVPNserviceRunner();
            _handler += new NativeMethods.HandlerRoutine(ConsoleCtrlCheck);
            NativeMethods.SetConsoleCtrlHandler(_handler, true);// Allow console to properly take shutdown also on Ctrl+C or closing the Console window.

            service.StartAsConsole();
            try
            {
                string input = string.Empty;
                Console.WriteLine("\r\nType \"exit\" and press Enter to stop.");
                while (input != null && input.ToLower() != "exit")
                    input = Console.ReadLine();
                service.Shutdown();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
        internal static void executeServiceAsConsole()
        {
            NativeMethods.AllocConsole();
            service   = new OpenVPNserviceRunner();
            _handler += new NativeMethods.HandlerRoutine(ConsoleCtrlCheck);
            NativeMethods.SetConsoleCtrlHandler(_handler, true);// Allow console to properly take shutdown also on Ctrl+C or closing the Console window.

            service.StartAsConsole();
            try
            {
                string input = string.Empty;
                Console.WriteLine("\r\nType \"exit\" and press Enter to stop.");
                while (input != null && input.ToLower() != "exit")
                {
                    input = Console.ReadLine();
                }
                service.Shutdown();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }