示例#1
0
        // ---------------------------------------------


        private void applyButton_Click(object sender, EventArgs e)
        {
            applyBasic();
            applyAdvanced();

            try
            {
                if (File.Exists(configFile + "_bak"))
                {
                }
                else
                {
                    File.Copy(configFile, configFile + "_bak");
                }

                string[] content = newContent.ToArray();



                File.WriteAllLines(configFile, content);

                DONE ne = new DONE();
                ne.ShowDialog();
                this.Close();
            }
            catch (Exception x)
            {
                MessageBox.Show(x.ToString());
            }
        }
示例#2
0
        private void doIt()
        {
            File.WriteAllText(tmpPath + "\\Init.con", ed.Text);

            ZipFile zipFile = new ZipFile(zipPath);

            zipFile.UseZip64 = UseZip64.Off;

            zipFile.BeginUpdate();

            zipFile.Add(tmpPath + "\\Init.con", "\\Init.con");

            zipFile.CommitUpdate();

            zipFile.Close();


            //then copy the file...

            File.Copy(zipPath, overPath, true);


            DONE done = new DONE();

            done.ShowDialog();

            this.Close();
        }
示例#3
0
        void saveMod(string modName)
        {
            if (File.Exists(modPath + "\\Objects_server(" + modName + ").zip"))
            {
                DialogResult over = MessageBox.Show("Overwrite?", "BF2 M0dd3r", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

                switch (over)
                {
                case DialogResult.Yes:
                    File.Copy(zipPath, modPath + "\\Objects_server(" + modName + ").zip", true);
                    break;

                case DialogResult.No:
                    MessageBox.Show("Enter a new mod name...");
                    break;

                case DialogResult.Cancel:
                    this.Close();
                    break;
                }
            }
            else
            {
                File.Copy(zipPath, modPath + "\\Objects_server(" + modName + ").zip");

                DONE sdlk = new DONE();
                sdlk.ShowDialog();
                this.Close();
            }
        }
示例#4
0
        public void ApplySettings()
        {
            try
            {
                writeValue("setServerName", ServerName);
                writeValue("setServerPassword", ServerPassword);
                writeValue("setSpawnTime", SpawnTime);
                writeValue("setMaxPlayers", MaxPlayers);
                writeValue("setTicketRatio", TicketRatio);
                writeValue("setTeamRatio", TeamRatio);
                writeValue("setAutoBalanceTeam", AutoBalanceTeam);
                writeValue("setManDownTime", ManDownTime);
                writeValue("setPunishTeamKills", PunishTeamKills);
                writeValue("setRoundsPerMap", RoundsPerMap);
                writeValue("setRoundTimeLimit", RoundTimeLimit);
                writeValue("setRoundScoreLimit", RoundScoreLimit);
                writeValue("setNoVehicles", NoVehicles);
                writeValue("setVotingEnabled", VotingEnabled);
                writeValue("setVoteTime", VoteTime);
                writeValue("setMinimumPlayersToVote", MinimumPlayersToVote);
                writeValue("setTeamVoteOnly", TeamVoteOnly);
                writeValue("setSvPunkBuster", PunkBusterEnabled);
                writeValue("setSoldierFF", SoldierFF);
                writeValue("setVehicleFF", VehicleFF);
                writeValue("setSoldierSplashFF", SoldierSplashFF);
                writeValue("setVehicleSplashFF", VehicleSplashFF);
                writeValue("setVoipQuality", VoIPQuality);
                writeValue("setVoipServerRemote", VoIPServerRemote);
                writeValue("setVoipServerRemoteIP", VoIPServerRemoteIP);
                writeValue("setVoipServerPort", VoIPServerPort);
                writeValue("setVoipBFClientPort", VoIP_BF_ClientPort);
                writeValue("setVoipBFServerPort", VoIP_BF_ServerPort);
                writeValue("setVoipSharedPassword", VoIPSharedPassword);

                string[] content = newContent.ToArray();

                File.WriteAllLines(configFile, content);

                DONE ne = new DONE();
                ne.ShowDialog();
            }
            catch (Exception x)
            {
                if (x.Message == "Empty path name is not legal.")
                {
                    MessageBox.Show("Use the Auto-Login feature to apply any server settings.");
                }
                else
                {
                    MessageBox.Show(x.ToString());
                }
            }
        }
示例#5
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (ipAddressTextBox.Text != "")
            {
                File.AppendAllText(@"C:\Program Files\SirCapsAlot.NET\BF2 M0dd3r\add_para.cfg", " +joinServer " + ipAddressTextBox.Text);
                DONE done = new DONE();

                done.ShowDialog();

                this.Close();
            }
            else
            {
                MessageBox.Show("Enter an IP of a local computer or click Cancel", "BF2 M0dd3r", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#6
0
        private void button1_Click(object sender, EventArgs e)
        {
            addFile = appDir + "\\add_para.cfg";

            //clicked ok...

            //append to addFile... the stuff...

            if (localAccount.Checked)
            {
                if (avaNames.Text != "")
                {
                    File.AppendAllText(addFile, " +playerName " + avaNames.Text);

                    string[] content = { avaNames.Text, dirs[avaNames.SelectedIndex] };

                    File.WriteAllLines(appDir + "\\bf2profname.cfg", content);

                    DONE done = new DONE();
                    done.ShowDialog();

                    this.Close();
                }
                else
                {
                    MessageBox.Show("Please select your Battlefield 2 Profile name!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (internetAccount.Checked)
            {
                if (avaNames.Text != "" && passwordTextBox.Text != "")
                {
                    File.AppendAllText(addFile, " +playerName " + avaNames.Text + " +playerPassword " + passwordTextBox.Text);

                    DONE done = new DONE();
                    done.ShowDialog();

                    this.Close();
                }
                else
                {
                    MessageBox.Show("Please select your Battlefield 2 Profile name!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
示例#7
0
        void applyMod(string difficulty, int numberOfBots)
        {
            if (File.Exists(@"C:\Program Files\SirCapsAlot.NET\BF2 M0dd3r\bf2path.cfg"))
            {
                string tt = File.ReadAllText(@"C:\Program Files\SirCapsAlot.NET\BF2 M0dd3r\bf2path.cfg");

                if (tt == String.Empty)
                {
                    MessageBox.Show("Please import the archive in BF2 M0dd3r before you use BF2 BotSwap.", "BF2 BotSwap", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.Close();
                }
                else
                {
                    string diff = "{DIFFICULTY}";
                    string num  = "{NUMBOTS}";

                    int start = txt.Find(diff);

                    txt.Select(start, diff.Length);

                    Clipboard.SetText(difficulty);

                    txt.Paste();

                    start = txt.Find(num);

                    txt.Select(start, num.Length);

                    Clipboard.SetText(numberOfBots.ToString());

                    txt.Paste();

                    string aifile = tt + "\\mods\\bf2modder\\AI\\AIDefault.ai";

                    //apply code in here...

                    if (!File.Exists(aifile))
                    {
                        StreamWriter sw = new StreamWriter(aifile);
                        foreach (string lin in txt.Lines)
                        {
                            sw.WriteLine(lin);
                        }
                        sw.Close();
                    }
                    else
                    {
                        StreamWriter sw = new StreamWriter(aifile);
                        foreach (string lin in txt.Lines)
                        {
                            sw.WriteLine(lin);
                        }
                        sw.Close();
                    }



                    //-----

                    DONE done = new DONE();
                    done.ShowDialog();

                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Please import the archive in BF2 M0dd3r before you use BF2 BotSwap.", "BF2 BotSwap", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
        }