Compression
This commit is contained in:
@@ -7,4 +7,5 @@ public interface IContentReader : IDisposable
|
||||
|
||||
Task<byte[]> ReadBytesAsync(int bufferSize, int? offset = null);
|
||||
void SetPosition(long position);
|
||||
Stream AsStream();
|
||||
}
|
||||
@@ -6,4 +6,5 @@ public interface IContentWriter : IDisposable
|
||||
|
||||
Task WriteBytesAsync(byte[] data, int? index = null, CancellationToken cancellationToken = default);
|
||||
Task FlushAsync(CancellationToken cancellationToken = default);
|
||||
Stream AsStream();
|
||||
}
|
||||
@@ -3,5 +3,5 @@ namespace FileTime.Core.Interactions;
|
||||
public interface IOptionsInputElement : IInputElement
|
||||
{
|
||||
object Value { get; set; }
|
||||
IEnumerable<IOptionElement> Options { get; }
|
||||
IReadOnlyCollection<IOptionElement> Options { get; }
|
||||
}
|
||||
@@ -5,19 +5,30 @@ namespace FileTime.Core.Interactions;
|
||||
|
||||
public partial class OptionsInputElement<T> : InputElementBase, IOptionsInputElement, INotifyPropertyChanged
|
||||
{
|
||||
public IEnumerable<OptionElement<T>> Options { get; }
|
||||
public IReadOnlyCollection<OptionElement<T>> Options { get; }
|
||||
|
||||
[Notify] private T? _value;
|
||||
|
||||
IEnumerable<IOptionElement> IOptionsInputElement.Options => Options;
|
||||
IReadOnlyCollection<IOptionElement> IOptionsInputElement.Options => Options;
|
||||
|
||||
object? IOptionsInputElement.Value
|
||||
{
|
||||
get => Value;
|
||||
set => Value = (T?)value;
|
||||
get => Options.FirstOrDefault(o => o.Value?.Equals(_value) ?? false);
|
||||
set
|
||||
{
|
||||
if (value is T newValue)
|
||||
{
|
||||
Value = newValue;
|
||||
}
|
||||
else if (value is OptionElement<T> optionElement)
|
||||
{
|
||||
Value = optionElement.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public OptionsInputElement(string label, IEnumerable<OptionElement<T>> options) : base(label, InputType.Options)
|
||||
{
|
||||
Options = options;
|
||||
Options = options.ToList();
|
||||
}
|
||||
}
|
||||
@@ -33,11 +33,15 @@ public class CopyCommand : CommandBase, ITransportationCommand
|
||||
ITimelessContentProvider timelessContentProvider,
|
||||
ICommandSchedulerNotifier commandSchedulerNotifier,
|
||||
ILogger<CopyCommand> logger,
|
||||
IReadOnlyCollection<FullName>? sources,
|
||||
TransportMode? mode,
|
||||
FullName? targetFullName)
|
||||
IReadOnlyCollection<FullName> sources,
|
||||
TransportMode mode,
|
||||
FullName targetFullName)
|
||||
: base("Copy - Calculating...")
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(sources);
|
||||
ArgumentNullException.ThrowIfNull(mode);
|
||||
ArgumentNullException.ThrowIfNull(targetFullName);
|
||||
|
||||
_timelessContentProvider = timelessContentProvider;
|
||||
_commandSchedulerNotifier = commandSchedulerNotifier;
|
||||
_logger = logger;
|
||||
@@ -54,12 +58,8 @@ public class CopyCommand : CommandBase, ITransportationCommand
|
||||
.Switch()
|
||||
.Subscribe(SetCurrentProgress);
|
||||
|
||||
if (sources is null) throw new ArgumentException(nameof(Sources) + " can not be null");
|
||||
if (targetFullName is null) throw new ArgumentException(nameof(Target) + " can not be null");
|
||||
if (mode is null) throw new ArgumentException(nameof(TransportMode) + " can not be null");
|
||||
|
||||
Sources = new List<FullName>(sources).AsReadOnly();
|
||||
TransportMode = mode.Value;
|
||||
TransportMode = mode;
|
||||
Target = targetFullName;
|
||||
|
||||
var recentSpeed = DeclarativePropertyHelpers.CombineLatest(
|
||||
|
||||
Reference in New Issue
Block a user