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
|
|
|
|
|
await _file.CopyToAsync(newPath, true, token);
|
2021-09-27 12:42:46 +00:00
|
|
|
|
}
|
|
|
|
|
}
|