/// <summary> /// Checks that the specified directory separator is actually a directory separator, and throws an exception if it is not. /// </summary> /// <exception cref="ArgumentException">Thrown if the <paramref name="directorySeparator"/> is not a directory separator according to <see cref="DirectorySeparator.IsDirectorySeparator(string)"/>.</exception> public static void ValidateDirectorySeparatorArgument(string directorySeparator, string parameterName) { if (!DirectorySeparator.IsDirectorySeparator(directorySeparator)) { throw DirectorySeparator.GetInvalidDirectorySeparatorException(directorySeparator, nameof(directorySeparator)); } }
/// <summary> /// Determines if the input directory separator is not the <see cref="DirectorySeparator.InvalidValue"/>, then if it is one of the Windows of non-Windows directory separators. /// </summary> public static bool IsValid(string directorySeparator) { var isInvalid = DirectorySeparator.IsInvalid(directorySeparator); if (isInvalid) { return(false); } var output = DirectorySeparator.IsDirectorySeparator(directorySeparator); return(output); }
/// <summary> /// Determines if the input character equals the specified directory separator, and if the specified directory separator is a directory separator. /// </summary> public static bool IsDirectorySeparator(char character, string directorySeparator) { var isDirectorySeparator = DirectorySeparator.IsDirectorySeparator(directorySeparator); if (!isDirectorySeparator) { return(false); } var output = character == directorySeparator.Single(); return(output); }