mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-02 14:46:25 +02:00
Add ability to trim and untrim XCI files from the application context menu AND in Bulk (#105)
This commit is contained in:
parent
47b8145809
commit
4831965404
23 changed files with 2095 additions and 3 deletions
46
src/Ryujinx/UI/Helpers/XCITrimmerFileStatusConverter.cs
Normal file
46
src/Ryujinx/UI/Helpers/XCITrimmerFileStatusConverter.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Data;
|
||||
using Avalonia.Data.Converters;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.UI.Common.Models;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using static Ryujinx.Common.Utilities.XCIFileTrimmer;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Helpers
|
||||
{
|
||||
internal class XCITrimmerFileStatusConverter : IValueConverter
|
||||
{
|
||||
public static XCITrimmerFileStatusConverter Instance = new();
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is UnsetValueType)
|
||||
{
|
||||
return BindingOperations.DoNothing;
|
||||
}
|
||||
|
||||
if (!targetType.IsAssignableFrom(typeof(string)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (value is not XCITrimmerFileModel app)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return app.PercentageProgress != null ? String.Empty :
|
||||
app.ProcessingOutcome != OperationOutcome.Successful && app.ProcessingOutcome != OperationOutcome.Undetermined ? LocaleManager.Instance[LocaleKeys.TitleXCIStatusFailedLabel] :
|
||||
app.Trimmable & app.Untrimmable ? LocaleManager.Instance[LocaleKeys.TitleXCIStatusPartialLabel] :
|
||||
app.Trimmable ? LocaleManager.Instance[LocaleKeys.TitleXCIStatusTrimmableLabel] :
|
||||
app.Untrimmable ? LocaleManager.Instance[LocaleKeys.TitleXCIStatusUntrimmableLabel] :
|
||||
String.Empty;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue