public override ValidationResult Validate(object value, CultureInfo cultureInfo) { if (value is string) { var identifier = value as string; if (AllowEmptyIdentifier && string.IsNullOrEmpty(identifier)) { return(ValidationResult.ValidResult); } if (SupportNamespaces) { var index = identifier.LastIndexOf(@"::", System.StringComparison.Ordinal); if (index >= 0) { identifier = identifier.Substring(index + 2); } } if (Regex.IsMatch(identifier, pattern) && !Vclm.IsReservedName(identifier)) { return(ValidationResult.ValidResult); } } return(new ValidationResult(false, @"Invalid identifier.")); }
public override ValidationResult Validate(object value, CultureInfo cultureInfo) { if (value is string) { var filename = value as string; if (FileExt == @".ui" || FileExt == @".qrc") { filename = filename.ToLower().Replace(@".h", @".x"); filename = filename.Replace(FileExt, @".h"); } if (Vclm.ValidateFileName(filename) && !Path.GetInvalidFileNameChars().Any(filename.Contains)) { return(ValidationResult.ValidResult); } } return(new ValidationResult(false, @"Invalid file name.")); }