2015-07-17 16:38:17 -04:00
|
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
2015-07-22 14:00:30 -04:00
|
|
|
|
using System.Diagnostics;
|
2015-07-17 16:38:17 -04:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Tools.DotNETCommon
|
|
|
|
|
|
{
|
|
|
|
|
|
public static class AssemblyUtils
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the original location (path and filename) of an assembly.
|
|
|
|
|
|
/// This method is using Assembly.CodeBase property to properly resolve original
|
|
|
|
|
|
/// assembly path in case shadow copying is enabled.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns>Absolute path and filename to the assembly.</returns>
|
|
|
|
|
|
public static string GetOriginalLocation(this Assembly ThisAssembly)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new Uri(ThisAssembly.CodeBase).LocalPath;
|
|
|
|
|
|
}
|
2015-07-22 14:00:30 -04:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Version info of the executable which runs this code.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static FileVersionInfo ExecutableVersion
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().GetOriginalLocation());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2015-07-17 16:38:17 -04:00
|
|
|
|
}
|