Diffusion .NET Classic API - Core and Common  5.9.4
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
PushTechnology.DiffusionCore.LongPath.LongPathFile Class Reference

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...
 

Detailed Description

Provides static methods for creating, copying, deleting, moving, and opening of files with long paths, that is, paths that exceed 259 characters.

Member Function Documentation

static void PushTechnology.DiffusionCore.LongPath.LongPathFile.Copy ( string  sourcePath,
string  destinationPath,
bool  overwrite 
)
static

Copies the specified file to a specified new file, indicating whether to overwrite an existing file.

Parameters
sourcePathA String containing the path of the file to copy.
destinationPathA String containing the new path of the file.
overwriteif destinationPath should be overwritten if it refers to an existing file, otherwise, .
Exceptions
ArgumentNullExceptionsourcePath and/or destinationPath is .
ArgumentExceptionsourcePath 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.

Exceptions
PathTooLongExceptionsourcePath and/or destinationPath exceeds the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 32,000 characters.
FileNotFoundExceptionsourcePath could not be found.
DirectoryNotFoundExceptionOne or more directories in sourcePath and/or destinationPath could not be found.
UnauthorizedAccessExceptionThe caller does not have the required access permissions.

-or-

overwrite is true and destinationPath refers to a file that is read-only.

Exceptions
IOExceptionoverwrite 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 void PushTechnology.DiffusionCore.LongPath.LongPathFile.Delete ( string  path)
static

Deletes the specified file.

Parameters
pathA string containing the path of the file to delete.
Exceptions
ArgumentNullExceptionpath is .
ArgumentExceptionpath 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.

Exceptions
PathTooLongExceptionpath exceeds the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 32,000 characters.
FileNotFoundExceptionpath could not be found.
DirectoryNotFoundExceptionOne or more directories in path could not be found.
UnauthorizedAccessExceptionThe caller does not have the required access permissions.

-or-

path refers to a file that is read-only.

-or-

path is a directory.

Exceptions
IOExceptionpath refers to a file that is in use.

-or-

path specifies a device that is not ready.

static bool PushTechnology.DiffusionCore.LongPath.LongPathFile.Exists ( string  path)
static

Returns a value indicating whether the specified path refers to an existing file.

Parameters
pathA string containing the path to check.
Returns
if path refers to an existing file; otherwise, .

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 void PushTechnology.DiffusionCore.LongPath.LongPathFile.Move ( string  sourcePath,
string  destinationPath 
)
static

Moves the specified file to a new location.

Parameters
sourcePathA String containing the path of the file to move.
destinationPathA String containing the new path of the file.
Exceptions
ArgumentNullExceptionsourcePath and/or destinationPath is .
ArgumentExceptionsourcePath 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.

Exceptions
PathTooLongExceptionsourcePath and/or destinationPath exceeds the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 32,000 characters.
FileNotFoundExceptionsourcePath could not be found.
DirectoryNotFoundExceptionOne or more directories in sourcePath and/or destinationPath could not be found.
UnauthorizedAccessExceptionThe caller does not have the required access permissions.
IOExceptiondestinationPath 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 FileStream PushTechnology.DiffusionCore.LongPath.LongPathFile.Open ( string  path,
FileMode  mode,
FileAccess  access 
)
static

Opens the specified file.

Parameters
pathA String containing the path of the file to open.
accessOne of the FileAccess value that specifies the operations that can be performed on the file.
modeOne 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.
Returns
A FileStream that provides access to the file specified in path .
Exceptions
ArgumentNullExceptionpath is .
ArgumentExceptionpath 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.

Exceptions
PathTooLongExceptionpath exceeds the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 32,000 characters.
DirectoryNotFoundExceptionOne or more directories in path could not be found.
UnauthorizedAccessExceptionThe 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.

Exceptions
IOExceptionpath refers to a file that is in use.

-or-

path specifies a device that is not ready.

static FileStream PushTechnology.DiffusionCore.LongPath.LongPathFile.Open ( string  path,
FileMode  mode,
FileAccess  access,
FileShare  share 
)
static

Opens the specified file.

Parameters
pathA String containing the path of the file to open.
accessOne of the FileAccess value that specifies the operations that can be performed on the file.
modeOne 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.
shareOne of the FileShare values specifying the type of access other threads have to the file.
Returns
A FileStream that provides access to the file specified in path .
Exceptions
ArgumentNullExceptionpath is .
ArgumentExceptionpath 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.

Exceptions
PathTooLongExceptionpath exceeds the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 32,000 characters.
DirectoryNotFoundExceptionOne or more directories in path could not be found.
UnauthorizedAccessExceptionThe 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.

Exceptions
IOExceptionpath refers to a file that is in use.

-or-

path specifies a device that is not ready.

static FileStream PushTechnology.DiffusionCore.LongPath.LongPathFile.Open ( string  path,
FileMode  mode,
FileAccess  access,
FileShare  share,
int  bufferSize,
FileOptions  options 
)
static

Opens the specified file.

Parameters
pathA String containing the path of the file to open.
accessOne of the FileAccess value that specifies the operations that can be performed on the file.
modeOne 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.
shareOne of the FileShare values specifying the type of access other threads have to the file.
bufferSizeAn Int32 containing the number of bytes to buffer for reads and writes to the file, or 0 to specified the default buffer size, 1024.
optionsOne or more of the FileOptions values that describes how to create or overwrite the file.
Returns
A FileStream that provides access to the file specified in path .
Exceptions
ArgumentNullExceptionpath is .
ArgumentExceptionpath 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.

Exceptions
ArgumentOutOfRangeExceptionbufferSize is less than 0.
PathTooLongExceptionpath exceeds the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 32,000 characters.
DirectoryNotFoundExceptionOne or more directories in path could not be found.
UnauthorizedAccessExceptionThe 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.

Exceptions
IOExceptionpath refers to a file that is in use.

-or-

path specifies a device that is not ready.