Replace List<> with HashSet<>
This commit is contained in:
parent
ed48dfcab6
commit
c83f21e932
2 changed files with 5 additions and 4 deletions
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Ryujinx.CustomTasks.SyntaxWalker;
|
using Ryujinx.CustomTasks.SyntaxWalker;
|
||||||
using Ryujinx.CustomTasks.Helper;
|
using Ryujinx.CustomTasks.Helper;
|
||||||
|
using System.Linq;
|
||||||
using Task = Microsoft.Build.Utilities.Task;
|
using Task = Microsoft.Build.Utilities.Task;
|
||||||
|
|
||||||
namespace Ryujinx.CustomTasks
|
namespace Ryujinx.CustomTasks
|
||||||
|
@ -15,7 +16,7 @@ namespace Ryujinx.CustomTasks
|
||||||
private const string InterfaceFileName = "IArray.g.cs";
|
private const string InterfaceFileName = "IArray.g.cs";
|
||||||
private const string ArraysFileName = "Arrays.g.cs";
|
private const string ArraysFileName = "Arrays.g.cs";
|
||||||
|
|
||||||
private readonly List<string> _outputFiles = new List<string>();
|
private readonly HashSet<string> _outputFiles = new HashSet<string>();
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string ArrayNamespace { get; set; }
|
public string ArrayNamespace { get; set; }
|
||||||
|
@ -58,7 +59,7 @@ namespace Ryujinx.CustomTasks
|
||||||
_outputFiles.Add(filePath);
|
_outputFiles.Add(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICollection<int> GetArraySizes(string itemPath)
|
private HashSet<int> GetArraySizes(string itemPath)
|
||||||
{
|
{
|
||||||
Log.LogMessage(MessageImportance.Low, $"Searching for StructArray types in: {itemPath}");
|
Log.LogMessage(MessageImportance.Low, $"Searching for StructArray types in: {itemPath}");
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace Ryujinx.CustomTasks.SyntaxWalker
|
||||||
{
|
{
|
||||||
class ArraySizeCollector : CSharpSyntaxWalker
|
class ArraySizeCollector : CSharpSyntaxWalker
|
||||||
{
|
{
|
||||||
public ICollection<int> ArraySizes { get; } = new List<int>();
|
public HashSet<int> ArraySizes { get; } = new HashSet<int>();
|
||||||
|
|
||||||
private void AddArrayString(string name)
|
private void AddArrayString(string name)
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@ namespace Ryujinx.CustomTasks.SyntaxWalker
|
||||||
|
|
||||||
string rawArrayType = name.Split('<')[0];
|
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);
|
ArraySizes.Add(size);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue