コード例 #1
0
        protected override bool Process(IInteraction parameters)
        {
            TextReader reader;
            bool       success;

            if (success = TryGetDatareader(parameters, null, out reader))
            {
                string fullData = reader.ReadToEnd();
                Match  results  = matcher.Match(fullData);

                SimpleInteraction inputs = new SimpleInteraction(parameters);

                foreach (string groupName in matcher.GetGroupNames())
                {
                    NameValueInteraction foundGroup = new NameValueInteraction(parameters)
                    {
                        Name  = groupName,
                        Value = Parser.GetBestPossible(results.Groups [groupName].Value)
                    };

                    success &= TryReportPair(inputs, foundGroup);
                }

                if (this.DoMapping)
                {
                    success &= this.Mapped.TryProcess(inputs);
                }
            }

            return(success);
        }
コード例 #2
0
        protected bool TryReportPair(Map <object> summary, NameValueInteraction input)
        {
            bool success = true;

            if (this.DoIterate)
            {
                success &= this.Iterator.TryProcess(input);
            }
            if (this.DoMapping)
            {
                summary [input.Name] = input.Value;
            }
            if (this.Branches.Has(input.Name))
            {
                success &= this.Branches [input.Name].TryProcess(input);
            }

            return(success);
        }