mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fixes for installer verification
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.DTOs.Streams;
|
||||
using Wabbajack.Hashing.xxHash64;
|
||||
using Wabbajack.Paths;
|
||||
|
||||
namespace Wabbajack.FileExtractor.ExtractedFiles;
|
||||
@ -16,4 +18,23 @@ public interface IExtractedFile : IStreamFactory
|
||||
/// <param name="newPath">destination to move the entry to</param>
|
||||
/// <returns></returns>
|
||||
public ValueTask Move(AbsolutePath newPath, CancellationToken token);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static class IExtractedFileExtensions
|
||||
{
|
||||
public static async Task<Hash> MoveHashedAsync(this IExtractedFile file, AbsolutePath destPath, CancellationToken token)
|
||||
{
|
||||
if (file.CanMove)
|
||||
{
|
||||
await file.Move(destPath, token);
|
||||
return await destPath.Hash(token);
|
||||
}
|
||||
else
|
||||
{
|
||||
await using var s = await file.GetStream();
|
||||
return await destPath.WriteAllHashedAsync(s, token, false);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user