Example #1
0
        private RESULT_LIST Convert(string line, PARTS_INFO partsInfo)
        {
            var paramGroupMap = new Dictionary <string, List <string> >();

            if (partsInfo.Rgx.IsMatch(line))
            {
                var match = partsInfo.Rgx.Match(line);
                for (int ctr = 1; ctr < match.Groups.Count; ctr++)
                {
                    Debug.Print("   Group {0}: name={1}, '{2}'", ctr, match.Groups[ctr].Name, match.Groups[ctr].Value);
                    if (match.Groups[ctr].Captures.Count > 0)
                    {
                        int capCtr    = 0;
                        var paramList = new List <string>();
                        foreach (Capture capture in match.Groups[ctr].Captures)
                        {
                            Debug.Print("      Capture {0}: '{1}'", capCtr, capture.Value);
                            paramList.Add(capture.Value);
                            capCtr++;
                        }
                        paramGroupMap.Add(match.Groups[ctr].Name, paramList);
                    }
                }
            }

            return(new RESULT_LIST(partsInfo.PartsKind, paramGroupMap));
        }
Example #2
0
        private bool GetMatchPartsInfo(string line, out PARTS_INFO partsInfo)
        {
            var rgx = currentPartsInfos_.GetEnumerator();

            while (rgx.MoveNext())
            {
                if (rgx.Current.PickupRgx.IsMatch(line))
                {
                    partsInfo = rgx.Current;
                    return(true);
                }
            }
            partsInfo = new PARTS_INFO();
            return(false);
        }