using System.IO;
using System.Reflection;
/// <summary>
/// freeware helper class for getting .NET assembly info
/// (W) 2011 by admin of codezentrale.6x.to
/// </summary>
public static class AssemblyInfo
{
/// <summary>
/// get assembly title
/// </summary>
public static string AssemblyTitle
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
if (attributes.Length > 0)
{
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
if (titleAttribute.Title != string.Empty) return titleAttribute.Title;
}
return Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
}
}
/// <summary>
/// get assembly version
/// </summary>
public static string AssemblyVersion
{
get
{
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
}
/// <summary>
/// get assembly description
/// </summary>
public static string AssemblyDescription
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
if (attributes.Length == 0) return string.Empty;
return ((AssemblyDescriptionAttribute)attributes[0]).Description;
}
}
/// <summary>
/// get assembly product
/// </summary>
public static string AssemblyProduct
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
if (attributes.Length == 0) return string.Empty;
return ((AssemblyProductAttribute)attributes[0]).Product;
}
}
/// <summary>
/// get assembly copyright
/// </summary>
public static string AssemblyCopyright
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
if (attributes.Length == 0) return string.Empty;
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
}
}
/// <summary>
/// get assembly company
/// </summary>
public static string AssemblyCompany
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
if (attributes.Length == 0) return string.Empty;
return ((AssemblyCompanyAttribute)attributes[0]).Company;
}
}
}