Exemplo n.º 1
0
 public static void IsWellFormedSimpleName(
     [NotNull] string path,
     [NotNull, InvokerParameterName] string argName)
 {
     Code.NotNullNorEmpty(path, argName);
     if (!PathHelpers.IsWellFormedSimpleName(path))
     {
         throw IoCodeExceptions.ArgumentNotSimpleName(argName, path);
     }
 }
Exemplo n.º 2
0
 public static void IsWellFormedRelativePath(
     [NotNull] string path,
     [NotNull, InvokerParameterName] string argName)
 {
     Code.NotNullNorEmpty(path, argName);
     if (!PathHelpers.IsWellFormedRelativePath(path))
     {
         throw IoCodeExceptions.ArgumentRootedOrNotRelativePath(argName, path);
     }
 }
Exemplo n.º 3
0
 public static void IsWellFormedContainerPath(
     [NotNull] string path,
     [NotNull, InvokerParameterName] string argName)
 {
     Code.NotNullNorEmpty(path, argName);
     if (!PathHelpers.IsWellFormedContainerPath(path))
     {
         throw IoCodeExceptions.ArgumentNotVolumeOrDirectoryPath(argName, path);
     }
 }
Exemplo n.º 4
0
 public static void IsFileName(
     string path,
     [InvokerParameterName] string argName)
 {
     Code.NotNullNorEmpty(path, argName);
     if (!PathHelper.IsFileName(path))
     {
         throw IoCodeExceptions.ArgumentNotFileName(argName, path);
     }
 }
Exemplo n.º 5
0
 public static void IsWellFormedAbsolutePath(
     string path,
     [InvokerParameterName] string argName)
 {
     Code.NotNullNorEmpty(path, argName);
     if (!PathHelper.IsWellFormedAbsolutePath(path))
     {
         throw IoCodeExceptions.ArgumentNotWellFormedAbsolutePath(argName, path);
     }
 }
Exemplo n.º 6
0
 public static void PathIsFree([NotNull] string path)
 {
     if (Directory.Exists(path))
     {
         throw IoCodeExceptions.DirectoryExists(path);
     }
     if (File.Exists(path))
     {
         throw IoCodeExceptions.FileExists(path);
     }
 }
Exemplo n.º 7
0
 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);
     }
 }
Exemplo n.º 8
0
 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);
     }
 }