Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions FileSystem/FileIOLinux.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions FileSystem/FileIOWin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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
Expand Down
31 changes: 31 additions & 0 deletions FileSystem/IFileIO.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace Skyline.DataMiner.CICD.FileSystem
{
using System;
using System.Text;

/// <summary>Provides static methods for the creation, copying, deletion, moving, and opening of a single file, and aids in the creation of <see cref="System.IO.FileStream" /> objects.</summary>
Expand Down Expand Up @@ -279,5 +280,35 @@ public interface IFileIO
/// <param name="path">The path to the file.</param>
/// <returns>The <see cref="T:System.IO.FileAttributes" /> of the file on the path.</returns>
System.IO.FileAttributes GetAttributes(string path);

/// <summary>Gets the creation date and time of the specified file.</summary>
/// <returns>A <see cref="T:System.DateTime" /> structure set to the creation date and time for the specified file. This value is expressed in local time.</returns>
/// <param name="path">The file for which to obtain creation date and time information.</param>
DateTime GetCreationTime(string path);

/// <summary>Gets the creation date and time, in Coordinated Universal Time (UTC) format, of the specified file.</summary>
/// <returns>A <see cref="T:System.DateTime" /> structure set to the creation date and time for the specified file. This value is expressed in UTC time.</returns>
/// <param name="path">The file for which to obtain creation date and time information, in Coordinated Universal Time (UTC) format.</param>
DateTime GetCreationTimeUtc(string path);

/// <summary>Gets the date and time that the specified file was last written to.</summary>
/// <param name="path">The file for which to obtain write date and time information.</param>
/// <returns>A <see cref="T:System.DateTime" /> structure set to the date and time that the specified file was last written to. This value is expressed in local time.</returns>
DateTime GetLastWriteTime(string path);

/// <summary>Gets the date and time, in coordinated universal time (UTC) time, that the specified file was last written to.</summary>
/// <param name="path">The file for which to obtain write date and time information.</param>
/// <returns>A <see cref="T:System.DateTime" /> structure set to the date and time that the specified file was last written to. This value is expressed in UTC time.</returns>
DateTime GetLastWriteTimeUtc(string path);

/// <summary>Gets the date and time that the specified file was last accessed.</summary>
/// <param name="path">The file for which to obtain access date and time information.</param>
/// <returns>A <see cref="T:System.DateTime" /> structure set to the date and time that the specified file was last accessed. This value is expressed in local time.</returns>
DateTime GetLastAccessTime(string path);

/// <summary>Gets the date and time, in coordinated universal time (UTC), that the specified file was last accessed.</summary>
/// <param name="path">The file for which to obtain access date and time information.</param>
/// <returns>A <see cref="T:System.DateTime" /> structure set to the date and time that the specified file was last accessed. This value is expressed in UTC time.</returns>
DateTime GetLastAccessTimeUtc(string path);
}
}
Loading