Thanks gdk
This commit is contained in:
parent
397fc9000f
commit
ffe2e0d35a
2 changed files with 13 additions and 29 deletions
|
@ -5,17 +5,17 @@ namespace Ryujinx.Ava.UI.Models
|
|||
{
|
||||
public class TitleUpdateModel
|
||||
{
|
||||
public ApplicationControlProperty Control { get; }
|
||||
public uint Version { get; }
|
||||
public string Path { get; }
|
||||
public string Label { get; }
|
||||
|
||||
public string Label => LocaleManager.Instance.UpdateAndGetDynamicValue(
|
||||
System.IO.Path.GetExtension(Path)?.ToLower() == ".xci" ? LocaleKeys.TitleBundledUpdateVersionLabel : LocaleKeys.TitleUpdateVersionLabel,
|
||||
Control.DisplayVersionString.ToString()
|
||||
);
|
||||
|
||||
public TitleUpdateModel(ApplicationControlProperty control, string path)
|
||||
public TitleUpdateModel(uint version, string displayVersion, string path)
|
||||
{
|
||||
Control = control;
|
||||
Version = version;
|
||||
Label = LocaleManager.Instance.UpdateAndGetDynamicValue(
|
||||
System.IO.Path.GetExtension(path)?.ToLower() == ".xci" ? LocaleKeys.TitleBundledUpdateVersionLabel : LocaleKeys.TitleUpdateVersionLabel,
|
||||
displayVersion
|
||||
);
|
||||
Path = path;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,29 +131,11 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
public void SortUpdates()
|
||||
{
|
||||
var list = TitleUpdates.ToList();
|
||||
|
||||
list.Sort((first, second) =>
|
||||
{
|
||||
var firstVersion = first.Control.DisplayVersionString.ToString();
|
||||
var secondVersion = second.Control.DisplayVersionString.ToString();
|
||||
|
||||
if (string.IsNullOrEmpty(firstVersion))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(secondVersion))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return String.Compare(firstVersion, secondVersion, StringComparison.InvariantCulture) * -1;
|
||||
});
|
||||
var sortedUpdates = TitleUpdates.OrderByDescending(update => update.Version);
|
||||
|
||||
Views.Clear();
|
||||
Views.Add(new BaseModel());
|
||||
Views.AddRange(list);
|
||||
Views.AddRange(sortedUpdates);
|
||||
|
||||
if (SelectedUpdate == null)
|
||||
{
|
||||
|
@ -207,7 +189,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
controlNca.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None).OpenFile(ref nacpFile.Ref, "/control.nacp".ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
nacpFile.Get.Read(out _, 0, SpanHelpers.AsByteSpan(ref controlData), ReadOption.None).ThrowIfFailure();
|
||||
|
||||
TitleUpdates.Add(new TitleUpdateModel(controlData, path));
|
||||
var displayVersion = controlData.DisplayVersionString.ToString();
|
||||
|
||||
TitleUpdates.Add(new TitleUpdateModel(content.Version.Version, displayVersion, path));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue