Esempio n. 1
0
 // Token: 0x06000EEF RID: 3823 RVA: 0x00065CB4 File Offset: 0x000640B4
 public static void getRequiredModules(List <Module> result)
 {
     if (ModuleHook.modules == null || result == null)
     {
         return;
     }
     for (int i = 0; i < ModuleHook.modules.Count; i++)
     {
         Module module = ModuleHook.modules[i];
         if (module != null)
         {
             ModuleConfig config = module.config;
             if (config != null)
             {
                 for (int j = 0; j < config.Assemblies.Count; j++)
                 {
                     ModuleAssembly moduleAssembly = config.Assemblies[j];
                     if (moduleAssembly != null)
                     {
                         if (moduleAssembly.Role == EModuleRole.Both_Required)
                         {
                             result.Add(module);
                             break;
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 2
0
 public Module(ModuleConfig newConfig)
 {
     this.config    = newConfig;
     this.isEnabled = false;
     this.status    = EModuleStatus.None;
     this.nexii     = new List <IModuleNexus>();
     this.register();
 }
Esempio n. 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);
        }
Esempio n. 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();
     }
 }
Esempio n. 5
0
        // Token: 0x06000EFC RID: 3836 RVA: 0x000664D8 File Offset: 0x000648D8
        private void loadModules()
        {
            ModuleHook.modules        = new List <Module>();
            ModuleHook.nameToPath     = new Dictionary <string, string>();
            ModuleHook.nameToAssembly = new Dictionary <string, Assembly>();
            List <ModuleConfig> list = this.findModules();

            this.sortModules(list);
            for (int i = 0; i < list.Count; i++)
            {
                ModuleConfig moduleConfig = list[i];
                if (moduleConfig != null)
                {
                    Module item = new Module(moduleConfig);
                    ModuleHook.modules.Add(item);
                }
            }
        }
Esempio n. 6
0
        // Token: 0x06000EF6 RID: 3830 RVA: 0x00065F28 File Offset: 0x00064328
        private static bool areModuleDependenciesEnabled(int moduleIndex)
        {
            Module       module = ModuleHook.modules[moduleIndex];
            ModuleConfig config = module.config;

            for (int i = 0; i < config.Dependencies.Count; i++)
            {
                ModuleDependency moduleDependency = config.Dependencies[i];
                int index = moduleIndex - 1;
                while (moduleIndex >= 0)
                {
                    if (ModuleHook.modules[index].config.Name == moduleDependency.Name && !ModuleHook.modules[index].isEnabled)
                    {
                        return(false);
                    }
                    moduleIndex--;
                }
            }
            return(true);
        }
Esempio n. 7
0
 // Token: 0x06000EFA RID: 3834 RVA: 0x000661E0 File Offset: 0x000645E0
 private void findModules(string path, List <ModuleConfig> configs)
 {
     foreach (string text in Directory.GetFiles(path, "*.module"))
     {
         ModuleConfig moduleConfig = IOUtility.jsonDeserializer.deserialize <ModuleConfig>(text);
         if (moduleConfig != null)
         {
             moduleConfig.DirectoryPath    = path;
             moduleConfig.FilePath         = text;
             moduleConfig.Version_Internal = Parser.getUInt32FromIP(moduleConfig.Version);
             for (int j = 0; j < moduleConfig.Dependencies.Count; j++)
             {
                 ModuleDependency moduleDependency = moduleConfig.Dependencies[j];
                 moduleDependency.Version_Internal = Parser.getUInt32FromIP(moduleDependency.Version);
             }
             configs.Add(moduleConfig);
         }
     }
     foreach (string path2 in Directory.GetDirectories(path))
     {
         this.findModules(path2, configs);
     }
 }
Esempio n. 8
0
        // Token: 0x06000EFB RID: 3835 RVA: 0x000662C4 File Offset: 0x000646C4
        private void sortModules(List <ModuleConfig> configs)
        {
            ModuleComparer comparer = new ModuleComparer();

            configs.Sort(comparer);
            for (int i = 0; i < configs.Count; i++)
            {
                ModuleConfig moduleConfig = configs[i];
                bool         flag         = true;
                for (int j = moduleConfig.Assemblies.Count - 1; j >= 0; j--)
                {
                    ModuleAssembly moduleAssembly = moduleConfig.Assemblies[j];
                    if (moduleAssembly.Role == EModuleRole.Client && Dedicator.isDedicated)
                    {
                        moduleConfig.Assemblies.RemoveAt(j);
                    }
                    else if (moduleAssembly.Role == EModuleRole.Server && !Dedicator.isDedicated)
                    {
                        moduleConfig.Assemblies.RemoveAt(j);
                    }
                    else
                    {
                        bool flag2 = false;
                        for (int k = 1; k < moduleAssembly.Path.Length; k++)
                        {
                            if (moduleAssembly.Path[k] == '.' && moduleAssembly.Path[k - 1] == '.')
                            {
                                flag2 = true;
                                break;
                            }
                        }
                        if (flag2)
                        {
                            flag = false;
                            break;
                        }
                        string path = moduleConfig.DirectoryPath + moduleAssembly.Path;
                        if (!File.Exists(path))
                        {
                            flag = false;
                            break;
                        }
                    }
                }
                if (!flag || moduleConfig.Assemblies.Count == 0)
                {
                    configs.RemoveAt(i);
                    i--;
                }
                else
                {
                    for (int l = 0; l < moduleConfig.Dependencies.Count; l++)
                    {
                        ModuleDependency moduleDependency = moduleConfig.Dependencies[l];
                        bool             flag3            = false;
                        for (int m = i - 1; m >= 0; m--)
                        {
                            if (configs[m].Name == moduleDependency.Name)
                            {
                                if (configs[m].Version_Internal >= moduleDependency.Version_Internal)
                                {
                                    flag3 = true;
                                }
                                break;
                            }
                        }
                        if (!flag3)
                        {
                            configs.RemoveAtFast(i);
                            i--;
                            break;
                        }
                    }
                }
            }
        }