private void ReadItem(string itemsource) { using (BinaryReader b = new BinaryReader(File.Open(itemsource, FileMode.Open))) { int num = b.ReadInt32(); while (b.BaseStream.Position < b.BaseStream.Length) { LevelUP temp = new LevelUP(); temp.Level = b.ReadInt32(); temp.StringIndex = b.ReadInt32(); ItemList.Add(temp); } } }
private void button1_Click(object sender, EventArgs e) { if (this.ItemListBox.Items.Count != 0) { DialogResult messageBoxResult = MessageBox.Show("Are you sure you want to add new record?", "Adder", MessageBoxButtons.YesNo); if (messageBoxResult == DialogResult.Yes) { int iD = ItemList[ItemList.Count - 1].Level + 1; LevelUP temp = new LevelUP(); temp.Level = iD; temp.StringIndex = 1; ItemList.Add(temp); this.ItemListBox.Items.Clear(); } } this.ItemListBox.SelectedIndex = this.ItemListBox.Items.Count - 1; this.makelist(); }