本文整理汇总了C#中SchwabenCode.QuickIO.QuickIODirectoryInfo类的典型用法代码示例。如果您正苦于以下问题:C# QuickIODirectoryInfo类的具体用法?C# QuickIODirectoryInfo怎么用?C# QuickIODirectoryInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QuickIODirectoryInfo类属于SchwabenCode.QuickIO命名空间,在下文中一共展示了QuickIODirectoryInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Compress
/// <summary>
/// Compresses a directory by using <see>
/// <cref>ZipFile.CreateFromDirectory</cref>
/// </see>
/// </summary>
/// <param name="directory">Directory to zip</param>
/// <param name="zipFullPath">Zipfile fullname to save</param>
/// <param name="overWriteExistingZip">true to overwrite existing zipfile</param>
/// <param name="compressionLevel"><see cref="CompressionLevel"/></param>
/// <param name="includeBaseDirectory">True to include basedirectory</param>
public static void Compress( QuickIODirectoryInfo directory, String zipFullPath, bool overWriteExistingZip = false, CompressionLevel compressionLevel = CompressionLevel.Fastest, bool includeBaseDirectory = false )
{
Invariant.NotNull( directory );
Invariant.NotEmpty( zipFullPath );
Compress( directory.FullName, zipFullPath, overWriteExistingZip, compressionLevel, includeBaseDirectory );
}
示例2: EnumerateDirectoryMetadata
/// <summary>
/// Receives <see cref="QuickIODirectoryMetadata"/> of current directory
/// </summary>
/// <returns><see cref="QuickIODirectoryMetadata"/></returns>
public static QuickIODirectoryMetadata EnumerateDirectoryMetadata( QuickIODirectoryInfo directoryInfo, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
Contract.Requires( directoryInfo != null );
Contract.Ensures( Contract.Result<QuickIODirectoryMetadata>() != null );
return EnumerateDirectoryMetadata( directoryInfo.PathInfo, enumerateOptions );
}
示例3: Copy
/// <summary>
/// Copies a directory and all contents
/// </summary>
/// <param name="source">Source directory</param>
/// <param name="target">Target directory</param>
/// <param name="overwrite">true to overwrite existing files</param>
/// <param name="cancellationToken">Cancallation Token</param>
public static void Copy( QuickIODirectoryInfo source, QuickIOPathInfo target, bool overwrite = false, CancellationToken cancellationToken = default( CancellationToken ) )
{
Contract.Requires( source != null );
Contract.Requires( target != null );
throw new NotImplementedException();
}
示例4: Compress
/// <summary>
/// Compresses a directory by using <see>
/// <cref>ZipFile.CreateFromDirectory</cref>
/// </see>
/// </summary>
/// <param name="directory">Directory to zip</param>
/// <param name="zipFullPath">Zipfile fullname to save</param>
/// <param name="overWriteExistingZip">true to overwrite existing zipfile</param>
/// <param name="compressionLevel"><see cref="CompressionLevel"/></param>
/// <param name="includeBaseDirectory">True to include basedirectory</param>
public static void Compress( QuickIODirectoryInfo directory, String zipFullPath, bool overWriteExistingZip = false, CompressionLevel compressionLevel = CompressionLevel.Fastest, bool includeBaseDirectory = false )
{
Contract.Requires( directory != null );
Contract.Requires( !String.IsNullOrWhiteSpace( zipFullPath ) );
Compress( directory.FullName, zipFullPath, overWriteExistingZip, compressionLevel, includeBaseDirectory );
}
示例5: EnumerateDirectoryPaths
/// <summary>
/// Returns an enumerable collection of directory names in a specified path.
/// </summary>
/// <param name="info">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( QuickIODirectoryInfo info, String pattern = QuickIOPatterns.PathMatchAll, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOPathType pathFormatReturn = QuickIOPathType.Regular, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
Contract.Requires( info != null );
Contract.Requires( !String.IsNullOrWhiteSpace( pattern ) );
return EnumerateDirectoryPaths( info.FullNameUnc, pattern, searchOption, pathFormatReturn, enumerateOptions );
}
示例6: Copy
/// <summary>
/// Copies a directory and all contents
/// </summary>
/// <param name="source">Source directory</param>
/// <param name="target">Target directory</param>
/// <param name="overwrite">true to overwrite existing files</param>
public static void Copy( QuickIODirectoryInfo source, QuickIOPathInfo target, bool overwrite = false )
{
Invariant.NotNull( source );
Invariant.NotNull( target );
var allContentUncPaths = EnumerateFileSystemEntryPaths( source, QuickIOPatternConstants.All, SearchOption.AllDirectories, QuickIOPathType.UNC );
foreach ( var entry in allContentUncPaths )
{
string sourcePathUnc = entry.Key;
var targetFullnameUnc = target.FullNameUnc + sourcePathUnc.Substring( source.FullNameUnc.Length );
switch ( entry.Value )
{
case QuickIOFileSystemEntryType.Directory:
{
QuickIODirectory.Create( targetFullnameUnc, true );
}
break;
case QuickIOFileSystemEntryType.File:
{
QuickIOFile.Copy( sourcePathUnc, targetFullnameUnc, overwrite );
}
break;
}
}
}
示例7: CopyToDirectory
/// <summary>
/// Copies an existing file. Overwrites an existing file if <paramref name="overwrite"/> is true
/// </summary>
/// <param name="sourceFileName">The file to copy.</param>
/// <param name="targetDirectory">Target directory</param>
/// <param name="newFileName">New File name. Null or empty to use <paramref name="sourceFileName"/>' name</param>
/// <param name="overwrite">true to overwrite existing files</param>
/// <remarks>http://msdn.microsoft.com/en-us/library/c6cfw35a(v=vs.110).aspx</remarks>
public static void CopyToDirectory( QuickIOFileInfo sourceFileName, QuickIODirectoryInfo targetDirectory, String newFileName = null, Boolean overwrite = false )
{
var targetFileName = sourceFileName.Name;
if ( !String.IsNullOrEmpty( newFileName ) )
{
// TODO: Check for invalid chars
targetFileName = newFileName;
}
Copy( sourceFileName.FullNameUnc, QuickIOPath.Combine( targetDirectory.FullNameUnc, targetFileName ), overwrite );
}
示例8: CopyToDirectory
/// <summary>
/// Copies an existing file. Overwrites an existing file if <paramref name="overwrite"/> is true
/// </summary>
/// <param name="sourceFileName">The file to copy.</param>
/// <param name="targetDirectory">Target directory</param>
/// <param name="newFileName">New File name. Null or empty to use <paramref name="sourceFileName"/>' name</param>
/// <param name="overwrite">true to overwrite existing files</param>
/// <remarks>http://msdn.microsoft.com/en-us/library/c6cfw35a(v=vs.110).aspx</remarks>
/// <exception cref="FileSystemIsBusyException">Filesystem is busy</exception>
public static void CopyToDirectory( QuickIOFileInfo sourceFileName, QuickIODirectoryInfo targetDirectory, String newFileName = null, Boolean overwrite = false )
{
Contract.Requires( sourceFileName != null );
Contract.Requires( targetDirectory != null );
if( sourceFileName == null )
{
throw new ArgumentNullException( nameof( sourceFileName ) );
}
if( targetDirectory == null )
{
throw new ArgumentNullException( nameof( targetDirectory ) );
}
CopyToDirectory( sourceFileName.FullNameUnc, targetDirectory.FullNameUnc, newFileName, overwrite );
}
示例9: EnumerateFileSystemEntries
/// <summary>
/// Returns an enumerable collection of file names and directory names that match a search pattern in a specified path, and optionally searches subdirectories.
/// </summary>
/// <param name="directoryInfo">The directory to search. </param>
/// <param name="enumerateOptions">Options <see cref="QuickIOEnumerateOptions"/></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>
/// <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>http://msdn.microsoft.com/en-us/library/dd383459(v=vs.110).aspx</remarks>
public static IEnumerable<KeyValuePair<QuickIOPathInfo, QuickIOFileSystemEntryType>> EnumerateFileSystemEntries( QuickIODirectoryInfo directoryInfo, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
return InternalQuickIO.EnumerateFileSystemEntries( directoryInfo.PathInfo, searchOption, enumerateOptions );
}
示例10: EnumerateFilePaths
/// <summary>
/// Returns an enumerable collection of file names in a specified path.
/// </summary>
/// <param name="directoryInfo">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 files in the directory specified by path.</returns>
/// <remarks>http://msdn.microsoft.com/en-us/library/dd383458(v=vs.110).aspx</remarks>
public static IEnumerable<string> EnumerateFilePaths( QuickIODirectoryInfo directoryInfo, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOPathType pathFormatReturn = QuickIOPathType.Regular, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
return EnumerateFilePaths( directoryInfo.PathInfo, searchOption, pathFormatReturn, enumerateOptions );
}
示例11: CompressAsync
/// <summary>
/// Compresses a directory by using <see>
/// <cref>ZipFile.CreateFromDirectory</cref>
/// </see>
/// </summary>
/// <param name="directory">Directory to zip</param>
/// <param name="zipFullPath">Zipfile fullname to save</param>
/// <param name="overWriteExistingZip">true to overwrite existing zipfile</param>
/// <param name="compressionLevel"><see cref="CompressionLevel"/></param>
/// <param name="includeBaseDirectory">True to include basedirectory</param>
public static Task CompressAsync( QuickIODirectoryInfo directory, String zipFullPath, bool overWriteExistingZip = false, CompressionLevel compressionLevel = CompressionLevel.Fastest, bool includeBaseDirectory = false )
{
return NETCompatibility.AsyncExtensions.ExecuteAsync( () => Compress( directory, zipFullPath, overWriteExistingZip, compressionLevel, includeBaseDirectory ) );
}
示例12: EnumerateDirectories
/// <summary>
/// Returns an enumerable collection of directories in a specified path.
/// </summary>
/// <param name="directoryInfo">The directory to search.</param>
/// <param name="searchOption"><see cref="SearchOption"/></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<QuickIODirectoryInfo> EnumerateDirectories( QuickIODirectoryInfo directoryInfo, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
return EnumerateDirectories( directoryInfo.PathInfo, searchOption, enumerateOptions );
}
示例13: EnumerateFilePathsAsync
/// <summary>
/// Returns an enumerable collection of file names in a specified path in a seperate task created by the default <see cref="TaskScheduler"/>.
/// </summary>
/// <param name="directoryInfo">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 files in the directory specified by path.</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<string>> EnumerateFilePathsAsync( QuickIODirectoryInfo directoryInfo, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOPathType pathFormatReturn = QuickIOPathType.Regular, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
{
return NETCompatibility.AsyncExtensions.GetAsyncResult( () => EnumerateFilePaths( directoryInfo.PathInfo, searchOption, pathFormatReturn, enumerateOptions ) );
}
示例14: SetCreationTime
/// <summary>
/// Defines the time at which the file or directory was created
/// </summary>
/// <param name="info">Affected file or directory</param>
/// <param name="creationTime">The time that is to be used</param>
/// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.setcreationtime(v=vs.110).aspx</remarks>
public static void SetCreationTime( QuickIODirectoryInfo info, DateTime creationTime )
{
SetCreationTimeUtc( info, creationTime.ToUniversalTime( ) );
}
示例15: SetAllFileTimesUtc
/// <summary>
/// Sets the dates and times of given directory or file.
/// </summary>
/// <param name="info">Affected file or directory</param>
/// <param name="creationTimeUtc">The time that is to be used (UTC)</param>
/// <param name="lastAccessTimeUtc">The time that is to be used (UTC)</param>
/// <param name="lastWriteTimeUtc">The time that is to be used (UTC)</param>
public static void SetAllFileTimesUtc( QuickIODirectoryInfo info, DateTime creationTimeUtc, DateTime lastAccessTimeUtc, DateTime lastWriteTimeUtc )
{
InternalQuickIO.SetAllFileTimes( info.PathInfo, creationTimeUtc, lastAccessTimeUtc, lastWriteTimeUtc );
}