コード例 #1
0
    /// <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;
    }
コード例 #2
0
    /* 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);
    }
コード例 #3
0
 public void SuspendMod(string modId)
 {
     Wrappers.ThrowIfENotEqual(IsLoaded, true, Errors.ModLoaderNotInitialized);
     Manager.SuspendMod(modId);
 }
コード例 #4
0
 public ModInfo[] GetLoadedModInfo()
 {
     Wrappers.ThrowIfENotEqual(IsLoaded, true, Errors.ModLoaderNotInitialized);
     return(Manager.GetLoadedModInfo());
 }
コード例 #5
0
 public List <ModInfo> GetLoadedModSummary()
 {
     Wrappers.ThrowIfENotEqual(IsLoaded, true, Errors.ModLoaderNotInitialized);
     return(Manager.GetLoadedModSummary());
 }