mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
bb9ef89dee
7Zip extracted archives now only extract the fewest files required. Audited the uses of .Wait Lazily init the VFS cleaning
48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Threading.Tasks;
|
|
using Wabbajack.Common;
|
|
|
|
namespace Wabbajack.VirtualFileSystem
|
|
{
|
|
public class ExtractedDiskFile : IExtractedFile
|
|
{
|
|
private AbsolutePath _path;
|
|
|
|
public ExtractedDiskFile(AbsolutePath path)
|
|
{
|
|
if (path == default)
|
|
throw new InvalidDataException("Path cannot be empty");
|
|
_path = path;
|
|
}
|
|
|
|
public async Task<Hash> HashAsync()
|
|
{
|
|
return await _path.FileHashAsync();
|
|
}
|
|
public DateTime LastModifiedUtc => _path.LastModifiedUtc;
|
|
public long Size => _path.Size;
|
|
public Stream OpenRead()
|
|
{
|
|
return _path.OpenRead();
|
|
}
|
|
|
|
public async Task<bool> CanExtract()
|
|
{
|
|
return await FileExtractor.CanExtract(_path);
|
|
}
|
|
|
|
public Task<ExtractedFiles> ExtractAll(WorkQueue queue, IEnumerable<RelativePath> onlyFiles)
|
|
{
|
|
return FileExtractor.ExtractAll(queue, _path, onlyFiles);
|
|
}
|
|
|
|
public async Task MoveTo(AbsolutePath path)
|
|
{
|
|
await _path.MoveToAsync(path, true);
|
|
_path = path;
|
|
}
|
|
}
|
|
}
|