Esempio n. 1
0
        public static void RebuildModList()
        {
            nestedRebuildInProgress = rebuildingModList;
            rebuildingModList       = true;
            string s = "Rebuilding mods list";

            mods.Clear();
            WorkshopItems.EnsureInit();
            s += "\nAdding official mods from content folder:";
            foreach (string item in from d in new DirectoryInfo(GenFilePaths.OfficialModsFolderPath).GetDirectories()
                     select d.FullName)
            {
                ModMetaData modMetaData = new ModMetaData(item, official: true);
                if (TryAddMod(modMetaData))
                {
                    s = s + "\n  Adding " + modMetaData.ToStringLong();
                }
            }
            s += "\nAdding mods from mods folder:";
            foreach (string item2 in from d in new DirectoryInfo(GenFilePaths.ModsFolderPath).GetDirectories()
                     select d.FullName)
            {
                ModMetaData modMetaData2 = new ModMetaData(item2);
                if (TryAddMod(modMetaData2))
                {
                    s = s + "\n  Adding " + modMetaData2.ToStringLong();
                }
            }
            s += "\nAdding mods from Steam:";
            foreach (WorkshopItem item3 in WorkshopItems.AllSubscribedItems.Where((WorkshopItem it) => it is WorkshopItem_Mod))
            {
                ModMetaData modMetaData3 = new ModMetaData(item3);
                if (TryAddMod(modMetaData3))
                {
                    s = s + "\n  Adding " + modMetaData3.ToStringLong();
                }
            }
            s += "\nDeactivating not-installed mods:";
            ModsConfig.DeactivateNotInstalledMods(delegate(string log)
            {
                s = s + "\n   " + log;
            });
            if (Prefs.SimulateNotOwningRoyalty)
            {
                ModsConfig.SetActive(ModContentPack.RoyaltyModPackageId, active: false);
            }
            if (mods.Count((ModMetaData m) => m.Active) == 0)
            {
                s += "\nThere are no active mods. Activating Core mod.";
                mods.First((ModMetaData m) => m.IsCoreMod).Active = true;
            }
            RecacheRoyaltyInstalled();
            if (Prefs.LogVerbose)
            {
                Log.Message(s);
            }
            rebuildingModList       = false;
            nestedRebuildInProgress = false;
        }
Esempio n. 2
0
        internal static void RebuildModList()
        {
            string s = "Rebuilding mods list";

            ModLister.mods.Clear();
            s += "\nAdding mods from mods folder:";
            foreach (string current in from d in new DirectoryInfo(GenFilePaths.CoreModsFolderPath).GetDirectories()
                     select d.FullName)
            {
                ModMetaData modMetaData = new ModMetaData(current);
                ModLister.mods.Add(modMetaData);
                s = s + "\n  Adding " + modMetaData.ToStringLong();
            }
            s += "\nAdding mods from Steam:";
            foreach (WorkshopItem current2 in from it in WorkshopItems.AllSubscribedItems
                     where it is WorkshopItem_Mod
                     select it)
            {
                ModMetaData modMetaData2 = new ModMetaData(current2);
                ModLister.mods.Add(modMetaData2);
                s = s + "\n  Adding " + modMetaData2.ToStringLong();
            }
            s += "\nDeactivating not-installed mods:";
            ModsConfig.DeactivateNotInstalledMods(delegate(string log)
            {
                s = s + "\n   " + log;
            });
            if (ModLister.mods.Count((ModMetaData m) => m.Active) == 0)
            {
                s += "\nThere are no active mods. Activating Core mod.";
                ModLister.mods.First((ModMetaData m) => m.IsCoreMod).Active = true;
            }
            if (Prefs.LogVerbose)
            {
                Log.Message(s);
            }
        }