Exemplo n.º 1
0
        internal bool ResolveVariables(ActivityExecutor executor)
        {
            this.substate = Substate.ResolvingVariables;
            bool             flag = true;
            IList <Variable> implementationVariables = this.Activity.ImplementationVariables;
            IList <Variable> runtimeVariables        = this.Activity.RuntimeVariables;
            int count = implementationVariables.Count;
            int num2  = runtimeVariables.Count;

            if ((count > 0) || (num2 > 0))
            {
                using (ActivityContext context = executor.GetResolutionContext(this))
                {
                    for (int i = 0; i < count; i++)
                    {
                        Variable variable = implementationVariables[i];
                        context.Activity = variable.Default;
                        if (!variable.TryPopulateLocation(executor, context))
                        {
                            Location specificLocation = this.environment.GetSpecificLocation(variable.Id);
                            executor.ScheduleExpression(variable.Default, this, this.environment, specificLocation.CreateReference(true));
                            flag = false;
                        }
                    }
                    for (int j = 0; j < num2; j++)
                    {
                        Variable variable2 = runtimeVariables[j];
                        context.Activity = variable2.Default;
                        if (!variable2.TryPopulateLocation(executor, context))
                        {
                            Location location2 = this.environment.GetSpecificLocation(variable2.Id);
                            executor.ScheduleExpression(variable2.Default, this, this.environment, location2.CreateReference(true));
                            flag = false;
                        }
                    }
                }
            }
            return(flag);
        }
Exemplo n.º 2
0
        internal bool ResolveArguments(ActivityExecutor executor, IDictionary <string, object> argumentValueOverrides, Location resultLocation, int startIndex = 0)
        {
            bool flag = true;

            if (this.Activity.SkipArgumentResolution)
            {
                using (ActivityContext context = executor.GetResolutionContext(this))
                {
                    RuntimeArgument resultRuntimeArgument = ((ActivityWithResult)this.Activity).ResultRuntimeArgument;
                    if (!resultRuntimeArgument.TryPopulateValue(this.environment, this, context, null, resultLocation, false))
                    {
                        flag = false;
                        Location specificLocation = this.environment.GetSpecificLocation(resultRuntimeArgument.Id);
                        executor.ScheduleExpression(resultRuntimeArgument.BoundArgument.Expression, this, context.Environment, specificLocation.CreateReference(true));
                    }
                    goto Label_0166;
                }
            }
            IList <RuntimeArgument> runtimeArguments = this.Activity.RuntimeArguments;
            int count = runtimeArguments.Count;

            if (count > 0)
            {
                using (ActivityContext context2 = executor.GetResolutionContext(this))
                {
                    for (int i = startIndex; i < count; i++)
                    {
                        RuntimeArgument argument2 = runtimeArguments[i];
                        object          obj2      = null;
                        if (argumentValueOverrides != null)
                        {
                            argumentValueOverrides.TryGetValue(argument2.Name, out obj2);
                        }
                        if (!argument2.TryPopulateValue(this.environment, this, context2, obj2, resultLocation, false))
                        {
                            flag = false;
                            int nextArgumentIndex = i + 1;
                            if (nextArgumentIndex < runtimeArguments.Count)
                            {
                                ResolveNextArgumentWorkItem workItem = executor.ResolveNextArgumentWorkItemPool.Acquire();
                                workItem.Initialize(this, nextArgumentIndex, argumentValueOverrides, resultLocation);
                                executor.ScheduleItem(workItem);
                            }
                            Location location2 = this.environment.GetSpecificLocation(argument2.Id);
                            executor.ScheduleExpression(argument2.BoundArgument.Expression, this, context2.Environment, location2.CreateReference(true));
                            goto Label_0166;
                        }
                    }
                }
            }
Label_0166:
            if (flag && (startIndex == 0))
            {
                this.substate = Substate.ResolvingVariables;
            }
            return(flag);
        }