本文整理汇总了C#中QuickIOEnumerateOptions类的典型用法代码示例。如果您正苦于以下问题:C# QuickIOEnumerateOptions类的具体用法?C# QuickIOEnumerateOptions怎么用?C# QuickIOEnumerateOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QuickIOEnumerateOptions类属于命名空间,在下文中一共展示了QuickIOEnumerateOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnumerateDirectoryMetadata
/// <summary>
/// Receives <see cref="QuickIODirectoryMetadata"/> of current directory
/// </summary>
/// <returns><see cref="QuickIODirectoryMetadata"/></returns>
public static QuickIODirectoryMetadata EnumerateDirectoryMetadata( String path, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
Contract.Requires( !String.IsNullOrWhiteSpace( path ) );
Contract.Ensures( Contract.Result<QuickIODirectoryMetadata>() != null );
return InternalEnumerateFileSystem.EnumerateDirectoryMetadata( path, enumerateOptions );
}
示例2: EnumerateDirectoryPaths
/// <summary>
/// Returns an enumerable collection of directory names in a specified path.
/// </summary>
/// <param name="path">The directory to search.</param>
/// <param name="pattern">Search pattern. Uses Win32 native filtering.</param>
/// <param name="searchOption"><see cref="SearchOption"/></param>
/// <param name="pathFormatReturn">Specifies the type of path to return.</param>
/// <param name="enumerateOptions">Options <see cref="QuickIOEnumerateOptions"/></param>
/// <returns>An enumerable collection of the full names (including paths) for the directories in the directory specified by path.</returns>
/// <remarks>http://msdn.microsoft.com/en-us/library/dd383304(v=vs.110).aspx</remarks>
public static IEnumerable<string> EnumerateDirectoryPaths( string path, String pattern = QuickIOPatterns.PathMatchAll, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOPathType pathFormatReturn = QuickIOPathType.Regular, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
Contract.Requires( !String.IsNullOrWhiteSpace( path ) );
Contract.Requires( !String.IsNullOrWhiteSpace( pattern ) );
return InternalEnumerateFileSystem.EnumerateSystemPaths( path, pattern, searchOption, enumerateOptions, pathFormatReturn, QuickIOFileSystemEntryType.Directory );
}
示例3: EnumerateFiles
/// <summary>
/// Returns an enumerable collection of files in a specified path.
/// </summary>
/// <param name="pattern">Search pattern. Uses Win32 native filtering.</param>
/// <param name="searchOption">Specifiy depth with <see cref="SearchOption"/></param>
/// <param name="enumerateOptions">Options <see cref="QuickIOEnumerateOptions"/></param>
/// <returns>An enumerable collection of the full names (including paths) for the files in the directory specified by path.</returns>
public IEnumerable<QuickIOFileInfo> EnumerateFiles( String pattern = QuickIOPatterns.PathMatchAll, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
Contract.Requires( !String.IsNullOrWhiteSpace( pattern ) );
Contract.Ensures(Contract.Result<IEnumerable<QuickIOFileInfo>>() != null);
return QuickIODirectory.EnumerateFiles( FullNameUnc, pattern, searchOption );
}
示例4: EnumerateFilePaths
/// <summary>
/// Returns an enumerable collection of file names in a specified path.
/// </summary>
/// <param name="pattern">Search pattern. Uses Win32 native filtering.</param>
/// <param name="searchOption">Specifiy depth with <see cref="SearchOption"/></param>
/// <param name="pathFormatReturn">Specifies the type of path to return.</param>
/// <param name="enumerateOptions">Options</param>
/// <returns>An enumerable collection of the full names (including paths) for the files in the directory specified by path.</returns>
public IEnumerable<string> EnumerateFilePaths( String pattern = QuickIOPatterns.PathMatchAll, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOPathType pathFormatReturn = QuickIOPathType.Regular, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
Contract.Requires( !String.IsNullOrWhiteSpace( pattern ) );
Contract.Ensures( Contract.Result<IEnumerable<string>>() != null );
return QuickIODirectory.EnumerateFilePaths( FullNameUnc, pattern, searchOption, pathFormatReturn, enumerateOptions );
}
示例5: EnumerateWin32FileSystemEntries
/// <summary>
/// Determined all sub system entries of a directory
/// </summary>
/// <param name="path">Path of the directory</param>
/// <param name="pattern">Search pattern. Uses Win32 native filtering.</param>
/// <param name="searchOption"><see cref="SearchOption"/></param>
/// <param name="enumerateOptions">The enumeration options for exception handling</param>
/// <returns>Collection of <see cref="QuickIODirectoryInfo"/></returns>
/// <exception cref="PathNotFoundException">This error is fired if the specified path or a part of them does not exist.</exception>
internal static IEnumerable<Tuple<string, Win32FileSystemEntry>> EnumerateWin32FileSystemEntries( String path, String pattern = QuickIOPatterns.PathMatchAll, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
Contract.Requires( !String.IsNullOrWhiteSpace( path ) );
Contract.Ensures( Contract.Result<IEnumerable<Tuple<string, Win32FileSystemEntry>>>() != null );
// Stack
Stack<string> directoryPathStack = new Stack<string>();
directoryPathStack.Push( path );
while( directoryPathStack.Count > 0 )
{
string currentDirectory = directoryPathStack.Pop();
foreach( Win32FileSystemEntry systemEntry in new Win32FileHandleCollection( QuickIOPath.Combine( currentDirectory, pattern ) ) )
{
yield return new Tuple<string, Win32FileSystemEntry>( currentDirectory, systemEntry );
// Create hit for current search result
string resultPath = QuickIOPath.Combine( currentDirectory, systemEntry.Name );
// Check for Directory
if( searchOption == SearchOption.AllDirectories && systemEntry.IsDirectory )
{
directoryPathStack.Push( resultPath );
}
}
}
}
示例6: EnumerateFileSystemEntries
/// <summary>
/// Determined all sub system entries of a directory
/// </summary>
/// <param name="uncDirectoryPath">Path of the directory</param>
/// <param name="pattern">Search pattern. Uses Win32 native filtering.</param>
/// <param name="searchOption"><see cref="SearchOption"/></param>
/// <param name="enumerateOptions">The enumeration options for exception handling</param>
/// <returns>Collection of <see cref="QuickIODirectoryInfo"/></returns>
/// <exception cref="PathNotFoundException">This error is fired if the specified path or a part of them does not exist.</exception>
internal static IEnumerable<QuickIOFileSystemEntry> EnumerateFileSystemEntries( String uncDirectoryPath, String pattern = QuickIOPatterns.PathMatchAll, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
Contract.Requires( !String.IsNullOrWhiteSpace( uncDirectoryPath ) );
Contract.Ensures( Contract.Result<IEnumerable<QuickIOFileSystemEntry>>() != null );
return
( from pair in EnumerateWin32FileSystemEntries( uncDirectoryPath, pattern, searchOption, enumerateOptions )
let parentDirectory = pair.Item1
let win32Entry = pair.Item2
let fullpath = QuickIOPath.Combine( parentDirectory, win32Entry.Name )
select
new QuickIOFileSystemEntry( fullpath, win32Entry.FileSystemEntryType, win32Entry.Attributes, win32Entry.Bytes ) );
}
示例7: EnumerateSystemPaths
/// <summary>
/// Search Exection
/// </summary>
/// <param name="uncDirectoryPath">Start directory path</param>
/// <param name="pattern">Search pattern. Uses Win32 native filtering.</param>
/// <param name="searchOption"><see cref="SearchOption"/></param>
/// <param name="enumerateOptions">The enumeration options for exception handling</param>
/// <param name="pathFormatReturn">Specifies the type of path to return.</param>
/// <param name="filterType"><see cref="QuickIOFileSystemEntryType"/></param>
/// <returns>Collection of path</returns>
/// <exception cref="PathNotFoundException">This error is fired if the specified path or a part of them does not exist.</exception>
public static IEnumerable<String> EnumerateSystemPaths( String uncDirectoryPath, String pattern = QuickIOPatterns.PathMatchAll, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None, QuickIOPathType pathFormatReturn = QuickIOPathType.Regular, QuickIOFileSystemEntryType? filterType = null )
{
Contract.Requires( !String.IsNullOrWhiteSpace( uncDirectoryPath ) );
Contract.Ensures( Contract.Result<IEnumerable<String>>() != null );
IEnumerable<QuickIOFileSystemEntry> entries = EnumerateFileSystemEntries( uncDirectoryPath, pattern, searchOption, enumerateOptions );
// filter?
if( filterType != null )
{
entries = entries.Where( entry => entry.Type == filterType );
}
// TODO: path format
return entries.Select( entry => entry.Path );
}
示例8: EnumerateDirectories
/// <summary>
/// Determined all subfolders of a directory
/// </summary>
/// <param name="pathInfo">Path of the directory</param>
/// <param name="pattern">Search pattern. Uses Win32 native filtering.</param>
/// <param name="searchOption"><see cref="SearchOption"/></param>
/// <param name="enumerateOptions">The enumeration options for exception handling</param>
/// <returns><see cref="QuickIODirectoryInfo"/> collection of subfolders</returns>
/// <exception cref="PathNotFoundException">This error is fired if the specified path or a part of them does not exist.</exception>
internal static IEnumerable<QuickIODirectoryInfo> EnumerateDirectories( QuickIOPathInfo pathInfo, String pattern = QuickIOPatternConstants.All, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
// Match for start of search
var currentPath = QuickIOPath.Combine( pathInfo.FullNameUnc, pattern );
// Find First file
var win32FindData = new Win32FindData( );
int win32Error;
using ( var fileHandle = FindFirstSafeFileHandle( currentPath, win32FindData, out win32Error ) )
{
// Take care of invalid handles
if ( fileHandle.IsInvalid )
{
if ( win32Error != Win32ErrorCodes.ERROR_NO_MORE_FILES )
{
InternalQuickIOCommon.NativeExceptionMapping( pathInfo.FullName, win32Error );
}
if ( EnumerationHandleInvalidFileHandle( pathInfo.FullName, enumerateOptions, win32Error ) )
{
yield return null;
}
}
// Treffer auswerten
do
{
// Ignore . and .. directories
if ( InternalRawDataHelpers.IsSystemDirectoryEntry( win32FindData ) )
{
continue;
}
// Create hit for current search result
var resultPath = QuickIOPath.Combine( pathInfo.FullName, win32FindData.cFileName );
// Check for Directory
if ( InternalHelpers.ContainsFileAttribute( win32FindData.dwFileAttributes, FileAttributes.Directory ) )
{
yield return new QuickIODirectoryInfo( resultPath, win32FindData );
// SubFolders?!
if ( searchOption == SearchOption.AllDirectories )
{
foreach ( var match in EnumerateDirectories( new QuickIOPathInfo( resultPath, win32FindData.cFileName ), pattern, searchOption, enumerateOptions ) )
{
yield return match;
}
}
}
// Create new FindData object for next result
win32FindData = new Win32FindData( );
} // Search for next entry
while ( Win32SafeNativeMethods.FindNextFile( fileHandle, win32FindData ) );
}
}
示例9: EnumerateDirectoryMetadata
/// <summary>
/// Determined metadata of directory
/// </summary>
/// <param name="pathInfo">Path of the directory</param>
/// <param name="enumerateOptions">The enumeration options for exception handling</param>
/// <returns><see cref="QuickIODirectoryMetadata"/> started with the given directory</returns>
/// <exception cref="PathNotFoundException">This error is fired if the specified path or a part of them does not exist.</exception>
internal static QuickIODirectoryMetadata EnumerateDirectoryMetadata( QuickIOPathInfo pathInfo, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
return EnumerateDirectoryMetadata( pathInfo.FullNameUnc, pathInfo.FindData, enumerateOptions );
}
示例10: GetDirectoryStatistics
/// <summary>
/// Determines the statistics of the given directory. This includes the number of files, folders and the total size in bytes.
/// </summary>
/// <param name="pathInfo">PathInfo of the directory to generate the statistics.</param>
/// <param name="enumerateOptions">Options <see cref="QuickIOEnumerateOptions"/></param>
/// <returns>Provides the statistics of the directory</returns>
/// <exception cref="PathNotFoundException">This error is fired if the specified path or a part of them does not exist.</exception>
public static QuickIOFolderStatisticResult GetDirectoryStatistics( QuickIOPathInfo pathInfo, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
return GetDirectoryStatistics( pathInfo.FullNameUnc, enumerateOptions );
}
示例11: EnumerateFileSystemEntryPaths
/// <summary>
/// Determined all sub file system entries of a directory
/// </summary>
/// <param name="pathInfo">Path of the directory</param>
/// <param name="pattern">Search pattern. Uses Win32 native filtering.</param>
/// <param name="searchOption"><see cref="SearchOption"/></param>
/// <param name="pathFormatReturn">Specifies the type of path to return.</param>
/// <param name="enumerateOptions">The enumeration options for exception handling</param>
/// <returns>Collection of <see cref="QuickIODirectoryInfo"/></returns>
/// <exception cref="PathNotFoundException">This error is fired if the specified path or a part of them does not exist.</exception>
internal static IEnumerable<KeyValuePair<String, QuickIOFileSystemEntryType>> EnumerateFileSystemEntryPaths( QuickIOPathInfo pathInfo, String pattern = QuickIOPatternConstants.All, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None, QuickIOPathType pathFormatReturn = QuickIOPathType.Regular )
{
return EnumerateFileSystemEntryPaths( pathInfo.FullNameUnc, pattern, searchOption, enumerateOptions, pathFormatReturn );
}
示例12: EnumerateDirectoryPaths
/// <summary>
/// Returns an enumerable collection of directory names in a specified path.
/// </summary>
/// <param name="path">The directory to search.</param>
/// <param name="searchOption"><see cref="SearchOption"/></param>
/// <param name="pathFormatReturn">Specifies the type of path to return.</param>
/// <param name="enumerateOptions">Options <see cref="QuickIOEnumerateOptions"/></param>
/// <returns>An enumerable collection of the full names (including paths) for the directories in the directory specified by path.</returns>
/// <remarks>http://msdn.microsoft.com/en-us/library/dd383304(v=vs.110).aspx</remarks>
public static IEnumerable<string> EnumerateDirectoryPaths( string path, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOPathType pathFormatReturn = QuickIOPathType.Regular, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
return EnumerateDirectoryPaths( new QuickIOPathInfo( path ), searchOption, pathFormatReturn, enumerateOptions );
}
示例13: EnumerateFileSystemEntryPathsAsync
/// <summary>
/// Returns an enumerable collection of file names and directory names that match a search pattern in a specified path, and optionally searches subdirectories in a seperate task created by the default <see cref="TaskScheduler"/>.
/// </summary>
/// <param name="pathInfo">The directory to search. </param>
/// <param name="searchOption">One of the enumeration values that specifies whether the search operation should include only the current directory or should include all subdirectories.The default value is TopDirectoryOnly.</param>
/// <param name="pathFormatReturn">Specifies the type of path to return.</param>
/// <param name="enumerateOptions">Options <see cref="QuickIOEnumerateOptions"/></param>
/// <returns>An enumerable collection of file-system entries in the directory specified by path and that match the specified search pattern and option.</returns>
/// <remarks><b>Requires .NET 4.0 or higher</b><br /><u>Warning:</u> parallel file system browsing on the same hard disk (HDD/SSD) will decrease performance. Use this only on stripped RAIDs or with network shares.</remarks>
public static Task<IEnumerable<KeyValuePair<string, QuickIOFileSystemEntryType>>> EnumerateFileSystemEntryPathsAsync( QuickIOPathInfo pathInfo, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOPathType pathFormatReturn = QuickIOPathType.Regular, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
return NETCompatibility.AsyncExtensions.GetAsyncResult( () => EnumerateFileSystemEntryPaths( pathInfo, searchOption, pathFormatReturn, enumerateOptions ) );
}
示例14: EnumerateFiles
/// <summary>
/// Determined all files of a directory
/// </summary>
/// <param name="pathInfo">Path of the directory</param>
/// <param name="pattern">Search pattern. Uses Win32 native filtering.</param>
/// <param name="searchOption"><see cref="SearchOption"/></param>
/// <param name="enumerateOptions">Options <see cref="QuickIOEnumerateOptions"/></param>
/// <returns>Collection of files</returns>
/// <exception cref="PathNotFoundException">This error is fired if the specified path or a part of them does not exist.</exception>
internal static IEnumerable<QuickIOFileInfo> EnumerateFiles( QuickIOPathInfo pathInfo, String pattern = QuickIOPatternConstants.All, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
return EnumerateFiles( pathInfo.FullNameUnc, pattern, searchOption, enumerateOptions );
}
示例15: EnumerateFileSystemEntryPaths
/// <summary>
/// Determined all sub file system entries of a directory
/// </summary>
/// <param name="pathInfo">Path of the directory</param>
/// <param name="searchOption"><see cref="SearchOption"/></param>
/// <param name="pathFormatReturn">Specifies the type of path to return.</param>
/// <param name="enumerateOptions">The enumeration options for exception handling</param>
/// <returns>Collection of <see cref="QuickIODirectoryInfo"/></returns>
/// <exception cref="PathNotFoundException">This error is fired if the specified path or a part of them does not exist.</exception>
internal static IEnumerable<KeyValuePair<String, QuickIOFileSystemEntryType>> EnumerateFileSystemEntryPaths( QuickIOPathInfo pathInfo, SearchOption searchOption, QuickIOEnumerateOptions enumerateOptions, QuickIOPathType pathFormatReturn = QuickIOPathType.Regular )
{
return EnumerateFileSystemEntryPaths( pathInfo.FullNameUnc, searchOption, enumerateOptions, pathFormatReturn );
}