示例#1
0
        internal static void RegisterScriptedImporters()
        {
            IEnumerable <Type> allTypesWithAttribute = EditorAssemblies.GetAllTypesWithAttribute <ScriptedImporterAttribute>();

            foreach (Type current in allTypesWithAttribute)
            {
                Type type = current;
                ScriptedImporterAttribute       scriptedImporterAttribute   = Attribute.GetCustomAttribute(type, typeof(ScriptedImporterAttribute)) as ScriptedImporterAttribute;
                SortedDictionary <string, bool> handledExtensionsByImporter = ScriptedImporter.GetHandledExtensionsByImporter(scriptedImporterAttribute);
                foreach (Type current2 in allTypesWithAttribute)
                {
                    if (current2 != current)
                    {
                        ScriptedImporterAttribute       attribute = Attribute.GetCustomAttribute(current2, typeof(ScriptedImporterAttribute)) as ScriptedImporterAttribute;
                        SortedDictionary <string, bool> handledExtensionsByImporter2 = ScriptedImporter.GetHandledExtensionsByImporter(attribute);
                        foreach (KeyValuePair <string, bool> current3 in handledExtensionsByImporter2)
                        {
                            if (handledExtensionsByImporter.ContainsKey(current3.Key))
                            {
                                Debug.LogError(string.Format("Scripted importers {0} and {1} are targeting the {2} extension, rejecting both.", type.FullName, current2.FullName, current3.Key));
                                handledExtensionsByImporter.Remove(current3.Key);
                            }
                        }
                    }
                }
                MethodInfo method = type.GetMethod("GetHashOfImportedAssetDependencyHintsForTesting", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
                foreach (KeyValuePair <string, bool> current4 in handledExtensionsByImporter)
                {
                    AssetImporter.RegisterImporter(type, scriptedImporterAttribute.version, scriptedImporterAttribute.importQueuePriority, current4.Key, method != null);
                }
            }
        }
        internal static void RegisterScriptedImporters()
        {
            ArrayList   arrayList  = AttributeHelper.FindEditorClassesWithAttribute(typeof(ScriptedImporterAttribute));
            IEnumerator enumerator = arrayList.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    object current = enumerator.Current;
                    Type   type    = current as Type;
                    ScriptedImporterAttribute       scriptedImporterAttribute   = Attribute.GetCustomAttribute(type, typeof(ScriptedImporterAttribute)) as ScriptedImporterAttribute;
                    SortedDictionary <string, bool> handledExtensionsByImporter = ScriptedImporter.GetHandledExtensionsByImporter(scriptedImporterAttribute);
                    IEnumerator enumerator2 = arrayList.GetEnumerator();
                    try
                    {
                        while (enumerator2.MoveNext())
                        {
                            object current2 = enumerator2.Current;
                            if (current2 != current)
                            {
                                ScriptedImporterAttribute       attribute = Attribute.GetCustomAttribute(current2 as Type, typeof(ScriptedImporterAttribute)) as ScriptedImporterAttribute;
                                SortedDictionary <string, bool> handledExtensionsByImporter2 = ScriptedImporter.GetHandledExtensionsByImporter(attribute);
                                foreach (KeyValuePair <string, bool> current3 in handledExtensionsByImporter2)
                                {
                                    if (handledExtensionsByImporter.ContainsKey(current3.Key))
                                    {
                                        Debug.LogError(string.Format("Scripted importers {0} and {1} are targeting the {2} extension, rejecting both.", type.FullName, (current2 as Type).FullName, current3.Key));
                                        handledExtensionsByImporter.Remove(current3.Key);
                                    }
                                }
                            }
                        }
                    }
                    finally
                    {
                        IDisposable disposable;
                        if ((disposable = (enumerator2 as IDisposable)) != null)
                        {
                            disposable.Dispose();
                        }
                    }
                    foreach (KeyValuePair <string, bool> current4 in handledExtensionsByImporter)
                    {
                        AssetImporter.RegisterImporter(type, scriptedImporterAttribute.version, scriptedImporterAttribute.importQueuePriority, current4.Key);
                    }
                }
            }
            finally
            {
                IDisposable disposable2;
                if ((disposable2 = (enumerator as IDisposable)) != null)
                {
                    disposable2.Dispose();
                }
            }
        }
 private static bool SupportsRemappedAssetTypeProxy(ScriptedImporter importer, Type type)
 {
     return(importer.SupportsRemappedAssetType(type));
 }