wabbajack/Wabbajack.FileExtractor/ExtractedFiles/ExtractedNativeFile.cs

28 lines
714 B
C#
Raw Normal View History

2021-09-27 12:42:46 +00:00
using System.Threading;
using System.Threading.Tasks;
using Wabbajack.Common;
using Wabbajack.Paths;
using Wabbajack.Paths.IO;
2021-10-23 16:51:17 +00:00
namespace Wabbajack.FileExtractor.ExtractedFiles;
public class ExtractedNativeFile : NativeFileStreamFactory, IExtractedFile
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
public ExtractedNativeFile(AbsolutePath file, IPath path) : base(file, path)
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
}
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
public ExtractedNativeFile(AbsolutePath file) : base(file)
{
}
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
public bool CanMove { get; set; } = true;
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
public async ValueTask Move(AbsolutePath newPath, CancellationToken token)
{
if (CanMove)
await _file.MoveToAsync(newPath, true, token);
else
2022-10-07 21:09:08 +00:00
await _file.CopyToAsync(newPath, token);
2021-09-27 12:42:46 +00:00
}
}