1815f1087d
- Large code refactoring and optimizations - The more essential SteamCMD directories (config and userdata) will no longer be cleaned up by the program, hopefully to speed up the first call - Games can now also use SteamCMD as a fallback similar to DLC (previously both steam store AND steamCMD output was required for games, now it's either OR)
19 lines
612 B
C#
19 lines
612 B
C#
using System.Collections.Generic;
|
|
|
|
namespace CreamInstaller.Components;
|
|
|
|
internal class AppIdComparer : IComparer<string>
|
|
{
|
|
private static AppIdComparer comparer;
|
|
public static AppIdComparer Comparer => comparer ??= new AppIdComparer();
|
|
|
|
public int Compare(string a, string b) =>
|
|
a == "ParadoxLauncher" ? -1
|
|
: b == "ParadoxLauncher" ? 1
|
|
: !int.TryParse(a, out _) && !int.TryParse(b, out _) ? string.Compare(a, b, System.StringComparison.Ordinal)
|
|
: !int.TryParse(a, out int A) ? 1
|
|
: !int.TryParse(b, out int B) ? -1
|
|
: A > B ? 1
|
|
: A < B ? -1
|
|
: 0;
|
|
}
|