Example #1
0
        private static void Runner()
        {
            DateTime dt = DateTime.Now;

            while (_running)
            {
                if (!_running)
                {
                    return;
                }
                Thread.Sleep(100);
                if (new TimeSpan(DateTime.Now.Ticks - dt.Ticks).Seconds > 30 && _gotCheckBack == false)
                {
                    Trace.WriteLine("[Status]Bot must have died. Remaking.");
                    GameBot.RemakeXmpp();
                    _gotCheckBack = true;
                }
                if (new TimeSpan(DateTime.Now.Ticks - dt.Ticks).Minutes > 1)
                {
                    dt = DateTime.Now;
                    var ts = new TimeSpan(dt.Ticks - _startTime.Ticks);
                    Trace.WriteLine(String.Format("[Running For]: {0} Days, {1} Hours, {2} Minutes", ts.Days, ts.Hours, ts.Minutes));
                    GameBot.CheckBotStatus();
                    Trace.WriteLine("[Status]Bot Checking...");
                    _gotCheckBack = false;
                }
            }
        }
Example #2
0
 private static void Main()
 {
     Trace.Listeners.Add(new ConsoleTraceListener());
     Trace.WriteLine(String.Format("[LobbyServer]: V{0}\nStart Time: {1} {2}", Assembly.GetExecutingAssembly().GetName().Version, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString()));
     //Console.WriteLine(String.Format("[LobbyServer] V{0}",Assembly.GetExecutingAssembly().GetName().Version.ToString()));
     AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;
     AppDomain.CurrentDomain.ProcessExit        += CurrentDomainProcessExit;
     RunThread.Name = "Main";
     RunThread.Start();
     GameBot.Init();
     _startTime               = DateTime.Now;
     _gotCheckBack            = true;
     GameBot.OnCheckRecieved += OnCheckRecieved;
 }
Example #3
0
        private static void HostedGameExited(object sender, EventArgs e)
        {
            Logger.PreLock();
            Locker.EnterWriteLock();
            Logger.InLock();
            var s = sender as HostedGame;

            if (s == null)
            {
                Locker.ExitWriteLock();
                Logger.EndLock();
                return;
            }
            s.Status = Lobby.EHostedGame.StoppedHosting;
            Games.Remove(s.Port);
            Locker.ExitWriteLock();
            Logger.EndLock();
            GameBot.RefreshLists();
        }