public static void GenerateDependencies(string strippedAssemblyDir, string icallsListFile, RuntimeClassRegistry rcr, out HashSet <string> nativeClasses, out HashSet <string> nativeModules) { string[] userAssemblies = GetUserAssemblies(strippedAssemblyDir); nativeClasses = !PlayerSettings.stripEngineCode ? null : GenerateNativeClassList(rcr, strippedAssemblyDir, userAssemblies); if (nativeClasses != null) { ExcludeModuleManagers(ref nativeClasses); } nativeModules = GetNativeModulesToRegister(nativeClasses); if ((nativeClasses != null) && (icallsListFile != null)) { HashSet <string> modulesFromICalls = GetModulesFromICalls(icallsListFile); int derivedFromClassID = BaseObjectTools.StringToClassID("GlobalGameManager"); foreach (string str in modulesFromICalls) { foreach (int num2 in ModuleMetadata.GetModuleClasses(str)) { if (BaseObjectTools.IsDerivedFromClassID(num2, derivedFromClassID)) { nativeClasses.Add(BaseObjectTools.ClassIDToString(num2)); } } } nativeModules.UnionWith(modulesFromICalls); } new AssemblyReferenceChecker().CollectReferencesFromRoots(strippedAssemblyDir, userAssemblies, true, 0f, true); }
public static void GenerateDependencies(string strippedAssemblyDir, string icallsListFile, RuntimeClassRegistry rcr, out HashSet <string> nativeClasses, out HashSet <string> nativeModules) { string[] userAssemblies = CodeStrippingUtils.GetUserAssemblies(strippedAssemblyDir); nativeClasses = !PlayerSettings.stripEngineCode ? (HashSet <string>)null : CodeStrippingUtils.GenerateNativeClassList(rcr, strippedAssemblyDir, userAssemblies); if (nativeClasses != null) { CodeStrippingUtils.ExcludeModuleManagers(ref nativeClasses); } nativeModules = CodeStrippingUtils.GetNativeModulesToRegister(nativeClasses); if (nativeClasses != null && icallsListFile != null) { HashSet <string> modulesFromIcalls = CodeStrippingUtils.GetModulesFromICalls(icallsListFile); int classId = BaseObjectTools.StringToClassID("GlobalGameManager"); using (HashSet <string> .Enumerator enumerator = modulesFromIcalls.GetEnumerator()) { while (enumerator.MoveNext()) { foreach (int moduleClass in ModuleMetadata.GetModuleClasses(enumerator.Current)) { if (BaseObjectTools.IsDerivedFromClassID(moduleClass, classId)) { nativeClasses.Add(BaseObjectTools.ClassIDToString(moduleClass)); } } } } nativeModules.UnionWith((IEnumerable <string>)modulesFromIcalls); } new AssemblyReferenceChecker().CollectReferencesFromRoots(strippedAssemblyDir, (IEnumerable <string>)userAssemblies, true, 0.0f, true); }
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)); } } } } }
public static void GenerateDependencies(string strippedAssemblyDir, string icallsListFile, RuntimeClassRegistry rcr, out HashSet <string> nativeClasses, out HashSet <string> nativeModules) { string[] userAssemblies = CodeStrippingUtils.GetUserAssemblies(strippedAssemblyDir); nativeClasses = ((!PlayerSettings.stripEngineCode) ? null : CodeStrippingUtils.GenerateNativeClassList(rcr, strippedAssemblyDir, userAssemblies)); if (nativeClasses != null) { CodeStrippingUtils.ExcludeModuleManagers(ref nativeClasses); } nativeModules = CodeStrippingUtils.GetNativeModulesToRegister(nativeClasses); if (nativeClasses != null && icallsListFile != null) { HashSet <string> modulesFromICalls = CodeStrippingUtils.GetModulesFromICalls(icallsListFile); int derivedFromClassID = BaseObjectTools.StringToClassID("GlobalGameManager"); foreach (string current in modulesFromICalls) { int[] moduleClasses = ModuleMetadata.GetModuleClasses(current); int[] array = moduleClasses; for (int i = 0; i < array.Length; i++) { int num = array[i]; if (BaseObjectTools.IsDerivedFromClassID(num, derivedFromClassID)) { nativeClasses.Add(BaseObjectTools.ClassIDToString(num)); } } } nativeModules.UnionWith(modulesFromICalls); } AssemblyReferenceChecker assemblyReferenceChecker = new AssemblyReferenceChecker(); assemblyReferenceChecker.CollectReferencesFromRoots(strippedAssemblyDir, userAssemblies, true, 0f, true); }
public static void GenerateDependencies(string strippedAssemblyDir, string icallsListFile, RuntimeClassRegistry rcr, out HashSet <string> nativeClasses, out HashSet <string> nativeModules, BuildReport buildReport) { StrippingInfo buildReportData = StrippingInfo.GetBuildReportData(buildReport); string[] userAssemblies = CodeStrippingUtils.GetUserAssemblies(strippedAssemblyDir); nativeClasses = ((!PlayerSettings.stripEngineCode) ? null : CodeStrippingUtils.GenerateNativeClassList(rcr, strippedAssemblyDir, userAssemblies, buildReportData)); if (nativeClasses != null) { CodeStrippingUtils.ExcludeModuleManagers(ref nativeClasses); } nativeModules = CodeStrippingUtils.GetNativeModulesToRegister(nativeClasses, buildReportData); if (nativeClasses != null && icallsListFile != null) { HashSet <string> modulesFromICalls = CodeStrippingUtils.GetModulesFromICalls(icallsListFile); foreach (string current in modulesFromICalls) { if (!nativeModules.Contains(current) && buildReportData != null) { buildReportData.RegisterDependency(current, "Required by Scripts"); } int[] moduleClasses = ModuleMetadata.GetModuleClasses(current); int[] array = moduleClasses; for (int i = 0; i < array.Length; i++) { int num = array[i]; if (BaseObjectTools.IsDerivedFromClassID(num, CodeStrippingUtils.gameManagerClassId)) { string text = BaseObjectTools.ClassIDToString(num); nativeClasses.Add(text); if (buildReportData != null) { buildReportData.RegisterDependency(text, "Required by Module"); } } } } nativeModules.UnionWith(modulesFromICalls); } AssemblyReferenceChecker assemblyReferenceChecker = new AssemblyReferenceChecker(); assemblyReferenceChecker.CollectReferencesFromRoots(strippedAssemblyDir, userAssemblies, true, 0f, true); if (buildReportData != null) { foreach (string current2 in nativeModules) { buildReportData.AddModule(current2); } buildReportData.AddModule("Core"); } }
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); }
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)); } } } } } }
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); }
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); }
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)); } } } } } }
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); }