示例#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));
                        }
                    }
                }
            }
        }
 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);
 }
示例#3
0
        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);
        }
示例#4
0
 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);
 }
示例#5
0
        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);
        }
        protected void AddNativeClassFromName(string className)
        {
            int num = BaseObjectTools.StringToClassID(className);

            if (num != -1 && !BaseObjectTools.IsBaseObject(num))
            {
                this.nativeClasses[num] = className;
            }
        }
示例#7
0
        protected void AddNativeClassFromName(string className)
        {
            int iD = BaseObjectTools.StringToClassID(className);

            if ((iD != -1) && !BaseObjectTools.IsBaseObject(iD))
            {
                this.nativeClasses[iD] = className;
            }
        }
示例#8
0
        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);
        }
示例#9
0
        protected void AddNativeClassFromName(string className)
        {
            int classId = BaseObjectTools.StringToClassID(className);

            if (classId == -1 || BaseObjectTools.IsBaseObject(classId))
            {
                return;
            }
            this.nativeClasses[classId] = className;
        }
示例#10
0
        private static HashSet <string> GetClassNames(IEnumerable <int> classIds)
        {
            HashSet <string> stringSet = new HashSet <string>();

            foreach (int classId in classIds)
            {
                stringSet.Add(BaseObjectTools.ClassIDToString(classId));
            }
            return(stringSet);
        }
示例#11
0
 public GameObjectTreeViewDataSource(TreeView treeView, int rootInstanceID, bool showRootNode, bool rootNodeIsCollapsable) : base(treeView)
 {
     this.kGameObjectClassID       = BaseObjectTools.StringToClassID("GameObject");
     this.m_SearchString           = string.Empty;
     this.m_StickySceneHeaderItems = new List <GameObjectTreeViewItem>();
     this.sortingState             = new SortingState();
     this.m_RootInstanceID         = rootInstanceID;
     this.showRootNode             = showRootNode;
     base.rootIsCollapsable        = rootNodeIsCollapsable;
 }
示例#12
0
        private static void ShowAssetsPopupMenu <T>(Rect buttonRect, string typeName, SerializedProperty serializedProperty, string fileExtension, string defaultFieldName) where T : UnityEngine.Object, new()
        {
            GenericMenu genericMenu = new GenericMenu();
            int         num         = (!(serializedProperty.objectReferenceValue != null)) ? 0 : serializedProperty.objectReferenceValue.GetInstanceID();

            genericMenu.AddItem(new GUIContent(defaultFieldName), num == 0, new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback), new object[]
            {
                0,
                serializedProperty
            });
            HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
            SearchFilter      searchFilter      = new SearchFilter
            {
                classNames = new string[]
                {
                    typeName
                }
            };

            hierarchyProperty.SetSearchFilter(searchFilter);
            hierarchyProperty.Reset();
            while (hierarchyProperty.Next(null))
            {
                genericMenu.AddItem(new GUIContent(hierarchyProperty.name), hierarchyProperty.instanceID == num, new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback), new object[]
                {
                    hierarchyProperty.instanceID,
                    serializedProperty
                });
            }
            int num2 = BaseObjectTools.StringToClassID(typeName);

            if (num2 > 0)
            {
                BuiltinResource[] builtinResourceList = EditorGUIUtility.GetBuiltinResourceList(num2);
                BuiltinResource[] array = builtinResourceList;
                for (int i = 0; i < array.Length; i++)
                {
                    BuiltinResource builtinResource = array[i];
                    genericMenu.AddItem(new GUIContent(builtinResource.m_Name), builtinResource.m_InstanceID == num, new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback), new object[]
                    {
                        builtinResource.m_InstanceID,
                        serializedProperty
                    });
                }
            }
            genericMenu.AddSeparator(string.Empty);
            genericMenu.AddItem(new GUIContent("Create New..."), false, delegate
            {
                T t = Activator.CreateInstance <T>();
                ProjectWindowUtil.CreateAsset(t, "New " + typeName + "." + fileExtension);
                serializedProperty.objectReferenceValue = t;
                serializedProperty.m_SerializedObject.ApplyModifiedProperties();
            });
            genericMenu.DropDown(buttonRect);
        }
        private void SyncToState()
        {
            Annotation[] annotations = AnnotationUtility.GetAnnotations();
            string       str         = string.Empty;

            if (AnnotationWindow.s_Debug)
            {
                str += "AnnotationWindow: SyncToState\n";
            }
            this.m_BuiltinAnnotations = new List <AInfo>();
            this.m_ScriptAnnotations  = new List <AInfo>();
            for (int index = 0; index < annotations.Length; ++index)
            {
                if (AnnotationWindow.s_Debug)
                {
                    str = str + "   same as below: icon " + (object)annotations[index].iconEnabled + " gizmo " + (object)annotations[index].gizmoEnabled + "\n";
                }
                AInfo ainfo = new AInfo(annotations[index].gizmoEnabled == 1, annotations[index].iconEnabled == 1, annotations[index].flags, annotations[index].classID, annotations[index].scriptClass);
                if (ainfo.m_ScriptClass == string.Empty)
                {
                    this.m_BuiltinAnnotations.Add(ainfo);
                    if (AnnotationWindow.s_Debug)
                    {
                        str = str + "   " + BaseObjectTools.ClassIDToString(ainfo.m_ClassID) + ": icon " + (object)ainfo.m_IconEnabled + " gizmo " + (object)ainfo.m_GizmoEnabled + "\n";
                    }
                }
                else
                {
                    this.m_ScriptAnnotations.Add(ainfo);
                    if (AnnotationWindow.s_Debug)
                    {
                        str = str + "   " + annotations[index].scriptClass + ": icon " + (object)ainfo.m_IconEnabled + " gizmo " + (object)ainfo.m_GizmoEnabled + "\n";
                    }
                }
            }
            this.m_BuiltinAnnotations.Sort();
            this.m_ScriptAnnotations.Sort();
            this.m_RecentAnnotations = new List <AInfo>();
            Annotation[] changedAnnotations = AnnotationUtility.GetRecentlyChangedAnnotations();
            for (int index = 0; index < changedAnnotations.Length && index < 5; ++index)
            {
                AInfo ainfo = this.GetAInfo(changedAnnotations[index].classID, changedAnnotations[index].scriptClass);
                if (ainfo != null)
                {
                    this.m_RecentAnnotations.Add(ainfo);
                }
            }
            this.m_SyncWithState = false;
            if (!AnnotationWindow.s_Debug)
            {
                return;
            }
            Debug.Log((object)str);
        }
 public GameObjectTreeViewDataSource(TreeViewController treeView, int rootInstanceID, bool showRoot, bool rootItemIsCollapsable) : base(treeView)
 {
     this.kGameObjectClassID       = BaseObjectTools.StringToClassID("GameObject");
     this.m_SearchString           = "";
     this.m_SearchMode             = 0;
     this.m_LastFetchTime          = 0.0;
     this.m_DelayedFetches         = 0;
     this.m_StickySceneHeaderItems = new List <GameObjectTreeViewItem>();
     this.sortingState             = new TransformSorting();
     this.m_RootInstanceID         = rootInstanceID;
     base.showRootItem             = showRoot;
     base.rootIsCollapsable        = rootItemIsCollapsable;
 }
示例#15
0
        public void AddNativeClassID(int ID)
        {
            string str = BaseObjectTools.ClassIDToString(ID);

            if (str.Length > 0)
            {
                this.allNativeClasses[ID] = str;
                if (!this.functionalityGroups.ContainsValue(str))
                {
                    this.nativeClasses[ID] = str;
                }
            }
        }
示例#16
0
        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");
            }
        }
示例#17
0
        private static HashSet <string> CollectNativeClassListFromRoots(string directory, string[] rootAssemblies)
        {
            HashSet <string> set = new HashSet <string>();

            foreach (string str in CollectManagedTypeReferencesFromRoots(directory, rootAssemblies))
            {
                int iD = BaseObjectTools.StringToClassID(str);
                if ((iD != -1) && !BaseObjectTools.IsBaseObject(iD))
                {
                    set.Add(str);
                }
            }
            return(set);
        }
示例#18
0
        private static HashSet <string> CollectNativeClassListFromRoots(string directory, string[] rootAssemblies)
        {
            HashSet <string> hashSet  = new HashSet <string>();
            HashSet <string> hashSet2 = CodeStrippingUtils.CollectManagedTypeReferencesFromRoots(directory, rootAssemblies);

            foreach (string current in hashSet2)
            {
                int num = BaseObjectTools.StringToClassID(current);
                if (num != -1 && !BaseObjectTools.IsBaseObject(num))
                {
                    hashSet.Add(current);
                }
            }
            return(hashSet);
        }
示例#19
0
 public AInfo(bool gizmoEnabled, bool iconEnabled, int flags, int classID, string scriptClass)
 {
     this.m_GizmoEnabled = gizmoEnabled;
     this.m_IconEnabled  = iconEnabled;
     this.m_ClassID      = classID;
     this.m_ScriptClass  = scriptClass;
     this.m_Flags        = flags;
     if (this.m_ScriptClass == string.Empty)
     {
         this.m_DisplayText = BaseObjectTools.ClassIDToString(this.m_ClassID);
     }
     else
     {
         this.m_DisplayText = this.m_ScriptClass;
     }
 }
示例#20
0
        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);
        }
示例#21
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));
                     }
                 }
             }
         }
     }
 }
示例#22
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);
        }
示例#23
0
        private static HashSet <string> CollectNativeClassListFromRoots(string directory, string[] rootAssemblies)
        {
            HashSet <string> stringSet = new HashSet <string>();

            using (HashSet <string> .Enumerator enumerator = CodeStrippingUtils.CollectManagedTypeReferencesFromRoots(directory, rootAssemblies).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    string current = enumerator.Current;
                    int    classId = BaseObjectTools.StringToClassID(current);
                    if (classId != -1 && !BaseObjectTools.IsBaseObject(classId))
                    {
                        stringSet.Add(current);
                    }
                }
            }
            return(stringSet);
        }
示例#24
0
        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);
        }
示例#25
0
        private static HashSet <string> GetClassNames(IEnumerable <int> classIds)
        {
            HashSet <string>  set        = new HashSet <string>();
            IEnumerator <int> enumerator = classIds.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    int current = enumerator.Current;
                    set.Add(BaseObjectTools.ClassIDToString(current));
                }
            }
            finally
            {
                if (enumerator == null)
                {
                }
                enumerator.Dispose();
            }
            return(set);
        }
示例#26
0
        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);
        }
示例#27
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));
                            }
                        }
                    }
                }
            }
        }
        private void SyncToState()
        {
            Annotation[] annotations = AnnotationUtility.GetAnnotations();
            string       text        = "";

            if (AnnotationWindow.s_Debug)
            {
                text += "AnnotationWindow: SyncToState\n";
            }
            this.m_BuiltinAnnotations = new List <AInfo>();
            this.m_ScriptAnnotations  = new List <AInfo>();
            for (int i = 0; i < annotations.Length; i++)
            {
                if (AnnotationWindow.s_Debug)
                {
                    string text2 = text;
                    text = string.Concat(new object[]
                    {
                        text2,
                        "   same as below: icon ",
                        annotations[i].iconEnabled,
                        " gizmo ",
                        annotations[i].gizmoEnabled,
                        "\n"
                    });
                }
                bool  gizmoEnabled = annotations[i].gizmoEnabled == 1;
                bool  iconEnabled  = annotations[i].iconEnabled == 1;
                AInfo aInfo        = new AInfo(gizmoEnabled, iconEnabled, annotations[i].flags, annotations[i].classID, annotations[i].scriptClass);
                if (aInfo.m_ScriptClass == "")
                {
                    this.m_BuiltinAnnotations.Add(aInfo);
                    if (AnnotationWindow.s_Debug)
                    {
                        string text2 = text;
                        text = string.Concat(new object[]
                        {
                            text2,
                            "   ",
                            BaseObjectTools.ClassIDToString(aInfo.m_ClassID),
                            ": icon ",
                            aInfo.m_IconEnabled,
                            " gizmo ",
                            aInfo.m_GizmoEnabled,
                            "\n"
                        });
                    }
                }
                else
                {
                    this.m_ScriptAnnotations.Add(aInfo);
                    if (AnnotationWindow.s_Debug)
                    {
                        string text2 = text;
                        text = string.Concat(new object[]
                        {
                            text2,
                            "   ",
                            annotations[i].scriptClass,
                            ": icon ",
                            aInfo.m_IconEnabled,
                            " gizmo ",
                            aInfo.m_GizmoEnabled,
                            "\n"
                        });
                    }
                }
            }
            this.m_BuiltinAnnotations.Sort();
            this.m_ScriptAnnotations.Sort();
            this.m_RecentAnnotations = new List <AInfo>();
            Annotation[] recentlyChangedAnnotations = AnnotationUtility.GetRecentlyChangedAnnotations();
            int          num = 0;

            while (num < recentlyChangedAnnotations.Length && num < 5)
            {
                AInfo aInfo2 = this.GetAInfo(recentlyChangedAnnotations[num].classID, recentlyChangedAnnotations[num].scriptClass);
                if (aInfo2 != null)
                {
                    this.m_RecentAnnotations.Add(aInfo2);
                }
                num++;
            }
            this.m_SyncWithState = false;
            if (AnnotationWindow.s_Debug)
            {
                Debug.Log(text);
            }
        }
示例#29
0
        private static void ShowAssetsPopupMenu <T>(Rect buttonRect, string typeName, SerializedProperty serializedProperty, string fileExtension) where T : Object, new()
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            AssetPopupBackend.\u003CShowAssetsPopupMenu\u003Ec__AnonStorey76 <T> menuCAnonStorey76 = new AssetPopupBackend.\u003CShowAssetsPopupMenu\u003Ec__AnonStorey76 <T>();
            // ISSUE: reference to a compiler-generated field
            menuCAnonStorey76.typeName = typeName;
            // ISSUE: reference to a compiler-generated field
            menuCAnonStorey76.fileExtension = fileExtension;
            // ISSUE: reference to a compiler-generated field
            menuCAnonStorey76.serializedProperty = serializedProperty;
            GenericMenu genericMenu = new GenericMenu();
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            int num = !(menuCAnonStorey76.serializedProperty.objectReferenceValue != (Object)null) ? 0 : menuCAnonStorey76.serializedProperty.objectReferenceValue.GetInstanceID();

            // ISSUE: reference to a compiler-generated field
            genericMenu.AddItem(new GUIContent("Default"), (num == 0 ? 1 : 0) != 0, new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback), (object)new object[2]
            {
                (object)0,
                (object)menuCAnonStorey76.serializedProperty
            });
            HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
            // ISSUE: reference to a compiler-generated field
            SearchFilter filter = new SearchFilter()
            {
                classNames = new string[1] {
                    menuCAnonStorey76.typeName
                }
            };

            hierarchyProperty.SetSearchFilter(filter);
            hierarchyProperty.Reset();
            while (hierarchyProperty.Next((int[])null))
            {
                // ISSUE: reference to a compiler-generated field
                genericMenu.AddItem(new GUIContent(hierarchyProperty.name), (hierarchyProperty.instanceID == num ? 1 : 0) != 0, new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback), (object)new object[2]
                {
                    (object)hierarchyProperty.instanceID,
                    (object)menuCAnonStorey76.serializedProperty
                });
            }
            // ISSUE: reference to a compiler-generated field
            int classId = BaseObjectTools.StringToClassID(menuCAnonStorey76.typeName);

            if (classId > 0)
            {
                foreach (BuiltinResource builtinResource in EditorGUIUtility.GetBuiltinResourceList(classId))
                {
                    // ISSUE: reference to a compiler-generated field
                    genericMenu.AddItem(new GUIContent(builtinResource.m_Name), (builtinResource.m_InstanceID == num ? 1 : 0) != 0, new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback), (object)new object[2]
                    {
                        (object)builtinResource.m_InstanceID,
                        (object)menuCAnonStorey76.serializedProperty
                    });
                }
            }
            genericMenu.AddSeparator(string.Empty);
            // ISSUE: reference to a compiler-generated method
            genericMenu.AddItem(new GUIContent("Create New..."), false, new GenericMenu.MenuFunction(menuCAnonStorey76.\u003C\u003Em__10A));
            genericMenu.DropDown(buttonRect);
        }
        private static void ShowAssetsPopupMenu <T>(Rect buttonRect, string typeName, SerializedProperty serializedProperty, string fileExtension, string defaultFieldName) where T : UnityEngine.Object, new()
        {
            GenericMenu genericMenu = new GenericMenu();
            int         num         = (!(serializedProperty.objectReferenceValue != null)) ? 0 : serializedProperty.objectReferenceValue.GetInstanceID();
            bool        flag        = false;
            int         num2        = BaseObjectTools.StringToClassID(typeName);

            BuiltinResource[] array = null;
            if (num2 > 0)
            {
                array = EditorGUIUtility.GetBuiltinResourceList(num2);
                BuiltinResource[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    BuiltinResource resource = array2[i];
                    if (resource.m_Name == defaultFieldName)
                    {
                        GenericMenu arg_10E_0 = genericMenu;
                        GUIContent  arg_10E_1 = new GUIContent(resource.m_Name);
                        bool        arg_10E_2 = resource.m_InstanceID == num;
                        if (AssetPopupBackend.< > f__mg$cache0 == null)
                        {
                            AssetPopupBackend.< > f__mg$cache0 = new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback);
                        }
                        arg_10E_0.AddItem(arg_10E_1, arg_10E_2, AssetPopupBackend.< > f__mg$cache0, new object[]
                        {
                            resource.m_InstanceID,
                            serializedProperty
                        });
                        array = (from x in array
                                 where x != resource
                                 select x).ToArray <BuiltinResource>();
                        flag = true;
                        break;
                    }
                }
            }
            if (!flag)
            {
                GenericMenu arg_190_0 = genericMenu;
                GUIContent  arg_190_1 = new GUIContent(defaultFieldName);
                bool        arg_190_2 = num == 0;
                if (AssetPopupBackend.< > f__mg$cache1 == null)
                {
                    AssetPopupBackend.< > f__mg$cache1 = new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback);
                }
                arg_190_0.AddItem(arg_190_1, arg_190_2, AssetPopupBackend.< > f__mg$cache1, new object[]
                {
                    0,
                    serializedProperty
                });
            }
            HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
            SearchFilter      searchFilter      = new SearchFilter
            {
                classNames = new string[]
                {
                    typeName
                }
            };

            hierarchyProperty.SetSearchFilter(searchFilter);
            hierarchyProperty.Reset();
            while (hierarchyProperty.Next(null))
            {
                GenericMenu arg_227_0 = genericMenu;
                GUIContent  arg_227_1 = new GUIContent(hierarchyProperty.name);
                bool        arg_227_2 = hierarchyProperty.instanceID == num;
                if (AssetPopupBackend.< > f__mg$cache2 == null)
                {
                    AssetPopupBackend.< > f__mg$cache2 = new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback);
                }
                arg_227_0.AddItem(arg_227_1, arg_227_2, AssetPopupBackend.< > f__mg$cache2, new object[]
                {
                    hierarchyProperty.instanceID,
                    serializedProperty
                });
            }
            if (num2 > 0 && array != null)
            {
                BuiltinResource[] array3 = array;
                for (int j = 0; j < array3.Length; j++)
                {
                    BuiltinResource builtinResource = array3[j];
                    GenericMenu     arg_2B1_0       = genericMenu;
                    GUIContent      arg_2B1_1       = new GUIContent(builtinResource.m_Name);
                    bool            arg_2B1_2       = builtinResource.m_InstanceID == num;
                    if (AssetPopupBackend.< > f__mg$cache3 == null)
                    {
                        AssetPopupBackend.< > f__mg$cache3 = new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback);
                    }
                    arg_2B1_0.AddItem(arg_2B1_1, arg_2B1_2, AssetPopupBackend.< > f__mg$cache3, new object[]
                    {
                        builtinResource.m_InstanceID,
                        serializedProperty
                    });
                }
            }
            genericMenu.AddSeparator("");
            genericMenu.AddItem(new GUIContent("Create New..."), false, delegate
            {
                T t = Activator.CreateInstance <T>();
                ProjectWindowUtil.CreateAsset(t, "New " + typeName + "." + fileExtension);
                serializedProperty.objectReferenceValue = t;
                serializedProperty.m_SerializedObject.ApplyModifiedProperties();
            });
            genericMenu.DropDown(buttonRect);
        }