mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 13:15:07 +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)
|
public static string GetPath(this Assembly extends)
|
||||||
{
|
{
|
||||||
if (extends == null)
|
if (extends == null)
|
||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException("extends");
|
||||||
|
|
||||||
string path = extends
|
string path = extends
|
||||||
#if SIMPLSHARP
|
#if SIMPLSHARP
|
||||||
@@ -43,5 +43,19 @@ namespace ICD.Common.Utils.Extensions
|
|||||||
|
|
||||||
return IcdFile.Exists(path) ? path : null;
|
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));
|
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