Compare commits

..

No commits in common. "e2c1e9831de3b12837624b5e45bbddf65aed9717" and "e5f6c681dec14d7e7c54e1e06dc914041fba7bc1" have entirely different histories.

2 changed files with 27 additions and 21 deletions

View File

@ -9,7 +9,7 @@ using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using PleOps.XdeltaSharp.Decoder; using PatcherUtils.Helpers;
namespace PatcherUtils namespace PatcherUtils
{ {
@ -114,30 +114,37 @@ namespace PatcherUtils
{ {
string decodedPath = SourceFilePath + ".decoded"; string decodedPath = SourceFilePath + ".decoded";
try var xdeltaArgs = $"-d {(debugOutput ? "-v -v" : "")} -f -s";
var xdeltaHelper =
new XdeltaProcessHelper(xdeltaArgs, SourceFilePath, DeltaFilePath, decodedPath, debugOutput);
if (!xdeltaHelper.Run())
{ {
using var inputFile = new FileStream(SourceFilePath, FileMode.Open); return (false, "something went wrong during the xdelta3 process");
using var patchFile = new FileStream(DeltaFilePath, FileMode.Open);
using var decodedFile = new FileStream(decodedPath, FileMode.Create);
using var decoder = new Decoder(inputFile, patchFile, decodedFile);
decoder.Run();
}
catch (Exception ex)
{
PatchLogger.LogException(ex);
return (false, ex.Message);
} }
try if (File.Exists(decodedPath))
{ {
File.Move(decodedPath, SourceFilePath, true); PatchLogger.LogInfo($"File delta decoded: {SourceFilePath}");
PatchLogger.LogInfo($"Delta applied: {DeltaFilePath}");
return (true, ""); try
{
File.Move(decodedPath, SourceFilePath, true);
PatchLogger.LogInfo($"Delta applied: {DeltaFilePath}");
return (true, "");
}
catch (Exception ex)
{
PatchLogger.LogException(ex);
return (false, ex.Message);
}
} }
catch (Exception ex) else
{ {
PatchLogger.LogException(ex); string error = $"Failed to decode file delta: {SourceFilePath}";
return (false, ex.Message); PatchLogger.LogError(error);
return (false, error);
} }
} }

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
@ -22,7 +22,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="PleOps.XdeltaSharp" Version="1.3.0" />
<PackageReference Include="Squid-Box.SevenZipSharp" Version="1.6.2.24" /> <PackageReference Include="Squid-Box.SevenZipSharp" Version="1.6.2.24" />
</ItemGroup> </ItemGroup>