mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-24 14:49:48 -06:00
43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using Avalonia;
|
|
using Avalonia.Data;
|
|
using Avalonia.Data.Converters;
|
|
using Ryujinx.Ava.Common.Models;
|
|
using System;
|
|
using System.Globalization;
|
|
using static Ryujinx.Common.Utilities.XCIFileTrimmer;
|
|
|
|
namespace Ryujinx.Ava.UI.Helpers
|
|
{
|
|
internal class XCITrimmerFileStatusDetailConverter : IValueConverter
|
|
{
|
|
public static XCITrimmerFileStatusDetailConverter 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 ? null :
|
|
app.ProcessingOutcome != OperationOutcome.Successful && app.ProcessingOutcome != OperationOutcome.Undetermined ? app.ProcessingOutcome.ToLocalisedText() :
|
|
null;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
}
|
|
}
|