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); }
void MemorizeStepResult(BotStepResult stepResult) { var setMotionMouseWaypointUIElement = stepResult?.ListMotion ?.Select(motion => motion?.MotionParam) ?.Where(motionParam => 0 < motionParam?.MouseButton?.Count()) ?.Select(motionParam => motionParam?.MouseListWaypoint) ?.ConcatNullable()?.Select(mouseWaypoint => mouseWaypoint?.UIElement)?.WhereNotDefault(); foreach (var mouseWaypointUIElement in setMotionMouseWaypointUIElement.EmptyIfNull()) { MouseClickLastStepIndexFromUIElementId[mouseWaypointUIElement.Id] = stepIndex; } }