init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
35
Kreta.BusinessLogic/VersionInfo/VersionInfoHelper.cs
Normal file
35
Kreta.BusinessLogic/VersionInfo/VersionInfoHelper.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Kreta.Core;
|
||||
|
||||
namespace Kreta.BusinessLogic.VersionInfo
|
||||
{
|
||||
public class VersionInfoHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the filtered assembly information.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Dictionary<string, string> GetFilteredAssemblyInformation()
|
||||
{
|
||||
var result = new Dictionary<string, string>();
|
||||
|
||||
Assembly targetAssembly = Assembly.GetExecutingAssembly();
|
||||
|
||||
var targetVersion = targetAssembly.GetName().Version.ToString();
|
||||
|
||||
result.Add(Constants.Version.BuildVersion, targetVersion);
|
||||
|
||||
var targetAssemblyAttributes = targetAssembly.GetCustomAttributes().OfType<AssemblyMetadataAttribute>();
|
||||
|
||||
result.Add(Constants.Version.BranchName, targetAssemblyAttributes.SingleOrDefault(x => x.Key == Constants.Version.BranchName)?.Value ?? Constants.Version.NotAvailable);
|
||||
|
||||
result.Add(Constants.Version.BuildDateTimeUtc, targetAssemblyAttributes.SingleOrDefault(x => x.Key == Constants.Version.BuildDateTimeUtc)?.Value ?? Constants.Version.NotAvailable);
|
||||
|
||||
result.Add(Constants.Version.CommitNumber, targetAssemblyAttributes.SingleOrDefault(x => x.Key == Constants.Version.CommitNumber)?.Value ?? Constants.Version.NotAvailable);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue