diff --git a/AssetEntry.cs b/AssetEntry.cs index 97983bd..aa140a7 100644 --- a/AssetEntry.cs +++ b/AssetEntry.cs @@ -12,7 +12,7 @@ namespace HashCalculator.GUI public string Type { get; } public string Name { get; } public string NameString { get; } - public IEnumerable DisplayLabels { get; } + public IReadOnlyList DisplayLabels { get; } public uint InstanceId => SageHash.CalculateLowercaseHash(Name); public string InstanceIdString => $"{InstanceId:x8} ({InstanceId,10})"; diff --git a/SageHash.cs b/SageHash.cs index d4c87ca..60c3a4b 100644 --- a/SageHash.cs +++ b/SageHash.cs @@ -3,17 +3,17 @@ using System.Diagnostics.CodeAnalysis; using System.IO; using System.Text; using TechnologyAssembler.Core.Hashing; -using System.Xml; namespace HashCalculator.GUI { public static class SageHash { + [SuppressMessage("MicrosoftCodeAnalysisCorrectness", "RS1024:Compare symbols correctly", Justification = "")] public static uint CalculateBinaryHash(byte[] content) { if (content == null) { - throw new ArgumentNullException($"{nameof(content)} is null"); + throw new ArgumentNullException(nameof(content)); } return FastHash.GetHashCode(content); } @@ -22,7 +22,7 @@ namespace HashCalculator.GUI { if (content == null) { - throw new ArgumentNullException($"{nameof(content)} is null"); + throw new ArgumentNullException(nameof(content)); } return FastHash.GetHashCodeLauncher(0, content); } @@ -31,26 +31,25 @@ namespace HashCalculator.GUI { if (content == null) { - throw new ArgumentNullException($"{nameof(content)} is null"); + throw new ArgumentNullException(nameof(content)); } return CalculateBinaryHash(Encoding.ASCII.GetBytes(content)); } - [SuppressMessage("Globalization", "CA1308:将字符串规范化为大写", Justification = "<挂起>")] public static uint CalculateLowercaseHash(string content) { - if(content == null) + if (content == null) { - throw new ArgumentNullException($"{nameof(content)} is null"); + throw new ArgumentNullException(nameof(content)); } return CalculateBinaryHash(content.ToLowerInvariant()); } - public static uint CalculateFileHash(string path) + public static uint CalculateFileHash(string path) { - if(path == null) + if (path == null) { - throw new ArgumentNullException($"{nameof(path)} is null"); + throw new ArgumentNullException(nameof(path)); } return CalculateBinaryHash(File.ReadAllBytes(path)); }