Esempio n. 1
0
        public ProtoWatch(KroConfig Configuration)
        {
            string enabled = Configuration.getValue("PW_Enable", "false");
            string ip      = Configuration.getValue("PW_IP", "127.0.0.1");
            string port    = Configuration.getValue("PW_PORT", "27015");

            PingDelay      = Convert.ToInt16(Configuration.getValue("PW_PingDelay", "10"));
            PingTimeout    = Convert.ToInt16(Configuration.getValue("PW_PingTimeout", "2"));
            MaxFailedPings = Convert.ToInt16(Configuration.getValue("PW_MaxFailedPings", "12"));
            StartupDelay   = Convert.ToInt16(Configuration.getValue("PW_StartupDelay", "60"));

            if (enabled == "true")
            {
                try
                {
                    GameServer = new IPEndPoint(IPAddress.Parse(ip), Convert.ToInt16(port));
                    UPing      = new UdpClient();
                    PingThread = new Thread(new ThreadStart(pingSpin));
                    PingThread.Start();
                } catch (Exception E)
                {
                    Console.Write(DateTime.Now + " ");
                    Console.WriteLine("Something bad happened to ProtoWatch!");
                    Console.WriteLine(E.ToString());
                    Console.WriteLine("ProtoWatch is disabled for this session!");
                }
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("SRCDS WARDEN (C) XAYRGA (wwww.xayr.ga) 2018.");
            Console.WriteLine("Opening config.wa...");
            Configuration = new KroConfig("config.wa");
            InitialStart  = DateTime.Now;

            ConsoleEx.SetScreenColors(Color.FromArgb(255, 255, 255), Color.FromArgb(0, 25, 75));

            QuickRestartTime = Convert.ToInt32(Configuration.getValue("QuickRestartTime", "20"));
            QuickRestartMax  = Convert.ToInt32(Configuration.getValue("QuickRestartMax", "5"));
            QuickRestartWait = Convert.ToInt32(Configuration.getValue("QuickRestartWait", "20"));

            NetWatcher = new ProtoWatch(Configuration);

            ProcessWatcherThread = new Thread(new ThreadStart(ProcessSpin));
            ProcessWatcherThread.Start();

            while (true)
            {
                Console.Write(">");
                string inp = Console.ReadLine();
            }
        }