示例#1
0
        private void LaunchClient()
        {
            CleanAndCopyMaps(MapsInfo.GetCurrentPack());

            Process.Start(new ProcessStartInfo
            {
                Arguments        = "",
                CreateNoWindow   = true,
                FileName         = Path.Combine(GAME_PATH, "CoD2MP_s.exe"),
                UseShellExecute  = true,
                WorkingDirectory = GAME_PATH
            });
        }
示例#2
0
        private void SaveCurrentMap()
        {
            int score;

            if (!int.TryParse(puntaje.Text, out score))
            {
                score = int.MinValue;
            }

            string package = GetCurrentPackage();
            string name    = GetCurrentMapName();

            MapsInfo.SaveMap(package, name, equipo1.Text, equipo2.Text, score, comentario.Text, pictureBox1.Image);
        }
示例#3
0
        private void RefreshMapInfo()
        {
            string  package = GetCurrentPackage();
            string  name    = GetCurrentMapName();
            MapInfo map     = MapsInfo.GetMap(package, name);

            if (map != null)
            {
                equipo1.Text      = map.Team1;
                equipo2.Text      = map.Team2;
                puntaje.Text      = map.Score.ToString();
                comentario.Text   = map.Description;
                pictureBox1.Image = map.Thumbnail;
            }
            else
            {
                equipo1.Text    = null;
                equipo2.Text    = null;
                puntaje.Text    = null;
                comentario.Text = null;
            }
        }
示例#4
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            var results = MapsInfo.SearchMaps(textBox1.Text);

            listBox4.DataSource = results;
        }
示例#5
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                var items = listBox3.Items.OfType <MyListItem>();
                if (items.Any())
                {
                    var    lastGameType = "";
                    string result       = "";
                    foreach (var item in items)
                    {
                        KeyValuePair <string, string> current = (KeyValuePair <string, string>)item.Tag;
                        if (current.Key != lastGameType)
                        {
                            lastGameType = current.Key;
                            result      += "gametype " + lastGameType + " ";
                        }

                        result += "map " + current.Value + " ";
                    }

                    result = "set sv_mapRotation \"" + result + "\"";

                    string content = MapsInfo.GetOriginalConfig();
                    if (string.IsNullOrWhiteSpace(content))
                    {
                        using (StreamReader source = new StreamReader("Cod2_server.cfg"))
                        {
                            content = source.ReadToEnd();
                        }
                    }

                    content = content.Replace("set sv_hostname \"Andresito\"", "set sv_hostname \"" + GetCurrentPackage() + "\"");

                    content += Environment.NewLine + Environment.NewLine + "// MAPS" + Environment.NewLine + Environment.NewLine + result;

                    using (TextWriter dest = new StreamWriter(CONFIG_FILE, false))
                    {
                        dest.Write(content);
                        dest.Flush();
                        dest.Close();
                    }

                    CleanAndCopyMaps(GetCurrentPackage());

                    MapsInfo.SaveCurrentPackageConfig(SystemInformation.ComputerName, GetCurrentPackage());

                    MessageBox.Show("Todo listo: A JUGAR!!!", "COD2", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    Process.Start(new ProcessStartInfo
                    {
                        Arguments        = "+exec server_configs\\server.cfg +map_rotate ",
                        CreateNoWindow   = true,
                        FileName         = Path.Combine(GAME_PATH, "CoD2MP_s.exe"),
                        UseShellExecute  = true,
                        WorkingDirectory = GAME_PATH
                    });
                }
            }
            catch (Exception ex)
            {
                ShowError(ex);
            }
        }