mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 03:57:32 +00:00
Extension method for getting the creation time of an assembly
This commit is contained in:
parent
546cabf0b4
commit
772a87bab6
2 changed files with 21 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue