mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-10 10:15:04 +00:00
Extension method for getting the creation time of an assembly
This commit is contained in:
@@ -20,7 +20,7 @@ namespace ICD.Common.Utils.Extensions
|
||||
public static string GetPath(this Assembly extends)
|
||||
{
|
||||
if (extends == null)
|
||||
throw new ArgumentNullException();
|
||||
throw new ArgumentNullException("extends");
|
||||
|
||||
string path = extends
|
||||
#if SIMPLSHARP
|
||||
@@ -43,5 +43,19 @@ namespace ICD.Common.Utils.Extensions
|
||||
|
||||
return IcdFile.Exists(path) ? path : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the creation date of the given assembly.
|
||||
/// </summary>
|
||||
/// <param name="extends"></param>
|
||||
/// <returns></returns>
|
||||
public static DateTime GetCreationTime(this Assembly extends)
|
||||
{
|
||||
if (extends == null)
|
||||
throw new ArgumentNullException("extends");
|
||||
|
||||
string path = extends.GetPath();
|
||||
return path == null ? DateTime.MinValue : IcdFile.GetCreationTime(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,5 +77,11 @@ namespace ICD.Common.Utils.IO
|
||||
{
|
||||
return new IcdFileStream(File.Open(path, mode));
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public static DateTime GetCreationTime(string path)
|
||||
{
|
||||
return File.GetCreationTime(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user