init
This commit is contained in:
		
							
								
								
									
										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;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user