Console size scan

This commit is contained in:
2023-08-28 21:29:15 +02:00
parent bc865011d3
commit ba06047a68
43 changed files with 567 additions and 279 deletions

View File

@@ -1,3 +0,0 @@
namespace FileTime.Core.Models.Extensions;
public record FileExtension(long? Size);

View File

@@ -2,5 +2,5 @@ namespace FileTime.Core.Models;
public interface IElement : IItem
{
long Size { get; }
}

View File

@@ -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;

View File

@@ -18,6 +18,7 @@ public record Element(
SupportsDelete CanDelete,
bool CanRename,
string? Attributes,
long Size,
IContentProvider Provider,
PointInTime PointInTime,
ObservableCollection<Exception> Exceptions,

View File

@@ -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)