예제 #1
0
 public void saveD2Mods(Form1 form1, StreamWriter sw, SettingDef settingDef)
 {
     sw.WriteLine("smod = " + ExpParser.getD2MExp(((ComboBox)settingDef.getDefs()["[DOOMII]"]["smod"]).SelectedItem.ToString()));
     for (int i = 0; i < 5; i++)
     {
         sw.WriteLine("modex = " + i);
         sw.WriteLine("mods = " + serializeMods(form1.ml[i].ToArray()));
     }
 }
예제 #2
0
        public string loadD2Mods(Form1 form1, SettingDef settingDef, string smod, StreamReader reader)
        {
            int    selected = Convert.ToInt32(smod);
            string line     = "";

            string[] inline;
            int      index = 0;

            ((ComboBox)settingDef.getDefs()["[DOOMII]"]["smod"]).SelectedItem = ExpParser.setD2MExp(selected);
            for (int i = 0; i < 5; i++)
            {
                line   = reader.ReadLine();
                inline = line.Split(new string[] { " = " }, StringSplitOptions.None);
                if (inline[0] != "modex")
                {
                    break;
                }
                index  = Convert.ToInt32(inline[1]);
                line   = reader.ReadLine();
                inline = line.Split(new string[] { " = " }, StringSplitOptions.None);
                string[] mods = deserializeMods(inline[1]);
                if (mods[0].Length != 0)
                {
                    if (index == selected)
                    {
                        ((ListBox)settingDef.getDefs()["[DOOMII]"]["mods"]).Items.AddRange(mods);
                    }
                    form1.ml[index].AddRange(mods);
                }
                if (i == 4)
                {
                    line = null;
                }
            }
            return(line);
        }