Add ability to trim XCI files from the application context menu #52
@ -1,4 +1,4 @@
|
|||||||
|
|||||||
using Ryujinx.Common.Logging;
|
using Gommon;
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@ -7,26 +7,6 @@ using System.Linq;
|
|||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
|
|
||||||
namespace Ryujinx.Common.Utilities
|
namespace Ryujinx.Common.Utilities
|
||||||
{
|
{
|
||||||
internal static class Performance
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
{
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
internal static TimeSpan Measure(Action action)
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
{
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
var sw = new Stopwatch();
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
sw.Start();
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
try
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
{
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
action();
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
}
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
finally
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
{
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
sw.Stop();
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
}
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
return sw.Elapsed;
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
}
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
}
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
|
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
public sealed class XCIFileTrimmer
|
public sealed class XCIFileTrimmer
|
||||||
{
|
{
|
||||||
private const long BytesInAMegabyte = 1024 * 1024;
|
private const long BytesInAMegabyte = 1024 * 1024;
|
||||||
@ -178,14 +158,14 @@ namespace Ryujinx.Common.Utilities
|
|||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
bool freeSpaceValid = true;
|
bool freeSpaceValid = true;
|
||||||
long readSizeB = FileSizeB - TrimmedFileSizeB;
|
long readSizeB = FileSizeB - TrimmedFileSizeB;
|
||||||
|
|
||||||
TimeSpan time = Performance.Measure(() =>
|
Stopwatch timedSw = Lambda.Timed(() =>
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
{
|
{
|
||||||
freeSpaceValid = CheckPadding(readSizeB);
|
freeSpaceValid = CheckPadding(readSizeB);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (time.TotalSeconds > 0)
|
if (timedSw.Elapsed.TotalSeconds > 0)
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
{
|
{
|
||||||
Log?.Write(LogType.Info, $"Checked at {readSizeB / (double)XCIFileTrimmer.BytesInAMegabyte / time.TotalSeconds:N} Mb/sec");
|
Log?.Write(LogType.Info, $"Checked at {readSizeB / (double)XCIFileTrimmer.BytesInAMegabyte / timedSw.Elapsed.TotalSeconds:N} Mb/sec");
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (freeSpaceValid)
|
if (freeSpaceValid)
|
||||||
@ -352,14 +332,14 @@ namespace Ryujinx.Common.Utilities
|
|||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TimeSpan time = Performance.Measure(() =>
|
Stopwatch timedSw = Lambda.Timed(() =>
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
{
|
{
|
||||||
WritePadding(outfileStream, bytesToWriteB);
|
WritePadding(outfileStream, bytesToWriteB);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (time.TotalSeconds > 0)
|
if (timedSw.Elapsed.TotalSeconds > 0)
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
{
|
{
|
||||||
Log?.Write(LogType.Info, $"Wrote at {bytesToWriteB / (double)XCIFileTrimmer.BytesInAMegabyte / time.TotalSeconds:N} Mb/sec");
|
Log?.Write(LogType.Info, $"Wrote at {bytesToWriteB / (double)XCIFileTrimmer.BytesInAMegabyte / timedSw.Elapsed.TotalSeconds:N} Mb/sec");
|
||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
|||||||
}
|
}
|
||||||
|
|
||||||
return OperationOutcome.Successful;
|
return OperationOutcome.Successful;
|
||||||
|
|||||||
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() This function can be entirely replaced with This function can be entirely replaced with `Lambda.Timed(Action)`, from my common library `Gommon` (which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
![]() Thanks @GreemDev , I have updated the branch with your suggested changes, definitely don't want to duplicate any code. Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
|
This function can be entirely replaced with
Lambda.Timed(Action)
, from my common libraryGommon
(which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.This function can be entirely replaced with
Lambda.Timed(Action)
, from my common libraryGommon
(which is already referenced by this Ryujinx fork). The only difference is that Timed returns the stopwatch directly instead of its Elapsed property.Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.
Thanks @GreemDev ,
I have updated the branch with your suggested changes, definitely don't want to duplicate any code.