Exemplo 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;
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 2
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;
                        }
                    }
                }
            }
        }