Example #1
0
        private bool LoadMod()
        {
            //first get the total file count using mod.Files loop

            ListView.CheckedListViewItemCollection selectedMods = InstalledMods.CheckedItems;

            //reset the applied mods list
            App.Default.ModList = null;

            int fileCount = 0;

            ModLoaders loader = new ModLoaders();

            foreach (ModLoader mod in _zippedMods)
            {
                //find file count for progress bar testing selected mods
                if (selectedMods.ContainsKey(mod.name))
                {
                    fileCount = fileCount + mod.zipFiles.Count;
                }
            }

            //set the progress bar total
            ApplyProgressBar.Maximum = fileCount;
            //reset the progress bar
            ApplyProgressBar.Value = 0;
            //ApplyProgressBar.Show();

            foreach (ModLoader mod in _zippedMods)
            {
                //App.Default.ModList.Add(mod.name);
                if (selectedMods.ContainsKey(mod.name))
                {
                    loader.Add(mod);
                    if (App.Default.ModList == null)
                    {
                        App.Default.ModList += mod.name;
                    }
                    else
                    {
                        App.Default.ModList += "," + mod.name;
                    }
                    //subscribe to the progress update
                    mod.ProgressChanged += UpdateProgress;
                    mod.ProcessDone     += ProcessFinished;
                }
            }

            App.Default.Save();
            //return whether or not loader was successful
            if (selectedMods.Count == 1 && selectedMods.ContainsKey("Vanilla"))
            {
                return(loader.BeginRestore());
            }
            else
            {
                return(loader.BeginImport());
            }
        }
Example #2
0
        private void InstalledMods_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListView.SelectedListViewItemCollection selectedMod = InstalledMods.SelectedItems;

            ModLoaders loader = new ModLoaders();

            foreach (ModLoader mod in _zippedMods)
            {
                if (selectedMod.ContainsKey(mod.name))
                {
                    htmlDescription.Navigate(mod.htmlinfo);
                }
            }
        }