![]() |
Diffusion .NET Classic API - Core and Common
5.9.4
|
Provides static methods for creating, copying, deleting, moving, and opening of files with long paths, that is, paths that exceed 259 characters. More...
Static Public Member Functions | |
static bool | Exists (string path) |
Returns a value indicating whether the specified path refers to an existing file. More... | |
static void | Delete (string path) |
Deletes the specified file. More... | |
static void | Move (string sourcePath, string destinationPath) |
Moves the specified file to a new location. More... | |
static void | Copy (string sourcePath, string destinationPath, bool overwrite) |
Copies the specified file to a specified new file, indicating whether to overwrite an existing file. More... | |
static FileStream | Open (string path, FileMode mode, FileAccess access) |
Opens the specified file. More... | |
static FileStream | Open (string path, FileMode mode, FileAccess access, FileShare share) |
Opens the specified file. More... | |
static FileStream | Open (string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options) |
Opens the specified file. More... | |
Provides static methods for creating, copying, deleting, moving, and opening of files with long paths, that is, paths that exceed 259 characters.
|
static |
Copies the specified file to a specified new file, indicating whether to overwrite an existing file.
sourcePath | A String containing the path of the file to copy. |
destinationPath | A String containing the new path of the file. |
overwrite | if destinationPath should be overwritten if it refers to an existing file, otherwise, . |
ArgumentNullException | sourcePath and/or destinationPath is . |
ArgumentException | sourcePath and/or destinationPath is an empty string (""), contains only white space, or contains one or more invalid characters as defined in Path.GetInvalidPathChars(). |
-or-
sourcePath and/or destinationPath contains one or more components that exceed the drive-defined maximum length. For example, on Windows-based platforms, components must not exceed 255 characters.
PathTooLongException | sourcePath and/or destinationPath exceeds the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 32,000 characters. |
FileNotFoundException | sourcePath could not be found. |
DirectoryNotFoundException | One or more directories in sourcePath and/or destinationPath could not be found. |
UnauthorizedAccessException | The caller does not have the required access permissions. |
-or-
overwrite is true and destinationPath refers to a file that is read-only.
IOException | overwrite is false and destinationPath refers to a file that already exists. |
-or-
sourcePath and/or destinationPath is a directory.
-or-
overwrite is true and destinationPath refers to a file that already exists and is in use.
-or-
sourcePath refers to a file that is in use.
-or-
sourcePath and/or destinationPath specifies a device that is not ready.
|
static |
Deletes the specified file.
path | A string containing the path of the file to delete. |
ArgumentNullException | path is . |
ArgumentException | path is an empty string (""), contains only white space, or contains one or more invalid characters as defined in Path.GetInvalidPathChars(). |
-or-
path contains one or more components that exceed the drive-defined maximum length. For example, on Windows-based platforms, components must not exceed 255 characters.
PathTooLongException | path exceeds the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 32,000 characters. |
FileNotFoundException | path could not be found. |
DirectoryNotFoundException | One or more directories in path could not be found. |
UnauthorizedAccessException | The caller does not have the required access permissions. |
-or-
path refers to a file that is read-only.
-or-
path is a directory.
IOException | path refers to a file that is in use. |
-or-
path specifies a device that is not ready.
|
static |
Returns a value indicating whether the specified path refers to an existing file.
path | A string containing the path to check. |
Note that this method will return false if any error occurs while trying to determine if the specified file exists. This includes situations that would normally result in thrown exceptions including (but not limited to); passing in a file name with invalid or too many characters, an I/O error such as a failing or missing disk, or if the caller does not have Windows or Code Access Security (CAS) permissions to to read the file.
|
static |
Moves the specified file to a new location.
sourcePath | A String containing the path of the file to move. |
destinationPath | A String containing the new path of the file. |
ArgumentNullException | sourcePath and/or destinationPath is . |
ArgumentException | sourcePath and/or destinationPath is an empty string (""), contains only white space, or contains one or more invalid characters as defined in Path.GetInvalidPathChars(). |
-or-
sourcePath and/or destinationPath contains one or more components that exceed the drive-defined maximum length. For example, on Windows-based platforms, components must not exceed 255 characters.
PathTooLongException | sourcePath and/or destinationPath exceeds the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 32,000 characters. |
FileNotFoundException | sourcePath could not be found. |
DirectoryNotFoundException | One or more directories in sourcePath and/or destinationPath could not be found. |
UnauthorizedAccessException | The caller does not have the required access permissions. |
IOException | destinationPath refers to a file that already exists. |
-or-
sourcePath and/or destinationPath is a directory.
-or-
sourcePath refers to a file that is in use.
-or-
sourcePath and/or destinationPath specifies a device that is not ready.
|
static |
Opens the specified file.
path | A String containing the path of the file to open. |
access | One of the FileAccess value that specifies the operations that can be performed on the file. |
mode | One of the FileMode values that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten. |
ArgumentNullException | path is . |
ArgumentException | path is an empty string (""), contains only white space, or contains one or more invalid characters as defined in Path.GetInvalidPathChars(). |
-or-
path contains one or more components that exceed the drive-defined maximum length. For example, on Windows-based platforms, components must not exceed 255 characters.
PathTooLongException | path exceeds the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 32,000 characters. |
DirectoryNotFoundException | One or more directories in path could not be found. |
UnauthorizedAccessException | The caller does not have the required access permissions. |
-or-
path refers to a file that is read-only and access is not FileAccess.Read.
-or-
path is a directory.
IOException | path refers to a file that is in use. |
-or-
path specifies a device that is not ready.
|
static |
Opens the specified file.
path | A String containing the path of the file to open. |
access | One of the FileAccess value that specifies the operations that can be performed on the file. |
mode | One of the FileMode values that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten. |
share | One of the FileShare values specifying the type of access other threads have to the file. |
ArgumentNullException | path is . |
ArgumentException | path is an empty string (""), contains only white space, or contains one or more invalid characters as defined in Path.GetInvalidPathChars(). |
-or-
path contains one or more components that exceed the drive-defined maximum length. For example, on Windows-based platforms, components must not exceed 255 characters.
PathTooLongException | path exceeds the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 32,000 characters. |
DirectoryNotFoundException | One or more directories in path could not be found. |
UnauthorizedAccessException | The caller does not have the required access permissions. |
-or-
path refers to a file that is read-only and access is not FileAccess.Read.
-or-
path is a directory.
IOException | path refers to a file that is in use. |
-or-
path specifies a device that is not ready.
|
static |
Opens the specified file.
path | A String containing the path of the file to open. |
access | One of the FileAccess value that specifies the operations that can be performed on the file. |
mode | One of the FileMode values that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten. |
share | One of the FileShare values specifying the type of access other threads have to the file. |
bufferSize | An Int32 containing the number of bytes to buffer for reads and writes to the file, or 0 to specified the default buffer size, 1024. |
options | One or more of the FileOptions values that describes how to create or overwrite the file. |
ArgumentNullException | path is . |
ArgumentException | path is an empty string (""), contains only white space, or contains one or more invalid characters as defined in Path.GetInvalidPathChars(). |
-or-
path contains one or more components that exceed the drive-defined maximum length. For example, on Windows-based platforms, components must not exceed 255 characters.
ArgumentOutOfRangeException | bufferSize is less than 0. |
PathTooLongException | path exceeds the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 32,000 characters. |
DirectoryNotFoundException | One or more directories in path could not be found. |
UnauthorizedAccessException | The caller does not have the required access permissions. |
-or-
path refers to a file that is read-only and access is not FileAccess.Read.
-or-
path is a directory.
IOException | path refers to a file that is in use. |
-or-
path specifies a device that is not ready.