void btnEdit_Click(object sender, EventArgs e) { if (this.lvSets.SelectedIndices.Count <= 0) { return; } bool flag = false; string uidOld = ""; int selectedIndex1 = this.lvSets.SelectedIndices[0]; EnhancementSetCollection enhancementSets = DatabaseAPI.Database.EnhancementSets; int selectedIndex2 = this.lvSets.SelectedIndices[0]; EnhancementSet iSet = enhancementSets[selectedIndex2]; enhancementSets[selectedIndex2] = iSet; frmSetEdit frmSetEdit = new frmSetEdit(ref iSet); int num = (int)frmSetEdit.ShowDialog(); if (frmSetEdit.DialogResult == DialogResult.OK) { if (frmSetEdit.mySet.Uid != DatabaseAPI.Database.EnhancementSets[this.lvSets.SelectedIndices[0]].Uid) { flag = true; uidOld = DatabaseAPI.Database.EnhancementSets[this.lvSets.SelectedIndices[0]].Uid; } DatabaseAPI.Database.EnhancementSets[this.lvSets.SelectedIndices[0]] = new EnhancementSet(frmSetEdit.mySet); this.ImageUpdate(); this.UpdateListItem(selectedIndex1); if (flag) { frmSetListing.RenameIOSet(uidOld, frmSetEdit.mySet.Uid); DatabaseAPI.MatchEnhancementIDs(); } } }
void btnAdd_Click(object sender, EventArgs e) { EnhancementSet iSet = new EnhancementSet(); frmSetEdit frmSetEdit = new frmSetEdit(ref iSet); int num = (int)frmSetEdit.ShowDialog(); if (frmSetEdit.DialogResult != DialogResult.OK) { return; } DatabaseAPI.Database.EnhancementSets.Add(new EnhancementSet(frmSetEdit.mySet)); this.ImageUpdate(); this.AddListItem(DatabaseAPI.Database.EnhancementSets.Count - 1); }
void btnClone_Click(object sender, EventArgs e) { if (this.lvSets.SelectedIndices.Count <= 0) { return; } EnhancementSet iSet = new EnhancementSet(DatabaseAPI.Database.EnhancementSets[this.lvSets.SelectedIndices[0]]); iSet.DisplayName += " Copy"; frmSetEdit frmSetEdit = new frmSetEdit(ref iSet); int num = (int)frmSetEdit.ShowDialog(); if (frmSetEdit.DialogResult == DialogResult.OK) { DatabaseAPI.Database.EnhancementSets.Add(new EnhancementSet(frmSetEdit.mySet)); this.ImageUpdate(); this.AddListItem(DatabaseAPI.Database.EnhancementSets.Count - 1); } }
void btnEdit_Click(object sender, EventArgs e) { if (lvSets.SelectedIndices.Count <= 0) { return; } bool flag = false; string uidOld = ""; int selectedIndex1 = lvSets.SelectedIndices[0]; EnhancementSetCollection enhancementSets = DatabaseAPI.Database.EnhancementSets; int selectedIndex2 = this.lvSets.SelectedIndices[0]; /*string setName = Regex.Replace(lvSets.SelectedItems[0].Text, @"( \(\w+\))", ""); * var setNameIndex = enhancementSets.FindIndex(x => x.DisplayName == setName);*/ EnhancementSet iSet = enhancementSets[selectedIndex2]; enhancementSets[selectedIndex2] = iSet; frmSetEdit frmSetEdit = new frmSetEdit(ref iSet); int num = (int)frmSetEdit.ShowDialog(); if (frmSetEdit.DialogResult != DialogResult.OK) { return; } if (frmSetEdit.mySet.Uid != DatabaseAPI.Database.EnhancementSets[lvSets.SelectedIndices[0]].Uid) { flag = true; uidOld = DatabaseAPI.Database.EnhancementSets[lvSets.SelectedIndices[0]].Uid; } DatabaseAPI.Database.EnhancementSets[lvSets.SelectedIndices[0]] = new EnhancementSet(frmSetEdit.mySet); ImageUpdate(); UpdateListItem(selectedIndex1); if (!flag) { return; } RenameIOSet(uidOld, frmSetEdit.mySet.Uid); DatabaseAPI.MatchEnhancementIDs(); }