void MemorizeStepInput(BotStepInput input) { ConfigSerialAndStruct = (input?.ConfigSerial?.String).DeserializeIfDifferent(ConfigSerialAndStruct); MemoryMeasurementAtTime = input?.FromProcessMemoryMeasurement?.MapValue(measurement => measurement?.Parse()); MemoryMeasurementAccu.Accumulate(MemoryMeasurementAtTime); OverviewMemory.Aggregate(MemoryMeasurementAtTime); }
public BotStepResult Step(BotStepInput input) { var beginTimeMilli = GetTimeMilli(); StepLastInput = input; Exception exception = null; var listMotion = new List <MotionRecommendation>(); IBotTask[][] outputListTaskPath = null; try { MemorizeStepInput(input); outputListTaskPath = StepOutputListTaskPath()?.ToArray(); foreach (var moduleToggle in outputListTaskPath.ConcatNullable().OfType <ModuleToggleTask>().Select(moduleToggleTask => moduleToggleTask?.module).WhereNotDefault()) { ToggleLastStepIndexFromModule[moduleToggle] = stepIndex; } foreach (var taskPath in outputListTaskPath.EmptyIfNull()) { foreach (var effectParam in (taskPath?.LastOrDefault()?.ApplicableEffects()).EmptyIfNull()) { listMotion.Add(new MotionRecommendation { Id = motionId++, MotionParam = effectParam, }); } } } catch (Exception e) { exception = e; } var stepResult = new BotStepResult { Exception = exception, ListMotion = listMotion?.ToArrayIfNotEmpty(), OutputListTaskPath = outputListTaskPath, }; MemorizeStepResult(stepResult); StepLastResult = new PropertyGenTimespanInt64 <BotStepResult>(stepResult, beginTimeMilli, GetTimeMilli()); ++stepIndex; return(stepResult); }