Methods (45)
Namespace: SchwabenCode.QuickIO.Internal
internal static classInternalQuickIOAddAttributeCopyFileCreateDirectoryCreateFileCreateSafeFileHandleCreateSafeFileHandleDeleteDirectoryDeleteFileDeleteFileDeleteFileDeleteFilesEnumerateDirectoriesEnumerateDirectoryMetadataEnumerateDirectoryMetadataEnumerateDirectoryPathsEnumerateFilePathsEnumerateFilesEnumerateFilesEnumerateFileSystemEntriesEnumerateFileSystemEntriesEnumerateFileSystemEntryPathsEnumerateFileSystemEntryPathsEnumerationHandleInvalidFileHandleExistsFindFirstFileManagedFindFirstSafeFileHandleFindPathsFormatPathByTypeGetAttributesGetDirectoryStatisticsGetDirectoryStatisticsGetFindDataFromPathGetFindDataFromPathGetFindDataFromPathLoadDirectoryFromPathInfoLoadFileFromPathInfoMoveFileOpenReadWriteFileSystemEntryHandleRemoveAttributeSetAllFileTimesSetAttributesSetCreationTimeUtcSetLastAccessTimeUtcSetLastWriteTimeUtcTryGetFindDataFromPath

Syntax

internal static class InternalQuickIO : object

Basetype

  • System.object

Summary

Provides internal methods. All IO operations are called from here.

Uses

Used by

Methods

public static Boolean AddAttribute(QuickIOPathInfo pathInfo, FileAttributes attribute)

Parameters

pathInfo

QuickIOPathInfo

Affected target

attribute

FileAttributes

Attribute to add

Returns

true if added. false if already exists in attributes

public static Boolean CopyFile(String sourceFilePath, String targetFilePath, Int32& win32Error, Boolean overwrite)

Parameters

sourceFilePath

String

Full source path

targetFilePath

String

Full target path

win32Error

Int32&

Last error occured

overwrite

Boolean

true to overwrite existing files

Returns

True if copy succeeded, false if not. Check last Win32 Error to get further information.

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

CreateDirectory(QuickIOPathInfo pathInfo, Boolean recursive)

Creates a new directory. If recursive is false, the parent directory must exists.

public static void CreateDirectory(QuickIOPathInfo pathInfo, Boolean recursive)

Parameters

pathInfo

QuickIOPathInfo

QuickIOPathInfo

recursive

Boolean

If recursive is false, the parent directory must exist.

Exceptions

PathAlreadyExistsException

The specified path already exists.

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

public static void CreateFile(QuickIOPathInfo pathInfo, FileAccess fileAccess, FileShare fileShare, FileMode fileMode, FileAttributes fileAttributes)

Exceptions

PathAlreadyExistsException

The specified path already exists.

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

CreateSafeFileHandle(String path)

Returns the SafeFileHandle and fills Win32FindData from the passes path.

private static SafeFileHandle CreateSafeFileHandle(String path)

Parameters

path

String

Path to the file system entry

Returns

SafeFileHandle

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

CreateSafeFileHandle(QuickIOPathInfo info)

Returns the SafeFileHandle and fills Win32FindData from the passes path.

internal static SafeFileHandle CreateSafeFileHandle(QuickIOPathInfo info)

Parameters

info

QuickIOPathInfo

Path to the file system entry

Returns

SafeFileHandle

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

DeleteDirectory(QuickIOPathInfo pathInfo, Boolean recursive)

Deletes all files in the given directory. On request all contents, too.

public static void DeleteDirectory(QuickIOPathInfo pathInfo, Boolean recursive)

Parameters

pathInfo

QuickIOPathInfo

PathInfo of directory to clear

recursive

Boolean

If recursive is true then all subfolders are also deleted.

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

DirectoryNotEmptyException

The directory is not empty.

Remarks

Function loads every file and attribute. Alls read-only flags will be removed before removing.

public static void DeleteFile(QuickIOPathInfo pathInfo)

Parameters

pathInfo

QuickIOPathInfo

PathInfo of the file to remove

Exceptions

FileNotFoundException

This error is fired if the specified file to remove does not exist.

DeleteFile(String path)

Removes a file.

public static void DeleteFile(String path)

Parameters

path

String

Path to the file to remove

Exceptions

FileNotFoundException

This error is fired if the specified file to remove does not exist.

public static void DeleteFile(QuickIOFileInfo fileInfo)

Parameters

fileInfo

QuickIOFileInfo

FileInfo of the file to remove

Exceptions

PathNotFoundException

This error will be fired if the specified path or a part of them does not exist.

FileNotFoundException

This error will be fired when attempting a file to delete, which does not exist.

DeleteFiles(String directoryPath, Boolean recursive)

Deletes all files in the given directory.

public static void DeleteFiles(String directoryPath, Boolean recursive)

Parameters

directoryPath

String

Path of directory to clear

recursive

Boolean

If true all files in all all subfolders included

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

FileNotFoundException

This error will be fired when attempting a file to delete, which does not exist.

internal static IEnumerable<QuickIODirectoryInfo> EnumerateDirectories(QuickIOPathInfo pathInfo, SearchOption searchOption, QuickIOEnumerateOptions enumerateOptions)

Parameters

pathInfo

QuickIOPathInfo

Path of the directory

searchOption

SearchOption

SearchOption

enumerateOptions

QuickIOEnumerateOptions

The enumeration options for exception handling

Returns

QuickIODirectoryInfo collection of subfolders

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

internal static QuickIODirectoryMetadata EnumerateDirectoryMetadata(QuickIOPathInfo pathInfo, QuickIOEnumerateOptions enumerateOptions)

Parameters

pathInfo

QuickIOPathInfo

Path of the directory

enumerateOptions

QuickIOEnumerateOptions

The enumeration options for exception handling

Returns

QuickIODirectoryMetadata started with the given directory

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

internal static QuickIODirectoryMetadata EnumerateDirectoryMetadata(String uncDirectoryPath, Win32FindData findData, QuickIOEnumerateOptions enumerateOptions)

Parameters

uncDirectoryPath

String

Path of the directory

findData

Win32FindData

Win32FindData

enumerateOptions

QuickIOEnumerateOptions

The enumeration options for exception handling

Returns

QuickIODirectoryMetadata started with the given directory

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

internal static IEnumerable<String> EnumerateDirectoryPaths(String path, SearchOption searchOption, QuickIOEnumerateOptions enumerateOptions, QuickIOPathType pathFormatReturn)

Parameters

path

String

Path of the directory

searchOption

SearchOption

SearchOption

pathFormatReturn

QuickIOPathType

Specifies the type of path to return.

enumerateOptions

QuickIOEnumerateOptions

The enumeration options for exception handling

Returns

Collection of directory paths

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

internal static IEnumerable<String> EnumerateFilePaths(String path, SearchOption searchOption, QuickIOEnumerateOptions enumerateOptions, QuickIOPathType pathFormatReturn)

Parameters

path

String

Path of the directory

searchOption

SearchOption

SearchOption

pathFormatReturn

QuickIOPathType

Specifies the type of path to return.

enumerateOptions

QuickIOEnumerateOptions

The enumeration options for exception handling

Returns

Collection of file paths

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

internal static IEnumerable<QuickIOFileInfo> EnumerateFiles(String uncDirectoryPath, SearchOption searchOption, QuickIOEnumerateOptions enumerateOptions)

Parameters

uncDirectoryPath

String

Path of the directory

searchOption

SearchOption

SearchOption

enumerateOptions

QuickIOEnumerateOptions

The enumeration options for exception handling

Returns

Collection of files

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

internal static IEnumerable<QuickIOFileInfo> EnumerateFiles(QuickIOPathInfo pathInfo, SearchOption searchOption, QuickIOEnumerateOptions enumerateOptions)

Parameters

pathInfo

QuickIOPathInfo

Path of the directory

searchOption

SearchOption

SearchOption

Returns

Collection of files

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

private static IEnumerable<KeyValuePair<String, QuickIOFileSystemEntryType>> EnumerateFileSystemEntries(String uncDirectoryPath, SearchOption searchOption, QuickIOEnumerateOptions enumerateOptions)

Parameters

uncDirectoryPath

String

Path of the directory

searchOption

SearchOption

SearchOption

enumerateOptions

QuickIOEnumerateOptions

The enumeration options for exception handling

Returns

Collection of QuickIODirectoryInfo

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

internal static IEnumerable<KeyValuePair<String, QuickIOFileSystemEntryType>> EnumerateFileSystemEntries(QuickIOPathInfo pathInfo, SearchOption searchOption, QuickIOEnumerateOptions enumerateOptions)

Parameters

pathInfo

QuickIOPathInfo

Path of the directory

searchOption

SearchOption

SearchOption

enumerateOptions

QuickIOEnumerateOptions

The enumeration options for exception handling

Returns

Collection of QuickIODirectoryInfo

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

private static IEnumerable<KeyValuePair<String, QuickIOFileSystemEntryType>> EnumerateFileSystemEntryPaths(String uncDirectoryPath, SearchOption searchOption, QuickIOEnumerateOptions enumerateOptions, QuickIOPathType pathFormatReturn)

Parameters

uncDirectoryPath

String

Path of the directory

searchOption

SearchOption

SearchOption

pathFormatReturn

QuickIOPathType

Specifies the type of path to return.

enumerateOptions

QuickIOEnumerateOptions

The enumeration options for exception handling

Returns

Collection of QuickIODirectoryInfo

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

internal static IEnumerable<KeyValuePair<String, QuickIOFileSystemEntryType>> EnumerateFileSystemEntryPaths(QuickIOPathInfo pathInfo, SearchOption searchOption, QuickIOEnumerateOptions enumerateOptions, QuickIOPathType pathFormatReturn)

Parameters

pathInfo

QuickIOPathInfo

Path of the directory

searchOption

SearchOption

SearchOption

pathFormatReturn

QuickIOPathType

Specifies the type of path to return.

enumerateOptions

QuickIOEnumerateOptions

The enumeration options for exception handling

Returns

Collection of QuickIODirectoryInfo

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

private static Boolean EnumerationHandleInvalidFileHandle(String path, QuickIOEnumerateOptions enumerateOptions, Int32 win32Error)

Exists(QuickIOPathInfo pathInfo)

Reurns true if passed path exists

public static Boolean Exists(QuickIOPathInfo pathInfo)

Parameters

pathInfo

QuickIOPathInfo

Path to check

private static Win32FileHandle FindFirstFileManaged(String uncPath, Win32FindData win32FindData, Int32& win32Error)

Parameters

uncPath

String

Specified path

win32FindData

Win32FindData

FindData to fill

win32Error

Int32&

Win32Error Code. 0 on success

Returns

Win32FileHandle of specified path

FindFirstSafeFileHandle(String path, Win32FindData win32FindData, Int32& win32Error)

Returns the SafeFileHandle and fills Win32FindData from the passes path.

private static Win32FileHandle FindFirstSafeFileHandle(String path, Win32FindData win32FindData, Int32& win32Error)

Parameters

path

String

Path to the file system entry

win32FindData

Win32FindData

win32Error

Int32&

Last error code. 0 if no error occurs

Returns

SafeFileHandle

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

private static IEnumerable<String> FindPaths(String uncDirectoryPath, SearchOption searchOption, Nullable filterType, QuickIOEnumerateOptions enumerateOptions, QuickIOPathType pathFormatReturn)

Parameters

uncDirectoryPath

String

Start directory path

searchOption

SearchOption

SearchOption

enumerateOptions

QuickIOEnumerateOptions

The enumeration options for exception handling

pathFormatReturn

QuickIOPathType

Specifies the type of path to return.

filterType

Nullable

QuickIOFileSystemEntryType

Returns

Collection of path

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

private static String FormatPathByType(QuickIOPathType pathFormatReturn, String uncPath)

Parameters

pathFormatReturn

QuickIOPathType

Target format type

uncPath

String

Path to format

Returns

Formatted path

GetAttributes(QuickIOPathInfo pathInfo)

Gets the FileAttributes of the file on the entry.

internal static FileAttributes GetAttributes(QuickIOPathInfo pathInfo)

Parameters

pathInfo

QuickIOPathInfo

The path to the entry.

Returns

The FileAttributes of the file on the entry.

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

GetDirectoryStatistics(String path, QuickIOEnumerateOptions enumerateOptions)

Determines the statistics of the given directory. This includes the number of files, folders and the total size in bytes. ///

public static QuickIOFolderStatisticResult GetDirectoryStatistics(String path, QuickIOEnumerateOptions enumerateOptions)

Parameters

path

String

Path to the directory to generate the statistics.

Returns

Provides the statistics of the directory

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

GetDirectoryStatistics(QuickIOPathInfo pathInfo, QuickIOEnumerateOptions enumerateOptions)

Determines the statistics of the given directory. This includes the number of files, folders and the total size in bytes.

public static QuickIOFolderStatisticResult GetDirectoryStatistics(QuickIOPathInfo pathInfo, QuickIOEnumerateOptions enumerateOptions)

Parameters

pathInfo

QuickIOPathInfo

PathInfo of the directory to generate the statistics.

Returns

Provides the statistics of the directory

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

public static Win32FindData GetFindDataFromPath(String fullUncPath, Nullable estimatedFileSystemEntryType)

Parameters

fullUncPath

String

Path to the file system entry

estimatedFileSystemEntryType

Nullable

Estimated Type (File or Directory)

Exceptions

UnmatchedFileSystemEntryTypeException

Searched for file but found folder or vise versa.

PathNotFoundException

No entry found for passed path

public static Win32FindData GetFindDataFromPath(QuickIOPathInfo pathInfo, Nullable estimatedFileSystemEntryType)

Parameters

pathInfo

QuickIOPathInfo

Path to the file system entry

estimatedFileSystemEntryType

Nullable

Estimated Type (File or Directory)

Exceptions

UnmatchedFileSystemEntryTypeException

Searched for file but found folder or vise versa.

PathNotFoundException

No entry found for passed path

GetFindDataFromPath(QuickIOPathInfo pathInfo)

Returns the Win32FindData from specified pathInfo

public static Win32FindData GetFindDataFromPath(QuickIOPathInfo pathInfo)

Parameters

pathInfo

QuickIOPathInfo

Path to the file system entry

fullUncPath

Path to the file system entry

Returns

Win32FindData

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

LoadDirectoryFromPathInfo(QuickIOPathInfo pathInfo)

Loads a directory from specified path

public static QuickIODirectoryInfo LoadDirectoryFromPathInfo(QuickIOPathInfo pathInfo)

Parameters

pathInfo

QuickIOPathInfo

Full path

Returns

QuickIODirectoryInfo

Exceptions

UnmatchedFileSystemEntryTypeException

Path exists but it's not a directory; it's a file.

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

LoadFileFromPathInfo(QuickIOPathInfo pathInfo)

Loads a file from specified path

public static QuickIOFileInfo LoadFileFromPathInfo(QuickIOPathInfo pathInfo)

Parameters

pathInfo

QuickIOPathInfo

Full path

Returns

QuickIOFileInfo

Exceptions

UnmatchedFileSystemEntryTypeException

Path exists but it's not a file; it's a directory.

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

public static void MoveFile(String sourceFileName, String destFileName)

Parameters

sourceFileName

String

Full source path

destFileName

String

Full target path

OpenReadWriteFileSystemEntryHandle(String path)

Returns the SafeFileHandle and fills Win32FindData from the passes path.

internal static SafeFileHandle OpenReadWriteFileSystemEntryHandle(String path)

Parameters

path

String

Path to the file system entry

Returns

SafeFileHandle

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

public static Boolean RemoveAttribute(QuickIOPathInfo pathInfo, FileAttributes attribute)

Parameters

pathInfo

QuickIOPathInfo

Affected target

attribute

FileAttributes

Attribute to remove

Returns

true if removed. false if not exists in attributes

public static void SetAllFileTimes(QuickIOPathInfo pathInfo, DateTime creationTimeUtc, DateTime lastAccessTimeUtc, DateTime lastWriteTimeUtc)

Parameters

pathInfo

QuickIOPathInfo

Affected file or directory

creationTimeUtc

DateTime

The time that is to be used (UTC)

lastAccessTimeUtc

DateTime

The time that is to be used (UTC)

lastWriteTimeUtc

DateTime

The time that is to be used (UTC)

SetAttributes(QuickIOPathInfo pathInfo, FileAttributes attributes)

Sets the specified FileAttributes of the entry on the specified path.

public static void SetAttributes(QuickIOPathInfo pathInfo, FileAttributes attributes)

Parameters

pathInfo

QuickIOPathInfo

The path to the entry.

attributes

FileAttributes

A bitwise combination of the enumeration values.

Exceptions

Win32Exception

Unmatched Exception

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

SetCreationTimeUtc(QuickIOPathInfo pathInfo, DateTime utcTime)

Sets the time at which the file or directory was created (UTC)

public static void SetCreationTimeUtc(QuickIOPathInfo pathInfo, DateTime utcTime)

Parameters

pathInfo

QuickIOPathInfo

Affected file or directory

utcTime

DateTime

The time that is to be used (UTC)

SetLastAccessTimeUtc(QuickIOPathInfo pathInfo, DateTime utcTime)

Sets the time at which the file or directory was last accessed to (UTC)

public static void SetLastAccessTimeUtc(QuickIOPathInfo pathInfo, DateTime utcTime)

Parameters

pathInfo

QuickIOPathInfo

Affected file or directory

utcTime

DateTime

The time that is to be used (UTC)

SetLastWriteTimeUtc(QuickIOPathInfo pathInfo, DateTime utcTime)

Sets the time at which the file or directory was last written to (UTC)

public static void SetLastWriteTimeUtc(QuickIOPathInfo pathInfo, DateTime utcTime)

Parameters

pathInfo

QuickIOPathInfo

Affected file or directory

utcTime

DateTime

The time that is to be used (UTC)

public static Boolean TryGetFindDataFromPath(QuickIOPathInfo pathInfo, Win32FindData& pathFindData)

Parameters

pathInfo

QuickIOPathInfo

pathFindData

Win32FindData&

. Will be null if path does not exist.

Returns

true if path is valid and Win32FindData is set

Exceptions

PathNotFoundException

This error is fired if the specified path or a part of them does not exist.

Remarks

if invalid handle found.