This commit is contained in:
skidoodle 2024-03-13 00:33:46 +01:00
commit e124a47765
19374 changed files with 9806149 additions and 0 deletions

View 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;
}
}
}