/*----------Functions----------*/ //PUBLIC /// <summary> /// Create of this data container with the specified values /// </summary> /// <param name="asset">The project asset that corresponds with this package description</param> /// <param name="assembly">The assembly object that is associated with the assembly definition</param> /// <param name="packageJson">The raw JSON string that describes the package that was identifed</param> public PackageData(AssemblyDefinitionAsset asset, Assembly assembly, string packageJson) { // If there is JSON data, load that over the top of this object first if (!string.IsNullOrEmpty(packageJson)) { // Load the packaged JSON data into this objects memory try { JsonUtility.FromJsonOverwrite(packageJson, this); } // If anything goes wrong, then we can't load the package description data catch (Exception exec) { Debug.LogError($"Unable to parse the package description JSON associated with {asset}. ERROR: {exec}", asset); packageJson = null; } } // If there are no names set for this package, take it from the asset if (string.IsNullOrEmpty(name)) { name = asset.name; } if (string.IsNullOrEmpty(displayName)) { displayName = ObjectNames.NicifyVariableName(asset.name.Replace(".", string.Empty)); } // Stash the parameter data AssemblyAsset = asset; PackageAssembly = assembly; RawPackageJson = packageJson; }
public static string GetNamespace(AssemblyDefinitionAsset assembly, string assetPath) { string assemblyPath = new FileInfo(AssetDatabase.GetAssetPath(assembly)).Directory.FullName; string scriptPath = new FileInfo(assetPath).Directory.FullName; string scriptNamespace = scriptPath .Substring(assemblyPath.Length) .Replace(Path.DirectorySeparatorChar, '.'); return(CleanNamespace(GetNamespace(assembly) + scriptNamespace)); }
private static string GetAssemblyName(AssemblyDefinitionAsset asmdef) { var m = AsmdefNameRegex.Match(asmdef.text); if (!m.Success) { throw new Exception($"Assembly name is missing: {asmdef.name}"); } return(m.Groups[1].Value); }
public static AssemblyDefinitionDescription Deserialize([NotNull] this AssemblyDefinitionAsset asset) { var assetPath = UnityEditor.AssetDatabase.GetAssetPath(asset); var assemblyDefinition = BuildAssemblyCache.AssemblyDefinitionDescriptionUtility.Deserialize(assetPath); return(new AssemblyDefinitionDescription { name = assemblyDefinition.name , references = assemblyDefinition.references , includePlatforms = assemblyDefinition.includePlatforms , excludePlatforms = assemblyDefinition.excludePlatforms , optionalUnityReferences = assemblyDefinition.optionalUnityReferences }); }
/// <summary> /// Loads all attributes from the attributes file of the specified assembly definition asset. /// </summary> /// <param name="assemblyDefinition">The assembly definition asset.</param> public static HashSet <string> LoadAttributes(AssemblyDefinitionAsset assemblyDefinition) { var attributes = new HashSet <string>(); if (IsAttributesFileExists(assemblyDefinition)) { string path = GetAttributesFilePath(assemblyDefinition); string text = File.ReadAllText(path); InternalParseAttributes(text, attributes); } return(attributes); }
public void Load(string reference, bool useGUID) { var referencePath = CompilationPipeline.GetAssemblyDefinitionFilePathFromAssemblyReference(reference); if (!string.IsNullOrEmpty(referencePath)) { asset = AssetDatabase.LoadAssetAtPath <AssemblyDefinitionAsset>(referencePath); if (useGUID) { var fileData = CustomScriptAssemblyData.FromJson(asset.text); name = fileData.name; } } }
internal Assembly[] CollectAssembiles() { var names = new List <string>(); for (int i = 0; i < assemblies.Count; i++) { AssemblyDefinitionAsset asmDef = assemblies[i]; if (asmDef == null) { continue; } var asmDefData = JsonUtility.FromJson <AssemblyDefinitionData>(asmDef.text); names.Add(asmDefData.name); } return(AppDomain.CurrentDomain.GetAssemblies().Where(a => names.Contains(a.GetName().Name)).ToArray()); }
public static void SyncCSProject(AssemblyDefinitionAsset asset) { var m_data = (Dictionary <string, object>)EditorJson.Deserialize(asset.text); var aname = (string)m_data["name"]; var aa = UnityEditor.Compilation.CompilationPipeline.GetAssemblies().Where(x => x.name == aname).ToArray(); var sourceList = aa[0].sourceFiles; //Task.Run(_); //void _() { var cspath = $"{System.Environment.CurrentDirectory}/{aname}.csproj".separatorToOS(); var content = fs.ReadAllText(cspath); var ss = content.Replace("\r", "").Split('\n'); int step = 0; fs.WriteFileAll(cspath, (b) => { foreach (var s in ss) { if (step == 0) { if (s.Contains("Compile Include")) { step = 1; continue; } } else if (step == 1) { if (s.Contains("None Include") || s.Contains("Reference Include")) { step = 2; foreach (var c in aa[0].sourceFiles) { b.AppendLine($" <Compile Include=\"{c.separatorToOS()}\" />"); } } else { continue; } } b.AppendLine(s); } }, utf8bom: true, newLineLinux: false); //} }
/// <summary> /// Gets the attributes file for the specified assembly definition file. /// </summary> /// <param name="assemblyDefinition">The assembly definition asset.</param> public static string GetAttributesFilePath(AssemblyDefinitionAsset assemblyDefinition) { string path = AssetDatabase.GetAssetPath(assemblyDefinition); string directory = Path.GetDirectoryName(path)?.Replace('\\', '/'); var builder = new StringBuilder(); if (!string.IsNullOrEmpty(directory)) { builder.Append(directory); builder.Append('/'); } builder.Append(assemblyDefinition.name); builder.Append(".Attributes.cs"); return(builder.ToString()); }
/// <summary> /// Get the Package Data associated with the specified <see cref="AssemblyDefinitionAsset"/> /// </summary> /// <param name="asset">The assembly asset that is to be looked for in the contained package descriptions</param> /// <returns>Returns a PackageData object containing information about the identified package or null if unable to find a match</returns> public static PackageData GetPackageFromAssemblyAsset(AssemblyDefinitionAsset asset) { // If there is no asset, nothing to find if (!asset) { return(null); } // Look for a matching data object for (int i = 0; i < includedPackages.Count; ++i) { if (includedPackages[i].AssemblyAsset == asset) { return(includedPackages[i]); } } // If we got this far, nothing to find return(null); }
private static void LogException(Exception exception) { AssemblyDefinitionException ex = exception as AssemblyDefinitionException; if (ex != null && ex.filePaths.Length > 0) { string[] filePaths = ex.filePaths; for (int i = 0; i < filePaths.Length; i++) { string text = filePaths[i]; string message = string.Format("{0} ({1})", exception.Message, text); AssemblyDefinitionAsset assemblyDefinitionAsset = AssetDatabase.LoadAssetAtPath <AssemblyDefinitionAsset>(text); int instanceID = assemblyDefinitionAsset.GetInstanceID(); CompilationPipeline.LogEditorCompilationError(message, instanceID); } } else { Debug.LogException(exception); } }
/// <summary> /// Saves the specified attributes to the attributes file of the specified assembly definition asset. /// <para> /// If the count of the passed attributes is zero and attribute file already exists, will delete empty attribute file. /// </para> /// </summary> /// <param name="assemblyDefinition">The assembly definition asset.</param> /// <param name="attributes">The collection of the text representation of the attributes.</param> public static void SaveAttributes(AssemblyDefinitionAsset assemblyDefinition, HashSet <string> attributes) { if (attributes.Count > 0) { var builder = new StringBuilder(); foreach (string attribute in attributes) { builder.AppendLine(attribute); } string path = GetAttributesFilePath(assemblyDefinition); string text = builder.ToString(); File.WriteAllText(path, text); AssetDatabase.ImportAsset(path); } else if (IsAttributesFileExists(assemblyDefinition)) { AssetDatabase.DeleteAsset(GetAttributesFilePath(assemblyDefinition)); } AssetDatabase.SaveAssets(); }
private void DrawReferenceListElement(Rect rect, int index, bool selected, bool focused) { IList list = this.m_ReferencesList.list; AssemblyDefinitionImporterInspector.AssemblyDefinitionReference assemblyDefinitionReference = list[index] as AssemblyDefinitionImporterInspector.AssemblyDefinitionReference; rect.height -= 2f; string text = (assemblyDefinitionReference.data == null) ? "(Missing Reference)" : assemblyDefinitionReference.data.name; AssemblyDefinitionAsset asset = assemblyDefinitionReference.asset; bool flag = assemblyDefinitionReference.displayValue == AssemblyDefinitionImporterInspector.MixedBool.Mixed; EditorGUI.showMixedValue = flag; assemblyDefinitionReference.asset = (EditorGUI.ObjectField(rect, (!flag) ? text : "(Multiple Values)", asset, typeof(AssemblyDefinitionAsset), false) as AssemblyDefinitionAsset); EditorGUI.showMixedValue = false; if (asset != assemblyDefinitionReference.asset && assemblyDefinitionReference.asset != null) { assemblyDefinitionReference.data = CustomScriptAssemblyData.FromJson(assemblyDefinitionReference.asset.text); AssemblyDefinitionImporterInspector.AssemblyDefintionState[] targetStates = this.m_TargetStates; for (int i = 0; i < targetStates.Length; i++) { AssemblyDefinitionImporterInspector.AssemblyDefintionState assemblyDefintionState = targetStates[i]; assemblyDefintionState.references[index] = assemblyDefinitionReference; } } }
/// <summary> /// Adds or removes a text representation of the attribute in attributes file of the specified assembly definition asset, depends on the specified state value. /// </summary> /// <param name="assemblyDefinition">The assembly definition asset.</param> /// <param name="attribute">The text representation of the attribute.</param> /// <param name="state">The state of the attribute.</param> public static void SetAttributeActive(AssemblyDefinitionAsset assemblyDefinition, string attribute, bool state) { if (assemblyDefinition == null) { throw new ArgumentNullException(nameof(assemblyDefinition)); } if (attribute == null) { throw new ArgumentNullException(nameof(attribute)); } HashSet <string> attributes = LoadAttributes(assemblyDefinition); if (state) { attributes.Add(attribute); } else { attributes.Remove(attribute); } SaveAttributes(assemblyDefinition, attributes); }
public static void ApplyPackageLabels() { // Find all of the MCU directories within the assets of the project List <string> rootDirectories = FindAssetDirectories(nameof(MCU), false); if (rootDirectories.Count == 0) { return; } // Queue of the processing of labels for elements Queue <(DirectoryInfo, HashSet <string>)> unsearched = new Queue <(DirectoryInfo, HashSet <string>)>(); for (int i = 0; i < rootDirectories.Count; ++i) { unsearched.Enqueue((new DirectoryInfo(rootDirectories[i]), new HashSet <string>())); } // Label all of the identified assets that are found List <FileSystemInfo> fileBuffer = new List <FileSystemInfo>(); while (unsearched.Count > 0) { // Get the search element for this stage (DirectoryInfo dir, HashSet <string> labels)current = unsearched.Dequeue(); // Add the current directories name to the label list current.labels.Add(current.dir.Name); // Load in the labels for the package that is found bool foundPackageRoot = false; FileInfo[] assemblyFiles = current.dir.GetFiles("*.asmdef", SearchOption.TopDirectoryOnly); foreach (FileInfo assemblyFile in assemblyFiles) { // Try to load the assembly reference at this location AssemblyDefinitionAsset assemblyAsset = AssetDatabase.LoadAssetAtPath <AssemblyDefinitionAsset>( assemblyFile.FullName.Substring(WORKING_DIRECTORY.Length).Replace('\\', '/') ); // If an asset could be loaded, get the labels that need to be added if (assemblyAsset) { // Flag that a package root was found foundPackageRoot = true; // Look for the package data that is to be associated with it PackageData packageData = GetPackageFromAssemblyAsset(assemblyAsset); if (packageData == null) { Debug.LogError($"Unable to find the PackageData corresponding to '{assemblyAsset}'. Can't extract labels", assemblyAsset); continue; } // Add the current level of labels to the package data packageData.Labels.UnionWith(current.labels); // Add the labels to the list for this level current.labels.UnionWith(packageData.Labels); } } // Clear the buffer of files for this point fileBuffer.Clear(); // If we didn't find a package root, we need to recurse down if (!foundPackageRoot) { // Find all of the directories that are at this level foreach (DirectoryInfo dir in current.dir.EnumerateDirectories("*", SearchOption.TopDirectoryOnly)) { unsearched.Enqueue((dir, new HashSet <string>(current.labels))); } // Find the files at this level that need to be labeled fileBuffer.AddRange(current.dir.EnumerateFiles("*", SearchOption.TopDirectoryOnly)); } // Otherwise, we just want to grab everything in this directory and below to be labeled else { fileBuffer.AddRange(current.dir.EnumerateFileSystemInfos("*", SearchOption.AllDirectories)); } // Add this directory to the collection to be labeled fileBuffer.Add(current.dir); // Set the labels on all of the assets that were identified foreach (FileSystemInfo element in fileBuffer) { // Correct the path of the asset to something that works with the Asset Database string assetPath = element.FullName.Substring(WORKING_DIRECTORY.Length).Replace('\\', '/'); // Try to load the generic asset at this location to set the labels UnityEngine.Object asset = AssetDatabase.LoadAssetAtPath <UnityEngine.Object>(assetPath); if (asset) { AddLabelsToAsset(asset, current.labels); } } } }
/// <summary> /// Find all of the usable package descriptions that currently exist within the project /// </summary> private static void IdentifyProjectPackages() { // Build a lookup collection of the different assemblies within the project Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); Dictionary <string, Assembly> assemblyLookup = new Dictionary <string, Assembly>(assemblies.Length); for (int i = 0; i < assemblies.Length; ++i) { assemblyLookup[assemblies[i].GetName().Name.ToLowerInvariant()] = assemblies[i]; } // Get all of the package descriptions that are included in this project DirectoryInfo workingDir = new DirectoryInfo(WORKING_DIRECTORY); FileInfo[] packageFileInfos = workingDir.GetFiles("package.json", SearchOption.AllDirectories); PackageFile[] packageFiles = new PackageFile[packageFileInfos.Length]; for (int i = 0; i < packageFileInfos.Length; ++i) { // Try to deserialise the package data into the container try { // Try to load the JSON data from the file string json = File.ReadAllText(packageFileInfos[i].FullName); // Try to deserialise the JSON data into the current container packageFiles[i] = JsonUtility.FromJson <PackageFile>(json); // Store the values that are needed for processing packageFiles[i].name = (string.IsNullOrEmpty(packageFiles[i].name) ? string.Empty : packageFiles[i].name.ToLowerInvariant() ); packageFiles[i].rawJson = json; } // If anything goes wrong, assume this is a bust catch (Exception exec) { packageFiles[i].name = packageFiles[i].rawJson = string.Empty; Debug.LogWarning($"Unable to parse '{packageFileInfos[i].FullName.Substring(WORKING_DIRECTORY.Length)}'. ERROR: {exec}"); } } // Look for Assembly Definition Assets in the project that need to be processed string[] assetIds = AssetDatabase.FindAssets($"t:{nameof(AssemblyDefinitionAsset)}"); for (int i = 0; i < assetIds.Length; ++i) { // Get the path to the asset that is to be loaded string path = AssetDatabase.GUIDToAssetPath(assetIds[i]); // Try to load the assembly definition asset at this location AssemblyDefinitionAsset asset = AssetDatabase.LoadAssetAtPath <AssemblyDefinitionAsset>(path); if (asset) { // Identify the package JSON that will be used string packageJson = null; string lowerName = asset.name.ToLowerInvariant(); for (int ii = 0; ii < packageFiles.Length; ++ii) { // Check if this is the associated package data if (!string.IsNullOrEmpty(packageFiles[ii].name) && packageFiles[ii].name.Contains(lowerName)) { packageJson = packageFiles[ii].rawJson; break; } } // Look for the assembly that matches the name of this package Assembly packageAssembly = null; foreach (var pair in assemblyLookup) { // Check if this assembly has a mathching name if (pair.Key.Contains(lowerName)) { packageAssembly = pair.Value; break; } } // Add the package description to the collection includedPackages.Add(new PackageData( asset, packageAssembly, packageJson )); } } }
public UnityProjectInfo(IEnumerable <CompilationPlatformInfo> availablePlatforms, string projectOutputPath) { this.availablePlatforms = availablePlatforms; Dictionary <string, Assembly> unityAssemblies = CompilationPipeline.GetAssemblies().ToDictionary(t => t.name); Dictionary <string, CSProjectInfo> csProjects = new Dictionary <string, CSProjectInfo>(); CSProjects = new ReadOnlyDictionary <string, CSProjectInfo>(csProjects); foreach (KeyValuePair <string, Assembly> pair in unityAssemblies) { CSProjectInfo toAdd; string asmDefPath = CompilationPipeline.GetAssemblyDefinitionFilePathFromAssemblyName(pair.Key); if (string.IsNullOrEmpty(asmDefPath)) { if (!pair.Key.StartsWith("Assembly-CSharp")) { Debug.LogError($"Failed to retrieve AsmDef for script assembly: {pair.Key}"); } toAdd = new CSProjectInfo(availablePlatforms, Guid.NewGuid(), null, pair.Value, projectOutputPath); } else { string guid = AssetDatabase.AssetPathToGUID(asmDefPath); if (!Guid.TryParse(guid, out Guid guidResult)) { Debug.LogError($"Failed to get GUID of the AsmDef at '{asmDefPath}' for assembly: {pair.Key}"); } else { guidResult = Guid.NewGuid(); } AssemblyDefinitionAsset assemblyDefinitionAsset = AssetDatabase.LoadAssetAtPath <AssemblyDefinitionAsset>(asmDefPath); AssemblyDefinitionInfo assemblyDefinitionInfo = assemblyDefinitionAsset == null ? null : JsonUtility.FromJson <AssemblyDefinitionInfo>(assemblyDefinitionAsset.text); assemblyDefinitionInfo?.Validate(availablePlatforms); toAdd = new CSProjectInfo(availablePlatforms, guidResult, assemblyDefinitionInfo, pair.Value, projectOutputPath); } csProjects.Add(pair.Key, toAdd); } Plugins = new ReadOnlyCollection <PluginAssemblyInfo>(ScanForPluginDLLs()); foreach (PluginAssemblyInfo plugin in Plugins) { if (plugin.Type == PluginType.Native) { Debug.LogWarning($"Native plugin {plugin.ReferencePath.AbsolutePath} not yet supported for MSBuild project."); } } foreach (CSProjectInfo project in CSProjects.Values) { // Get the assembly references first from AssemblyDefinitionInfo if available (it's actually more correct), otherwise fallback to Assemby IEnumerable <string> references = project.AssemblyDefinitionInfo == null ? project.Assembly.assemblyReferences.Select(t => t.name) : (project.AssemblyDefinitionInfo.references ?? Array.Empty <string>()); foreach (string reference in references) { if (CSProjects.TryGetValue(reference, out CSProjectInfo dependency)) { project.AddDependency(dependency); } else { Debug.LogError($"Failed to get dependency '{reference}' for project '{project.Name}'."); } } foreach (PluginAssemblyInfo plugin in Plugins) { if (plugin.AutoReferenced && plugin.Type != PluginType.Native) { project.AddDependency(plugin); } } } }
public static AssemblyDefinition GetData(this AssemblyDefinitionAsset asset) { string text = Encoding.UTF8.GetString(asset.bytes); return(JsonUtility.FromJson <AssemblyDefinition>(text)); }
public static Assembly ToAssembly([NotNull] this AssemblyDefinitionAsset assembly) { var name = assembly.Deserialize().name; return(Core.Utilities.ALL_ASSEMBLIES.Value.FirstOrDefault(assembly => assembly.GetName().Name == name)); }
public AssemblyDataNode(AssemblyDefinitionAsset textAsset) { this.textAsset = textAsset; this.data = new AssamblyAssetData(this.textAsset.text); }
public static string GetNamespace(AssemblyDefinitionAsset assembly) { return(CleanNamespace(assembly.name.Replace(".Runtime", ""))); }
static string GetNamespace(AssemblyDefinitionAsset assembly, MonoScript script) { return(GetNamespace(assembly, AssetDatabase.GetAssetPath(script))); }
/// <summary> /// Determines whether the specified text representation of the attribute exist in attributes file of the specified assembly definition asset. /// </summary> /// <param name="assemblyDefinition">The assembly definition asset.</param> /// <param name="attribute">The text representation of the attribute.</param> public static bool IsAttributeActive(AssemblyDefinitionAsset assemblyDefinition, string attribute) { return(LoadAttributes(assemblyDefinition).Contains(attribute)); }
private static AssemblyDefinitionImporterInspector.AssemblyDefintionState LoadAssemblyDefintionState(string path) { AssemblyDefinitionAsset assemblyDefinitionAsset = AssetDatabase.LoadAssetAtPath <AssemblyDefinitionAsset>(path); AssemblyDefinitionImporterInspector.AssemblyDefintionState result; if (assemblyDefinitionAsset == null) { result = null; } else { CustomScriptAssemblyData customScriptAssemblyData = CustomScriptAssemblyData.FromJson(assemblyDefinitionAsset.text); if (customScriptAssemblyData == null) { result = null; } else { AssemblyDefinitionImporterInspector.AssemblyDefintionState assemblyDefintionState = new AssemblyDefinitionImporterInspector.AssemblyDefintionState(); assemblyDefintionState.asset = assemblyDefinitionAsset; assemblyDefintionState.name = customScriptAssemblyData.name; assemblyDefintionState.references = new List <AssemblyDefinitionImporterInspector.AssemblyDefinitionReference>(); if (customScriptAssemblyData.references != null) { string[] references = customScriptAssemblyData.references; for (int i = 0; i < references.Length; i++) { string text = references[i]; try { AssemblyDefinitionImporterInspector.AssemblyDefinitionReference assemblyDefinitionReference = new AssemblyDefinitionImporterInspector.AssemblyDefinitionReference(); string assemblyDefinitionFilePathFromAssemblyName = CompilationPipeline.GetAssemblyDefinitionFilePathFromAssemblyName(text); if (string.IsNullOrEmpty(assemblyDefinitionFilePathFromAssemblyName)) { throw new AssemblyDefinitionException(string.Format("Could not find assembly reference '{0}'", text), new string[] { path }); } assemblyDefinitionReference.asset = AssetDatabase.LoadAssetAtPath <AssemblyDefinitionAsset>(assemblyDefinitionFilePathFromAssemblyName); if (assemblyDefinitionReference.asset == null) { throw new AssemblyDefinitionException(string.Format("Reference assembly definition file '{0}' not found", assemblyDefinitionFilePathFromAssemblyName), new string[] { path }); } assemblyDefinitionReference.data = CustomScriptAssemblyData.FromJson(assemblyDefinitionReference.asset.text); assemblyDefinitionReference.displayValue = AssemblyDefinitionImporterInspector.MixedBool.False; assemblyDefintionState.references.Add(assemblyDefinitionReference); } catch (AssemblyDefinitionException exception) { Debug.LogException(exception, assemblyDefinitionAsset); assemblyDefintionState.references.Add(new AssemblyDefinitionImporterInspector.AssemblyDefinitionReference()); assemblyDefintionState.modified = true; } } } AssemblyDefinitionPlatform[] assemblyDefinitionPlatforms = CompilationPipeline.GetAssemblyDefinitionPlatforms(); assemblyDefintionState.platformCompatibility = new AssemblyDefinitionImporterInspector.MixedBool[assemblyDefinitionPlatforms.Length]; CustomScriptOptinalUnityAssembly[] optinalUnityAssemblies = CustomScriptAssembly.OptinalUnityAssemblies; assemblyDefintionState.optionalUnityReferences = new AssemblyDefinitionImporterInspector.MixedBool[optinalUnityAssemblies.Length]; if (customScriptAssemblyData.optionalUnityReferences != null) { for (int j = 0; j < optinalUnityAssemblies.Length; j++) { string optionalUnityReferences = optinalUnityAssemblies[j].OptionalUnityReferences.ToString(); bool flag = customScriptAssemblyData.optionalUnityReferences.Any((string x) => x == optionalUnityReferences); if (flag) { assemblyDefintionState.optionalUnityReferences[j] = AssemblyDefinitionImporterInspector.MixedBool.True; } } } assemblyDefintionState.compatibleWithAnyPlatform = AssemblyDefinitionImporterInspector.MixedBool.True; string[] array = null; if (customScriptAssemblyData.includePlatforms != null && customScriptAssemblyData.includePlatforms.Length > 0) { assemblyDefintionState.compatibleWithAnyPlatform = AssemblyDefinitionImporterInspector.MixedBool.False; array = customScriptAssemblyData.includePlatforms; } else if (customScriptAssemblyData.excludePlatforms != null && customScriptAssemblyData.excludePlatforms.Length > 0) { assemblyDefintionState.compatibleWithAnyPlatform = AssemblyDefinitionImporterInspector.MixedBool.True; array = customScriptAssemblyData.excludePlatforms; } if (array != null) { string[] array2 = array; for (int k = 0; k < array2.Length; k++) { string name = array2[k]; int platformIndex = AssemblyDefinitionImporterInspector.GetPlatformIndex(assemblyDefinitionPlatforms, name); assemblyDefintionState.platformCompatibility[platformIndex] = AssemblyDefinitionImporterInspector.MixedBool.True; } } result = assemblyDefintionState; } } return(result); }
/// <summary> /// Determines whether the attribute file exists for the specified assembly definition file. /// </summary> /// <param name="assemblyDefinition">The assembly definition asset.</param> public static bool IsAttributesFileExists(AssemblyDefinitionAsset assemblyDefinition) { string path = GetAttributesFilePath(assemblyDefinition); return(File.Exists(path)); }