From dcd5f070c8ce53ee8cb4b5ebfe6b51c827ddcc53 Mon Sep 17 00:00:00 2001 From: cooolbros Date: Sun, 31 Dec 2023 12:37:51 +1100 Subject: [PATCH] Update FilesHashSet - Fix nullability - Use App.PathSeparatorRegex --- src/HUDMerger/Models/FilesHashSet.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/HUDMerger/Models/FilesHashSet.cs b/src/HUDMerger/Models/FilesHashSet.cs index 044a9e0..198ba30 100644 --- a/src/HUDMerger/Models/FilesHashSet.cs +++ b/src/HUDMerger/Models/FilesHashSet.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using System.Text.RegularExpressions; namespace HUDMerger.Models; @@ -9,9 +8,9 @@ public class FilesHashSet : HashSet { private class FilePathComparer : IEqualityComparer { - public bool Equals(string x, string y) + public bool Equals(string? x, string? y) { - return x == Encode(y); + return x == (y != null ? Encode(y) : null); } public int GetHashCode([DisallowNull] string obj) @@ -21,7 +20,7 @@ public int GetHashCode([DisallowNull] string obj) public static string Encode(string filePath) { - return String.Join('\\', Regex.Split(filePath, @"[/\\]+")); + return App.PathSeparatorRegex().Replace(filePath, "\\"); } }