Пример #1
0
        void btnClone_Click(object sender, EventArgs e)

        {
            if (lvSets.SelectedIndices.Count <= 0)
            {
                return;
            }
            EnhancementSet iSet = new EnhancementSet(DatabaseAPI.Database.EnhancementSets[lvSets.SelectedIndices[0]]);

            iSet.DisplayName += " Copy";
            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));
            ImageUpdate();
            AddListItem(DatabaseAPI.Database.EnhancementSets.Count - 1);
        }
Пример #2
0
        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();
        }