diff --git a/src/Warden.Watchers.Disk/FileInfo.cs b/src/Warden.Watchers.Disk/FileInfo.cs
index 1778cfb..b4c03d7 100644
--- a/src/Warden.Watchers.Disk/FileInfo.cs
+++ b/src/Warden.Watchers.Disk/FileInfo.cs
@@ -1,4 +1,6 @@
-namespace Warden.Watchers.Disk
+using System;
+
+namespace Warden.Watchers.Disk
{
///
/// Details of the performed file analysis.
@@ -40,8 +42,14 @@ public class FileInfo
///
public string Directory { get; }
+ ///
+ /// File creation time in coordinated universal time (UTC).
+ ///
+ public DateTime CreationTimeUtc { get; }
+
protected FileInfo(string path, string name, string extension,
- bool exists, long size, string partition, string directory)
+ bool exists, long size, string partition, string directory,
+ DateTime creationTimeUtc)
{
Path = path;
Name = name;
@@ -51,6 +59,7 @@ protected FileInfo(string path, string name, string extension,
Size = size;
Partition = partition;
Directory = directory;
+ CreationTimeUtc = creationTimeUtc;
}
///
@@ -63,7 +72,7 @@ protected FileInfo(string path, string name, string extension,
/// Full path of the directory in which the file exists e.g. D:\Images.
///
public static FileInfo NotFound(string name, string path, string extension, string partition, string directory)
- => new FileInfo(name, path, extension, false, 0, partition, directory);
+ => new FileInfo(name, path, extension, false, 0, partition, directory, new DateTime());
///
///
@@ -74,9 +83,10 @@ public static FileInfo NotFound(string name, string path, string extension, stri
/// Size in bytes.
/// Name of the directory in which the file exists e.g. D:\.
/// Full path of the directory in which the file exists e.g. D:\Images.
+ /// File creation time in coordinated universal time (UTC).
///
public static FileInfo Create(string name, string path, string extension, long sizeBytes,
- string partition, string directory)
- => new FileInfo(name, path, extension, true, sizeBytes, partition, directory);
+ string partition, string directory, DateTime creationTimeUtc)
+ => new FileInfo(name, path, extension, true, sizeBytes, partition, directory, creationTimeUtc);
}
}
\ No newline at end of file
diff --git a/src/Warden.Watchers.Disk/IDiskChecker.cs b/src/Warden.Watchers.Disk/IDiskChecker.cs
index ad8eb59..ec23e15 100644
--- a/src/Warden.Watchers.Disk/IDiskChecker.cs
+++ b/src/Warden.Watchers.Disk/IDiskChecker.cs
@@ -83,7 +83,7 @@ private FileInfo CheckFile(string file)
return FileInfo.NotFound(info.Name, info.FullName, info.Extension, partition, info.DirectoryName);
return FileInfo.Create(info.Name, info.FullName, info.Extension, info.Length, partition,
- info.DirectoryName);
+ info.DirectoryName, info.CreationTimeUtc);
}
}
}
\ No newline at end of file