/// <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 );
        }
        /// <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 );
        }
        /// <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
0
        /// <summary>
        /// Moves a file, providing the option to give a new file name.
        /// </summary>
        /// <param name="sourceFileInfo">The file to move.</param>
        /// <param name="destinationFolder">Target directory to move the file.</param>
        /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.move(v=vs.110).aspx</remarks>
        public static void Move(QuickIOPathInfo sourceFileInfo, QuickIODirectoryInfo destinationFolder)
        {
            Contract.Requires(sourceFileInfo != null);
            Contract.Requires(destinationFolder != null);

            QuickIOEngine.MoveFile(sourceFileInfo.FullNameUnc, Path.Combine(destinationFolder.FullNameUnc, sourceFileInfo.Name));
        }
示例#5
0
        /// <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();
        }
        /// <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 );
        }
示例#7
0
        /// <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;
                }
            }
        }
示例#8
0
        /// <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));
        }
示例#9
0
        /// <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));
        }
        /// <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 );
        }
        /// <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);
        }
        /// <summary>
        /// Adds the specified attribute to file or directory
        /// </summary>
        /// <param name="info">A directory or file. </param>
        /// <param name="attribute">Attribute to add </param>
        /// <returns>true if added. false if already exists in attributes</returns>
        public static bool AddAttribute(QuickIODirectoryInfo info, FileAttributes attribute)
        {
            FileAttributes updatedAttributes;
            bool           result = QuickIOEngine.TryAddAttribute(info.FullNameUnc, attribute, out updatedAttributes);

            info.Attributes = updatedAttributes;

            return(result);
        }
示例#13
0
        /// <summary>
        /// Returns an enumerable collection of files in a specified path.
        /// </summary>
        /// <param name="directoryInfo">The directory to search. </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>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 <QuickIOFileInfo> EnumerateFiles(QuickIODirectoryInfo directoryInfo,
                                                                   String pattern = QuickIOPatterns.PathMatchAll, SearchOption searchOption = SearchOption.TopDirectoryOnly,
                                                                   QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None)
        {
            Contract.Requires(directoryInfo != null);
            Contract.Requires(!String.IsNullOrWhiteSpace(pattern));

            return(EnumerateFiles(directoryInfo.FullNameUnc, pattern, searchOption, enumerateOptions));
        }
示例#14
0
        /// <summary>
        /// Removes the specified attribute from file or directory
        /// </summary>
        /// <param name="info">A directory or file. </param>
        /// <param name="attribute">Attribute to remove </param>
        /// <returns>true if removed. false if not exists in attributes</returns>
        public static bool RemoveAttribute(QuickIODirectoryInfo info, FileAttributes attribute)
        {
            Contract.Requires(info != null);

            FileAttributes updatedAttributes;
            bool           result = QuickIOEngine.TryRemoveAttribute(info.FullNameUnc, attribute, out updatedAttributes);

            info.Attributes = updatedAttributes;

            return(result);
        }
示例#15
0
        /// <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 );
        }
示例#16
0
        /// <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);
        }
示例#17
0
        /// <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 );
        }
 /// <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 ) );
 }
 /// <summary>
 /// Returns the time of last access of the file or directory
 /// </summary>
 /// <param name="info">Affected file or directory</param>
 /// <returns>A <see cref="DateTime"/> structure.</returns>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.getlastaccesstime(v=vs.110).aspx</remarks>
 /// <exception cref="PathNotFoundException">No entry found for passed path</exception>
 public static DateTime GetLastAccessTime(QuickIODirectoryInfo info)
 {
     return(GetLastAccessTimeUtc(info.PathInfo).ToLocalTime( ));
 }
 /// <summary>
 /// Gets the directory statistics: total files, folders and bytes
 /// </summary>
 /// <param name="directoryInfo"></param>
 /// <returns>A <see cref="QuickIOFolderStatisticResult"/> object that holds the folder statistics such as number of folders, files and total bytes</returns>
 /// <example>
 /// This example shows how to call <see>
 ///         <cref>GetStatistics</cref>
 ///     </see>
 ///     with <see cref="QuickIODirectoryInfo"/> and write the result to the console.
 /// <code>
 ///public static void GetStatistics_With_DirectoryInfo_Example()
 ///{
 ///    QuickIODirectoryInfo targetDirectoryPathInfo = new QuickIODirectoryInfo( @"C:\temp\QuickIOTest" );
 ///
 ///    // Get statistics
 ///    QuickIOFolderStatisticResult stats = QuickIODirectory.GetStatistics( targetDirectoryPathInfo );
 ///
 ///    // Output
 ///    Console.WriteLine( "[Stats] Folders: '{0}' Files: '{1}' Total TotalBytes '{2}'", stats.FolderCount, stats.FileCount, stats.TotalBytes );
 ///}
 /// </code>
 /// </example>
 public static QuickIOFolderStatisticResult GetStatistics( QuickIODirectoryInfo directoryInfo )
 {
     return InternalQuickIO.GetDirectoryStatistics( directoryInfo.PathInfo );
 }
 /// <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 );
 }
 /// <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 ) );
 }
 /// <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="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>http://msdn.microsoft.com/en-us/library/dd383459(v=vs.110).aspx</remarks>
 public static IEnumerable<KeyValuePair<string, QuickIOFileSystemEntryType>> EnumerateFileSystemEntryPaths( QuickIODirectoryInfo directoryInfo, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOPathType pathFormatReturn = QuickIOPathType.Regular, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
 {
     return InternalQuickIO.EnumerateFileSystemEntryPaths( directoryInfo.PathInfo, searchOption, enumerateOptions, pathFormatReturn );
 }
示例#24
0
 /// <summary>
 /// Checks whether the given directory exists.
 /// </summary>
 /// <param name="directoryInfo">The path to test. </param>
 /// <returns>true if exists; otherwise, false.</returns>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.directory.exists(v=vs.110).aspx</remarks>
 /// <exception cref="UnmatchedFileSystemEntryTypeException">Searched for file but found folder.</exception>
 /// <exception cref="InvalidPathException">Path is invalid.</exception>
 public static bool Exists(QuickIODirectoryInfo directoryInfo)
 {
     return(Exists(directoryInfo.FullNameUnc));
 }
 /// <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( ));
 }
 /// <summary>
 /// Gets the <see cref="FileAttributes"/> of the directory or file.
 /// </summary>
 /// <param name="info">A directory or file. </param>
 /// <returns>The <see cref="FileAttributes"/> of the directory or file.</returns>
 public static FileAttributes GetAttributes(QuickIODirectoryInfo info)
 {
     return(QuickIOEngine.GetAttributes(info.FullNameUnc));
 }
 /// <summary>
 /// Gets the <see cref="FileAttributes"/> of the directory or file.
 /// </summary>
 /// <param name="info">A directory or file. </param>
 /// <param name="attributes">New attributes to set.</param>
 /// <returns>The <see cref="FileAttributes"/> of the directory or file.</returns>
 public static void SetAttributes(QuickIODirectoryInfo info, FileAttributes attributes)
 {
     QuickIOEngine.SetAttributes(info.FullNameUnc, attributes);
 }
 /// <summary>
 /// Defines the time at which the file or directory was created (UTC)
 /// </summary>
 /// <param name="info">Affected file or directory</param>
 /// <param name="creationTimeUtc">The time that is to be used (UTC)</param>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.setcreationtimeutc(v=vs.110).aspx</remarks>
 public static void SetCreationTimeUtc(QuickIODirectoryInfo info, DateTime creationTimeUtc)
 {
     InternalQuickIO.SetCreationTimeUtc(info.PathInfo, creationTimeUtc);
 }
 /// <summary>
 /// Returns the creation time of the file or directory
 /// </summary>
 /// <param name="info">Affected file or directory</param>
 /// <returns>A <see cref="DateTime"/> structure.</returns>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.getcreationtime(v=vs.110).aspx</remarks>
 /// <exception cref="PathNotFoundException">No entry found for passed path</exception>
 public static DateTime GetCreationTime(QuickIODirectoryInfo info)
 {
     return(GetCreationTimeUtc(info.PathInfo).ToLocalTime( ));
 }
 /// <summary>
 /// Defines the time at which the file or directory was last written
 /// </summary>
 /// <param name="info">Affected file or directory</param>
 /// <param name="lastWriteTime">The time that is to be used</param>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.setlastwritetime(v=vs.110).aspx</remarks>
 public static void SetLastWriteTime(QuickIODirectoryInfo info, DateTime lastWriteTime)
 {
     SetLastWriteTimeUtc(info, lastWriteTime.ToUniversalTime( ));
 }
示例#31
0
 /// <summary>
 /// Adds the specified attribute to file or directory
 /// </summary>
 /// <param name="info">A directory or file. </param>
 /// <param name="attribute">Attribute to add </param>
 /// <returns>true if added. false if already exists in attributes</returns>
 public static bool AddAttribute(QuickIODirectoryInfo info, FileAttributes attribute)
 {
     Contract.Requires(info != null);
     return(AddAttribute(info.PathInfo, attribute));
 }
示例#32
0
 /// <summary>
 /// Returns the time of last access of the file or directory (UTC)
 /// </summary>
 /// <param name="info">Affected file or directory</param>
 /// <returns>A <see cref="DateTime"/> structure. (UTC)</returns>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.getlastaccesstimeutc(v=vs.110).aspx</remarks>
 /// <exception cref="PathNotFoundException">No entry found for passed path</exception>   
 public static DateTime GetLastAccessTimeUtc( QuickIODirectoryInfo info )
 {
     return info.FindData.GetLastAccessTimeUtc( );
 }
 /// <summary>
 /// Adds the specified attribute to file or directory
 /// </summary>
 /// <param name="info">A directory or file. </param>
 /// <param name="attribute">Attribute to add </param>
 /// <returns>true if added. false if already exists in attributes</returns>
 public static bool AddAttribute(QuickIODirectoryInfo info, FileAttributes attribute)
 {
     return(AddAttribute(info.PathInfo, attribute));
 }
示例#34
0
 /// <summary>
 /// Sets the time the file was created.
 /// </summary>
 /// <param name="info">Affected file or directory</param>
 /// <param name="creationTime">The time that is to be used</param>
 /// <param name="lastAccessTime">The time that is to be used</param>
 /// <param name="lastWriteTime">The time that is to be used</param>
 public static void SetAllFileTimes( QuickIODirectoryInfo info, DateTime creationTime, DateTime lastAccessTime, DateTime lastWriteTime )
 {
     SetAllFileTimesUtc( info, creationTime.ToUniversalTime( ), lastAccessTime.ToUniversalTime( ), lastWriteTime.ToUniversalTime( ) );
 }
 /// <summary>
 /// Returns the creation time of the file or directory (UTC)
 /// </summary>
 /// <param name="info">Affected file or directory</param>
 /// <returns>A <see cref="DateTime"/> structure. (UTC)</returns>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.getcreationtimeutc(v=vs.110).aspx</remarks>
 /// <exception cref="PathNotFoundException">No entry found for passed path</exception>
 public static DateTime GetCreationTimeUtc(QuickIODirectoryInfo info)
 {
     return(info.FindData.GetCreationTimeUtc( ));
 }
示例#36
0
 /// <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 );
 }
 /// <summary>
 /// Returns an enumerable collection of directories in a specified path in a seperate task created by the default <see cref="TaskScheduler"/> in async context.
 /// </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><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<QuickIODirectoryInfo>> EnumerateDirectoriesAsync( QuickIODirectoryInfo directoryInfo, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
 {
     return NETCompatibility.AsyncExtensions.GetAsyncResult( () => EnumerateDirectories( directoryInfo.PathInfo, searchOption, enumerateOptions ) );
 }
示例#38
0
 /// <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( ) );
 }
 /// <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="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>
 /// <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<QuickIOPathInfo, QuickIOFileSystemEntryType>>> EnumerateFileSystemEntriesAsync( QuickIODirectoryInfo directoryInfo, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None )
 {
     return NETCompatibility.AsyncExtensions.GetAsyncResult( () => EnumerateFileSystemEntries( directoryInfo.PathInfo, searchOption, enumerateOptions ) );
 }
 /// <summary>
 /// Gets the <see cref="FileAttributes"/> of the directory or file.
 /// </summary>
 /// <param name="info">A directory or file. </param>
 /// <param name="attributes">New attributes to set.</param>
 /// <returns>The <see cref="FileAttributes"/> of the directory or file.</returns>
 public static void SetAttributes( QuickIODirectoryInfo info, FileAttributes attributes )
 {
     InternalQuickIO.SetAttributes( info.PathInfo, attributes);
 }
 /// <summary>
 /// Sets the time the file was created.
 /// </summary>
 /// <param name="info">Affected file or directory</param>
 /// <param name="creationTime">The time that is to be used</param>
 /// <param name="lastAccessTime">The time that is to be used</param>
 /// <param name="lastWriteTime">The time that is to be used</param>
 public static void SetAllFileTimes(QuickIODirectoryInfo info, DateTime creationTime, DateTime lastAccessTime, DateTime lastWriteTime)
 {
     SetAllFileTimesUtc(info, creationTime.ToUniversalTime( ), lastAccessTime.ToUniversalTime( ), lastWriteTime.ToUniversalTime( ));
 }
 /// <summary>
 /// Gets the <see cref="FileAttributes"/> of the directory or file.
 /// </summary>
 /// <param name="info">A directory or file. </param>
 /// <returns>The <see cref="FileAttributes"/> of the directory or file.</returns>
 public static FileAttributes GetAttributes( QuickIODirectoryInfo info )
 {
     return InternalQuickIO.GetAttributes( info.PathInfo );
 }
 /// <summary>
 /// Returns the time of last access of the file or directory (UTC)
 /// </summary>
 /// <param name="info">Affected file or directory</param>
 /// <returns>A <see cref="DateTime"/> structure. (UTC)</returns>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.getlastaccesstimeutc(v=vs.110).aspx</remarks>
 /// <exception cref="PathNotFoundException">No entry found for passed path</exception>
 public static DateTime GetLastAccessTimeUtc(QuickIODirectoryInfo info)
 {
     return(info.FindData.GetLastAccessTimeUtc( ));
 }
 /// <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);
 }
示例#45
0
 /// <summary>
 /// Returns an enumerable collection of directories 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="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 info, String pattern = QuickIOPatterns.PathMatchAll, SearchOption searchOption = SearchOption.TopDirectoryOnly, QuickIOEnumerateOptions enumerateOptions = QuickIOEnumerateOptions.None)
 {
     return(EnumerateDirectories(info.FullNameUnc, pattern, searchOption, enumerateOptions));
 }
示例#46
0
 /// <summary>
 /// Returns the creation time of the file or directory
 /// </summary>
 /// <param name="info">Affected file or directory</param>
 /// <returns>A <see cref="DateTime"/> structure.</returns>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.getcreationtime(v=vs.110).aspx</remarks>
 /// <exception cref="PathNotFoundException">No entry found for passed path</exception>   
 public static DateTime GetCreationTime( QuickIODirectoryInfo info )
 {
     return GetCreationTimeUtc( info.PathInfo ).ToLocalTime( );
 }
示例#47
0
 /// <summary>
 /// Gets the <see cref="FileAttributes"/> of the directory or file.
 /// </summary>
 /// <param name="info">A directory or file. </param>
 /// <returns>The <see cref="FileAttributes"/> of the directory or file.</returns>
 public static FileAttributes GetAttributes(QuickIODirectoryInfo info)
 {
     Contract.Requires(info != null);
     return(GetAttributes(info.PathInfo));
 }
示例#48
0
 /// <summary>
 /// Returns the creation time of the file or directory (UTC)
 /// </summary>
 /// <param name="info">Affected file or directory</param>
 /// <returns>A <see cref="DateTime"/> structure. (UTC)</returns>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.getcreationtimeutc(v=vs.110).aspx</remarks>
 /// <exception cref="PathNotFoundException">No entry found for passed path</exception>   
 public static DateTime GetCreationTimeUtc( QuickIODirectoryInfo info )
 {
     return info.FindData.GetCreationTimeUtc( );
 }
示例#49
0
 /// <summary>
 /// Gets the <see cref="FileAttributes"/> of the directory or file.
 /// </summary>
 /// <param name="info">A directory or file. </param>
 /// <param name="attributes">New attributes to set.</param>
 /// <returns>The <see cref="FileAttributes"/> of the directory or file.</returns>
 public static void SetAttributes(QuickIODirectoryInfo info, FileAttributes attributes)
 {
     Contract.Requires(info != null);
     SetAttributes(info.PathInfo, attributes);
 }
 /// <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 );
 }
示例#51
0
 /// <summary>
 /// Checks whether the given directory exists.
 /// </summary>
 /// <param name="directoryInfo">The path to test. </param>
 /// <returns>true if exists; otherwise, false.</returns>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.directory.exists(v=vs.110).aspx</remarks>
 /// <exception cref="UnmatchedFileSystemEntryTypeException">Searched for file but found folder.</exception>
 /// <exception cref="InvalidPathException">Path is invalid.</exception>
 public static bool Exists( QuickIODirectoryInfo directoryInfo )
 {
     return InternalQuickIOCommon.Exists( directoryInfo.PathInfo, QuickIOFileSystemEntryType.Directory );
 }
 /// <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 );
 }
 /// <summary>
 /// Gets the directory statistics: total files, folders and bytes
 /// </summary>
 /// <param name="directoryInfo"></param>
 /// <returns>A <see cref="QuickIOFolderStatisticResult"/> object that holds the folder statistics such as number of folders, files and total bytes</returns>
 /// <example>
 /// This example shows how to call <see>
 ///         <cref>GetStatistics</cref>
 ///     </see>
 ///     with <see cref="QuickIODirectoryInfo"/> and write the result to the console.
 /// <code>
 ///public static void GetStatistics_With_DirectoryInfo_Example()
 ///{
 ///    QuickIODirectoryInfo targetDirectoryPathInfo = new QuickIODirectoryInfo( @"C:\temp\QuickIOTest" );
 ///
 ///    // Get statistics
 ///    QuickIOFolderStatisticResult stats = QuickIODirectory.GetStatistics( targetDirectoryPathInfo );
 ///
 ///    // Output
 ///    Console.WriteLine( "[Stats] Folders: '{0}' Files: '{1}' Total TotalBytes '{2}'", stats.FolderCount, stats.FileCount, stats.TotalBytes );
 ///}
 /// </code>
 /// </example>
 public static QuickIOFolderStatisticResult GetStatistics(QuickIODirectoryInfo directoryInfo)
 {
     return(QuickIOEngine.GetDirectoryStatistics(directoryInfo.PathInfo));
 }
 /// <summary>
 /// Defines the time at which the file or directory was last written (UTC)
 /// </summary>
 /// <param name="info">Affected file or directory</param>
 /// <param name="lastWriteTimeUtc">The time that is to be used (UTC)</param>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.setlastwritetimeutc(v=vs.110).aspx</remarks>
 public static void SetLastWriteTimeUtc(QuickIODirectoryInfo info, DateTime lastWriteTimeUtc)
 {
     InternalQuickIO.SetLastWriteTimeUtc(info.PathInfo, lastWriteTimeUtc);
 }
 /// <summary>
 /// Adds the specified attribute to file or directory
 /// </summary>
 /// <param name="info">A directory or file. </param>
 /// <param name="attribute">Attribute to add </param>
 /// <returns>true if added. false if already exists in attributes</returns>
 public static bool AddAttribute( QuickIODirectoryInfo info, FileAttributes attribute )
 {
     return InternalQuickIO.AddAttribute( info.PathInfo, attribute );
 }
示例#56
0
 /// <summary>
 /// Defines the time at which the file or directory was last written (UTC)
 /// </summary>
 /// <param name="info">Affected file or directory</param>
 /// <param name="lastWriteTimeUtc">The time that is to be used (UTC)</param>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.setlastwritetimeutc(v=vs.110).aspx</remarks>
 public static void SetLastWriteTimeUtc(QuickIODirectoryInfo info, DateTime lastWriteTimeUtc)
 {
     QuickIOEngine.SetLastWriteTimeUtc(info.FullNameUnc, lastWriteTimeUtc);
 }
示例#57
0
 /// <summary>
 /// Defines the time at which the file or directory was created (UTC)
 /// </summary>
 /// <param name="info">Affected file or directory</param>
 /// <param name="creationTimeUtc">The time that is to be used (UTC)</param>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.setcreationtimeutc(v=vs.110).aspx</remarks>
 public static void SetCreationTimeUtc( QuickIODirectoryInfo info, DateTime creationTimeUtc )
 {
     InternalQuickIO.SetCreationTimeUtc( info.PathInfo, creationTimeUtc );
 }
示例#58
0
 /// <summary>
 /// Defines the time at which the file or directory was last written (UTC)
 /// </summary>
 /// <param name="info">Affected file or directory</param>     
 /// <param name="lastWriteTimeUtc">The time that is to be used (UTC)</param>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.setlastwritetimeutc(v=vs.110).aspx</remarks>
 public static void SetLastWriteTimeUtc( QuickIODirectoryInfo info, DateTime lastWriteTimeUtc )
 {
     InternalQuickIO.SetLastWriteTimeUtc( info.PathInfo, lastWriteTimeUtc );
 }
示例#59
0
 /// <summary>
 /// Defines the time at which the file or directory was last written
 /// </summary>
 /// <param name="info">Affected file or directory</param>
 /// <param name="lastWriteTime">The time that is to be used</param>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.setlastwritetime(v=vs.110).aspx</remarks>
 public static void SetLastWriteTime( QuickIODirectoryInfo info, DateTime lastWriteTime )
 {
     SetLastWriteTimeUtc( info, lastWriteTime.ToUniversalTime( ) );
 }
示例#60
0
 /// <summary>
 /// Defines the time at which the file or directory was last written
 /// </summary>
 /// <param name="info">Affected file or directory</param>
 /// <param name="lastWriteTime">The time that is to be used</param>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.file.setlastwritetime(v=vs.110).aspx</remarks>
 public static void SetLastWriteTime(QuickIODirectoryInfo info, DateTime lastWriteTime)
 {
     QuickIOEngine.SetLastWriteTimeUtc(info.FullNameUnc, lastWriteTime.ToUniversalTime( ));
 }