Exemple #1
0
            internal static bool IsValidValue(Type type, string value)
            {
                if (type == typeof(string))
                {
                    if (value.StartsWith("--")) // can't be long option
                    {
                        return(false);
                    }
                    if (value.StartsWith("-"))                 // can't be short option
                    {
                        return(CStringUtils.IsNumeric(value)); // but can be a negative number
                    }
                    if (value.Equals("&&") || value.Equals("||"))
                    {
                        return(false);
                    }

                    return(value.Length > 0); // can't be empty
                }

                if (type == typeof(int))
                {
                    return(CStringUtils.IsInteger(value));
                }

                if (type == typeof(float))
                {
                    return(CStringUtils.IsNumeric(value));
                }

                return(false);
            }