/// <summary>
        /// Removes the specified attribute from file or directory
        /// </summary>
        /// <param name="path">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(string path, FileAttributes attribute)
        {
            FileAttributes updatedAttributes;
            bool           result = QuickIOEngine.TryRemoveAttribute(QuickIOPath.ToPathUnc(path), attribute, out updatedAttributes);

            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// Adds the specified attribute to file or directory
        /// </summary>
        /// <param name="path">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(string path, FileAttributes attribute)
        {
            Contract.Requires(!String.IsNullOrWhiteSpace(path));

            FileAttributes updatedAttributes;
            bool           result = QuickIOEngine.TryAddAttribute(QuickIOPath.ToPathUnc(path), attribute, out updatedAttributes);

            return(result);
        }
Esempio n. 3
0
        internal QuickIOFileSystemMetadataBase(string fullPath, Win32FindData win32FindData)
        {
            Contract.Requires(!String.IsNullOrWhiteSpace(fullPath));
            Contract.Requires(win32FindData != null);

            FindData = win32FindData;

            FullNameUnc = QuickIOPath.ToPathUnc(fullPath);
            FullName    = QuickIOPath.ToPathRegular(fullPath);

            this.LastWriteTimeUtc  = win32FindData.GetLastWriteTimeUtc();
            this.LastAccessTimeUtc = win32FindData.GetLastAccessTimeUtc();
            this.CreationTimeUtc   = win32FindData.GetCreationTimeUtc();

            Name = win32FindData.cFileName;

            Attributes = win32FindData.dwFileAttributes;
        }
Esempio n. 4
0
        /// <summary>
        /// Creates the path information container
        /// </summary>
        /// <param name="fullpath">Full path to the file or directory (regular or unc)</param>
        /// <param name="win32FindData">Win32 handle information</param>
        internal QuickIOPathInfo(string fullpath, Win32FindData win32FindData)
        {
            Contract.Requires(fullpath != null);
            //Changed to allow paths which do not exist:
            //Contract.Requires( win32FindData != null );

            this.FindData = win32FindData;


            this.Name        = QuickIOPath.GetName(fullpath);
            this.FullName    = QuickIOPath.ToPathRegular(fullpath);
            this.FullNameUnc = QuickIOPath.ToPathUnc(fullpath);

            // TODO:
            this.Parent = QuickIOPath.GetDirectoryName(fullpath);
            this.Root   = QuickIOPath.GetPathRoot(fullpath);

            this.IsRoot = QuickIOPath.IsRoot(fullpath);
        }
Esempio n. 5
0
 /// <summary>
 /// Defines the time at which the file or directory was last written (UTC)
 /// </summary>
 /// <param name="path">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(String path, DateTime lastWriteTimeUtc)
 {
     QuickIOEngine.SetLastWriteTimeUtc(QuickIOPath.ToPathUnc(path), lastWriteTimeUtc);
 }
Esempio n. 6
0
 /// <summary>
 /// Defines the time at which the file or directory was last accessed
 /// </summary>
 /// <param name="path">Affected file or directory</param>
 /// <param name="lastAccessTime">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 SetLastAccessTime(String path, DateTime lastAccessTime)
 {
     QuickIOEngine.SetLastAccessTimeUtc(QuickIOPath.ToPathUnc(path), lastAccessTime.ToUniversalTime( ));
 }
Esempio n. 7
0
 /// <summary>
 /// Defines the time at which the file or directory was created (UTC)
 /// </summary>
 /// <param name="path">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(String path, DateTime creationTimeUtc)
 {
     QuickIOEngine.SetCreationTimeUtc(QuickIOPath.ToPathUnc(path), creationTimeUtc);
 }
Esempio n. 8
0
 /// <summary>
 /// Defines the time at which the file or directory was created
 /// </summary>
 /// <param name="path">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(String path, DateTime creationTime)
 {
     QuickIOEngine.SetCreationTimeUtc(QuickIOPath.ToPathUnc(path), creationTime.ToUniversalTime( ));
 }
Esempio n. 9
0
 /// <summary>
 /// Sets the dates and times of given directory or file.
 /// </summary>
 /// <param name="path">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(String path, DateTime creationTimeUtc, DateTime lastAccessTimeUtc, DateTime lastWriteTimeUtc)
 {
     QuickIOEngine.SetAllFileTimes(QuickIOPath.ToPathUnc(path), creationTimeUtc, lastAccessTimeUtc, lastWriteTimeUtc);
 }
Esempio n. 10
0
 /// <summary>
 /// Sets the time the file was created.
 /// </summary>
 /// <param name="path">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(String path, DateTime creationTime, DateTime lastAccessTime, DateTime lastWriteTime)
 {
     QuickIOEngine.SetAllFileTimes(QuickIOPath.ToPathUnc(path), creationTime.ToUniversalTime( ), lastAccessTime.ToUniversalTime( ), lastWriteTime.ToUniversalTime( ));
 }
 /// <summary>
 /// Gets the <see cref="FileAttributes"/> of the directory or file.
 /// </summary>
 /// <param name="path">The path to the directory or file. </param>
 /// <returns>The <see cref="FileAttributes"/> of the directory or file.</returns>
 public static FileAttributes GetAttributes(string path)
 {
     return(QuickIOEngine.GetAttributes(QuickIOPath.ToPathUnc(path)));
 }
 /// <summary>
 /// Gets the <see cref="FileAttributes"/> of the directory or file.
 /// </summary>
 /// <param name="path">The path to the 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(string path, FileAttributes attributes)
 {
     QuickIOEngine.SetAttributes(QuickIOPath.ToPathUnc(path), attributes);
 }
Esempio n. 13
0
 /// <summary>
 /// Returns <see cref="Path"/> in unc.
 /// </summary>
 /// <returns></returns>
 public String GetPathUnc()
 {
     return(QuickIOPath.ToPathUnc(Path));
 }
Esempio n. 14
0
 /// <summary>
 /// Gets the <see cref="FileAttributes"/> of the directory or file.
 /// </summary>
 /// <param name="path">The path to the directory or file. </param>
 /// <returns>The <see cref="FileAttributes"/> of the directory or file.</returns>
 public static FileAttributes GetAttributes(string path)
 {
     Contract.Requires(!String.IsNullOrWhiteSpace(path));
     return(QuickIOEngine.GetAttributes(QuickIOPath.ToPathUnc(path)));
 }
Esempio n. 15
0
 /// <summary>
 /// Gets the <see cref="FileAttributes"/> of the directory or file.
 /// </summary>
 /// <param name="path">The path to the 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(string path, FileAttributes attributes)
 {
     Contract.Requires(!String.IsNullOrWhiteSpace(path));
     QuickIOEngine.SetAttributes(QuickIOPath.ToPathUnc(path), attributes);
 }