/// <summary> /// Loads all mods directly into the process. /// </summary> public void LoadForAppConfig(IApplicationConfig applicationConfig) { Wrappers.ThrowIfENotEqual(IsLoaded, false, Errors.ModLoaderAlreadyInitialized); Application = applicationConfig; // Get all mods and their paths. var allModsForApplication = ApplicationConfig.GetAllMods(Application, out var allMods, LoaderConfig.GetModConfigDirectory()); // Get list of mods to load and load them. var modsToLoad = allModsForApplication.Where(x => x.Enabled).Select(x => x.Generic.Config); LoadModsWithDependencies(modsToLoad, allMods); Manager.LoaderApi.OnModLoaderInitialized(); IsLoaded = true; }
/* Public Interface */ public void LoadMod(string modId) { Wrappers.ThrowIfENotEqual(IsLoaded, true, Errors.ModLoaderNotInitialized); // Check for duplicate. if (Manager.IsModLoaded(modId)) { throw new ReloadedException(Errors.ModAlreadyLoaded(modId)); } // Note: Code below already ensures no duplicates but it would be nice to // throw for the end users of the loader servers so they can see the error. var mod = FindMod(modId, out var allMods); var modArray = new[] { (ModConfig)mod.Config }; LoadModsWithDependencies(modArray, allMods); }
public void SuspendMod(string modId) { Wrappers.ThrowIfENotEqual(IsLoaded, true, Errors.ModLoaderNotInitialized); Manager.SuspendMod(modId); }
public ModInfo[] GetLoadedModInfo() { Wrappers.ThrowIfENotEqual(IsLoaded, true, Errors.ModLoaderNotInitialized); return(Manager.GetLoadedModInfo()); }
public List <ModInfo> GetLoadedModSummary() { Wrappers.ThrowIfENotEqual(IsLoaded, true, Errors.ModLoaderNotInitialized); return(Manager.GetLoadedModSummary()); }