Rebuild() static private method

static private Rebuild ( Assembly assembly ) : void
assembly System.Reflection.Assembly
return void
        internal static Type FindCustomEditorTypeByType(Type type, bool multiEdit)
        {
            if (!CustomEditorAttributes.s_Initialized)
            {
                Assembly[] loadedAssemblies = EditorAssemblies.loadedAssemblies;
                for (int i = loadedAssemblies.Length - 1; i >= 0; i--)
                {
                    CustomEditorAttributes.Rebuild(loadedAssemblies[i]);
                }
                CustomEditorAttributes.s_Initialized = true;
            }
            List <CustomEditorAttributes.MonoEditorType> source = (!multiEdit) ? CustomEditorAttributes.kSCustomEditors : CustomEditorAttributes.kSCustomMultiEditors;
            Type inspected;

            for (inspected = type; inspected != null; inspected = inspected.BaseType)
            {
                CustomEditorAttributes.MonoEditorType monoEditorType;
                if (type == inspected)
                {
                    monoEditorType = source.FirstOrDefault((CustomEditorAttributes.MonoEditorType x) => inspected == x.m_InspectedType);
                }
                else
                {
                    monoEditorType = source.FirstOrDefault((CustomEditorAttributes.MonoEditorType x) => inspected == x.m_InspectedType && x.m_EditorForChildClasses);
                }
                if (monoEditorType != null)
                {
                    return(monoEditorType.m_InspectorType);
                }
            }
            return(null);
        }
示例#2
0
        internal static System.Type FindCustomEditorTypeByType(System.Type type, bool multiEdit)
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            CustomEditorAttributes.\u003CFindCustomEditorTypeByType\u003Ec__AnonStorey35 typeCAnonStorey35 = new CustomEditorAttributes.\u003CFindCustomEditorTypeByType\u003Ec__AnonStorey35();
            // ISSUE: reference to a compiler-generated field
            typeCAnonStorey35.type = type;
            if (!CustomEditorAttributes.s_Initialized)
            {
                Assembly[] loadedAssemblies = EditorAssemblies.loadedAssemblies;
                for (int index = loadedAssemblies.Length - 1; index >= 0; --index)
                {
                    CustomEditorAttributes.Rebuild(loadedAssemblies[index]);
                }
                CustomEditorAttributes.s_Initialized = true;
            }
            List <CustomEditorAttributes.MonoEditorType> source = !multiEdit ? CustomEditorAttributes.kSCustomEditors : CustomEditorAttributes.kSCustomMultiEditors;

            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            CustomEditorAttributes.\u003CFindCustomEditorTypeByType\u003Ec__AnonStorey37 typeCAnonStorey37 = new CustomEditorAttributes.\u003CFindCustomEditorTypeByType\u003Ec__AnonStorey37();
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            for (typeCAnonStorey37.pass = 0; typeCAnonStorey37.pass < 2; typeCAnonStorey37.pass = typeCAnonStorey37.pass + 1)
            {
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                CustomEditorAttributes.\u003CFindCustomEditorTypeByType\u003Ec__AnonStorey36 typeCAnonStorey36 = new CustomEditorAttributes.\u003CFindCustomEditorTypeByType\u003Ec__AnonStorey36();
                // ISSUE: reference to a compiler-generated field
                typeCAnonStorey36.\u003C\u003Ef__ref\u002453 = typeCAnonStorey35;
                // ISSUE: reference to a compiler-generated field
                typeCAnonStorey36.\u003C\u003Ef__ref\u002455 = typeCAnonStorey37;
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                for (typeCAnonStorey36.inspected = typeCAnonStorey35.type; typeCAnonStorey36.inspected != null; typeCAnonStorey36.inspected = typeCAnonStorey36.inspected.BaseType)
                {
                    // ISSUE: reference to a compiler-generated method
                    CustomEditorAttributes.MonoEditorType monoEditorType = source.FirstOrDefault <CustomEditorAttributes.MonoEditorType>(new Func <CustomEditorAttributes.MonoEditorType, bool>(typeCAnonStorey36.\u003C\u003Em__4C));
                    if (monoEditorType != null)
                    {
                        return(monoEditorType.m_InspectorType);
                    }
                }
            }
            return((System.Type)null);
        }
示例#3
0
        internal static Type FindCustomEditorTypeByType(Type type, bool multiEdit)
        {
            if (!CustomEditorAttributes.s_Initialized)
            {
                Assembly[] loadedAssemblies = EditorAssemblies.loadedAssemblies;
                for (int i = loadedAssemblies.Length - 1; i >= 0; i--)
                {
                    CustomEditorAttributes.Rebuild(loadedAssemblies[i]);
                }
                CustomEditorAttributes.s_Initialized = true;
            }
            Type result;

            if (type == null)
            {
                result = null;
            }
            else
            {
                Dictionary <Type, Type> dictionary = (!multiEdit) ? CustomEditorAttributes.kCachedEditorForType : CustomEditorAttributes.kCachedMultiEditorForType;
                Type inspectorType;
                if (dictionary.TryGetValue(type, out inspectorType))
                {
                    result = inspectorType;
                }
                else
                {
                    List <CustomEditorAttributes.MonoEditorType> list = (!multiEdit) ? CustomEditorAttributes.kSCustomEditors : CustomEditorAttributes.kSCustomMultiEditors;
                    for (int j = 0; j < 2; j++)
                    {
                        for (Type type2 = type; type2 != null; type2 = type2.BaseType)
                        {
                            for (int k = 0; k < list.Count; k++)
                            {
                                if (CustomEditorAttributes.IsAppropriateEditor(list[k], type2, type != type2, j == 1))
                                {
                                    inspectorType = list[k].m_InspectorType;
                                    dictionary.Add(type, inspectorType);
                                    result = inspectorType;
                                    return(result);
                                }
                            }
                        }
                    }
                    dictionary.Add(type, null);
                    result = null;
                }
            }
            return(result);
        }
示例#4
0
        internal static Type FindCustomEditorTypeByType(Type type, bool multiEdit)
        {
            if (!CustomEditorAttributes.s_Initialized)
            {
                Assembly[] loadedAssemblies = EditorAssemblies.loadedAssemblies;
                for (int i = loadedAssemblies.Length - 1; i >= 0; i--)
                {
                    CustomEditorAttributes.Rebuild(loadedAssemblies[i]);
                }
                CustomEditorAttributes.s_Initialized = true;
            }
            Type result;

            if (type == null)
            {
                result = null;
            }
            else
            {
                Dictionary <Type, List <CustomEditorAttributes.MonoEditorType> > dictionary = (!multiEdit) ? CustomEditorAttributes.kSCustomEditors : CustomEditorAttributes.kSCustomMultiEditors;
                for (int j = 0; j < 2; j++)
                {
                    Type type2 = type;
                    while (type2 != null)
                    {
                        List <CustomEditorAttributes.MonoEditorType> list;
                        if (dictionary.TryGetValue(type2, out list))
                        {
                            goto IL_AB;
                        }
                        if (type2.IsGenericType)
                        {
                            type2 = type2.GetGenericTypeDefinition();
                            if (dictionary.TryGetValue(type2, out list))
                            {
                                goto IL_AB;
                            }
                        }
IL_20E:
                        type2 = type2.BaseType;
                        continue;
IL_AB:
                        CustomEditorAttributes.s_SearchCache.Clear();
                        foreach (CustomEditorAttributes.MonoEditorType current in list)
                        {
                            if (CustomEditorAttributes.IsAppropriateEditor(current, type2, type != type2, j == 1))
                            {
                                CustomEditorAttributes.s_SearchCache.Add(current);
                            }
                        }
                        Type type3 = null;
                        if (GraphicsSettings.renderPipelineAsset != null)
                        {
                            Type type4 = GraphicsSettings.renderPipelineAsset.GetType();
                            foreach (CustomEditorAttributes.MonoEditorType current2 in CustomEditorAttributes.s_SearchCache)
                            {
                                if (current2.m_RenderPipelineType == type4)
                                {
                                    type3 = current2.m_InspectorType;
                                    break;
                                }
                            }
                        }
                        if (type3 == null)
                        {
                            foreach (CustomEditorAttributes.MonoEditorType current3 in CustomEditorAttributes.s_SearchCache)
                            {
                                if (current3.m_RenderPipelineType == null)
                                {
                                    type3 = current3.m_InspectorType;
                                    break;
                                }
                            }
                        }
                        CustomEditorAttributes.s_SearchCache.Clear();
                        if (type3 != null)
                        {
                            result = type3;
                            return(result);
                        }
                        goto IL_20E;
                    }
                }
                result = null;
            }
            return(result);
        }