private static HashSet <string> GenerateNativeClassList(RuntimeClassRegistry rcr, string directory, string[] rootAssemblies) { HashSet <string> set = CollectNativeClassListFromRoots(directory, rootAssemblies); foreach (string str in NativeClassBlackList) { set.Add(str); } foreach (string str2 in rcr.GetAllNativeClassesIncludingManagersAsString()) { int iD = BaseObjectTools.StringToClassID(str2); if ((iD != -1) && !BaseObjectTools.IsBaseObject(iD)) { set.Add(str2); } } HashSet <string> set2 = new HashSet <string>(); foreach (string str3 in set) { for (int i = BaseObjectTools.StringToClassID(str3); !BaseObjectTools.IsBaseObject(i); i = BaseObjectTools.GetSuperClassID(i)) { set2.Add(BaseObjectTools.ClassIDToString(i)); } } return(set2); }
private static HashSet <UnityType> GenerateNativeClassList(RuntimeClassRegistry rcr, string directory, string[] rootAssemblies, StrippingInfo strippingInfo) { if (AssemblyStripper.UseUnityLinkerEngineModuleStripping) { throw new NotSupportedException("Don't want to rely on this method when UnityLinker EMS is used"); } HashSet <UnityType> nativeClasses = CollectNativeClassListFromRoots(directory, rootAssemblies, strippingInfo); // List native classes found in scenes foreach (string klassName in rcr.GetAllNativeClassesIncludingManagersAsString()) { UnityType klass = UnityType.FindTypeByName(klassName); if (klass != null && klass.baseClass != null) { nativeClasses.Add(klass); if (strippingInfo != null) { if (!klass.IsDerivedFrom(GameManagerTypeInfo)) { var scenes = rcr.GetScenesForClass(klass.persistentTypeID); if (scenes != null) { foreach (var scene in scenes) { strippingInfo.RegisterDependency(klassName, scene); if (scene.EndsWith(".unity")) { strippingInfo.SetIcon(scene, "class/SceneAsset"); } else { strippingInfo.SetIcon(scene, "class/AssetBundle"); } } } } } } } // Always include base classes of derived native classes. HashSet <UnityType> nativeClassesAndBaseClasses = new HashSet <UnityType>(); foreach (var klass in nativeClasses) { var current = klass; while (current.baseClass != null) { nativeClassesAndBaseClasses.Add(current); current = current.baseClass; } } return(nativeClassesAndBaseClasses); }
private static HashSet <string> GenerateNativeClassList(RuntimeClassRegistry rcr, string directory, string[] rootAssemblies, StrippingInfo strippingInfo) { HashSet <string> hashSet = CodeStrippingUtils.CollectNativeClassListFromRoots(directory, rootAssemblies, strippingInfo); string[] nativeClassBlackList = CodeStrippingUtils.NativeClassBlackList; for (int i = 0; i < nativeClassBlackList.Length; i++) { string text = nativeClassBlackList[i]; hashSet.Add(text); if (strippingInfo != null) { strippingInfo.RegisterDependency(text, "Blacklisted"); } } foreach (string current in CodeStrippingUtils.NativeClassDependencyBlackList.Keys) { if (hashSet.Contains(current)) { string text2 = CodeStrippingUtils.NativeClassDependencyBlackList[current]; hashSet.Add(text2); if (strippingInfo != null) { strippingInfo.RegisterDependency(text2, string.Format("Blacklisted due to dependent class '{0}'", current)); } } } foreach (string current2 in rcr.GetAllNativeClassesIncludingManagersAsString()) { int num = BaseObjectTools.StringToClassID(current2); if (num != -1 && !BaseObjectTools.IsBaseObject(num)) { hashSet.Add(current2); if (strippingInfo != null && !BaseObjectTools.IsDerivedFromClassID(num, CodeStrippingUtils.gameManagerClassId)) { strippingInfo.RegisterDependency(current2, "Used in Scenes"); } } } HashSet <string> hashSet2 = new HashSet <string>(); foreach (string current3 in hashSet) { int iD = BaseObjectTools.StringToClassID(current3); while (!BaseObjectTools.IsBaseObject(iD)) { hashSet2.Add(BaseObjectTools.ClassIDToString(iD)); int superClassID = BaseObjectTools.GetSuperClassID(iD); if (strippingInfo != null) { strippingInfo.RegisterDependency(BaseObjectTools.ClassIDToString(superClassID), BaseObjectTools.ClassIDToString(iD)); } iD = BaseObjectTools.GetSuperClassID(iD); } } return(hashSet2); }
private static HashSet <string> GenerateNativeClassList(RuntimeClassRegistry rcr, string directory, string[] rootAssemblies) { HashSet <string> stringSet1 = CodeStrippingUtils.CollectNativeClassListFromRoots(directory, rootAssemblies); foreach (string nativeClassBlack in CodeStrippingUtils.NativeClassBlackList) { stringSet1.Add(nativeClassBlack); } using (Dictionary <string, string> .KeyCollection.Enumerator enumerator = CodeStrippingUtils.NativeClassDependencyBlackList.Keys.GetEnumerator()) { while (enumerator.MoveNext()) { string current = enumerator.Current; if (stringSet1.Contains(current)) { string classDependencyBlack = CodeStrippingUtils.NativeClassDependencyBlackList[current]; stringSet1.Add(classDependencyBlack); } } } using (List <string> .Enumerator enumerator = rcr.GetAllNativeClassesIncludingManagersAsString().GetEnumerator()) { while (enumerator.MoveNext()) { string current = enumerator.Current; int classId = BaseObjectTools.StringToClassID(current); if (classId != -1 && !BaseObjectTools.IsBaseObject(classId)) { stringSet1.Add(current); } } } HashSet <string> stringSet2 = new HashSet <string>(); using (HashSet <string> .Enumerator enumerator = stringSet1.GetEnumerator()) { while (enumerator.MoveNext()) { for (int ID = BaseObjectTools.StringToClassID(enumerator.Current); !BaseObjectTools.IsBaseObject(ID); ID = BaseObjectTools.GetSuperClassID(ID)) { stringSet2.Add(BaseObjectTools.ClassIDToString(ID)); } } } return(stringSet2); }
private static HashSet <string> GenerateNativeClassList(RuntimeClassRegistry rcr, string directory, string[] rootAssemblies) { HashSet <string> hashSet = CodeStrippingUtils.CollectNativeClassListFromRoots(directory, rootAssemblies); string[] nativeClassBlackList = CodeStrippingUtils.NativeClassBlackList; for (int i = 0; i < nativeClassBlackList.Length; i++) { string item = nativeClassBlackList[i]; hashSet.Add(item); } foreach (string current in rcr.GetAllNativeClassesIncludingManagersAsString()) { int num = BaseObjectTools.StringToClassID(current); if (num != -1 && !BaseObjectTools.IsBaseObject(num)) { hashSet.Add(current); } } return(hashSet); }
private static HashSet <string> GenerateNativeClassList(RuntimeClassRegistry rcr, string directory, string[] rootAssemblies) { HashSet <string> hashSet = CodeStrippingUtils.CollectNativeClassListFromRoots(directory, rootAssemblies); string[] nativeClassBlackList = CodeStrippingUtils.NativeClassBlackList; for (int i = 0; i < nativeClassBlackList.Length; i++) { string item = nativeClassBlackList[i]; hashSet.Add(item); } foreach (string current in CodeStrippingUtils.NativeClassDependencyBlackList.Keys) { if (hashSet.Contains(current)) { string item2 = CodeStrippingUtils.NativeClassDependencyBlackList[current]; hashSet.Add(item2); } } foreach (string current2 in rcr.GetAllNativeClassesIncludingManagersAsString()) { int num = BaseObjectTools.StringToClassID(current2); if (num != -1 && !BaseObjectTools.IsBaseObject(num)) { hashSet.Add(current2); } } HashSet <string> hashSet2 = new HashSet <string>(); foreach (string current3 in hashSet) { int iD = BaseObjectTools.StringToClassID(current3); while (!BaseObjectTools.IsBaseObject(iD)) { hashSet2.Add(BaseObjectTools.ClassIDToString(iD)); iD = BaseObjectTools.GetSuperClassID(iD); } } return(hashSet2); }
private static HashSet <UnityType> GenerateNativeClassList(RuntimeClassRegistry rcr, string directory, string[] rootAssemblies, StrippingInfo strippingInfo) { HashSet <UnityType> nativeClasses = CollectNativeClassListFromRoots(directory, rootAssemblies, strippingInfo); // Inject blacklisted native types foreach (var klass in BlackListNativeClasses) { nativeClasses.Add(klass); } foreach (var dependent in BlackListNativeClassesDependency.Keys) { if (nativeClasses.Contains(dependent)) { var provider = BlackListNativeClassesDependency[dependent]; nativeClasses.Add(provider); } } // List native classes found in scenes foreach (string klassName in rcr.GetAllNativeClassesIncludingManagersAsString()) { UnityType klass = UnityType.FindTypeByName(klassName); if (klass != null && klass.baseClass != null) { nativeClasses.Add(klass); if (strippingInfo != null) { if (!klass.IsDerivedFrom(GameManagerTypeInfo)) { var scenes = rcr.GetScenesForClass(klass.persistentTypeID); if (scenes != null) { foreach (var scene in scenes) { strippingInfo.RegisterDependency(klassName, scene); if (scene.EndsWith(".unity")) { strippingInfo.SetIcon(scene, "class/SceneAsset"); } else { strippingInfo.SetIcon(scene, "class/AssetBundle"); } } } } } } } // Always include base classes of derived native classes. HashSet <UnityType> nativeClassesAndBaseClasses = new HashSet <UnityType>(); foreach (var klass in nativeClasses) { var current = klass; while (current.baseClass != null) { nativeClassesAndBaseClasses.Add(current); current = current.baseClass; } } return(nativeClassesAndBaseClasses); }
private static HashSet <UnityType> GenerateNativeClassList(RuntimeClassRegistry rcr, string directory, string[] rootAssemblies, StrippingInfo strippingInfo) { HashSet <UnityType> hashSet = CodeStrippingUtils.CollectNativeClassListFromRoots(directory, rootAssemblies, strippingInfo); UnityType[] blackListNativeClasses = CodeStrippingUtils.BlackListNativeClasses; for (int i = 0; i < blackListNativeClasses.Length; i++) { UnityType item = blackListNativeClasses[i]; hashSet.Add(item); } foreach (UnityType current in CodeStrippingUtils.BlackListNativeClassesDependency.Keys) { if (hashSet.Contains(current)) { UnityType item2 = CodeStrippingUtils.BlackListNativeClassesDependency[current]; hashSet.Add(item2); } } foreach (string current2 in rcr.GetAllNativeClassesIncludingManagersAsString()) { UnityType unityType = UnityType.FindTypeByName(current2); if (unityType != null && unityType.baseClass != null) { hashSet.Add(unityType); if (strippingInfo != null) { if (!unityType.IsDerivedFrom(CodeStrippingUtils.GameManagerTypeInfo)) { List <string> scenesForClass = rcr.GetScenesForClass(unityType.persistentTypeID); if (scenesForClass != null) { foreach (string current3 in scenesForClass) { strippingInfo.RegisterDependency(current2, current3); if (current3.EndsWith(".unity")) { strippingInfo.SetIcon(current3, "class/SceneAsset"); } else { strippingInfo.SetIcon(current3, "class/AssetBundle"); } } } } } } } HashSet <UnityType> hashSet2 = new HashSet <UnityType>(); foreach (UnityType current4 in hashSet) { UnityType unityType2 = current4; while (unityType2.baseClass != null) { hashSet2.Add(unityType2); unityType2 = unityType2.baseClass; } } return(hashSet2); }
private static HashSet<string> GenerateNativeClassList(RuntimeClassRegistry rcr, string directory, string[] rootAssemblies) { HashSet<string> stringSet1 = CodeStrippingUtils.CollectNativeClassListFromRoots(directory, rootAssemblies); foreach (string nativeClassBlack in CodeStrippingUtils.NativeClassBlackList) stringSet1.Add(nativeClassBlack); using (Dictionary<string, string>.KeyCollection.Enumerator enumerator = CodeStrippingUtils.NativeClassDependencyBlackList.Keys.GetEnumerator()) { while (enumerator.MoveNext()) { string current = enumerator.Current; if (stringSet1.Contains(current)) { string classDependencyBlack = CodeStrippingUtils.NativeClassDependencyBlackList[current]; stringSet1.Add(classDependencyBlack); } } } using (List<string>.Enumerator enumerator = rcr.GetAllNativeClassesIncludingManagersAsString().GetEnumerator()) { while (enumerator.MoveNext()) { string current = enumerator.Current; int classId = BaseObjectTools.StringToClassID(current); if (classId != -1 && !BaseObjectTools.IsBaseObject(classId)) stringSet1.Add(current); } } HashSet<string> stringSet2 = new HashSet<string>(); using (HashSet<string>.Enumerator enumerator = stringSet1.GetEnumerator()) { while (enumerator.MoveNext()) { for (int ID = BaseObjectTools.StringToClassID(enumerator.Current); !BaseObjectTools.IsBaseObject(ID); ID = BaseObjectTools.GetSuperClassID(ID)) stringSet2.Add(BaseObjectTools.ClassIDToString(ID)); } } return stringSet2; }
private static HashSet<string> GenerateNativeClassList(RuntimeClassRegistry rcr, string directory, string[] rootAssemblies) { HashSet<string> hashSet = CodeStrippingUtils.CollectNativeClassListFromRoots(directory, rootAssemblies); string[] nativeClassBlackList = CodeStrippingUtils.NativeClassBlackList; for (int i = 0; i < nativeClassBlackList.Length; i++) { string item = nativeClassBlackList[i]; hashSet.Add(item); } foreach (string current in rcr.GetAllNativeClassesIncludingManagersAsString()) { int num = BaseObjectTools.StringToClassID(current); if (num != -1 && !BaseObjectTools.IsBaseObject(num)) { hashSet.Add(current); } } return hashSet; }
private static HashSet<string> GenerateNativeClassList(RuntimeClassRegistry rcr, string directory, string[] rootAssemblies) { HashSet<string> set = CollectNativeClassListFromRoots(directory, rootAssemblies); foreach (string str in NativeClassBlackList) { set.Add(str); } foreach (string str2 in rcr.GetAllNativeClassesIncludingManagersAsString()) { int iD = BaseObjectTools.StringToClassID(str2); if ((iD != -1) && !BaseObjectTools.IsBaseObject(iD)) { set.Add(str2); } } HashSet<string> set2 = new HashSet<string>(); foreach (string str3 in set) { for (int i = BaseObjectTools.StringToClassID(str3); !BaseObjectTools.IsBaseObject(i); i = BaseObjectTools.GetSuperClassID(i)) { set2.Add(BaseObjectTools.ClassIDToString(i)); } } return set2; }