Command execution, CreateContainer command WIP
This commit is contained in:
@@ -7,6 +7,7 @@ public class CommandTimeState
|
||||
public ICommand Command { get; }
|
||||
public CanCommandRun CanRun { get; private set; } = CanCommandRun.False;
|
||||
public bool ForceRun { get; set; }
|
||||
public ExecutionState ExecutionState { get; set; }
|
||||
|
||||
public CommandTimeState(ICommand command, PointInTime? startTime)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
using FileTime.Core.Command;
|
||||
|
||||
namespace FileTime.Core.Timeline;
|
||||
|
||||
public interface ICommandExecutor
|
||||
{
|
||||
void ExecuteCommand(ICommand command);
|
||||
event EventHandler<ICommand> CommandFinished;
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
using FileTime.Core.Command;
|
||||
|
||||
namespace FileTime.Core.Timeline;
|
||||
|
||||
public interface ICommandScheduler
|
||||
{
|
||||
|
||||
Task AddCommand(ICommand command, int? batchId = null, bool toNewBatch = false);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace FileTime.Core.Timeline;
|
||||
|
||||
public interface ILocalCommandExecutor : ICommandExecutor
|
||||
{
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace FileTime.Core.Timeline;
|
||||
public class ParallelCommands
|
||||
{
|
||||
private static ushort _idCounter;
|
||||
public List<CommandTimeState> _commands;
|
||||
private List<CommandTimeState> _commands;
|
||||
public ushort Id { get; }
|
||||
public IReadOnlyList<CommandTimeState> Commands { get; }
|
||||
public PointInTime? Result { get; private set; }
|
||||
|
||||
@@ -2,10 +2,11 @@ namespace FileTime.Core.Timeline;
|
||||
|
||||
public class PointInTime
|
||||
{
|
||||
private readonly List<Difference> _differences;
|
||||
public static readonly PointInTime Eternal = new PointInTime();
|
||||
public static readonly PointInTime Present = new PointInTime();
|
||||
|
||||
private readonly List<Difference> _differences;
|
||||
|
||||
public IReadOnlyList<Difference> Differences { get; }
|
||||
|
||||
private PointInTime() : this(new List<Difference>())
|
||||
@@ -26,6 +27,14 @@ public class PointInTime
|
||||
public PointInTime WithDifferences(IEnumerable<Difference> differences) =>
|
||||
new(this, differences);
|
||||
|
||||
public PointInTime WithDifferences(Func<PointInTime, IEnumerable<Difference>> differenceGenerator)
|
||||
{
|
||||
var newPointInTime = new PointInTime();
|
||||
newPointInTime._differences.AddRange(differenceGenerator(newPointInTime));
|
||||
|
||||
return newPointInTime;
|
||||
}
|
||||
|
||||
private static List<Difference> MergeDifferences(IEnumerable<Difference> previouses,
|
||||
IEnumerable<Difference> differences)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user