diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2021-05-31 09:33:35 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2021-05-31 09:37:17 +0300 |
commit | d43fae48a08a2e45871e6e9c0f227f1259543e1f (patch) | |
tree | 4c4acd584122fb252fbfef8a5f9aef9dbba30ace | |
parent | d70499a3ca201da55b9cceef7c95093b8f04e56f (diff) |
Cutrom string comparerUsing custom string comparer.
-rw-r--r-- | tools_sources/CoolgirlCombiner/ClassicSorter.cs | 26 | ||||
-rw-r--r-- | tools_sources/CoolgirlCombiner/Program.cs | 5 |
2 files changed, 28 insertions, 3 deletions
diff --git a/tools_sources/CoolgirlCombiner/ClassicSorter.cs b/tools_sources/CoolgirlCombiner/ClassicSorter.cs new file mode 100644 index 0000000..3044561 --- /dev/null +++ b/tools_sources/CoolgirlCombiner/ClassicSorter.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic;
+
+namespace com.clusterrr.Famicom.CoolGirl
+{
+ public class ClassicSorter : IComparer<string>
+ {
+ public int Compare(string x, string y)
+ {
+ int p = 0;
+ while (true)
+ {
+ if ((p >= x.Length) && (p >= y.Length))
+ return 0;
+ else if (p >= x.Length)
+ return -1;
+ else if (p >= y.Length)
+ return 1;
+ else if (x[p] < y[p])
+ return -1;
+ else if (x[p] > y[p])
+ return 1;
+ p++;
+ }
+ }
+ }
+}
diff --git a/tools_sources/CoolgirlCombiner/Program.cs b/tools_sources/CoolgirlCombiner/Program.cs index 2bf4128..0439e5b 100644 --- a/tools_sources/CoolgirlCombiner/Program.cs +++ b/tools_sources/CoolgirlCombiner/Program.cs @@ -26,8 +26,6 @@ namespace com.clusterrr.Famicom.CoolGirl {
try
{
- AppContext.SetSwitch("System.Globalization.UseNls", true); // for correct cyrillic sorting
-
Console.WriteLine("COOLGIRL UNIF combiner");
Console.WriteLine("(c) Cluster, 2021");
Console.WriteLine("http://clusterrr.com");
@@ -342,7 +340,7 @@ namespace com.clusterrr.Famicom.CoolGirl var gamesNoSeparators = games.Where(g => !g.IsSeparator);
sortedGames =
Enumerable.Concat(
- gamesNoSeparators.Where(g => !g.IsHidden).OrderBy(g => g.MenuName),
+ gamesNoSeparators.Where(g => !g.IsHidden).OrderBy(g => g.MenuName, new ClassicSorter()),
gamesNoSeparators.Where(g => g.IsHidden)
);
}
@@ -990,6 +988,7 @@ namespace com.clusterrr.Famicom.CoolGirl asmResult.AppendLine();
return asmResult.ToString();
}
+
static string FirstCharToUpper(string input)
{
if (String.IsNullOrEmpty(input)) return "";
|