From ec1d5134ac031600c1b8c8a9fad7cc99491fb7a5 Mon Sep 17 00:00:00 2001 From: caitsith2 Date: Sat, 25 Aug 2018 15:22:16 -0700 Subject: [PATCH 1/3] Fix case sensitivity issues with long filenames. --- libhac.Nand/DiscUtils.Fat/FileName.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libhac.Nand/DiscUtils.Fat/FileName.cs b/libhac.Nand/DiscUtils.Fat/FileName.cs index 39501203..5966e79a 100644 --- a/libhac.Nand/DiscUtils.Fat/FileName.cs +++ b/libhac.Nand/DiscUtils.Fat/FileName.cs @@ -131,14 +131,14 @@ namespace DiscUtils.Fat return false; } if (!string.IsNullOrEmpty(LongName) && !string.IsNullOrEmpty(other.LongName)) - return LongName == other.LongName; + return LongName.Equals(other.LongName, StringComparison.InvariantCultureIgnoreCase); return CompareRawNames(this, other) == 0; } public static FileName FromPath(string path, Encoding encoding) { - return new FileName(Utilities.GetFileFromPath(path), encoding, false); + return new FileName(Utilities.GetFileFromPath(path), encoding, true); } public static bool operator ==(FileName a, FileName b) From 5edce67f73f82d58847c6354773bbe53ec3c2b06 Mon Sep 17 00:00:00 2001 From: caitsith2 Date: Sat, 25 Aug 2018 15:31:26 -0700 Subject: [PATCH 2/3] Also optimize a filename check... ... to avoid 3 rounds of recursion per check. --- libhac.Nand/DiscUtils.Fat/FileName.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libhac.Nand/DiscUtils.Fat/FileName.cs b/libhac.Nand/DiscUtils.Fat/FileName.cs index 5966e79a..1e37965c 100644 --- a/libhac.Nand/DiscUtils.Fat/FileName.cs +++ b/libhac.Nand/DiscUtils.Fat/FileName.cs @@ -126,7 +126,7 @@ namespace DiscUtils.Fat public bool Equals(FileName other) { - if (other == null) + if (other is null) { return false; } From 0bd4984c069e803723011a547a8d9274211005b1 Mon Sep 17 00:00:00 2001 From: caitsith2 Date: Sat, 25 Aug 2018 15:49:50 -0700 Subject: [PATCH 3/3] Address issue #5 --- libhac.Nand/DiscUtils.Fat/ClusterStream.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libhac.Nand/DiscUtils.Fat/ClusterStream.cs b/libhac.Nand/DiscUtils.Fat/ClusterStream.cs index c02b015f..97167e58 100644 --- a/libhac.Nand/DiscUtils.Fat/ClusterStream.cs +++ b/libhac.Nand/DiscUtils.Fat/ClusterStream.cs @@ -134,7 +134,7 @@ namespace DiscUtils.Fat if (!TryLoadCurrentCluster()) { - if ((_position == _length || _position == DetectLength()) && !_atEOF) + if ((_position == _length || _position == DetectLength())) { _atEOF = true; return 0;