Beispiel #1
0
 public void ResetLists()
 {
     foreach (ModEntry mod in ActiveMods)
     {
         mod.IsActive = false;
         InsertSorted(mod);
     }
     activeMods = new ActiveModList();
 }
Beispiel #2
0
        //Public Functions
        public void FetchMods()
        {
            //Create temp lists
            List <ModEntry> tempPassive = new List <ModEntry>();
            List <ModEntry> tempActive  = new List <ModEntry>();

            //Load existing mod list
            if (File.Exists(MOD_LIST))
            {
                passivMods = Tools.Deserilize(MOD_LIST);
            }

            //Read mod folder for changes
            bool needToCereal = false;

            foreach (string modPath in Directory.GetDirectories(Program.MOD_PATH))
            {
                if (!modPath.Equals(Program.MOD_MERGER)) //Ignore Mod Merger
                {
                    ModEntry mod = SearchLoadedMods(modPath);
                    if (mod == null) //Such mod has not been loaded yet
                    {
                        needToCereal = true;
                        tempPassive.Add(ModEntry.BuildModEntry(modPath));
                    }
                    else //I know a mod like that
                    {
                        mod.FetchInfo();
                        if (mod.IsActive)
                        {
                            tempActive.Add(mod);
                        }
                        else
                        {
                            tempPassive.Add(mod);
                        }

                        passivMods.Remove(mod);
                    }
                }
            }
            if (passivMods.Count > 0)
            {
                needToCereal = true;                       //Too many mods?
            }
            passivMods = tempPassive;
            passivMods.Sort();

            activeMods = new ActiveModList(tempActive);

            if (needToCereal)
            {
                Cereal();
            }
        }
Beispiel #3
0
 public void RefreshMods()
 {
     passivMods = new List <ModEntry>();
     activeMods = new ActiveModList();
     FetchMods();
 }