public CombatCalc() { InitializeComponent(); this.Icon = FiddlerControls.Options.GetFiddlerIcon(); mobList = new MobileList(); setList = new ArmorSets(); }
private void OnLoad(object sender, EventArgs e) { MobListSerializer = new XmlSerializer(typeof(MobileList)); ArmorSetSerializer = new XmlSerializer(typeof(ArmorSets)); if (File.Exists(XMLpath)) { TextReader r = new StreamReader(XMLpath); mobList = (MobileList)MobListSerializer.Deserialize(r); mobList.mobileList.Sort(); r.Close(); } if (File.Exists(XMLpathSets)) { TextReader r = new StreamReader(XMLpathSets); setList = (ArmorSets)ArmorSetSerializer.Deserialize(r); r.Close(); } if (setList == null) { setList = new ArmorSets(); } listView1.BeginUpdate(); listView1.Items.Clear(); foreach (Mobile mob in mobList.mobile) { ListViewItem item = new ListViewItem(); item.Text = mob.ToString(); listView1.Items.Add(item); } listView1.EndUpdate(); comboBox1ArmorSet.BeginUpdate(); comboBox2ArmorSet.BeginUpdate(); comboBox1ArmorSet.Items.Clear(); comboBox2ArmorSet.Items.Clear(); foreach (ArmorSet aset in setList.sets) { comboBox1ArmorSet.Items.Add(aset); comboBox2ArmorSet.Items.Add(aset); } if (comboBox1ArmorSet.Items.Count > 0) { comboBox1ArmorSet.SelectedIndex = 0; } if (comboBox2ArmorSet.Items.Count > 0) { comboBox2ArmorSet.SelectedIndex = 0; } comboBox1ArmorSet.EndUpdate(); comboBox2ArmorSet.EndUpdate(); OnCheckedNPC1(this, EventArgs.Empty); OnCheckedNPC2(this, EventArgs.Empty); }