Exemplo n.º 1
0
        private void btnOptional_Click(object sender, EventArgs e)
        {
            SelectModsForm smf = new SelectModsForm(OptionalMods.ToArray(), Mods.ToArray(true));

            smf.ShowDialog();
            if (smf.DialogResult == DialogResult.None)
            {
                return;
            }
            foreach (Mod m in smf.SelectedMods)
            {
                if (lsModsToDelete.Items.Contains(Path.GetFileName(m.File)))
                {
                    lsModsToDelete.Items.Remove(Path.GetFileName(m.File));
                    lsMods.Items.Add(m);
                    Mods.Add(m);
                }
                else if (!lsModsToUpdate.Items.Contains(m) && !lsMods.Items.Contains(m))
                {
                    lsModsToUpdate.Items.Add(m);
                    Mods.Add(m);
                }
            }
            foreach (Mod m in smf.UnselectedMods)
            {
                bool delete = false;
                if (lsModsToUpdate.Items.Contains(m))
                {
                    lsModsToUpdate.Items.Remove(m);
                    delete = true;
                }
                else if (lsMods.Items.Contains(m))
                {
                    lsMods.Items.Remove(m);
                    delete = true;
                }
                if (delete)
                {
                    lsModsToDelete.Items.Add(Path.GetFileName(m.File));
                    Mods.Remove(m);
                }
            }
        }
Exemplo n.º 2
0
 private void btnOptional_Click(object sender, EventArgs e)
 {
     SelectModsForm smf = new SelectModsForm(OptionalMods.ToArray(), Mods.ToArray(true));
     smf.ShowDialog();
     if (smf.DialogResult == DialogResult.None) return;
     foreach (Mod m in smf.SelectedMods)
     {
         if (lsModsToDelete.Items.Contains(Path.GetFileName(m.File)))
         {
             lsModsToDelete.Items.Remove(Path.GetFileName(m.File));
             lsMods.Items.Add(m);
             Mods.Add(m);
         }
         else if (!lsModsToUpdate.Items.Contains(m) && !lsMods.Items.Contains(m))
         {
             lsModsToUpdate.Items.Add(m);
             Mods.Add(m);
         }
     }
     foreach (Mod m in smf.UnselectedMods)
     {
         bool delete = false;
         if (lsModsToUpdate.Items.Contains(m))
         {
             lsModsToUpdate.Items.Remove(m);
             delete = true;
         }
         else if (lsMods.Items.Contains(m))
         {
             lsMods.Items.Remove(m);
             delete = true;
         }
         if (delete)
         {
             lsModsToDelete.Items.Add(Path.GetFileName(m.File));
             Mods.Remove(m);
         }
     }
 }