-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added list of known hash names, list is now sorted like OpenIV.
- Loading branch information
1 parent
e188a53
commit 7ad2a26
Showing
4 changed files
with
857,658 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using CodeWalker.GameFiles; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace RDR2AudioTool | ||
{ | ||
public class AlphanumericComparer : IComparer<AwcStream> | ||
{ | ||
public int Compare(AwcStream x, AwcStream y) | ||
{ | ||
if (ReferenceEquals(x, y)) | ||
return 0; | ||
|
||
if (x == null) | ||
return -1; | ||
|
||
if (y == null) | ||
return 1; | ||
|
||
string[] xParts = Regex.Split(x.Name, "([0-9]+)"); | ||
string[] yParts = Regex.Split(y.Name, "([0-9]+)"); | ||
|
||
for (int i = 0; i < Math.Min(xParts.Length, yParts.Length); i++) | ||
{ | ||
if (i % 2 == 0) | ||
{ | ||
int textCompare = string.Compare(xParts[i], yParts[i], StringComparison.OrdinalIgnoreCase); | ||
if (textCompare != 0) | ||
return textCompare; | ||
} | ||
else | ||
{ | ||
int xNum = int.Parse(xParts[i]); | ||
int yNum = int.Parse(yParts[i]); | ||
int numCompare = xNum.CompareTo(yNum); | ||
if (numCompare != 0) | ||
return numCompare; | ||
} | ||
} | ||
|
||
return xParts.Length.CompareTo(yParts.Length); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.