diff --git a/Ryujinx.CustomTasks/GenerateArrays.cs b/Ryujinx.CustomTasks/GenerateArrays.cs index d65fad3..70f91f1 100644 --- a/Ryujinx.CustomTasks/GenerateArrays.cs +++ b/Ryujinx.CustomTasks/GenerateArrays.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.IO; using Ryujinx.CustomTasks.SyntaxWalker; using Ryujinx.CustomTasks.Helper; +using System.Linq; using Task = Microsoft.Build.Utilities.Task; namespace Ryujinx.CustomTasks @@ -15,7 +16,7 @@ namespace Ryujinx.CustomTasks private const string InterfaceFileName = "IArray.g.cs"; private const string ArraysFileName = "Arrays.g.cs"; - private readonly List _outputFiles = new List(); + private readonly HashSet _outputFiles = new HashSet(); [Required] public string ArrayNamespace { get; set; } @@ -58,7 +59,7 @@ namespace Ryujinx.CustomTasks _outputFiles.Add(filePath); } - private ICollection GetArraySizes(string itemPath) + private HashSet GetArraySizes(string itemPath) { Log.LogMessage(MessageImportance.Low, $"Searching for StructArray types in: {itemPath}"); diff --git a/Ryujinx.CustomTasks/SyntaxWalker/ArraySizeCollector.cs b/Ryujinx.CustomTasks/SyntaxWalker/ArraySizeCollector.cs index 5882bbe..832caaf 100644 --- a/Ryujinx.CustomTasks/SyntaxWalker/ArraySizeCollector.cs +++ b/Ryujinx.CustomTasks/SyntaxWalker/ArraySizeCollector.cs @@ -6,7 +6,7 @@ namespace Ryujinx.CustomTasks.SyntaxWalker { class ArraySizeCollector : CSharpSyntaxWalker { - public ICollection ArraySizes { get; } = new List(); + public HashSet ArraySizes { get; } = new HashSet(); private void AddArrayString(string name) { @@ -17,7 +17,7 @@ namespace Ryujinx.CustomTasks.SyntaxWalker string rawArrayType = name.Split('<')[0]; - if (int.TryParse(rawArrayType.Substring(5), out int size) && !ArraySizes.Contains(size)) + if (int.TryParse(rawArrayType.Substring(5), out int size)) { ArraySizes.Add(size); }