private GetBuildTargetByName ( string platform ) : BuildTarget | ||
platform | string | |
Результат | BuildTarget |
public override string CalculateFinalPluginPath(string platformName, PluginImporter imp) { BuildTarget buildTargetByName = BuildPipeline.GetBuildTargetByName(platformName); bool flag1 = buildTargetByName == BuildTarget.StandaloneWindows || buildTargetByName == BuildTarget.StandaloneWindows64; bool flag2 = buildTargetByName == BuildTarget.StandaloneOSXIntel || buildTargetByName == BuildTarget.StandaloneOSXIntel64 || buildTargetByName == BuildTarget.StandaloneOSXUniversal; bool flag3 = buildTargetByName == BuildTarget.StandaloneLinux || buildTargetByName == BuildTarget.StandaloneLinux64 || buildTargetByName == BuildTarget.StandaloneLinuxUniversal; if (!flag3 && !flag2 && !flag1) { throw new Exception(string.Format("Failed to resolve standalone platform, platform string '{0}', resolved target '{1}'", (object)platformName, (object)buildTargetByName.ToString())); } if (flag1 && !this.IsUsableOnWindows(imp) || flag2 && !this.IsUsableOnOSX(imp) || flag3 && !this.IsUsableOnLinux(imp)) { return(string.Empty); } string platformData = imp.GetPlatformData(platformName, "CPU"); if (string.Compare(platformData, "None", true) == 0) { return(string.Empty); } if (!string.IsNullOrEmpty(platformData) && string.Compare(platformData, "AnyCPU", true) != 0) { return(Path.Combine(platformData, Path.GetFileName(imp.assetPath))); } return(Path.GetFileName(imp.assetPath)); }
public override string CalculateFinalPluginPath(string platformName, PluginImporter imp) { BuildTarget buildTargetByName = BuildPipeline.GetBuildTargetByName(platformName); bool flag = (buildTargetByName == BuildTarget.StandaloneWindows) || (buildTargetByName == BuildTarget.StandaloneWindows64); bool flag2 = ((buildTargetByName == BuildTarget.StandaloneOSXIntel) || (buildTargetByName == BuildTarget.StandaloneOSXIntel64)) || (buildTargetByName == BuildTarget.StandaloneOSXUniversal); bool flag3 = ((buildTargetByName == BuildTarget.StandaloneLinux) || (buildTargetByName == BuildTarget.StandaloneLinux64)) || (buildTargetByName == BuildTarget.StandaloneLinuxUniversal); if ((!flag3 && !flag2) && !flag) { throw new Exception($"Failed to resolve standalone platform, platform string '{platformName}', resolved target '{buildTargetByName.ToString()}'"); } if (flag && !this.IsUsableOnWindows(imp)) { return(string.Empty); } if (flag2 && !this.IsUsableOnOSX(imp)) { return(string.Empty); } if (flag3 && !this.IsUsableOnLinux(imp)) { return(string.Empty); } string platformData = imp.GetPlatformData(platformName, "CPU"); if (string.Compare(platformData, "None", true) == 0) { return(string.Empty); } if (!string.IsNullOrEmpty(platformData) && (string.Compare(platformData, "AnyCPU", true) != 0)) { return(Path.Combine(platformData, Path.GetFileName(imp.assetPath))); } return(Path.GetFileName(imp.assetPath)); }
internal bool GetCompatibleWithPlatform(string platformName) { if (base.targets.Length > 1) { throw new InvalidOperationException("Cannot be used while multiple plugins are selected"); } return(this.m_CompatibleWithPlatform[(int)BuildPipeline.GetBuildTargetByName(platformName)] == 1); }
public static PluginImporter[] GetImporters(string platformName) { // The final list of importers that will be returned List <PluginImporter> finalImporters = new List <PluginImporter>(); // Contains all unique finalPaths. Used to remove overridable plugins from the finalImporters list Dictionary <string, PluginImporter> uniqueFinalPathToImporterMap = new Dictionary <string, PluginImporter>(); PluginImporter[] allImporters = GetAllImporters().Where(imp => imp.GetCompatibleWithPlatformOrAnyPlatformBuildTarget(platformName)).ToArray(); IPluginImporterExtension pluginImporterExtension = ModuleManager.GetPluginImporterExtension(platformName); if (pluginImporterExtension == null) { pluginImporterExtension = ModuleManager.GetPluginImporterExtension(BuildPipeline.GetBuildTargetByName(platformName)); } if (pluginImporterExtension == null) { return(allImporters); } // Go through all of the Importers for the specified platform and determine if any of the natively included Unity Plugins should be removed. // Removal should only happen if the user has included a plugin of the same name and they are copying to the same finalPath for (int i = 0; i < allImporters.Length; ++i) { PluginImporter currentImporter = allImporters[i]; string finalPluginPath = pluginImporterExtension.CalculateFinalPluginPath(platformName, currentImporter); // Only compare overridables if the plugin has a calculated finalPluginPath if (!string.IsNullOrEmpty(finalPluginPath)) { PluginImporter tempImporter; if (!uniqueFinalPathToImporterMap.TryGetValue(finalPluginPath, out tempImporter)) { // Unique Plugin found, add it to the list for comparing overridable plugins // The first overridable plugin of it's kind should be added to the return list here. uniqueFinalPathToImporterMap.Add(finalPluginPath, currentImporter); } else if (tempImporter.GetIsOverridable() && !currentImporter.GetIsOverridable()) { // finalPluginPath isn't unique and the finalImporter already in the list is overriden by the new one, // remove the overridable one. uniqueFinalPathToImporterMap[finalPluginPath] = currentImporter; finalImporters.Remove(tempImporter); } else if (currentImporter.GetIsOverridable()) { // The current importer is going to the same final location as another, but // this plugin is overridable, so don't include it. continue; } } finalImporters.Add(currentImporter); } return(finalImporters.ToArray()); }
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); }
// Used by extensions, for ex., Standalone where we have options for enabling/disabling platform in platform specific extensions internal Compatibility GetPlatformCompatibility(string platformName) { var buildTarget = BuildPipeline.GetBuildTargetByName(platformName); if (!IsValidBuildTarget(buildTarget)) { return(Compatibility.NotCompatible); } return(m_CompatibleWithPlatform[(int)buildTarget]); }
public override string CalculateFinalPluginPath(string platformName, PluginImporter imp) { BuildTarget target = BuildPipeline.GetBuildTargetByName(platformName); bool pluginForWindows = target == BuildTarget.StandaloneWindows || target == BuildTarget.StandaloneWindows64; #pragma warning disable 612, 618 bool pluginForOSX = target == BuildTarget.StandaloneOSXIntel || target == BuildTarget.StandaloneOSXIntel64 || target == BuildTarget.StandaloneOSX; bool pluginForLinux = target == BuildTarget.StandaloneLinux || target == BuildTarget.StandaloneLinux64 || target == BuildTarget.StandaloneLinuxUniversal || target == BuildTarget.CloudRendering; #pragma warning restore 612, 618 if (!pluginForLinux && !pluginForOSX && !pluginForWindows) { throw new Exception(string.Format("Failed to resolve standalone platform, platform string '{0}', resolved target '{1}'", platformName, target.ToString())); } if (pluginForWindows && !IsUsableOnWindows(imp)) { return(string.Empty); } if (pluginForOSX && !IsUsableOnOSX(imp)) { return(string.Empty); } if (pluginForLinux && !IsUsableOnLinux(imp)) { return(string.Empty); } string cpu = imp.GetPlatformData(platformName, "CPU"); if (string.Compare(cpu, "None", true) == 0) { return(string.Empty); } if (pluginForWindows) { // Fix case 1185926: plugins for x86_64 are supposed to be copied to Plugins/x86_64 // Plugins for x86 are supposed to be copied to Plugins/x86 var cpuName = target == BuildTarget.StandaloneWindows ? nameof(DesktopPluginCPUArchitecture.x86) : nameof(DesktopPluginCPUArchitecture.x86_64); return(Path.Combine(cpuName, Path.GetFileName(imp.assetPath))); } if (pluginForOSX) { // Add the correct architecture if not AnyCPU return(base.CalculateFinalPluginPath(platformName, imp)); } // For files this will return filename, for directories, this will return last path component return(Path.GetFileName(imp.assetPath)); }
internal void SetPlatformCompatibility(string platformName, PluginImporterInspector.Compatibility compatibility) { if (compatibility == PluginImporterInspector.Compatibility.Mixed) { throw new ArgumentException("compatibility value cannot be Mixed"); } int buildTargetByName = (int)BuildPipeline.GetBuildTargetByName(platformName); if (this.m_CompatibleWithPlatform[buildTargetByName] != compatibility) { this.m_CompatibleWithPlatform[buildTargetByName] = compatibility; this.m_HasModified = true; } }
internal PluginImporterInspector.Compatibility GetPlatformCompatibility(string platformName) { BuildTarget buildTargetByName = BuildPipeline.GetBuildTargetByName(platformName); PluginImporterInspector.Compatibility result; if (!PluginImporterInspector.IsValidBuildTarget(buildTargetByName)) { result = PluginImporterInspector.Compatibility.NotCompatible; } else { result = this.m_CompatibleWithPlatform[(int)buildTargetByName]; } return(result); }
internal void SetCompatibleWithPlatform(string platformName, bool enabled) { if (this.targets.Length > 1) { throw new InvalidOperationException("Cannot be used while multiple plugins are selected"); } int num = !enabled ? 0 : 1; int buildTargetByName = (int)BuildPipeline.GetBuildTargetByName(platformName); if (this.m_CompatibleWithPlatform[buildTargetByName] == num) { return; } this.m_CompatibleWithPlatform[buildTargetByName] = num; this.m_HasModified = true; }
internal void SetPlatformCompatibility(string platformName, Compatibility compatibility) { if (compatibility == Compatibility.Mixed) { throw new ArgumentException("compatibility value cannot be Mixed"); } var buildTarget = BuildPipeline.GetBuildTargetByName(platformName); if (!IsValidBuildTarget(buildTarget) || m_CompatibleWithPlatform[(int)buildTarget] == compatibility) { return; } m_CompatibleWithPlatform[(int)buildTarget] = compatibility; m_HasModified = true; }
public override string CalculateFinalPluginPath(string platformName, PluginImporter imp) { BuildTarget target = BuildPipeline.GetBuildTargetByName(platformName); bool pluginForWindows = target == BuildTarget.StandaloneWindows || target == BuildTarget.StandaloneWindows64; #pragma warning disable 612, 618 bool pluginForOSX = target == BuildTarget.StandaloneOSXIntel || target == BuildTarget.StandaloneOSXIntel64 || target == BuildTarget.StandaloneOSX; #pragma warning restore 612, 618 bool pluginForLinux = target == BuildTarget.StandaloneLinux || target == BuildTarget.StandaloneLinux64 || target == BuildTarget.StandaloneLinuxUniversal; if (!pluginForLinux && !pluginForOSX && !pluginForWindows) { throw new Exception(string.Format("Failed to resolve standalone platform, platform string '{0}', resolved target '{1}'", platformName, target.ToString())); } if (pluginForWindows && !IsUsableOnWindows(imp)) { return(string.Empty); } if (pluginForOSX && !IsUsableOnOSX(imp)) { return(string.Empty); } if (pluginForLinux && !IsUsableOnLinux(imp)) { return(string.Empty); } string cpu = imp.GetPlatformData(platformName, "CPU"); if (string.Compare(cpu, "None", true) == 0) { return(string.Empty); } if (!string.IsNullOrEmpty(cpu) && string.Compare(cpu, "AnyCPU", true) != 0) { return(Path.Combine(cpu, Path.GetFileName(imp.assetPath))); } // For files this will return filename, for directories, this will return last path component return(Path.GetFileName(imp.assetPath)); }
internal Compatibility GetPlatformCompatibility(string platformName) => this.m_CompatibleWithPlatform[(int)BuildPipeline.GetBuildTargetByName(platformName)];
internal PluginImporterInspector.Compatibility GetPlatformCompatibility(string platformName) { return(this.m_CompatibleWithPlatform[(int)BuildPipeline.GetBuildTargetByName(platformName)]); }
public static void SetPlatformSettings(string platformName, string name, string value) { string buildTargetGroup = BuildPipeline.GetBuildTargetGroupName(BuildPipeline.GetBuildTargetByName(platformName)); SetPlatformSettings(buildTargetGroup, platformName, name, value); }
public string GetPlatformData(string platformName, string key) { return(GetPlatformData(BuildPipeline.GetBuildTargetByName(platformName), key)); }
public bool GetCompatibleWithPlatform(string platformName) { return(GetCompatibleWithPlatform(BuildPipeline.GetBuildTargetGroupName(BuildPipeline.GetBuildTargetByName(platformName)), platformName)); }
public static string GetPlatformSettings(string platformName, string name) { string buildTargetGroup = BuildPipeline.GetBuildTargetGroupName(BuildPipeline.GetBuildTargetByName(platformName)); return(GetPlatformSettings(buildTargetGroup, platformName, name)); }
public void SetCompatibleWithPlatform(string platformName, bool enable) { SetCompatibleWithPlatform(BuildPipeline.GetBuildTargetGroupName(BuildPipeline.GetBuildTargetByName(platformName)), platformName, enable); }