Esempio n. 1
0
        public void ResolveConfigAndParameters(Dictionary <string, string> dynamicData,
                                               Dictionary <string, ParameterInfo> globalConfigSets, Dictionary <string, ParameterInfo> globalParamSets, ref List <ActionItem> resolvedActions, object parentExitData)
        {
            if (Handler == null)
            {
                Handler = new HandlerInfo();
            }

            List <object> forEachConfigs = new List <object>();

            if (Handler.HasConfig)
            {
                ParameterInfo c = Handler.Config;
                if (globalConfigSets != null && c.HasInheritFrom && globalConfigSets.Keys.Contains(c.InheritFrom))
                {
                    c.InheritedValues = globalConfigSets[c.InheritFrom];
                }

                c.Resolve(out forEachConfigs, dynamicData, parentExitData, globalConfigSets);

                if (globalConfigSets != null && c.HasName)
                {
                    globalConfigSets[c.Name] = c;
                }
            }
            else
            {
                Handler.Config = new ParameterInfo()
                {
                };
                forEachConfigs.Add(null);
            }

            List <object> forEachParms = new List <object>();

            if (HasParameters)
            {
                ParameterInfo p = Parameters;
                if (globalParamSets != null && p.HasInheritFrom && globalParamSets.Keys.Contains(p.InheritFrom))
                {
                    p.InheritedValues = globalParamSets[p.InheritFrom];
                }

                p.Resolve(out forEachParms, dynamicData, parentExitData, globalParamSets);

                if (globalParamSets != null && p.HasName)
                {
                    globalParamSets[p.Name] = p;
                }
            }
            else
            {
                Parameters = new ParameterInfo()
                {
                };
                forEachParms.Add(null);
            }

            if (resolvedActions != null)
            {
                foreach (object forEachConfig in forEachConfigs)
                {
                    foreach (object forEachParm in forEachParms)
                    {
                        ActionItem clone = Clone(shallow: false);
                        clone.Handler.Config.Values = forEachConfig;
                        clone.Parameters.Values     = forEachParm;

                        resolvedActions.Add(clone);
                    }
                }
            }
        }