/// <summary>
        /// Same as <see cref="IsEqualTimestampLastAccessed"/> but does not check the param for null
        /// </summary>
        private Boolean InternalIsEqualTimestampLastAccessed( QuickIOFileInfo file )
        {
            Contract.Requires( file != null );

            int result = ( this.LastAccessTimeUtc.CompareTo( file.LastAccessTimeUtc ) );
            return ( result == 0 ); // result < 0: file1 is earlier, result > 0: file1 is later. 0 = equal 
        }
예제 #2
0
        /// <summary>
        /// Returns the chunks of current file that are NOT identical with the other file
        /// </summary>
        /// <param name="file">File to compare</param>
        /// <param name="chunkSize">Chunk size (Bytes)</param>
        /// <returns>Returns the chunks of current file that are NOT identical with the other file</returns>
        public IEnumerable <QuickIOFileChunk> GetFileChunksUnequal(QuickIOFileInfo file, Int32 chunkSize = DefaultChunkSize)
        {
            var en1 = GetFileChunksEnumerator(chunkSize);
            var en2 = file.GetFileChunksEnumerator(chunkSize);

            while (en1.MoveNext( ))
            {
                var mn2 = en2.MoveNext( );

                // EOF of file2?
                if (!mn2)
                {
                    // current chunk must be unequal
                    yield return(en1.Current);
                }
                else
                {
                    // check of the chunks are unequal
                    if (!en1.Current.ChunkEquals(en2.Current))
                    {
                        // unequal
                        yield return(en1.Current);
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Returns the chunks of current file that are NOT identical with the other file
        /// </summary>
        /// <param name="file">File to compare</param>
        /// <param name="chunkSize">Chunk size (Bytes)</param>
        /// <returns>Returns the chunks of current file that are NOT identical with the other file</returns>
        public IEnumerable<QuickIOFileChunk> GetFileChunksUnequal( QuickIOFileInfo file, Int32 chunkSize = DefaultChunkSize )
        {
            var en1 = GetFileChunksEnumerator( chunkSize );
            var en2 = file.GetFileChunksEnumerator( chunkSize );

            while ( en1.MoveNext( ) )
            {
                var mn2 = en2.MoveNext( );

                // EOF of file2?
                if ( !mn2 )
                {
                    // current chunk must be unequal
                    yield return en1.Current;
                }
                else
                {
                    // check of the chunks are unequal
                    if ( !en1.Current.ChunkEquals( en2.Current ) )
                    {
                        // unequal
                        yield return en1.Current;
                    }
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Checks if both file contents are equal.
        /// Opens both files for read and breaks on first unequal chunk.
        /// </summary>
        /// <param name="file">File to compare</param>
        /// <param name="chunkSize">Chunk size (Bytes)</param>
        /// <returns>true if contents are equal</returns>
        public Boolean IsEqualContents(QuickIOFileInfo file, Int32 chunkSize = DefaultChunkSize)
        {
            var en1 = GetFileChunksEnumerator(chunkSize);
            var en2 = file.GetFileChunksEnumerator(chunkSize);

            while (true)
            {
                // Go to next element
                var mn1 = en1.MoveNext( );
                var mn2 = en2.MoveNext( );

                // check if next element exists
                if (mn1 != mn2)
                {
                    // collections count diff
                    return(false);
                }

                // no more elements in both collections
                if (!mn1)
                {
                    return(true);
                }

                // check chunks
                var chunk1 = en1.Current;
                var chunk2 = en2.Current;

                if (!chunk1.ChunkEquals(chunk2))
                {
                    return(false);
                }
            }
        }
예제 #5
0
        /// <summary>
        /// Same as <see cref="IsEqualTimestampLastAccessed"/> but does not check the param for null
        /// </summary>
        private Boolean InternalIsEqualTimestampLastAccessed(QuickIOFileInfo file)
        {
            Contract.Requires(file != null);

            int result = (this.LastAccessTimeUtc.CompareTo(file.LastAccessTimeUtc));

            return(result == 0);    // result < 0: file1 is earlier, result > 0: file1 is later. 0 = equal
        }
예제 #6
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(QuickIOFileInfo info, FileAttributes attribute)
        {
            FileAttributes updatedAttributes;
            bool           result = QuickIOEngine.TryAddAttribute(info.FullNameUnc, attribute, out updatedAttributes);

            info.Attributes = updatedAttributes;

            return(result);
        }
예제 #7
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(QuickIOFileInfo info, FileAttributes attribute)
        {
            Contract.Requires(info != null);

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

            info.Attributes = updatedAttributes;

            return(result);
        }
예제 #8
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 );
        }
예제 #9
0
        /// <summary>
        /// Returns the chunks of current file that are identical with the other file
        /// </summary>
        /// <param name="file">File to compare</param>
        /// <param name="chunkSize">Chunk size (Bytes)</param>
        /// <returns>Returns the chunks of current file that are identical with the other file</returns>
        public IEnumerable <QuickIOFileChunk> GetFileChunksEqual(QuickIOFileInfo file, Int32 chunkSize = DefaultChunkSize)
        {
            var en1 = GetFileChunksEnumerator(chunkSize);
            var en2 = file.GetFileChunksEnumerator(chunkSize);

            while (en1.MoveNext( ) && en2.MoveNext( ))
            {
                // check of the chunks are equal
                if (en1.Current.ChunkEquals(en2.Current))
                {
                    // equal
                    yield return(en1.Current);
                }
            }
        }
예제 #10
0
        /// <summary>
        /// Returns the chunks of current file that are identical with the other file
        /// </summary>
        /// <param name="file">File to compare</param>
        /// <param name="chunkSize">Chunk size (Bytes)</param>
        /// <returns>Returns the chunks of current file that are identical with the other file</returns>
        public IEnumerable<QuickIOFileChunk> GetFileChunksEqual( QuickIOFileInfo file, Int32 chunkSize = DefaultChunkSize )
        {
            var en1 = GetFileChunksEnumerator( chunkSize );
            var en2 = file.GetFileChunksEnumerator( chunkSize );

            while ( en1.MoveNext( ) && en2.MoveNext( ) )
            {
                // check of the chunks are equal
                if ( en1.Current.ChunkEquals( en2.Current ) )
                {
                    // equal
                    yield return en1.Current;
                }
            }
        }
예제 #11
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 );
        }
예제 #12
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>
        /// Checks all timestamps.
        /// </summary>
        /// <param name="file">File to compare with</param>
        /// <returns>If collection is empty, all timestamps are equal. Otherwise unequal timestamp is returned.</returns>
        public IEnumerable<QuickIOFileCompareCriteria> CompareTimestamps( QuickIOFileInfo file )
        {
            Invariant.NotNull( file );
            if ( InternalIsEqualTimestampCreated( file ) )
            {
                yield return QuickIOFileCompareCriteria.TimestampCreated;
            }

            if ( InternalIsEqualTimestampLastAccessed( file ) )
            {
                yield return QuickIOFileCompareCriteria.TimestampLastAccessed;
            }

            if ( InternalIsEqualTimestampsLastWritten( file ) )
            {
                yield return QuickIOFileCompareCriteria.TimestampLastWritten;
            }
        }
        /// <summary>
        /// Checks all timestamps.
        /// </summary>
        /// <param name="file">File to compare with</param>
        /// <returns>If collection is empty, all timestamps are equal. Otherwise unequal timestamp is returned.</returns>
        public IEnumerable<QuickIOFileCompareCriteria> CompareTimestamps( QuickIOFileInfo file )
        {
            Contract.Requires( file != null );

            if ( InternalIsEqualTimestampCreated( file ) )
            {
                yield return QuickIOFileCompareCriteria.TimestampCreated;
            }

            if ( InternalIsEqualTimestampLastAccessed( file ) )
            {
                yield return QuickIOFileCompareCriteria.TimestampLastAccessed;
            }

            if ( InternalIsEqualTimestampsLastWritten( file ) )
            {
                yield return QuickIOFileCompareCriteria.TimestampLastWritten;
            }
        }
예제 #15
0
        /// <summary>
        /// Checks all timestamps.
        /// </summary>
        /// <param name="file">File to compare with</param>
        /// <returns>If collection is empty, all timestamps are equal. Otherwise unequal timestamp is returned.</returns>
        public IEnumerable <QuickIOFileCompareCriteria> CompareTimestamps(QuickIOFileInfo file)
        {
            Contract.Requires(file != null);

            if (InternalIsEqualTimestampCreated(file))
            {
                yield return(QuickIOFileCompareCriteria.TimestampCreated);
            }

            if (InternalIsEqualTimestampLastAccessed(file))
            {
                yield return(QuickIOFileCompareCriteria.TimestampLastAccessed);
            }

            if (InternalIsEqualTimestampsLastWritten(file))
            {
                yield return(QuickIOFileCompareCriteria.TimestampLastWritten);
            }
        }
 /// <summary>
 /// Checks byte length (NOT CONTENTS!)
 /// </summary>
 /// <param name="file">File to compare with</param>
 /// <returns>Returns true if both <see cref="QuickIOFileInfo.Bytes"/> properties are equal</returns>
 public Boolean IsEqualByteLength( QuickIOFileInfo file )
 {
     Contract.Requires( file != null );
     return ( this.Bytes == file.Bytes );
 }
예제 #17
0
 /// <summary>
 /// Returns the time of the file or directory was last written (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.getlastwritetimeutc(v=vs.110).aspx</remarks>
 /// <exception cref="PathNotFoundException">No entry found for passed path</exception> 
 public static DateTime GetLastWriteTimeUtc( QuickIOFileInfo info )
 {
     return info.FindData.GetLastWriteTimeUtc( );
 }
예제 #18
0
파일: QuickIO.cs 프로젝트: nagyist/QuickIO
 /// <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(QuickIOFileInfo info)
 {
     Contract.Requires(info != null);
     return(GetAttributes(info.PathInfo));
 }
예제 #19
0
파일: QuickIO.cs 프로젝트: nagyist/QuickIO
 /// <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(QuickIOFileInfo info, FileAttributes attribute)
 {
     Contract.Requires(info != null);
     return(AddAttribute(info.PathInfo, attribute));
 }
예제 #20
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(QuickIOFileInfo info, DateTime lastWriteTimeUtc)
 {
     QuickIOEngine.SetLastWriteTimeUtc(info.FullNameUnc, lastWriteTimeUtc);
 }
예제 #21
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(QuickIOFileInfo info)
 {
     return(GetCreationTimeUtc(info.PathInfo).ToLocalTime( ));
 }
예제 #22
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(QuickIOFileInfo info, DateTime creationTime)
 {
     QuickIOEngine.SetCreationTimeUtc(info.FullNameUnc, creationTime.ToUniversalTime( ));
 }
예제 #23
0
 /// <summary>
 /// Checks byte length (NOT CONTENTS!)
 /// </summary>
 /// <param name="file">File to compare with</param>
 /// <returns>Returns true if both <see cref="QuickIOFileInfo.Bytes"/> properties are equal</returns>
 public Boolean IsEqualByteLength( QuickIOFileInfo file )
 {
     Invariant.NotNull( file );
     return ( this.Bytes == file.Bytes );
 }
예제 #24
0
 /// <summary>
 /// Returns the root information
 /// </summary>
 /// <param name="info">A file or directory. </param>
 /// <returns>A QuickIOPathInfo that represents the root or null if <paramref name="info"/> is root.</returns>
 /// <remarks>http://msdn.microsoft.com/en-us/library/system.io.directory.getdirectoryroot(v=vs.110).aspx</remarks>
 public static Task<QuickIOPathInfo> GetDirectoryRootAsync( QuickIOFileInfo info )
 {
     return NETCompatibility.AsyncExtensions.GetAsyncResult( ( ) => QuickIOFile.GetDirectoryRoot( info ) );
 }
예제 #25
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 FileAttributes SetAttributes( QuickIOFileInfo info, FileAttributes attributes )
 {
     return SetAttributes( info.PathInfo, attributes );
 }
예제 #26
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( QuickIOFileInfo info, FileAttributes attribute )
 {
     return RemoveAttribute( info.PathInfo, attribute );
 }
예제 #27
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(QuickIOFileInfo info, DateTime creationTime, DateTime lastAccessTime, DateTime lastWriteTime)
 {
     SetAllFileTimesUtc(info, creationTime.ToUniversalTime( ), lastAccessTime.ToUniversalTime( ), lastWriteTime.ToUniversalTime( ));
 }
예제 #28
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(QuickIOFileInfo info, DateTime creationTimeUtc, DateTime lastAccessTimeUtc, DateTime lastWriteTimeUtc)
 {
     InternalQuickIO.SetAllFileTimes(info.PathInfo, creationTimeUtc, lastAccessTimeUtc, lastWriteTimeUtc);
 }
예제 #29
0
        /// <summary>
        /// Checks if both file contents are equal.
        /// Opens both files for read and breaks on first unequal chunk.
        /// </summary>
        /// <param name="file">File to compare</param>
        /// <param name="chunkSize">Chunk size (Bytes)</param>
        /// <returns>true if contents are equal</returns>
        public Boolean IsEqualContents( QuickIOFileInfo file, Int32 chunkSize = DefaultChunkSize )
        {
            var en1 = GetFileChunksEnumerator( chunkSize );
            var en2 = file.GetFileChunksEnumerator( chunkSize );

            while ( true )
            {
                // Go to next element
                var mn1 = en1.MoveNext( );
                var mn2 = en2.MoveNext( );

                // check if next element exists
                if ( mn1 != mn2 )
                {
                    // collections count diff
                    return false;
                }

                // no more elements in both collections
                if ( !mn1 )
                {
                    return true;
                }

                // check chunks
                var chunk1 = en1.Current;
                var chunk2 = en2.Current;

                if ( !chunk1.ChunkEquals( chunk2 ) )
                {
                    return false;
                }
            }
        }
예제 #30
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(QuickIOFileInfo info, DateTime creationTimeUtc)
 {
     InternalQuickIO.SetCreationTimeUtc(info.PathInfo, creationTimeUtc);
 }
예제 #31
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(QuickIOFileInfo info, DateTime creationTimeUtc, DateTime lastAccessTimeUtc, DateTime lastWriteTimeUtc)
 {
     QuickIOEngine.SetAllFileTimes(info.FullNameUnc, creationTimeUtc, lastAccessTimeUtc, lastWriteTimeUtc);
 }
예제 #32
0
        /// <summary>
        /// Checks whether the specified file exists.
        /// </summary>
        /// <param name="fileInfo">The the file to check.</param>
        /// <returns><b>true</b> if the caller has the required permissions and path contains the name of an existing file; otherwise, <b>false</b></returns>
        /// <remarks>The original Exists method returns also false on null! http://msdn.microsoft.com/en-us/library/system.io.file.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( QuickIOFileInfo fileInfo )
        {
            Contract.Requires( fileInfo != null );

            return Exists( fileInfo.FullNameUnc );
        }
예제 #33
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(QuickIOFileInfo info, DateTime creationTimeUtc)
 {
     QuickIOEngine.SetCreationTimeUtc(info.FullNameUnc, creationTimeUtc);
 }
예제 #34
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( QuickIOFileInfo info )
 {
     return GetCreationTimeUtc( info.PathInfo ).ToLocalTime( );
 }
예제 #35
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(QuickIOFileInfo info, DateTime lastWriteTime)
 {
     QuickIOEngine.SetLastWriteTimeUtc(info.FullNameUnc, lastWriteTime.ToUniversalTime( ));
 }
예제 #36
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( QuickIOFileInfo info )
 {
     return info.FindData.GetCreationTimeUtc( );
 }
예제 #37
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(QuickIOFileInfo info)
 {
     return(info.FindData.GetCreationTimeUtc( ));
 }
예제 #38
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( QuickIOFileInfo info, DateTime creationTimeUtc, DateTime lastAccessTimeUtc, DateTime lastWriteTimeUtc )
 {
     InternalQuickIO.SetAllFileTimes( info.PathInfo, creationTimeUtc, lastAccessTimeUtc, lastWriteTimeUtc );
 }
예제 #39
0
파일: QuickIO.cs 프로젝트: nagyist/QuickIO
 /// <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(QuickIOFileInfo info, FileAttributes attributes)
 {
     Contract.Requires(info != null);
     SetAttributes(info.PathInfo, attributes);
 }
예제 #40
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( QuickIOFileInfo info, DateTime creationTimeUtc )
 {
     InternalQuickIO.SetCreationTimeUtc( info.PathInfo, creationTimeUtc );
 }
예제 #41
0
 /// <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( QuickIOFileInfo info )
 {
     return GetLastAccessTimeUtc( info.PathInfo ).ToLocalTime( );
 }
예제 #42
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(QuickIOFileInfo info, DateTime lastWriteTime)
 {
     SetLastWriteTimeUtc(info, lastWriteTime.ToUniversalTime( ));
 }
예제 #43
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( QuickIOFileInfo info, DateTime creationTime, DateTime lastAccessTime, DateTime lastWriteTime )
 {
     SetAllFileTimesUtc( info, creationTime.ToUniversalTime( ), lastAccessTime.ToUniversalTime( ), lastWriteTime.ToUniversalTime( ) );
 }
예제 #44
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(QuickIOFileInfo info, DateTime creationTime)
 {
     SetCreationTimeUtc(info, creationTime.ToUniversalTime( ));
 }
예제 #45
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( QuickIOFileInfo info, DateTime creationTime )
 {
     SetCreationTimeUtc( info, creationTime.ToUniversalTime( ) );
 }
예제 #46
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 Task<bool> AddAttributeAsync( QuickIOFileInfo info, FileAttributes attribute )
 {
     return NETCompatibility.AsyncExtensions.GetAsyncResult( ( ) => QuickIOFile.AddAttribute( info, attribute ) );
 }
예제 #47
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( QuickIOFileInfo info, DateTime lastWriteTime )
 {
     SetLastWriteTimeUtc( info, lastWriteTime.ToUniversalTime( ) );
 }
예제 #48
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(QuickIOFileInfo info, DateTime lastWriteTimeUtc)
 {
     InternalQuickIO.SetLastWriteTimeUtc(info.PathInfo, lastWriteTimeUtc);
 }
예제 #49
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( QuickIOFileInfo info, DateTime lastWriteTimeUtc )
 {
     InternalQuickIO.SetLastWriteTimeUtc( info.PathInfo, lastWriteTimeUtc );
 }
예제 #50
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( QuickIOFileInfo info, FileAttributes attributes )
 {
     InternalQuickIO.SetAttributes( info.PathInfo, attributes);
 }
예제 #51
0
 /// <summary>
 /// Returns the if timestamp 'last written to' is equal
 /// </summary>
 /// <param name="file">File to compare with</param>
 /// <returns>Returns the if timestamp 'last written to' is equal</returns>
 public Boolean IsEqualTimestampsLastWritten(QuickIOFileInfo file)
 {
     Contract.Requires(file != null);
     return(InternalIsEqualTimestampsLastWritten(file));
 }
예제 #52
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( QuickIOFileInfo info, FileAttributes attribute )
 {
     return InternalQuickIO.AddAttribute( info.PathInfo, attribute );
 }
예제 #53
0
 /// <summary>
 /// Returns the if timestamp 'last accessed' is equal
 /// </summary>
 /// <param name="file">File to compare with</param>
 /// <returns>Returns the if timestamp 'last accessed' is equal</returns>
 public Boolean IsEqualTimestampLastAccessed(QuickIOFileInfo file)
 {
     Contract.Requires(file != null);
     return(InternalIsEqualTimestampLastAccessed(file));
 }
예제 #54
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( QuickIOFileInfo info )
 {
     return InternalQuickIO.GetAttributes( info.PathInfo );
 }
예제 #55
0
        /// <summary>
        /// Checks whether the specified file exists.
        /// </summary>
        /// <param name="fileInfo">The the file to check.</param>
        /// <returns><b>true</b> if the caller has the required permissions and path contains the name of an existing file; otherwise, <b>false</b></returns>
        /// <remarks>The original Exists method returns also false on null! http://msdn.microsoft.com/en-us/library/system.io.file.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(QuickIOFileInfo fileInfo)
        {
            Contract.Requires(fileInfo != null);

            return(Exists(fileInfo.FullNameUnc));
        }
예제 #56
0
 /// <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(QuickIOFileInfo info)
 {
     return(GetLastAccessTimeUtc(info.PathInfo).ToLocalTime( ));
 }
예제 #57
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 Task SetAttributesAsync( QuickIOFileInfo info, FileAttributes attributes )
 {
     return NETCompatibility.AsyncExtensions.ExecuteAsync( ( ) => QuickIOFile.SetAttributes( info.PathInfo, attributes) );
 }
예제 #58
0
 /// <summary>
 /// Returns the time of the file or directory was last written (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.getlastwritetimeutc(v=vs.110).aspx</remarks>
 /// <exception cref="PathNotFoundException">No entry found for passed path</exception>
 public static DateTime GetLastWriteTimeUtc(QuickIOFileInfo info)
 {
     return(info.FindData.GetLastWriteTimeUtc( ));
 }
예제 #59
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 Task<FileAttributes> GetAttributesAsync( QuickIOFileInfo info )
 {
     return NETCompatibility.AsyncExtensions.GetAsyncResult( ( ) =>  QuickIOFile.GetAttributes( info ) );
 }
예제 #60
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(QuickIOFileInfo info, DateTime creationTime, DateTime lastAccessTime, DateTime lastWriteTime)
 {
     QuickIOEngine.SetAllFileTimes(info.FullNameUnc, creationTime.ToUniversalTime( ), lastAccessTime.ToUniversalTime( ), lastWriteTime.ToUniversalTime( ));
 }