Example #1
0
        public static string[] CheckCommaSeparatedString(MainForm form, Extensions.GetStringMethod method, Regex mask, RuleBase rule)
        {
            HashSet <string> res  = new HashSet <string>(StringComparer.InvariantCultureIgnoreCase);
            HashSet <string> dups = new HashSet <string>();

            foreach (string s in CheckNotEmptyString(form, method, rule).Split(','))
            {
                if (res.Contains(s))
                {
                    dups.Add(s);
                }
                else if (!mask.IsMatch(s))
                {
                    form.Add(rule, method.ToString(Resources._0_DontMatchMask), new DataEntry(Resources.Value, s));
                }
                else
                {
                    res.Add(s);
                }
            }
            if (dups.Count > 0)
            {
                form.Add(rule, method.ToString(Resources._0_Duplicated), new DataEntry(Resources.Value, dups.ToArray()));
            }

            return(res.ToArray());
        }
Example #2
0
        public static string CheckNotEmptyString(MainForm form, Extensions.GetStringMethod method, RuleBase rule)
        {
            string s = Extensions.GetString(method);

            if (string.IsNullOrEmpty(s))
            {
                form.Add(rule, method.ToString(Resources._0_EmptyString));
            }

            return(s);
        }
Example #3
0
        public static void CheckVersion(MainForm form, Extensions.GetStringMethod method, RuleBase rule)
        {
            string version = CheckNotEmptyString(form, method, rule);

            if (!string.IsNullOrEmpty(version))
            {
                if (VersionMask.IsMatch(version))
                {
                    form.Add(rule, method.ToString(Resources._0_DontMatchMask), new DataEntry(Resources.Value, version));
                }
            }
        }