namespace Ubisoft.Hotel.Extensions.UnityEditor.Editor { public class AssemblyDefinitionJson { public string name = string.Empty; #if UNITY_2020_2_OR_NEWER public string rootNamespace = string.Empty; #endif public string[] references = new string[0]; public string[] includePlatforms = new string[0]; public string[] excludePlatforms = new string[0]; public bool allowUnsafeCode = false; public bool overrideReferences = false; public string[] precompiledReferences = new string[0]; public bool autoReferenced = false; public string[] defineConstraints = new string[0]; public string[] versionDefines = new string[0]; public bool noEngineReferences = false; private bool ContainsEntry(string[] entries, string entry) { bool returnValue = false; if (entries != null) { for (int i = entries.Length - 1; i > -1 && !returnValue; --i) { returnValue = entries[i].Equals(entry); } } return returnValue; } private void AddEntry(ref string[] entries, string entry) { if (!ContainsEntry(entries, entry)) { int count = entries == null ? 0 : entries.Length; string[] newEntries = new string[count + 1]; if (entries != null) { entries.CopyTo(newEntries, 0); } newEntries[count] = entry; entries = newEntries; } } private void RemoveEntry(ref string[] entries, string entry) { if (ContainsEntry(entries, entry)) { int count = entries.Length; string[] newEntries = new string[count - 1]; for (int i = 0; i < count; ++i) { if (!entries[i].Equals(entry)) { newEntries[i] = entries[i]; } } entries = newEntries; } } public bool ContainsReference(string reference) { return ContainsEntry(references, reference); } public void AddReference(string reference) { AddEntry(ref references, reference); } public bool ContainsIncludePlatform(string platform) { return ContainsEntry(includePlatforms, platform); } public void AddIncludePlatform(string platform) { AddEntry(ref includePlatforms, platform); } public void RemoveIncludePlatform(string platform) { RemoveEntry(ref includePlatforms, platform); } public bool ContainsExcludePlatform(string platform) { return ContainsEntry(excludePlatforms, platform); } public void AddExcludePlatform(string platform) { AddEntry(ref excludePlatforms, platform); } public void RemoveExcludePlatform(string platform) { RemoveEntry(ref excludePlatforms, platform); } } }