diff --git a/FileSystem/FileIOLinux.cs b/FileSystem/FileIOLinux.cs index 7d5154f..2f33619 100644 --- a/FileSystem/FileIOLinux.cs +++ b/FileSystem/FileIOLinux.cs @@ -208,6 +208,36 @@ public FileAttributes GetAttributes(string path) return File.GetAttributes(path); } + public DateTime GetCreationTime(string path) + { + return File.GetCreationTime(path); + } + + public DateTime GetCreationTimeUtc(string path) + { + return File.GetCreationTimeUtc(path); + } + + public DateTime GetLastWriteTime(string path) + { + return File.GetLastWriteTime(path); + } + + public DateTime GetLastWriteTimeUtc(string path) + { + return File.GetLastWriteTimeUtc(path); + } + + public DateTime GetLastAccessTime(string path) + { + return File.GetLastAccessTime(path); + } + + public DateTime GetLastAccessTimeUtc(string path) + { + return File.GetLastAccessTimeUtc(path); + } + private static bool TryAllowWritesOnFile(string path) { try diff --git a/FileSystem/FileIOWin.cs b/FileSystem/FileIOWin.cs index cf86d38..3178ba7 100644 --- a/FileSystem/FileIOWin.cs +++ b/FileSystem/FileIOWin.cs @@ -185,6 +185,8 @@ public void Copy(string sourcePath, string destinationPath) public void Copy(string sourcePath, string destinationPath, bool overwrite) { + TryAllowWritesOnFile(sourcePath); + TryAllowWritesOnFile(destinationPath); File.Copy(sourcePath, destinationPath, overwrite); } @@ -208,6 +210,36 @@ public System.IO.FileAttributes GetAttributes(string path) return File.GetAttributes(path); } + public DateTime GetCreationTime(string path) + { + return File.GetCreationTime(path); + } + + public DateTime GetCreationTimeUtc(string path) + { + return File.GetCreationTimeUtc(path); + } + + public DateTime GetLastWriteTime(string path) + { + return File.GetLastWriteTime(path); + } + + public DateTime GetLastWriteTimeUtc(string path) + { + return File.GetLastWriteTimeUtc(path); + } + + public DateTime GetLastAccessTime(string path) + { + return File.GetLastAccessTime(path); + } + + public DateTime GetLastAccessTimeUtc(string path) + { + return File.GetLastAccessTimeUtc(path); + } + private static bool TryAllowWritesOnFile(string path) { try diff --git a/FileSystem/IFileIO.cs b/FileSystem/IFileIO.cs index ea4053b..dd98f12 100644 --- a/FileSystem/IFileIO.cs +++ b/FileSystem/IFileIO.cs @@ -1,5 +1,6 @@ namespace Skyline.DataMiner.CICD.FileSystem { + using System; using System.Text; /// Provides static methods for the creation, copying, deletion, moving, and opening of a single file, and aids in the creation of objects. @@ -279,5 +280,35 @@ public interface IFileIO /// The path to the file. /// The of the file on the path. System.IO.FileAttributes GetAttributes(string path); + + /// Gets the creation date and time of the specified file. + /// A structure set to the creation date and time for the specified file. This value is expressed in local time. + /// The file for which to obtain creation date and time information. + DateTime GetCreationTime(string path); + + /// Gets the creation date and time, in Coordinated Universal Time (UTC) format, of the specified file. + /// A structure set to the creation date and time for the specified file. This value is expressed in UTC time. + /// The file for which to obtain creation date and time information, in Coordinated Universal Time (UTC) format. + DateTime GetCreationTimeUtc(string path); + + /// Gets the date and time that the specified file was last written to. + /// The file for which to obtain write date and time information. + /// A structure set to the date and time that the specified file was last written to. This value is expressed in local time. + DateTime GetLastWriteTime(string path); + + /// Gets the date and time, in coordinated universal time (UTC) time, that the specified file was last written to. + /// The file for which to obtain write date and time information. + /// A structure set to the date and time that the specified file was last written to. This value is expressed in UTC time. + DateTime GetLastWriteTimeUtc(string path); + + /// Gets the date and time that the specified file was last accessed. + /// The file for which to obtain access date and time information. + /// A structure set to the date and time that the specified file was last accessed. This value is expressed in local time. + DateTime GetLastAccessTime(string path); + + /// Gets the date and time, in coordinated universal time (UTC), that the specified file was last accessed. + /// The file for which to obtain access date and time information. + /// A structure set to the date and time that the specified file was last accessed. This value is expressed in UTC time. + DateTime GetLastAccessTimeUtc(string path); } } \ No newline at end of file