コード例 #1
0
        //protected override void OnActivated(EventArgs e)
        //{
        //    notifyIcon.Visible = false;
        //    base.OnActivated(e);
        //}

        public void StartServer(bool showMessage)
        {
            server = new myTcpServer(App.Config.SERVER_PORT);

            try
            {
                server.start();
                string currentIP;
                if (!App.Config.ipAddress.Equals((currentIP = TCPserver.getLocalIP().ToString().Trim())))
                {
                    App.Log.logEvent("The IP address of this computer has changed!! Take note of the new IP (erase your bookmark and add): " + currentIP, Event.EVENT_FLAGS.IMPORTANT);
                    App.Config.ipAddress = currentIP;
                    App.serialize(App.Config);
                }
                this.lblAddress.Text = currentIP;

                if (App.Config.SERVER_PORT != 80)
                {
                    lblAddress.Text += ":" + App.Config.SERVER_PORT;
                }
                cmdStartServer.Visibility = Visibility.Hidden;
                cmdStopServer.Visibility  = Visibility.Visible;
                lblServerStatus.Text      = "The server is.. Started.";
                Event.EVENT_FLAGS flags = Event.EVENT_FLAGS.NORMAL;
                if (showMessage)
                {
                    flags |= Event.EVENT_FLAGS.IMPORTANT;
                }
                App.Log.logEvent("The server has been started.", flags);
            }
            catch (NetworkException ex)
            {
                App.Log.logEvent(ex.Message, Event.EVENT_FLAGS.IMPORTANT);
            }
            catch (SocketException exception)
            {
                App.Log.logEvent("critical error: " + exception.Message + "\r\n" + exception.StackTrace.ToString(), Event.EVENT_FLAGS.IMPORTANT);
            }
        }
コード例 #2
0
 void Awake()
 {
     tcpserver = (tcpserver == null) ? this : tcpserver;
 }
コード例 #3
0
 private void Application_Exit(object sender, ExitEventArgs e)
 {
     Miner.StopMiner();
     TCPserver.StopServers();
     Overclocker.ApplicationLive = false;
 }