Пример #1
0
        private async Task ProcessOperation(Operation operation)
        {
            // TODO: make this more efficient!
            // Perhaps DataValues could use integer keys, and we store an array of inputDataIndices and outputDataIndices for each operation?
            var inputValues = operation.Inputs
                              .Select(i =>
            {
                if (!DataValues.TryGetValue(i, out object value))
                {
                    throw new InvalidOperationException("Failed to find value in field " + i);
                }
                return(value);
            })
                              .ToArray();

            object[] outputValues = OperationRunner.Run(operation, inputValues);

            // TODO: can this be made more efficient?
            for (int i = 0; i < operation.Outputs.Length; i++)
            {
                var output = operation.Outputs[i];
                DataValues[output] = outputValues[i];
            }

            // TODO: step-through task for debugging could go here
            await Task.CompletedTask;
        }
Пример #2
0
 public MappingRunner(Mapping mapping)
 {
     Mapping         = mapping;
     OperationRunner = new OperationRunner();
     DataValues      = new Dictionary <DataFieldInstance, object>();
 }