using System.Collections.Generic; using System.Linq; using System.Reflection; using Kreta.Core; namespace Kreta.BusinessLogic.VersionInfo { public class VersionInfoHelper { /// /// Gets the filtered assembly information. /// /// public static Dictionary GetFilteredAssemblyInformation() { var result = new Dictionary(); Assembly targetAssembly = Assembly.GetExecutingAssembly(); var targetVersion = targetAssembly.GetName().Version.ToString(); result.Add(Constants.Version.BuildVersion, targetVersion); var targetAssemblyAttributes = targetAssembly.GetCustomAttributes().OfType(); 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; } } }