Esempio n. 1
0
 public static PluginImporter[] GetImporters(string platformName)
 {
     return((
                from imp in PluginImporter.GetAllImporters()
                where (imp.GetCompatibleWithPlatform(platformName) || imp.GetCompatibleWithAnyPlatform()) && !string.IsNullOrEmpty(imp.assetPath)
                select imp).ToArray <PluginImporter>());
 }
Esempio n. 2
0
 /// <summary>
 ///   <para>Returns all plugin importers for specfied platform.</para>
 /// </summary>
 /// <param name="platform">Target platform.</param>
 /// <param name="platformName">Name of the target platform.</param>
 public static PluginImporter[] GetImporters(string platformName)
 {
     // ISSUE: object of a compiler-generated type is created
     // ISSUE: reference to a compiler-generated method
     return(((IEnumerable <PluginImporter>)PluginImporter.GetAllImporters()).Where <PluginImporter>(new Func <PluginImporter, bool>(new PluginImporter.\u003CGetImporters\u003Ec__AnonStorey16()
     {
         platformName = platformName
     }.\u003C\u003Em__1C)).ToArray <PluginImporter>());
 }
Esempio n. 3
0
        public static PluginImporter[] GetImporters(string platformName)
        {
            List <PluginImporter> list = new List <PluginImporter>();
            Dictionary <string, PluginImporter> dictionary = new Dictionary <string, PluginImporter>();

            PluginImporter[] array = (from imp in PluginImporter.GetAllImporters()
                                      where PluginImporter.IsCompatible(imp, platformName)
                                      select imp).ToArray <PluginImporter>();
            IPluginImporterExtension pluginImporterExtension = ModuleManager.GetPluginImporterExtension(platformName);

            if (pluginImporterExtension == null)
            {
                pluginImporterExtension = ModuleManager.GetPluginImporterExtension(BuildPipeline.GetBuildTargetByName(platformName));
            }
            PluginImporter[] result;
            if (pluginImporterExtension == null)
            {
                result = array;
            }
            else
            {
                int i = 0;
                while (i < array.Length)
                {
                    PluginImporter pluginImporter = array[i];
                    string         text           = pluginImporterExtension.CalculateFinalPluginPath(platformName, pluginImporter);
                    if (!string.IsNullOrEmpty(text))
                    {
                        PluginImporter pluginImporter2;
                        if (!dictionary.TryGetValue(text, out pluginImporter2))
                        {
                            dictionary.Add(text, pluginImporter);
                        }
                        else if (pluginImporter2.GetIsOverridable() && !pluginImporter.GetIsOverridable())
                        {
                            dictionary[text] = pluginImporter;
                            list.Remove(pluginImporter2);
                        }
                        else if (pluginImporter.GetIsOverridable())
                        {
                            goto IL_106;
                        }
                        goto IL_FD;
                    }
                    goto IL_FD;
IL_106:
                    i++;
                    continue;
IL_FD:
                    list.Add(pluginImporter);
                    goto IL_106;
                }
                result = list.ToArray();
            }
            return(result);
        }
        public static Error[] ValidateAssemblyDefinitionFiles()
        {
            var customScriptAssemblies = EditorCompilationInterface.Instance.GetCustomScriptAssemblies();

            if (customScriptAssemblies.Length == 0)
            {
                return(null);
            }

            var pluginImporters = PluginImporter.GetAllImporters();

            if (pluginImporters == null || pluginImporters.Length == 0)
            {
                return(null);
            }

            var pluginFilenameToAssetPath = new Dictionary <string, string>();

            foreach (var pluginImporter in pluginImporters)
            {
                var pluginAssetPath     = pluginImporter.assetPath;
                var lowerPluginFilename = AssetPath.GetFileName(pluginAssetPath).ToLower(CultureInfo.InvariantCulture);
                pluginFilenameToAssetPath[lowerPluginFilename] = pluginAssetPath;
            }

            var errors = new List <Error>();

            foreach (var customScriptAssembly in customScriptAssemblies)
            {
                var lowerAsmdefFilename = $"{customScriptAssembly.Name.ToLower(CultureInfo.InvariantCulture)}.dll";

                string pluginPath;

                if (pluginFilenameToAssetPath.TryGetValue(lowerAsmdefFilename, out pluginPath))
                {
                    var error = new Error()
                    {
                        message      = $"Plugin '{pluginPath}' has the same filename as Assembly Definition File '{customScriptAssembly.FilePath}'. Rename the assemblies to avoid hard to diagnose issues and crashes.",
                        flags        = ErrorFlags.AsmdefPluginConflict,
                        assemblyPath = pluginPath
                    };

                    errors.Add(error);
                }
            }

            return(errors.ToArray());
        }
Esempio n. 5
0
 public static PluginImporter[] GetImporters(string platformName)
 {
     return((from imp in PluginImporter.GetAllImporters()
             where PluginImporter.IsCompatible(imp, platformName)
             select imp).ToArray <PluginImporter>());
 }
Esempio n. 6
0
 public static PluginImporter[] GetImporters(string buildTargetGroup, string buildTarget)
 {
     return((from imp in PluginImporter.GetAllImporters()
             where PluginImporter.IsCompatible(imp, buildTargetGroup, buildTarget)
             select imp).ToArray <PluginImporter>());
 }
Esempio n. 7
0
 public static PluginImporter[] GetImporters(string buildTargetGroup, string buildTarget)
 {
     return((from imp in PluginImporter.GetAllImporters()
             where imp.GetCompatibleWithPlatformOrAnyPlatformBuildGroupAndTarget(buildTargetGroup, buildTarget)
             select imp).ToArray <PluginImporter>());
 }