Пример #1
0
        private static void ExcludeModuleManagers(ref HashSet <string> nativeClasses)
        {
            string[] moduleNames        = ModuleMetadata.GetModuleNames();
            int      derivedFromClassID = BaseObjectTools.StringToClassID("GlobalGameManager");

            foreach (string str in moduleNames)
            {
                if (ModuleMetadata.GetModuleStrippable(str))
                {
                    int[]            moduleClasses = ModuleMetadata.GetModuleClasses(str);
                    HashSet <int>    set           = new HashSet <int>();
                    HashSet <string> other         = new HashSet <string>();
                    foreach (int num3 in moduleClasses)
                    {
                        if (BaseObjectTools.IsDerivedFromClassID(num3, derivedFromClassID))
                        {
                            set.Add(num3);
                        }
                        else
                        {
                            other.Add(BaseObjectTools.ClassIDToString(num3));
                        }
                    }
                    if ((other.Count != 0) && !nativeClasses.Overlaps(other))
                    {
                        foreach (int num5 in set)
                        {
                            nativeClasses.Remove(BaseObjectTools.ClassIDToString(num5));
                        }
                    }
                }
            }
        }
Пример #2
0
        private static void ExcludeModuleManagers(ref HashSet <UnityType> nativeClasses)
        {
            if (AssemblyStripper.UseUnityLinkerEngineModuleStripping)
            {
                throw new NotSupportedException("Don't want to rely on this method when UnityLinker EMS is used");
            }

            string[] moduleNames = ModuleMetadata.GetModuleNames();

            foreach (string module in moduleNames)
            {
                if (!ModuleMetadata.IsStrippableModule(module)) // Only handle strippable modules
                {
                    continue;
                }

                var moduleClasses = ModuleMetadata.GetModuleTypes(module);

                // Find (non-)manager classes
                HashSet <UnityType> managerClasses    = new HashSet <UnityType>();
                HashSet <UnityType> nonManagerClasses = new HashSet <UnityType>();
                foreach (var klass in moduleClasses)
                {
                    if (klass.IsDerivedFrom(GameManagerTypeInfo))
                    {
                        managerClasses.Add(klass);
                    }
                    else
                    {
                        nonManagerClasses.Add(klass);
                    }
                }

                // At least one non-manager class is required for the removal attempt
                if (nonManagerClasses.Count == 0)
                {
                    continue;
                }

                // Exclude manager classes if no non-manager classes are present
                if (!nativeClasses.Overlaps(nonManagerClasses))
                {
                    foreach (var klass in managerClasses)
                    {
                        nativeClasses.Remove(klass);
                    }
                }
                else
                {
                    foreach (var klass in managerClasses)
                    {
                        nativeClasses.Add(klass);
                    }
                }
            }
        }
Пример #3
0
        public static void InjectCustomDependencies(BuildTarget target, StrippingInfo strippingInfo, HashSet <UnityType> nativeClasses,
                                                    HashSet <string> nativeModules)
        {
            // This function can be used to inject user-readable dependency information for specific classes which would not be obvious otherwise.
            // Can also be used to set up dependencies to modules which cannot be derived by the build pipeline without custom rules
            const string connectSettingsName         = "UnityConnectSettings";
            var          connectSettings             = UnityType.FindTypeByName(connectSettingsName);
            const string cloudWebServicesManagerName = "CloudWebServicesManager";
            var          cloudWebServicesManager     = UnityType.FindTypeByName(cloudWebServicesManagerName);

            if (nativeClasses.Contains(connectSettings) || nativeClasses.Contains(cloudWebServicesManager))
            {
                if (PlayerSettings.submitAnalytics)
                {
                    const string requiredMessage = "Required by HW Statistics (See Player Settings)";
                    strippingInfo.RegisterDependency(connectSettingsName, requiredMessage);
                    strippingInfo.RegisterDependency(cloudWebServicesManagerName, requiredMessage);
                    strippingInfo.SetIcon(requiredMessage, "class/PlayerSettings");
                }
            }

            const string analyticsManagerName = "UnityAnalyticsManager";
            var          analyticsManager     = UnityType.FindTypeByName(analyticsManagerName);

            if (nativeClasses.Contains(analyticsManager))
            {
                if (UnityEditor.Analytics.AnalyticsSettings.enabled)
                {
                    const string requiredMessage = "Required by Unity Analytics (See Services Window)";
                    strippingInfo.RegisterDependency(analyticsManagerName, requiredMessage);
                    strippingInfo.SetIcon(requiredMessage, "class/PlayerSettings");
                }
            }

            if (UnityEditorInternal.VR.VRModule.ShouldInjectVRDependenciesForBuildTarget(target))
            {
                const string moduleName      = "VR";
                const string requiredMessage = "Required because VR is enabled in PlayerSettings";
                nativeModules.Add(moduleName);
                strippingInfo.RegisterDependency(StrippingInfo.ModuleName(moduleName), requiredMessage);
                strippingInfo.SetIcon(requiredMessage, "class/PlayerSettings");
            }

            foreach (string module in ModuleMetadata.GetModuleNames())
            {
                if (!ModuleMetadata.IsStrippableModule(module))
                {
                    string requiredMessage = module + " is always required";
                    nativeModules.Add(module);
                    strippingInfo.AddModule(module);
                    strippingInfo.RegisterDependency(StrippingInfo.ModuleName(module), requiredMessage);
                    strippingInfo.SetIcon(requiredMessage, "class/DefaultAsset");
                }
            }
        }
Пример #4
0
        private static HashSet <string> GetAllStrippableModules()
        {
            HashSet <string> nativeModules = new HashSet <string>();

            foreach (string module in ModuleMetadata.GetModuleNames())
            {
                if (ModuleMetadata.IsStrippableModule(module)) // Only handle strippable modules. Others are listed in RegisterStaticallyLinkedModulesGranular()
                {
                    nativeModules.Add(module);
                }
            }
            return(nativeModules);
        }
Пример #5
0
        private static HashSet <string> GetAllStrippableModules()
        {
            HashSet <string> stringSet = new HashSet <string>();

            foreach (string moduleName in ModuleMetadata.GetModuleNames())
            {
                if (ModuleMetadata.GetModuleStrippable(moduleName))
                {
                    stringSet.Add(moduleName);
                }
            }
            return(stringSet);
        }
Пример #6
0
        private static void ExcludeModuleManagers(ref HashSet <UnityType> nativeClasses)
        {
            string[] moduleNames = ModuleMetadata.GetModuleNames();

            foreach (string module in moduleNames)
            {
                if (!ModuleMetadata.IsStrippableModule(module)) // Only handle strippable modules
                {
                    continue;
                }

                var moduleClasses = ModuleMetadata.GetModuleTypes(module);

                // Find (non-)manager classes
                HashSet <UnityType> managerClasses    = new HashSet <UnityType>();
                HashSet <UnityType> nonManagerClasses = new HashSet <UnityType>();
                foreach (var klass in moduleClasses)
                {
                    if (klass.IsDerivedFrom(GameManagerTypeInfo))
                    {
                        managerClasses.Add(klass);
                    }
                    else
                    {
                        nonManagerClasses.Add(klass);
                    }
                }

                // At least one non-manager class is required for the removal attempt
                if (nonManagerClasses.Count == 0)
                {
                    continue;
                }

                // Exclude manager classes if no non-manager classes are present
                if (!nativeClasses.Overlaps(nonManagerClasses))
                {
                    foreach (var klass in managerClasses)
                    {
                        nativeClasses.Remove(klass);
                    }
                }
                else
                {
                    foreach (var klass in managerClasses)
                    {
                        nativeClasses.Add(klass);
                    }
                }
            }
        }
Пример #7
0
 public static void ApplyManualStrippingOverrides(HashSet <UnityType> nativeClasses, HashSet <string> nativeModules, StrippingInfo strippingInfo)
 {
     string[] moduleNames = ModuleMetadata.GetModuleNames();
     for (int i = 0; i < moduleNames.Length; i++)
     {
         string text = moduleNames[i];
         ModuleIncludeSetting moduleIncludeSettingForModule = ModuleMetadata.GetModuleIncludeSettingForModule(text);
         if (moduleIncludeSettingForModule == ModuleIncludeSetting.ForceInclude)
         {
             nativeModules.Add(text);
             UnityType[] moduleTypes = ModuleMetadata.GetModuleTypes(text);
             UnityType[] array       = moduleTypes;
             for (int j = 0; j < array.Length; j++)
             {
                 UnityType unityType = array[j];
                 nativeClasses.Add(unityType);
                 if (strippingInfo != null)
                 {
                     strippingInfo.RegisterDependency(unityType.name, "Force included module");
                     strippingInfo.RegisterDependency(StrippingInfo.ModuleName(text), unityType.name);
                 }
             }
             if (strippingInfo != null)
             {
                 strippingInfo.RegisterDependency(StrippingInfo.ModuleName(text), "Force included module");
             }
         }
         else if (moduleIncludeSettingForModule == ModuleIncludeSetting.ForceExclude)
         {
             if (nativeModules.Contains(text))
             {
                 nativeModules.Remove(text);
                 UnityType[] moduleTypes2 = ModuleMetadata.GetModuleTypes(text);
                 UnityType[] array2       = moduleTypes2;
                 for (int k = 0; k < array2.Length; k++)
                 {
                     UnityType item = array2[k];
                     if (nativeClasses.Contains(item))
                     {
                         nativeClasses.Remove(item);
                     }
                 }
                 if (strippingInfo != null)
                 {
                     strippingInfo.modules.Remove(StrippingInfo.ModuleName(text));
                 }
             }
         }
     }
 }
Пример #8
0
        public static void InjectCustomDependencies(BuildTarget target, StrippingInfo strippingInfo, HashSet <UnityType> nativeClasses,
                                                    HashSet <string> nativeModules)
        {
            if (AssemblyStripper.UseUnityLinkerEngineModuleStripping)
            {
                throw new NotSupportedException("Don't want to rely on this method when UnityLinker EMS is used");
            }

            // This function can be used to inject user-readable dependency information for specific classes which would not be obvious otherwise.
            // Can also be used to set up dependencies to modules which cannot be derived by the build pipeline without custom rules
            if (UnityEngine.Connect.UnityConnectSettings.enabled || UnityEditor.CrashReporting.CrashReportingSettings.enabled || UnityEngine.Analytics.PerformanceReporting.enabled || UnityEngine.Analytics.Analytics.enabled)
            {
                string       requiredMessage = "Required by HW Statistics (See Player Settings)";
                const string icon            = "class/PlayerSettings";
                if (UnityEngine.Analytics.Analytics.enabled || UnityEngine.Analytics.PerformanceReporting.enabled)
                {
                    requiredMessage = "Required by Analytics Performance Reporting (See Analytics Services Window)";
                    AddNativeModuleInStrippingInfo("PerformanceReporting", requiredMessage, strippingInfo, nativeModules, icon);
                }
                requiredMessage = "Required by UnityAnalytics (See Services Window)";
                AddNativeModuleInStrippingInfo("UnityAnalytics", requiredMessage, strippingInfo, nativeModules, icon);

                AddNativeModuleInStrippingInfo("UnityConnect", requiredMessage, strippingInfo, nativeModules, icon);
                strippingInfo.RegisterDependency("UnityConnectSettings", "Required by UnityAnalytics");
            }

            if (CrashReporting.CrashReportingSettings.enabled)
            {
                AddNativeModuleInStrippingInfo("CrashReporting", "Required by Crash Reporting Service (See Services Window)", strippingInfo, nativeModules, "class/PlayerSettings");
            }

            if (UnityEditorInternal.VR.VRModule.ShouldInjectVRDependenciesForBuildTarget(target))
            {
                const string moduleName      = "VR";
                const string requiredMessage = "Required because VR is enabled in PlayerSettings";
                nativeModules.Add(moduleName);
                strippingInfo.RegisterDependency(StrippingInfo.ModuleName(moduleName), requiredMessage);
                strippingInfo.SetIcon(requiredMessage, "class/PlayerSettings");
            }

            foreach (string module in ModuleMetadata.GetModuleNames())
            {
                if (!ModuleMetadata.IsStrippableModule(module))
                {
                    string requiredMessage = module + " is always required";
                    AddNativeModuleInStrippingInfo(module, requiredMessage, strippingInfo, nativeModules, "class/DefaultAsset");
                }
            }
        }
Пример #9
0
        private static HashSet <string> GetAllStrippableModules()
        {
            HashSet <string> hashSet = new HashSet <string>();

            string[] moduleNames = ModuleMetadata.GetModuleNames();
            for (int i = 0; i < moduleNames.Length; i++)
            {
                string text = moduleNames[i];
                if (ModuleMetadata.GetModuleStrippable(text))
                {
                    hashSet.Add(text);
                }
            }
            return(hashSet);
        }
Пример #10
0
        private static HashSet <string> GetRequiredStrippableModules(HashSet <UnityType> nativeClasses, StrippingInfo strippingInfo)
        {
            if (AssemblyStripper.UseUnityLinkerEngineModuleStripping)
            {
                throw new NotSupportedException("Don't want to rely on this method when UnityLinker EMS is used");
            }

            HashSet <UnityType> nativeClassesUsedInModules = new HashSet <UnityType>();
            HashSet <string>    nativeModules = new HashSet <string>();

            foreach (string module in ModuleMetadata.GetModuleNames())
            {
                if (ModuleMetadata.IsStrippableModule(module)) // Only handle strippable modules. Others are listed in RegisterStaticallyLinkedModulesGranular()
                {
                    var moduleClasses = new HashSet <UnityType>(ModuleMetadata.GetModuleTypes(module));
                    if (nativeClasses.Overlaps(moduleClasses)) // Include module if at least one of its classes is present
                    {
                        nativeModules.Add(module);
                        if (strippingInfo != null)
                        {
                            foreach (var klass in moduleClasses)
                            {
                                if (nativeClasses.Contains(klass))
                                {
                                    strippingInfo.RegisterDependency(StrippingInfo.ModuleName(module), klass.name);
                                    // Don't list GlobalGameManagers in a module will automatically be added if the module is added.
                                    nativeClassesUsedInModules.Add(klass);
                                }
                            }
                        }
                    }
                }
            }

            // Classes which have not been registered as belonging to a module belong to the Core module.
            if (strippingInfo != null)
            {
                foreach (var klass in nativeClasses)
                {
                    if (!nativeClassesUsedInModules.Contains(klass))
                    {
                        strippingInfo.RegisterDependency(StrippingInfo.ModuleName("Core"), klass.name);
                    }
                }
            }
            return(nativeModules);
        }
Пример #11
0
        public static void ApplyManualStrippingOverrides(HashSet <UnityType> nativeClasses, HashSet <string> nativeModules, StrippingInfo strippingInfo)
        {
            if (AssemblyStripper.UseUnityLinkerEngineModuleStripping)
            {
                throw new NotSupportedException("Don't want to rely on this method when UnityLinker EMS is used");
            }

            // Apply manual stripping overrides
            foreach (var module in ModuleMetadata.GetModuleNames())
            {
                var includeSetting = ModuleMetadata.GetModuleIncludeSettingForModule(module);
                if (includeSetting == ModuleIncludeSetting.ForceInclude)
                {
                    nativeModules.Add(module);
                    if (nativeClasses != null)
                    {
                        var moduleClasses = ModuleMetadata.GetModuleTypes(module);
                        foreach (var klass in moduleClasses)
                        {
                            nativeClasses.Add(klass);
                            if (strippingInfo != null)
                            {
                                strippingInfo.RegisterDependency(klass.name, "Force included module");
                                strippingInfo.RegisterDependency(StrippingInfo.ModuleName(module), klass.name);
                            }
                        }
                    }

                    if (strippingInfo != null)
                    {
                        strippingInfo.RegisterDependency(StrippingInfo.ModuleName(module), "Force included module");
                    }
                }
                else if (includeSetting == ModuleIncludeSetting.ForceExclude)
                {
                    if (nativeModules.Contains(module))
                    {
                        nativeModules.Remove(module);

                        if (strippingInfo != null)
                        {
                            strippingInfo.modules.Remove(StrippingInfo.ModuleName(module));
                        }
                    }
                }
            }
        }
        public static void ApplyManualStrippingOverrides(HashSet <UnityType> nativeClasses, HashSet <string> nativeModules, StrippingInfo strippingInfo)
        {
            // Apply manual stripping overrides
            foreach (var module in ModuleMetadata.GetModuleNames())
            {
                var includeSetting = ModuleMetadata.GetModuleIncludeSettingForModule(module);
                if (includeSetting == ModuleIncludeSetting.ForceInclude)
                {
                    nativeModules.Add(module);
                    var moduleClasses = ModuleMetadata.GetModuleTypes(module);
                    foreach (var klass in moduleClasses)
                    {
                        nativeClasses.Add(klass);
                        if (strippingInfo != null)
                        {
                            strippingInfo.RegisterDependency(klass.name, "Force included module");
                            strippingInfo.RegisterDependency(StrippingInfo.ModuleName(module), klass.name);
                        }
                    }

                    if (strippingInfo != null)
                    {
                        strippingInfo.RegisterDependency(StrippingInfo.ModuleName(module), "Force included module");
                    }
                }
                else if (includeSetting == ModuleIncludeSetting.ForceExclude)
                {
                    if (nativeModules.Contains(module))
                    {
                        nativeModules.Remove(module);
                        var moduleClasses = ModuleMetadata.GetModuleTypes(module);
                        foreach (var klass in moduleClasses)
                        {
                            if (nativeClasses.Contains(klass))
                            {
                                nativeClasses.Remove(klass);
                            }
                        }

                        if (strippingInfo != null)
                        {
                            strippingInfo.modules.Remove(StrippingInfo.ModuleName(module));
                        }
                    }
                }
            }
        }
Пример #13
0
        private static HashSet <string> GetRequiredStrippableModules(HashSet <string> nativeClasses)
        {
            HashSet <string> set = new HashSet <string>();

            foreach (string str in ModuleMetadata.GetModuleNames())
            {
                if (ModuleMetadata.GetModuleStrippable(str))
                {
                    HashSet <string> classNames = GetClassNames(ModuleMetadata.GetModuleClasses(str));
                    if (nativeClasses.Overlaps(classNames))
                    {
                        set.Add(str);
                    }
                }
            }
            return(set);
        }
Пример #14
0
        private static HashSet <string> GetRequiredStrippableModules(HashSet <string> nativeClasses)
        {
            HashSet <string> stringSet = new HashSet <string>();

            foreach (string moduleName in ModuleMetadata.GetModuleNames())
            {
                if (ModuleMetadata.GetModuleStrippable(moduleName))
                {
                    HashSet <string> classNames = CodeStrippingUtils.GetClassNames((IEnumerable <int>)ModuleMetadata.GetModuleClasses(moduleName));
                    if (nativeClasses.Overlaps((IEnumerable <string>)classNames))
                    {
                        stringSet.Add(moduleName);
                    }
                }
            }
            return(stringSet);
        }
Пример #15
0
        private static HashSet <string> GetRequiredStrippableModules(HashSet <string> nativeClasses, StrippingInfo strippingInfo)
        {
            HashSet <string> hashSet  = new HashSet <string>();
            HashSet <string> hashSet2 = new HashSet <string>();

            string[] moduleNames = ModuleMetadata.GetModuleNames();
            for (int i = 0; i < moduleNames.Length; i++)
            {
                string text = moduleNames[i];
                if (ModuleMetadata.GetModuleStrippable(text))
                {
                    HashSet <string> classNames = CodeStrippingUtils.GetClassNames(ModuleMetadata.GetModuleClasses(text));
                    if (nativeClasses.Overlaps(classNames))
                    {
                        hashSet2.Add(text);
                        if (strippingInfo != null)
                        {
                            foreach (string current in classNames)
                            {
                                if (nativeClasses.Contains(current))
                                {
                                    strippingInfo.RegisterDependency(text, current);
                                    if (BaseObjectTools.IsDerivedFromClassID(BaseObjectTools.StringToClassID(current), CodeStrippingUtils.gameManagerClassId))
                                    {
                                        strippingInfo.RegisterDependency(current, "Required by Module");
                                    }
                                    hashSet.Add(current);
                                }
                            }
                        }
                    }
                }
            }
            if (strippingInfo != null)
            {
                foreach (string current2 in nativeClasses)
                {
                    if (!hashSet.Contains(current2))
                    {
                        strippingInfo.RegisterDependency("Core", current2);
                    }
                }
            }
            return(hashSet2);
        }
Пример #16
0
 private static void ExcludeModuleManagers(ref HashSet <string> nativeClasses)
 {
     string[] moduleNames = ModuleMetadata.GetModuleNames();
     string[] array       = moduleNames;
     for (int i = 0; i < array.Length; i++)
     {
         string moduleName = array[i];
         if (ModuleMetadata.GetModuleStrippable(moduleName))
         {
             int[]            moduleClasses = ModuleMetadata.GetModuleClasses(moduleName);
             HashSet <int>    hashSet       = new HashSet <int>();
             HashSet <string> hashSet2      = new HashSet <string>();
             int[]            array2        = moduleClasses;
             for (int j = 0; j < array2.Length; j++)
             {
                 int num = array2[j];
                 if (BaseObjectTools.IsDerivedFromClassID(num, CodeStrippingUtils.gameManagerClassId))
                 {
                     hashSet.Add(num);
                 }
                 else
                 {
                     hashSet2.Add(BaseObjectTools.ClassIDToString(num));
                 }
             }
             if (hashSet2.Count != 0)
             {
                 if (!nativeClasses.Overlaps(hashSet2))
                 {
                     foreach (int current in hashSet)
                     {
                         nativeClasses.Remove(BaseObjectTools.ClassIDToString(current));
                     }
                 }
                 else
                 {
                     foreach (int current2 in hashSet)
                     {
                         nativeClasses.Add(BaseObjectTools.ClassIDToString(current2));
                     }
                 }
             }
         }
     }
 }
Пример #17
0
 private static void ExcludeModuleManagers(ref HashSet <UnityType> nativeClasses)
 {
     string[] moduleNames = ModuleMetadata.GetModuleNames();
     string[] array       = moduleNames;
     for (int i = 0; i < array.Length; i++)
     {
         string moduleName = array[i];
         if (ModuleMetadata.GetModuleStrippable(moduleName))
         {
             UnityType[]         moduleTypes = ModuleMetadata.GetModuleTypes(moduleName);
             HashSet <UnityType> hashSet     = new HashSet <UnityType>();
             HashSet <UnityType> hashSet2    = new HashSet <UnityType>();
             UnityType[]         array2      = moduleTypes;
             for (int j = 0; j < array2.Length; j++)
             {
                 UnityType unityType = array2[j];
                 if (unityType.IsDerivedFrom(CodeStrippingUtils.GameManagerTypeInfo))
                 {
                     hashSet.Add(unityType);
                 }
                 else
                 {
                     hashSet2.Add(unityType);
                 }
             }
             if (hashSet2.Count != 0)
             {
                 if (!nativeClasses.Overlaps(hashSet2))
                 {
                     foreach (UnityType current in hashSet)
                     {
                         nativeClasses.Remove(current);
                     }
                 }
                 else
                 {
                     foreach (UnityType current2 in hashSet)
                     {
                         nativeClasses.Add(current2);
                     }
                 }
             }
         }
     }
 }
Пример #18
0
        public static void InjectCustomDependencies(BuildTarget target, StrippingInfo strippingInfo, HashSet <UnityType> nativeClasses, HashSet <string> nativeModules)
        {
            UnityType item  = UnityType.FindTypeByName("UnityConnectSettings");
            UnityType item2 = UnityType.FindTypeByName("CloudWebServicesManager");

            if (nativeClasses.Contains(item) || nativeClasses.Contains(item2))
            {
                if (PlayerSettings.submitAnalytics)
                {
                    strippingInfo.RegisterDependency("UnityConnectSettings", "Required by HW Statistics (See Player Settings)");
                    strippingInfo.RegisterDependency("CloudWebServicesManager", "Required by HW Statistics (See Player Settings)");
                    strippingInfo.SetIcon("Required by HW Statistics (See Player Settings)", "class/PlayerSettings");
                }
            }
            UnityType item3 = UnityType.FindTypeByName("UnityAnalyticsManager");

            if (nativeClasses.Contains(item3))
            {
                if (AnalyticsSettings.enabled)
                {
                    strippingInfo.RegisterDependency("UnityAnalyticsManager", "Required by Unity Analytics (See Services Window)");
                    strippingInfo.SetIcon("Required by Unity Analytics (See Services Window)", "class/PlayerSettings");
                }
            }
            if (VRModule.ShouldInjectVRDependenciesForBuildTarget(target))
            {
                nativeModules.Add("VR");
                strippingInfo.RegisterDependency(StrippingInfo.ModuleName("VR"), "Required because VR is enabled in PlayerSettings");
                strippingInfo.SetIcon("Required because VR is enabled in PlayerSettings", "class/PlayerSettings");
            }
            string[] moduleNames = ModuleMetadata.GetModuleNames();
            for (int i = 0; i < moduleNames.Length; i++)
            {
                string text = moduleNames[i];
                if (!ModuleMetadata.IsStrippableModule(text))
                {
                    string text2 = text + " is always required";
                    nativeModules.Add(text);
                    strippingInfo.AddModule(text, true);
                    strippingInfo.RegisterDependency(StrippingInfo.ModuleName(text), text2);
                    strippingInfo.SetIcon(text2, "class/DefaultAsset");
                }
            }
        }
Пример #19
0
        private static HashSet <string> GetRequiredStrippableModules(HashSet <string> nativeClasses)
        {
            HashSet <string> hashSet = new HashSet <string>();

            string[] moduleNames = ModuleMetadata.GetModuleNames();
            for (int i = 0; i < moduleNames.Length; i++)
            {
                string text = moduleNames[i];
                if (ModuleMetadata.GetModuleStrippable(text))
                {
                    HashSet <string> classNames = CodeStrippingUtils.GetClassNames(ModuleMetadata.GetModuleClasses(text));
                    if (nativeClasses.Overlaps(classNames))
                    {
                        hashSet.Add(text);
                    }
                }
            }
            return(hashSet);
        }
Пример #20
0
        private static HashSet <string> GetRequiredStrippableModules(HashSet <UnityType> nativeClasses, StrippingInfo strippingInfo)
        {
            HashSet <UnityType> hashSet  = new HashSet <UnityType>();
            HashSet <string>    hashSet2 = new HashSet <string>();

            string[] moduleNames = ModuleMetadata.GetModuleNames();
            for (int i = 0; i < moduleNames.Length; i++)
            {
                string text = moduleNames[i];
                if (ModuleMetadata.GetModuleStrippable(text))
                {
                    HashSet <UnityType> hashSet3 = new HashSet <UnityType>(ModuleMetadata.GetModuleTypes(text));
                    if (nativeClasses.Overlaps(hashSet3))
                    {
                        hashSet2.Add(text);
                        if (strippingInfo != null)
                        {
                            foreach (UnityType current in hashSet3)
                            {
                                if (nativeClasses.Contains(current))
                                {
                                    strippingInfo.RegisterDependency(StrippingInfo.ModuleName(text), current.name);
                                    hashSet.Add(current);
                                }
                            }
                        }
                    }
                }
            }
            if (strippingInfo != null)
            {
                foreach (UnityType current2 in nativeClasses)
                {
                    if (!hashSet.Contains(current2))
                    {
                        strippingInfo.RegisterDependency(StrippingInfo.ModuleName("Core"), current2.name);
                    }
                }
            }
            return(hashSet2);
        }
Пример #21
0
        private static void ExcludeModuleManagers(ref HashSet <string> nativeClasses)
        {
            string[] moduleNames = ModuleMetadata.GetModuleNames();
            int      classId     = BaseObjectTools.StringToClassID("GlobalGameManager");

            foreach (string moduleName in moduleNames)
            {
                if (ModuleMetadata.GetModuleStrippable(moduleName))
                {
                    int[]            moduleClasses = ModuleMetadata.GetModuleClasses(moduleName);
                    HashSet <int>    intSet        = new HashSet <int>();
                    HashSet <string> stringSet     = new HashSet <string>();
                    foreach (int num in moduleClasses)
                    {
                        if (BaseObjectTools.IsDerivedFromClassID(num, classId))
                        {
                            intSet.Add(num);
                        }
                        else
                        {
                            stringSet.Add(BaseObjectTools.ClassIDToString(num));
                        }
                    }
                    if (stringSet.Count != 0 && !nativeClasses.Overlaps((IEnumerable <string>)stringSet))
                    {
                        using (HashSet <int> .Enumerator enumerator = intSet.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                int current = enumerator.Current;
                                nativeClasses.Remove(BaseObjectTools.ClassIDToString(current));
                            }
                        }
                    }
                }
            }
        }