Ejemplo n.º 1
0
 internal static void PreLoadMods()
 {
     foreach (var modid in loadOrder)
     {
         var mod = Mods[modid];
         try
         {
             EnumHolderResolver.RegisterAllEnums(mod.EntryType.Module);
             ConfigManager.PopulateConfigs(mod);
             mod.PreLoad();
             Console.Console.Reload += () =>
             {
                 SRMod.ForceModContext(mod);
                 foreach (var v in mod.Configs)
                 {
                     v.TryLoadFromFile();
                 }
                 SRMod.ClearModContext();
             };
         }
         catch (Exception e)
         {
             throw new Exception($"Error pre-loading mod '{modid}'!\n{e.GetType().Name}: {e}");
         }
     }
 }
Ejemplo n.º 2
0
 internal static void ReloadMods()
 {
     CurrentLoadingStep = LoadingStep.RELOAD;
     foreach (var modid in loadOrder)
     {
         var mod = Mods[modid];
         try
         {
             SRMod.ForceModContext(mod);
             foreach (var v in mod.Configs)
             {
                 v.TryLoadFromFile();
             }
             SRMod.ClearModContext();
             mod.Reload();
         }
         catch (Exception e)
         {
             throw new Exception($"Error reloading mod '{modid}'!\n{e.GetType().Name}: {e}");
         }
     }
     CurrentLoadingStep = LoadingStep.FINISHED;
 }
Ejemplo n.º 3
0
 internal static void ReLoadMods()
 {
     CurrentLoadingStep = LoadingStep.RELOAD;
     foreach (string key in loadOrder)
     {
         SRMod mod = Mods[key];
         try
         {
             SRMod.ForceModContext(mod);
             foreach (var v in mod.Configs)
             {
                 v.TryLoadFromFile();
             }
             SRMod.ClearModContext();
             mod.ReLoad();
         }
         catch (Exception ex)
         {
             Debug.LogError(new Exception(string.Format("Error reloading mod '{0}'!\n{1}: {2}", (object)key, (object)ex.GetType().Name, (object)ex)));
         }
     }
     CurrentLoadingStep = LoadingStep.FINISHED;
 }