public static string readStringAndValidate(string key, List <string> validationRegexPatternList, string SettingsFilePath) { string value = readString(key, SettingsFilePath); if (!DataValidation.ValidateBasedOnRegexList(value, validationRegexPatternList)) { throw new ArgumentException("That value does not match one or more of the provided regexes!"); } return(value); }
public static void writeStringAndValidate(string key, string value, List <string> validationRegexPatternList, string SettingsFilePath) { if (!DataValidation.ValidateBasedOnRegexList(value, validationRegexPatternList)) { throw new ArgumentException("That value does not match one or more of the provided regexes!"); } else { writeString(key, value, SettingsFilePath); } }