Example #1
0
        public override void OnRun()
        {
            bool initResult = OnInit();

            if(initResult == true)
            {
                Platform.Instance.LogSystemInfo();

                Software.Checking();

                Software.Log();

                Platform.Instance.OnRecovery();

                Recovery.Load();

                RunEventCommand("app.start");

                Platform.Instance.OnAppStart();

                if (Engine.Storage.GetLower("netlock.mode") != "none")
                {
                    if (Engine.Storage.GetBool("netlock")) // 2.8
                        m_networkLockManager.Activation();
                }

                WaitMessageClear();

                m_threadPinger = new Threads.Pinger();
                m_threadPenalities = new Threads.Penalities();
                m_threadDiscover = new Threads.Discover();
                m_threadManifest = new Threads.Manifest();

                bool autoStart = false;
                if (ConsoleMode)
                {
                    Auth();
                    /* // 2.8
                    if (IsLogged())
                        autoStart = true;
                    else
                        CancelRequested = true;
                    */
                }

                // Clodo: Try to remove: if not logged, no servers, fatal error and exit.
                if ((IsLogged()) && (Engine.Storage.GetBool("connect")))
                    autoStart = true;
                if (autoStart)
                    Connect();
                else
                    Logs.Log(LogType.InfoImportant, Messages.Ready);

                for (; ; )
                {
                    OnWork();

                    if (ConsoleMode)
                    {
                        if (Storage.Get("console.mode") == "keys")
                        {
                            try
                            {
                                // try/catch because throw an exception if stdin is redirected.
                                // May in future we can use Console.IsInputRedirected, but require .Net 4.5
                                if (Console.KeyAvailable)
                                {
                                    ConsoleKeyInfo key = Console.ReadKey();
                                    OnConsoleKey(key);
                                }
                            }
                            catch
                            {
                            }
                        }
                    }

                    if (CancelRequested)
                        break;
                }
            }

            Logs.Log(LogType.Verbose, Messages.AppShutdownStart);

            OnDeInit();

            RunEventCommand("app.stop");

            Command("shutdown.done"); // Clodo, new Eddie3

            OnDeInit2();

            Logs.Log(LogType.Verbose, Messages.AppShutdownComplete);

            Terminated = true;
            if (TerminateEvent != null)
                TerminateEvent();
        }
Example #2
0
 public Manifest()
 {
     Instance = this;
 }