Пример #1
0
 /* Initialize/Uninitialize when Controller Hook Loading/Unloading */
 private void ModLoading(IModV1 mod, IModConfigV1 modConfig)
 {
     if (modConfig.ModId == ControllerHookModId)
     {
         Initialize();
     }
 }
Пример #2
0
 private void ModUnloading(IModV1 mod, IModConfigV1 modConfig)
 {
     if (modConfig.ModId == ControllerHookModId)
     {
         DoSuspend();
     }
 }
Пример #3
0
 /* Events */
 private void OnRedirectorLoaded(IModV1 arg1, IModConfigV1 arg2)
 {
     if (arg2.ModId.Equals("reloaded.universal.redirector", StringComparison.OrdinalIgnoreCase))
     {
         _swapper.SetRedirector(_modLoader.GetController <IRedirectorController>());
     }
 }
Пример #4
0
 private void ModLoaded(IModV1 mod, IModConfigV1 modConfig)
 {
     if (modConfig.ModId == RedirectorId)
     {
         SetupEventFromRedirector();
     }
 }
 /// <summary>
 /// Add stage mods requiring this.
 /// </summary>
 private void ModLoading(IModV1 mod, IModConfigV1 modConfig)
 {
     if (modConfig.ModDependencies.Contains(ThisModId))
     {
         _collection.AddMod(modConfig.ModId);
     }
 }
 private void ModLoaded(IModV1 modInstance, IModConfigV1 modConfig)
 {
     if (modConfig.ModId == HookModId)
     {
         SetupController();
     }
 }
Пример #7
0
        /* Native Mods */
        public ModInstance(IModV1 mod, IModConfig config)
        {
            Mod       = mod;
            ModConfig = config;

            CanSuspend = mod.CanSuspend();
            CanUnload  = mod.CanUnload();
        }
Пример #8
0
        /* Dll Mods */
        public ModInstance(LoadContext context, IModV1 mod, IModConfig config)
        {
            Context   = context;
            Mod       = mod;
            ModConfig = config;

            CanSuspend = mod.CanSuspend();
            CanUnload  = mod.CanUnload();
        }
Пример #9
0
        /* Dll Mods */
        public ModInstance(PluginLoader loader, IModV1 mod, IModConfig config)
        {
            Loader    = loader;
            Mod       = mod;
            ModConfig = config;

            CanSuspend = mod.CanSuspend();
            CanUnload  = mod.CanUnload();
        }
Пример #10
0
 private void AutoDisposeController_NoInline(IModV1 modToRemove)
 {
     foreach (var mapping in _controllerModMapping.ToArray())
     {
         var mod = mapping.Value.Mod;
         if (mod.Equals(modToRemove))
         {
             _controllerModMapping.Remove(mapping.Key, out _);
         }
     }
 }
Пример #11
0
 private void AutoDisposePlugin(IModV1 modToRemove, IModConfigV1 modConfigToRemove)
 {
     // Note: Assumes no copying takes place.
     foreach (var mapping in _interfaceModMapping.ToArray())
     {
         var mod = mapping.Value.Mod;
         if (mod.Equals(modToRemove))
         {
             _interfaceModMapping.Remove(mapping.Key, out _);
         }
     }
 }
Пример #12
0
 private void AutoDisposePlugin_NoInline(IModV1 modToRemove)
 {
     foreach (var modMapping in _interfaceModMapping.ToArray())
     {
         foreach (var mapping in modMapping.Value.ToArray())
         {
             if (mapping.Mod.Equals(modToRemove))
             {
                 modMapping.Value.Remove(mapping);
             }
         }
     }
 }
Пример #13
0
 private void OnModLoading(IModV1 modInstance, IModConfigV1 modConfig) => _afsHook.OnModLoading(_modLoader.GetDirectoryForModId(modConfig.ModId));
Пример #14
0
 public void AddOrReplaceController <T>(IModV1 owner, T instance)
 {
     _controllerModMapping[typeof(T)] = new ModGenericTuple <object>(owner, instance);
 }
 private void ModLoading(IModV1 mod, IModConfigV1 config) => _redirector.Add(config);
 private void ModUnloading(IModV1 mod, IModConfigV1 config) => _redirector.Remove(config);
Пример #17
0
 private void AutoDisposePlugin(IModV1 modToRemove, IModConfigV1 modConfigToRemove)
 {
     // Note: Assumes no copying takes place.
     AutoDisposePlugin_NoInline(modToRemove);
     GC.Collect();
 }
Пример #18
0
 public ModGenericTuple(IModV1 mod, T generic)
 {
     Mod     = mod;
     Generic = generic;
 }