コード例 #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);
     }
 }
コード例 #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);
     }
 }
コード例 #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);
     }
 }
コード例 #4
0
 public static void IsFileName(
     string path,
     [InvokerParameterName] string argName)
 {
     Code.NotNullNorEmpty(path, argName);
     if (!PathHelper.IsFileName(path))
     {
         throw IoCodeExceptions.ArgumentNotFileName(argName, path);
     }
 }
コード例 #5
0
 public static void IsWellFormedAbsolutePath(
     string path,
     [InvokerParameterName] string argName)
 {
     Code.NotNullNorEmpty(path, argName);
     if (!PathHelper.IsWellFormedAbsolutePath(path))
     {
         throw IoCodeExceptions.ArgumentNotWellFormedAbsolutePath(argName, path);
     }
 }
コード例 #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);
     }
 }
コード例 #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);
     }
 }
コード例 #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);
     }
 }