public static void IsWellFormedSimpleName( [NotNull] string path, [NotNull, InvokerParameterName] string argName) { Code.NotNullNorEmpty(path, argName); if (!PathHelpers.IsWellFormedSimpleName(path)) { throw IoCodeExceptions.ArgumentNotSimpleName(argName, path); } }
public static void IsWellFormedRelativePath( [NotNull] string path, [NotNull, InvokerParameterName] string argName) { Code.NotNullNorEmpty(path, argName); if (!PathHelpers.IsWellFormedRelativePath(path)) { throw IoCodeExceptions.ArgumentRootedOrNotRelativePath(argName, path); } }
public static void IsWellFormedContainerPath( [NotNull] string path, [NotNull, InvokerParameterName] string argName) { Code.NotNullNorEmpty(path, argName); if (!PathHelpers.IsWellFormedContainerPath(path)) { throw IoCodeExceptions.ArgumentNotVolumeOrDirectoryPath(argName, path); } }
public static void IsFileName( string path, [InvokerParameterName] string argName) { Code.NotNullNorEmpty(path, argName); if (!PathHelper.IsFileName(path)) { throw IoCodeExceptions.ArgumentNotFileName(argName, path); } }
public static void IsWellFormedAbsolutePath( string path, [InvokerParameterName] string argName) { Code.NotNullNorEmpty(path, argName); if (!PathHelper.IsWellFormedAbsolutePath(path)) { throw IoCodeExceptions.ArgumentNotWellFormedAbsolutePath(argName, path); } }
public static void PathIsFree([NotNull] string path) { if (Directory.Exists(path)) { throw IoCodeExceptions.DirectoryExists(path); } if (File.Exists(path)) { throw IoCodeExceptions.FileExists(path); } }
public static void DirectoryExists( [NotNull] string directoryPath, [NotNull, InvokerParameterName] string argName) { if (!Directory.Exists(directoryPath)) { throw File.Exists(directoryPath) ? IoCodeExceptions.ArgumentFileExistsDirectoryExpected(argName, directoryPath) : IoCodeExceptions.ArgumentDirectoryNotFound(argName, directoryPath); } }
public static void FileExists( [NotNull] string filePath, [NotNull, InvokerParameterName] string argName) { Code.NotNull(filePath, argName); if (!File.Exists(filePath)) { throw Directory.Exists(filePath) ? IoCodeExceptions.ArgumentDirectoryExistsFileExpected(argName, filePath) : IoCodeExceptions.ArgumentFileNotFound(argName, filePath); } }