예제 #1
0
        private void launchBeginDayEvent()
        {
            var executable = Properties.Settings.Default.executable;
            var argumentsTemplate = Properties.Settings.Default.parameters;
            var homeDirectory = Properties.Settings.Default.homeDirectory;

            Launcher launcher = new Launcher(executable, homeDirectory, argumentsTemplate, logger);
            Process p = launcher.launchBeginDayEvent(Convert.ToInt32(Properties.Settings.Default.localNode));
            p.WaitForExit();
        }
예제 #2
0
        private void runLocalNodeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.runLocalNodeToolStripMenuItem.Enabled = false;

            var executable = Properties.Settings.Default.executable;
            var argumentsTemplate = Properties.Settings.Default.parameters;
            var homeDirectory = Properties.Settings.Default.homeDirectory;

            Action<string> logger = delegate (string s)
            {
                server_StatusMessage(this, new StatusMessageEventArgs(s, StatusMessageEventArgs.MessageType.LogDebug));
            };
            Launcher launcher = new Launcher(executable, homeDirectory, argumentsTemplate, logger);
            Process p = launcher.launchLocalNode(Convert.ToInt32(Properties.Settings.Default.localNode));
            Thread localNodeCleanupThread = new Thread(delegate ()
            {
                p.WaitForExit();
                this.Name = "localNodeCleanupThread";
                MethodInvoker d = delegate () { this.runLocalNodeToolStripMenuItem.Enabled = true; };
                this.Invoke(d);
            });
            // Set this to be a background thread so we can still exit and not wait for it.
            localNodeCleanupThread.IsBackground = true;
            localNodeCleanupThread.Start();
        }
예제 #3
0
파일: SocketServer.cs 프로젝트: TRI0N/wwiv
    private void LaunchInstance(NodeStatus node, Socket socket)
    {
      try
      {
        var executable = (node.NodeType == NodeType.BBS)
          ? Properties.Settings.Default.executable : Properties.Settings.Default.binkpExecutable;

        var homeDirectory = Properties.Settings.Default.homeDirectory;

        Launcher launcher = new Launcher(executable, homeDirectory, argumentsTemplate, DebugLog);
        var socketHandle = socket.Handle.ToInt32();
        using (Process p = launcher.launchSocketNode(node.Node, socketHandle))
        {
          if (p != null)
          {
            p.WaitForExit();
          }
        }
      }
      catch (Exception e)
      {
        DebugLog(e.ToString());
      }
      finally
      {
        try
        {
          // Let's try to shutdown in a try..catch incase it's already closed.
          socket.Shutdown(SocketShutdown.Both);
          socket.Close();
        }
        catch (SocketException e)
        {
          Debug.WriteLine(e.ToString());
        }
        finally
        {
          nodeManager.freeNode(node);
          OnNodeUpdated(node);
        }
      }
    }
예제 #4
0
        private void LaunchInstance(NodeStatus node, Socket socket)
        {
            try
            {
                var executable = Properties.Settings.Default.executable;
                var homeDirectory = Properties.Settings.Default.homeDirectory;

                Launcher launcher = new Launcher(executable, homeDirectory, argumentsTemplate, DebugLog);
                var socketHandle = socket.Handle.ToInt32();
                Process p = launcher.launchTelnetNode(node.Node, socketHandle);
                p.WaitForExit();
                socket.Shutdown(SocketShutdown.Both);
                socket.Close();
            }
            catch (SocketException e)
            {
                Console.WriteLine(e.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            finally
            {
                nodeManager.freeNode(node);
                OnNodeUpdated(node);
            }
        }
예제 #5
0
        private void LaunchInstance(NodeStatus node, Socket socket)
        {
            try
            {
                var executable = Properties.Settings.Default.executable;
                // Detect Port 22 SSH or Use Telnet
                string bbsProperties;
                if (isSSH != "1")
                {
                    bbsProperties = Properties.Settings.Default.parameters;
                }
                else
                {
                    bbsProperties = Properties.Settings.Default.parameters2;
                }
                var argumentsTemplate = bbsProperties;
                var homeDirectory = Properties.Settings.Default.homeDirectory;

                Launcher launcher = new Launcher(executable, homeDirectory, argumentsTemplate, DebugLog);
                var socketHandle = socket.Handle.ToInt32();
                Process p = launcher.launchTelnetNode(node.Node, socketHandle);
                p.WaitForExit();
                socket.Shutdown(SocketShutdown.Both);
                socket.Close();
            }
            catch (SocketException e)
            {
                Console.WriteLine(e.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            finally
            {
                lock (nodeLock)
                {
                    node.InUse = false;
                }
                OnNodeUpdated(node);
            }
        }