wabbajack/Wabbajack.VFS/AbsolutePathExtensions.cs

17 lines
471 B
C#
Raw Permalink Normal View History

2021-09-27 12:42:46 +00:00
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Wabbajack.Hashing.xxHash64;
using Wabbajack.Paths;
using Wabbajack.Paths.IO;
2021-10-23 16:51:17 +00:00
namespace Wabbajack.VFS;
public static class AbsolutePathExtensions
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
public static async Task<Hash> Hash(this AbsolutePath src, CancellationToken token)
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
await using var fs = src.Open(FileMode.Open, FileAccess.Read, FileShare.Read);
return await fs.HashingCopy(Stream.Null, token);
2021-09-27 12:42:46 +00:00
}
}