Exemplo n.º 1
0
		void TaskResolve()
		{
			var ClientOrderExecution = new List<StepTaskNodeResolver>();

			try
			{
				var Resolver = new StepTaskTreeResolver();

				var FromUserTask = StepCurrentState?.UserPreference?.ExtraktTaskParam();

				FromUserTask?.ForEachNullable(FromClientOrder =>
				{
					var RootTaskParam = FromClientOrder;

					if (null == RootTaskParam)
					{
						return;
					}

					var RootTask = TaskForExecutingTaskParam(RootTaskParam);

					var RootTaskComposition = new StepTaskNodeResolver(
						StepIndex - RootTask.BeginStepIndexInBot ?? -1,
							Component(RootTaskParam).GetEnumerator(), RootTask);

					Resolver.CurrentPathPush(RootTaskComposition);
					ClientOrderExecution.Add(RootTaskComposition);

					while (true)
					{
						var NodeTaskComposition = Resolver.CurrentPathPeek();

						if (null == NodeTaskComposition)
						{
							break;
						}

						var NodeNextComponentParam = NodeTaskComposition.ComponentParamGetNext();

						if (!NodeTaskComposition.CompositionContinue)
						{
							Resolver.CurrentPathPop();
							continue;
						}

						if (null == NodeNextComponentParam)
						{
							continue;
						}

						var RateLimitEffective =
							EnumRateLimitEffective(NodeNextComponentParam)?.Any(RateLimitAndSetTask => !RateLimitAndSetTask.Value.NullOderLeer()) ?? false;

						var NodeNextComponentTask = TaskForExecutingTaskParam(NodeNextComponentParam);

						var NodeNextComponentTaskComposition = Resolver.TaskStepCompositionFromTask(NodeNextComponentTask);

						if (null == NodeNextComponentTaskComposition)
						{
							NodeNextComponentTaskComposition = new StepTaskNodeResolver(
								StepIndex - NodeNextComponentTask.BeginStepIndexInBot ?? -1,
								Component(NodeNextComponentParam)?.GetEnumerator(),
								NodeNextComponentTask,
								RateLimitEffective);
						}

						NodeTaskComposition.Component.Add(NodeNextComponentTaskComposition);
						Resolver.CurrentPathPush(NodeNextComponentTaskComposition);
					}
				});
			}
			finally
			{
				StepCurrentState.ToUserReport = new BotStepReport(
					ClientOrderExecution?.FirstOrDefault(rootTaskComposition => rootTaskComposition?.Task?.Param is TravelInfoPanelRouteParam)?.Render(),
					ClientOrderExecution?.FirstOrDefault(rootTaskComposition => rootTaskComposition?.Task?.Param is MineParam)?.Render());
			}
		}
		public void CurrentPathPush(StepTaskNodeResolver TaskStepComposition)
		{
			this.TaskStepComposition[TaskStepComposition] = true;

			CurrentPath.Push(TaskStepComposition);
		}