예제 #1
0
 private void KillTestServers()
 {
     if (testServerPID != 0 && killTestServer_checkBox.Checked)
     {
         MatchMakingMaster.KillServerInstanceByID(testServerPID);
         canStart      = true;
         testServerPID = 0;
         testServerInstancebtn.Text    = "Test Server Instance";
         testServerInstancebtn.Enabled = true;
         refreshServerList();
     }
 }
예제 #2
0
        public void StopServer()
        {
            Process pTOKill = Process.GetProcessById(PROCESS_ID_SERVER);

            if (pTOKill.ProcessName.Length != 0)
            {
                pTOKill.Kill();
                MatchMakingMaster.unregisterPID(PROCESS_ID_SERVER);
                MatchMakingMaster.removeMMServer(MATCHMAKING_ID);
                MatchMakingMaster.removeServer(PORT);
                Console.WriteLine("Server Instance '" + PROCESS_ID_SERVER + "' Terminated");
            }
        }
예제 #3
0
        private void BuildProcessList()
        {
            processList_panel1.Controls.Clear();
            foreach (KeyValuePair <int, string> process in MatchMakingMaster.GetProcessList())
            {
                TextBox txtB = new TextBox();
                txtB.ReadOnly = true;
                txtB.Text     = "PID: " + process.Key + " | StartDate: " + process.Value;
                txtB.Location = new Point(10, processList_panel1.Controls.Count * 25);
                Size size = TextRenderer.MeasureText(txtB.Text, txtB.Font);
                txtB.Width  = size.Width;
                txtB.Height = size.Height;

                processList_panel1.Controls.Add(txtB);
            }
        }
예제 #4
0
        private void BuildMMList()
        {
            mmList_panel.Controls.Clear();
            foreach (KeyValuePair <string, string> mmserver in MatchMakingMaster.GetMMServerList())
            {
                TextBox txtB = new TextBox();
                txtB.ReadOnly = true;
                txtB.Text     = "ID: " + mmserver.Key + " | Port: " + mmserver.Value;
                txtB.Location = new Point(10, mmList_panel.Controls.Count * 25);
                Size size = TextRenderer.MeasureText(txtB.Text, txtB.Font);
                txtB.Width  = size.Width;
                txtB.Height = size.Height;

                mmList_panel.Controls.Add(txtB);
            }
        }
예제 #5
0
        private void BuildServerList()
        {
            serverList_panel1.Controls.Clear();
            foreach (KeyValuePair <string, string> server in MatchMakingMaster.GetServerList())
            {
                TextBox txtB = new TextBox();
                txtB.ReadOnly = true;
                txtB.Text     = server.Value + ":" + server.Key;
                txtB.Location = new Point(10, serverList_panel1.Controls.Count * 25);
                Size size = TextRenderer.MeasureText(txtB.Text, txtB.Font);
                txtB.Width  = size.Width;
                txtB.Height = size.Height;

                serverList_panel1.Controls.Add(txtB);
            }
        }
예제 #6
0
        public bool StartServer(bool IsLiveServer)
        {
            bool started = false;
            //Console.WriteLine("--Starting Server--");
            //Process.Start(GeneratePath(), GenerateArguments());

            Process p    = new Process();
            string  path = GeneratePath();
            string  args = GenerateArguments();

            p.StartInfo.FileName  = path;
            p.StartInfo.Arguments = args;

            Console.WriteLine("--Starting Server--");
            Console.WriteLine(path);
            Console.WriteLine(args);

            started = p.Start();

            try
            {
                PROCESS_ID_SERVER = p.Id;

                SERVER_START_TIMESTAMP = DateTime.Now;
                MatchMakingMaster.registerPID(PROCESS_ID_SERVER, SERVER_START_TIMESTAMP.ToString("F"));
                Console.WriteLine("Server Started: {0} ID: {1}", started, PROCESS_ID_SERVER);

                //Only Start Death Timers for live servers, Not test ones
                if (IsLiveServer)
                {
                    Console.WriteLine("Server Death Timer Started: {0} minutes", StartDeathTimer().ToString());
                    MatchMakingMaster.totalServersCreated++;
                }
            }
            catch (InvalidOperationException)
            {
                started = false;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                started = false;
            }

            return(started);
        }