Example #1
0
        public static string Execute540(string vri, INodesCollection mf)
        {
            var lmap = new List <(string, string)>();

            foreach (var kv in map)
            {
                lmap.Add((kv.Key.Substring(0, kv.Key.Length - 2), kv.Value));
            }

            var pattern = @"\d+[.]\d+([.]\d+)?([.]\d+)?";
            var matches = Regex.Matches(vri, pattern).Cast <Match>().Select(p => p.Value);
            var result  = "";

            foreach (var match in matches)
            {
                foreach (var val in lmap)
                {
                    if (match.Equals(val.Item1))
                    {
                        result += result.Length == 0? val.Item2 : ", " + val.Item2;
                    }
                }
            }

            Codes codes = new Codes(mf);

            codes.AddNodes(result);

            codes.Sort();
            codes.Distinct();

            return(codes.Show);
        }
Example #2
0
        public static string Execute(string vri, int type, INodesCollection mf)
        {
            var pattern = @"\d+[.]\d+([.]\d+)?([.]\d+)?";
            var matches = Regex.Matches(vri, pattern).Cast <Match>().Select(p => p.Value);

            Codes codes = new Codes(mf);

            foreach (var match in matches)
            {
                if (map.ContainsKey(match))
                {
                    if (match.Equals("12.0.1") && type == 500)
                    {
                        codes.AddNodes(match);
                    }
                    else if (match.Equals("12.0.2") && type == 400)
                    {
                        codes.AddNodes(match);
                    }
                    else
                    {
                        codes.AddNodes(map[match]);
                    }
                }
                else
                {
                    codes.AddNodes(match);
                }
            }

            codes.Sort();
            codes.Distinct();

            return(codes.Show);
        }