BF2Statistics.RandomizeForm.SaveBtn_Click C# (CSharp) Method

SaveBtn_Click() private method

Saves the current generated maplist into the maplist.con file
private SaveBtn_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            // Make sure we have at least 1 map :/
            int Len = MapListBox.Lines.Length - 1;
            if (Len == 0 || String.IsNullOrWhiteSpace(MapListBox.Text))
            {
                MessageBox.Show("There must be at least 1 map before saving!", "User Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            // Append the prefix to each map line
            MapList List = MainForm.SelectedMod.MapList;

            // Clear out old Junk, and add new
            List.Entries.Clear();
            for (int i = 0; i < Len; i++)
                List.AddFromString("mapList.append " + MapListBox.Lines[i]);

            // Save and close
            List.SaveToFile(MainForm.SelectedMod.MaplistFilePath);
            this.Close();
        }
    }