Console size scan
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
namespace FileTime.Core.Models.Extensions;
|
||||
|
||||
public record FileExtension(long? Size);
|
||||
@@ -2,5 +2,5 @@ namespace FileTime.Core.Models;
|
||||
|
||||
public interface IElement : IItem
|
||||
{
|
||||
|
||||
long Size { get; }
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using FileTime.Core.Models;
|
||||
using FileTime.Core.Models.Extensions;
|
||||
using FileTime.Core.Timeline;
|
||||
|
||||
namespace FileTime.Core.Command.Copy;
|
||||
@@ -20,7 +19,7 @@ public class CalculateStrategy : ICopyStrategy
|
||||
public async Task CopyAsync(AbsolutePath from, AbsolutePath to, CopyCommandContext context)
|
||||
{
|
||||
var resolvedFrom = await from.ResolveAsync();
|
||||
_operationStatuses.Add(new OperationProgress(from.Path.Path, (resolvedFrom as IElement)?.GetExtension<FileExtension>()?.Size ?? 0L));
|
||||
_operationStatuses.Add(new OperationProgress(from.Path.Path, (resolvedFrom as IElement)?.Size ?? 0L));
|
||||
}
|
||||
|
||||
public Task CreateContainerAsync(IContainer target, string name, PointInTime currentTime) => Task.CompletedTask;
|
||||
|
||||
@@ -18,6 +18,7 @@ public record Element(
|
||||
SupportsDelete CanDelete,
|
||||
bool CanRename,
|
||||
string? Attributes,
|
||||
long Size,
|
||||
IContentProvider Provider,
|
||||
PointInTime PointInTime,
|
||||
ObservableCollection<Exception> Exceptions,
|
||||
|
||||
@@ -6,7 +6,6 @@ using DeclarativeProperty;
|
||||
using DynamicData;
|
||||
using FileTime.Core.Helper;
|
||||
using FileTime.Core.Models;
|
||||
using FileTime.Core.Models.Extensions;
|
||||
using FileTime.Core.Timeline;
|
||||
using ObservableComputations;
|
||||
using IContainer = FileTime.Core.Models.IContainer;
|
||||
@@ -178,12 +177,12 @@ public class Tab : ITab
|
||||
|
||||
private static long GetSize(IItem item)
|
||||
{
|
||||
if (item is IElement element && element.GetExtension<FileExtension>() is { } fileExtension)
|
||||
if (item is IElement element)
|
||||
{
|
||||
return fileExtension.Size ?? -1;
|
||||
return element.Size;
|
||||
}
|
||||
|
||||
return -2;
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static IItem MapItem(AbsolutePath item)
|
||||
|
||||
Reference in New Issue
Block a user