Ejemplo n.º 1
0
        void SetupGeneral()
        {
            // Setup Position Updates
            updateTimer.Elapsed += delegate
            {
                Player.GlobalUpdate();
            };
            updateTimer.Start();


            // Performance counters
            try
            {
                if (System.Environment.OSVersion.Platform != PlatformID.Unix)
                {
                    PCCounter      = new PerformanceCounter("Processor", "% Processor Time", "_Total");
                    ProcessCounter = new PerformanceCounter("Process", "% Processor Time", Process.GetCurrentProcess().ProcessName);
                    PCCounter.BeginInit();
                    ProcessCounter.BeginInit();
                    PCCounter.NextValue();
                    ProcessCounter.NextValue();
                }
            }
            catch (Exception e)
            {
                Logger.Log("Error Setting up performance counters", LogType.Error);
                Logger.Log(e.Message, LogType.ErrorMessage);
            }


            // Setup Random Messages
            messageTimer.Elapsed += delegate
            {
                RandomMessage();
            };
            messageTimer.Start();
            process = System.Diagnostics.Process.GetCurrentProcess();

            /*if (File.Exists("griefExemption.txt"))
             * {
             *  StreamReader r = File.OpenText("griefExemption.txt");
             *  while (!r.EndOfStream)
             *      griefExemption.Add(r.ReadLine());
             * }
             * else
             *  File.Create("griefExemption.txt").Close();
             */
            if (File.Exists("messages.txt"))
            {
                StreamReader r = File.OpenText("messages.txt");
                while (!r.EndOfStream)
                {
                    messages.Add(r.ReadLine());
                }
            }
            else
            {
                File.Create("messages.txt").Close();
            }

            // Setup Joker
            if (File.Exists("joker.txt"))
            {
                StreamReader r = File.OpenText("joker.txt");
                while (!r.EndOfStream)
                {
                    jokerMessages.Add(r.ReadLine());
                }
            }
            else
            {
                File.Create("joker.txt").Close();
            }
        }