Skip to content

Commit 0872d8c

Browse files
committed
Slight reorganization
1 parent 1619046 commit 0872d8c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

SabreTools.Hashing/SpamSum/Comparisons.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ public static int FuzzyCompare(string? first, string? second)
3636
if (secondSplit[0].Length == 0 || secondSplit[2].Length == 0)
3737
return -1;
3838

39+
// Ensure only second block data before a comma is used
40+
firstSplit[2] = firstSplit[2].Split(',')[0];
41+
secondSplit[2] = secondSplit[2].Split(',')[0];
42+
3943
// Each SpamSum string starts with its block size before the first semicolon.
4044
if (!uint.TryParse(firstSplit[0], out uint firstBlockSize))
4145
return -1;
@@ -53,16 +57,12 @@ public static int FuzzyCompare(string? first, string? second)
5357
return 0;
5458
}
5559

56-
// Ensure only second block data before a comma is used
57-
string firstBlockTwo = firstSplit[2].Split(',')[0];
58-
string secondBlockTwo = secondSplit[2].Split(',')[0];
59-
6060
// Reduce any sequences longer than 3
6161
// These sequences contain very little info and can be reduced as a result
6262
string firstBlockOne = _reduceRegex.Replace(firstSplit[1], string.Empty);
63-
firstBlockTwo = _reduceRegex.Replace(firstBlockTwo, string.Empty);
63+
string firstBlockTwo = _reduceRegex.Replace(firstSplit[2], string.Empty);
6464
string secondBlockOne = _reduceRegex.Replace(secondSplit[1], string.Empty);
65-
secondBlockTwo = _reduceRegex.Replace(secondBlockTwo, string.Empty);
65+
string secondBlockTwo = _reduceRegex.Replace(secondSplit[2], string.Empty);
6666

6767
// Return 100 immediately if both spamSums are identical.
6868
if (firstBlockSize == secondBlockSize && firstBlockOne == secondBlockOne && firstBlockTwo == secondBlockTwo)

0 commit comments

Comments
 (0)