mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-30 01:29:48 -06:00
misc: move Models & Helpers into Common & Avalonia projects
This commit is contained in:
55
src/Ryujinx/Common/Models/XCITrimmerFileModel.cs
Normal file
55
src/Ryujinx/Common/Models/XCITrimmerFileModel.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using Ryujinx.Ava.Utilities.AppLibrary;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Common.Utilities;
|
||||
|
||||
namespace Ryujinx.Ava.Common.Models
|
||||
{
|
||||
public record XCITrimmerFileModel(
|
||||
string Name,
|
||||
string Path,
|
||||
bool Trimmable,
|
||||
bool Untrimmable,
|
||||
long PotentialSavingsB,
|
||||
long CurrentSavingsB,
|
||||
int? PercentageProgress,
|
||||
XCIFileTrimmer.OperationOutcome ProcessingOutcome)
|
||||
{
|
||||
public static XCITrimmerFileModel FromApplicationData(ApplicationData applicationData, XCIFileTrimmerLog logger)
|
||||
{
|
||||
var trimmer = new XCIFileTrimmer(applicationData.Path, logger);
|
||||
|
||||
return new XCITrimmerFileModel(
|
||||
applicationData.Name,
|
||||
applicationData.Path,
|
||||
trimmer.CanBeTrimmed,
|
||||
trimmer.CanBeUntrimmed,
|
||||
trimmer.DiskSpaceSavingsB,
|
||||
trimmer.DiskSpaceSavedB,
|
||||
null,
|
||||
XCIFileTrimmer.OperationOutcome.Undetermined
|
||||
);
|
||||
}
|
||||
|
||||
public bool IsFailed
|
||||
{
|
||||
get
|
||||
{
|
||||
return ProcessingOutcome != XCIFileTrimmer.OperationOutcome.Undetermined &&
|
||||
ProcessingOutcome != XCIFileTrimmer.OperationOutcome.Successful;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool Equals(XCITrimmerFileModel obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return false;
|
||||
|
||||
return this.Path == obj.Path;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return this.Path.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user