Example #1
0
        static void PingCallback()
        {
            //Never stop pinging
            while (!Environment.HasShutdownStarted)
            {
                if (Environment.TickCount - LastTick > 60000)
                {
                    //Try pinging all servers
                    try
                    {
                        foreach (KeyValuePair <byte, ServerInfo2> pair in
                                 ServerManager2.Instance.server)
                        {
                            ServerInfo2 info = pair.Value;
                            if (info.client != null)
                            {
                                info.client.SM_PING();
                            }
                        }
                    }
                    //catch all exceptions but don't handle them
                    catch (Exception)
                    {
                    }
                    //Always update the last tick
                    finally
                    {
                        LastTick = Environment.TickCount;
                    }
                }

                Thread.Sleep(1);
            }
        }
Example #2
0
        private ServerManager2()
        {
            List <WorldInfo> list = Singleton.Database.GetWorldInformation();

            foreach (WorldInfo info2 in list)
            {
                ServerInfo2 info = new ServerInfo2();
                info.IP    = null;
                info.name  = info2.Worldname;
                info.proof = info2.Worldproof;
                this.server.Add(info2.WorldId, info);
            }
        }
Example #3
0
 private ServerManager2()
 {
     List<WorldInfo> list = Singleton.Database.GetWorldInformation();
     foreach (WorldInfo info2 in list)
     {
         ServerInfo2 info = new ServerInfo2();
         info.IP = null;
         info.name = info2.Worldname;
         info.proof = info2.Worldproof;
         this.server.Add(info2.WorldId, info);
     }
 }