SetCreationTime() 공개 정적인 메소드

public static SetCreationTime ( string path, System creationTime ) : void
path string
creationTime System
리턴 void
예제 #1
0
 public static void SetCreationTime(string path, DateTime creationTime)
 {
     if (_provider == null)
     {
         Directory.SetCreationTime(path, creationTime);
     }
     else
     {
         _provider.SetCreationTime(path, creationTime);
     }
 }
예제 #2
0
    /// <summary>
    ///     Sets the directory's creation time.
    /// </summary>
    /// <param name="path">The path of the directory.</param>
    /// <param name="creationTime">A <see cref="DateTime" /> with the directory attribute to set.</param>
    /// <exception cref="ArgumentNullException">
    ///     <paramref name="path" /> is <see langword="null" /> (<see langword="Nothing" />
    ///     in Visual Basic).
    /// </exception>
    public void SetCreationTime(
        string path,
        DateTime creationTime)
    {
        _ = Requires.NotNullOrWhiteSpace(
            path,
            nameof(path));

        FSDir.SetCreationTime(
            path,
            creationTime);
    }
예제 #3
0
    /// <summary>
    ///     Asynchronously sets the directory's creation time.
    /// </summary>
    /// <param name="path">The path of the directory.</param>
    /// <param name="creationTime">A <see cref="DateTime" /> with the directory attribute to set.</param>
    /// <param name="cancellationToken">The cancellation token.</param>
    /// <returns>A task.</returns>
    public Task SetCreationTimeAsync(
        string path,
        DateTime creationTime,
        CancellationToken cancellationToken = default)
    {
        _ = Requires.NotNullOrWhiteSpace(
            path,
            nameof(path));

        return(Work.OnThreadPoolAsync(
                   state => FSDir.SetCreationTime(
                       state.Path,
                       state.CreationTime),
                   (Path: path, CreationTime: creationTime),
                   cancellationToken));
    }
예제 #4
0
 public static void TouchFiles(string path, DateTime dt)
 {
     foreach (var s in Tools.GetDirs(path))
     {
         try {
             Directory.SetCreationTime(s, dt);
             Directory.SetLastAccessTime(s, dt);
             Directory.SetLastWriteTime(s, dt);
         } catch (Exception e) {
             Console.WriteLine(e.Message);
         }
         foreach (var f in Tools.GetFiles(s, "*.*", SearchOption.TopDirectoryOnly))
         {
             try {
                 File.SetCreationTime(f, dt);
                 File.SetLastAccessTime(f, dt);
                 File.SetLastWriteTime(f, dt);
             } catch (Exception e) {
                 Console.WriteLine(e.Message);
             }
         }
     }
 }
예제 #5
0
 public static void SetCreationTime(string path, System.DateTime creationTime) =>
 MSIOD.SetCreationTime(path, creationTime);
예제 #6
0
 public override void SetCreationTime(string path, DateTime creationTime)
 {
     Directory.SetCreationTime(path, creationTime);
 }