예제 #1
0
        // Token: 0x06000EF5 RID: 3829 RVA: 0x00065EEC File Offset: 0x000642EC
        protected Assembly handleAssemblyResolve(object sender, ResolveEventArgs args)
        {
            Assembly assembly = ModuleHook.resolveAssemblyName(args.Name);

            if (assembly == null)
            {
                Debug.LogError("Unable to resolve dependency \"" + args.Name + "\"! Include it in one of your module assembly lists.");
            }
            return(assembly);
        }
예제 #2
0
 protected void register()
 {
     if (this.config == null)
     {
         return;
     }
     for (int i = 0; i < this.config.Assemblies.Count; i++)
     {
         ModuleHook.registerAssemblyPath(this.config.DirectoryPath + this.config.Assemblies[i].Path);
     }
 }
예제 #3
0
        // Token: 0x06000EF1 RID: 3825 RVA: 0x00065DD8 File Offset: 0x000641D8
        public static void toggleModuleEnabled(int index)
        {
            if (index < 0 || index >= ModuleHook.modules.Count)
            {
                return;
            }
            Module       module = ModuleHook.modules[index];
            ModuleConfig config = module.config;

            config.IsEnabled = !config.IsEnabled;
            IOUtility.jsonSerializer.serialize <ModuleConfig>(module.config, config.FilePath, true);
            ModuleHook.updateModuleEnabled(index, config.IsEnabled);
        }
예제 #4
0
 // Token: 0x06000EFE RID: 3838 RVA: 0x000665A8 File Offset: 0x000649A8
 private void initializeModules()
 {
     if (ModuleHook.modules == null)
     {
         return;
     }
     for (int i = 0; i < ModuleHook.modules.Count; i++)
     {
         Module       module = ModuleHook.modules[i];
         ModuleConfig config = module.config;
         module.isEnabled = (config.IsEnabled && ModuleHook.areModuleDependenciesEnabled(i) && !ModuleHook.isModuleDisabledByCommandLine(config.Name));
     }
     if (ModuleHook.onModulesInitialized != null)
     {
         ModuleHook.onModulesInitialized();
     }
 }
예제 #5
0
 // Token: 0x06000EFF RID: 3839 RVA: 0x00066630 File Offset: 0x00064A30
 private void shutdownModules()
 {
     if (ModuleHook.modules == null)
     {
         return;
     }
     for (int i = ModuleHook.modules.Count - 1; i >= 0; i--)
     {
         Module module = ModuleHook.modules[i];
         if (module != null)
         {
             module.isEnabled = false;
         }
     }
     if (ModuleHook.onModulesShutdown != null)
     {
         ModuleHook.onModulesShutdown();
     }
 }
예제 #6
0
        protected void load()
        {
            if (this.config == null || this.assemblies != null)
            {
                return;
            }
            if (!this.config.IsEnabled)
            {
                return;
            }
            List <Type> list = new List <Type>();

            this.assemblies = new Assembly[this.config.Assemblies.Count];
            for (int i = 0; i < this.config.Assemblies.Count; i++)
            {
                Assembly assembly = ModuleHook.resolveAssemblyPath(this.config.DirectoryPath + this.config.Assemblies[i].Path);
                this.assemblies[i] = assembly;
                Type[] types;
                try
                {
                    types = assembly.GetTypes();
                }
                catch (ReflectionTypeLoadException ex)
                {
                    types = ex.Types;
                }
                if (types != null)
                {
                    for (int j = 0; j < types.Length; j++)
                    {
                        if (types[j] != null)
                        {
                            list.Add(types[j]);
                        }
                    }
                }
            }
            this.types = list.ToArray();
            if (this.onModuleLoaded != null)
            {
                this.onModuleLoaded(this);
            }
        }
예제 #7
0
 // Token: 0x06000EF7 RID: 3831 RVA: 0x00065FC8 File Offset: 0x000643C8
 private static void updateModuleEnabled(int index, bool enable)
 {
     if (enable)
     {
         if (ModuleHook.modules[index].config.IsEnabled && ModuleHook.areModuleDependenciesEnabled(index) && !ModuleHook.isModuleDisabledByCommandLine(ModuleHook.modules[index].config.Name))
         {
             ModuleHook.modules[index].isEnabled = true;
             for (int i = index + 1; i < ModuleHook.modules.Count; i++)
             {
                 for (int j = 0; j < ModuleHook.modules[i].config.Dependencies.Count; j++)
                 {
                     ModuleDependency moduleDependency = ModuleHook.modules[i].config.Dependencies[j];
                     if (moduleDependency.Name == ModuleHook.modules[index].config.Name)
                     {
                         ModuleHook.updateModuleEnabled(i, true);
                         break;
                     }
                 }
             }
         }
     }
     else
     {
         for (int k = ModuleHook.modules.Count - 1; k > index; k--)
         {
             for (int l = 0; l < ModuleHook.modules[k].config.Dependencies.Count; l++)
             {
                 ModuleDependency moduleDependency2 = ModuleHook.modules[k].config.Dependencies[l];
                 if (moduleDependency2.Name == ModuleHook.modules[index].config.Name)
                 {
                     ModuleHook.updateModuleEnabled(k, false);
                     break;
                 }
             }
         }
         ModuleHook.modules[index].isEnabled = false;
     }
 }
예제 #8
0
        // Token: 0x06000EF4 RID: 3828 RVA: 0x00065ECC File Offset: 0x000642CC
        public static Assembly resolveAssemblyPath(string path)
        {
            AssemblyName assemblyName = AssemblyName.GetAssemblyName(path);

            return(ModuleHook.resolveAssemblyName(assemblyName.FullName));
        }