v3.2.0.4
- Fixed appid sorting
This commit is contained in:
parent
d8afcac1c3
commit
7c554d02f5
4 changed files with 25 additions and 16 deletions
19
CreamInstaller/Components/AppIdComparer.cs
Normal file
19
CreamInstaller/Components/AppIdComparer.cs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
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)
|
||||||
|
: !int.TryParse(a, out int A) ? 1
|
||||||
|
: !int.TryParse(b, out int B) ? -1
|
||||||
|
: A > B ? 1
|
||||||
|
: A < B ? -1
|
||||||
|
: 0;
|
||||||
|
}
|
|
@ -5,7 +5,7 @@
|
||||||
<UseWindowsForms>True</UseWindowsForms>
|
<UseWindowsForms>True</UseWindowsForms>
|
||||||
<ApplicationIcon>Resources\ini.ico</ApplicationIcon>
|
<ApplicationIcon>Resources\ini.ico</ApplicationIcon>
|
||||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||||
<Version>3.2.0.3</Version>
|
<Version>3.2.0.4</Version>
|
||||||
<PackageIcon>Resources\ini.ico</PackageIcon>
|
<PackageIcon>Resources\ini.ico</PackageIcon>
|
||||||
<PackageIconUrl />
|
<PackageIconUrl />
|
||||||
<Description />
|
<Description />
|
||||||
|
|
|
@ -3,6 +3,8 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
using CreamInstaller.Components;
|
||||||
|
|
||||||
namespace CreamInstaller;
|
namespace CreamInstaller;
|
||||||
|
|
||||||
internal enum DlcType
|
internal enum DlcType
|
||||||
|
@ -31,8 +33,8 @@ internal class ProgramSelection
|
||||||
|
|
||||||
internal bool IsSteam = false;
|
internal bool IsSteam = false;
|
||||||
|
|
||||||
internal readonly SortedList<string, (DlcType type, string name, string icon)> AllDlc = new();
|
internal readonly SortedList<string, (DlcType type, string name, string icon)> AllDlc = new(AppIdComparer.Comparer);
|
||||||
internal readonly SortedList<string, (DlcType type, string name, string icon)> SelectedDlc = new();
|
internal readonly SortedList<string, (DlcType type, string name, string icon)> SelectedDlc = new(AppIdComparer.Comparer);
|
||||||
internal readonly List<Tuple<string, string, SortedList<string, (DlcType type, string name, string icon)>>> ExtraDlc = new(); // for Paradox Launcher
|
internal readonly List<Tuple<string, string, SortedList<string, (DlcType type, string name, string icon)>>> ExtraDlc = new(); // for Paradox Launcher
|
||||||
|
|
||||||
internal bool AreDllsLocked
|
internal bool AreDllsLocked
|
||||||
|
|
|
@ -503,19 +503,7 @@ internal partial class SelectForm : CustomForm
|
||||||
|
|
||||||
private class TreeNodeSorter : IComparer
|
private class TreeNodeSorter : IComparer
|
||||||
{
|
{
|
||||||
public int Compare(object a, object b)
|
public int Compare(object a, object b) => AppIdComparer.Comparer.Compare((a as TreeNode).Name, (b as TreeNode).Name);
|
||||||
{
|
|
||||||
string aId = (a as TreeNode).Name;
|
|
||||||
string bId = (b as TreeNode).Name;
|
|
||||||
return aId == "ParadoxLauncher" ? -1
|
|
||||||
: bId == "ParadoxLauncher" ? 1
|
|
||||||
: !int.TryParse(aId, out _) && !int.TryParse(bId, out _) ? string.Compare(aId, bId)
|
|
||||||
: !int.TryParse(aId, out int A) ? 1
|
|
||||||
: !int.TryParse(bId, out int B) ? -1
|
|
||||||
: A > B ? 1
|
|
||||||
: A < B ? -1
|
|
||||||
: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowProgressBar()
|
private void ShowProgressBar()
|
||||||
|
|
Loading…
Reference in a new issue