Rework file extraction to combine the old and new methods

This commit is contained in:
Timothy Baldridge
2020-10-09 21:02:58 -06:00
parent e17b577e5a
commit e557e46556
24 changed files with 267 additions and 1343 deletions

View File

@ -0,0 +1,26 @@
using System.Threading.Tasks;
using Wabbajack.Common;
namespace Wabbajack.VirtualFileSystem.ExtractedFiles
{
public class ExtractedNativeFile : NativeFileStreamFactory, IExtractedFile
{
public bool CanMove { get; set; } = true;
public ExtractedNativeFile(AbsolutePath file, IPath path) : base(file, path)
{
}
public ExtractedNativeFile(AbsolutePath file) : base(file)
{
}
public async ValueTask Move(AbsolutePath newPath)
{
if (CanMove)
await _file.MoveToAsync(newPath, overwrite: true);
else
await _file.CopyToAsync(newPath);
}
}
}