namespace BKTech.Utilities
{
using System;
using System.Reflection;
///<summary>Helper class for AssemblyInfo classes.</summary>
///<remarks>This class has been adapted from a class originally from the Microsoft XML comment maker.</remarks>
public class AssemblyInfoHelper
{
//Used by Helper Functions to access information from Assembly Attributes
private Type _type;
///<summary>Creates a new assmebly information helper</summary>
///<param name=applicationType>The type of the application this assembly info helper class is built into.</param>
///<remarks>In most cases the paramater will be filled in using the GetType(Object as Type) function where Object is the assembly
/// this helper class will be helping.</remarks>
public AssemblyInfoHelper(Type applicationType)
{
_type = applicationType;
}
///<summary>Gets the name of the assembly.</summary>
public string AsmName
{
get { return _type.Assembly.GetName().Name.ToString(); }
}
///<summary>Gets the full name of the assembly.</summary>
public string AsmFQName
{
get { return _type.Assembly.GetName().FullName.ToString(); }
}
///<summary>Gets the code base of the assembly.</summary>
public string CodeBase
{
get { return _type.Assembly.CodeBase; }
}
///<summary>Gets the copyright string of the assembly.</summary>
public string Copyright
{
get
{
Type at = typeof(AssemblyCopyrightAttribute);
Object[] r = _type.Assembly.GetCustomAttributes(at, false);
AssemblyCopyrightAttribute ct = (AssemblyCopyrightAttribute)r[0];
return ct.Copyright;
}
}
/// <summary>Gets the company to whom this assembly belongs.</summary>
public string Company
{
get
{
Type at = typeof(AssemblyCompanyAttribute);
Object[] r = _type.Assembly.GetCustomAttributes(at, false);
AssemblyCompanyAttribute ct = (AssemblyCompanyAttribute)r[0];
return ct.Company;
}
}
///<summary>Gets a breif description of this assembly.</summary>
public string Description
{
get
{
Type at = typeof(AssemblyDescriptionAttribute);
Object[] r = _type.Assembly.GetCustomAttributes(at, false);
AssemblyDescriptionAttribute da = (AssemblyDescriptionAttribute)r[0];
return da.Description;
}
}
///<summary>Gets the product of which this assembly is a part.</summary>
public string Product
{
get
{
Type at = typeof(AssemblyProductAttribute);
Object[] r = _type.Assembly.GetCustomAttributes(at, false);
AssemblyProductAttribute pt = (AssemblyProductAttribute)r[0];
return pt.Product;
}
}
///<summary>Gets the official title of this assembly.</summary>
public string Title
{
get
{
Type at = typeof(AssemblyTitleAttribute);
Object[] r = _type.Assembly.GetCustomAttributes(at, false);
AssemblyTitleAttribute ta = (AssemblyTitleAttribute)r[0];
return ta.Title;
}
}
///<summary>Gets the version number of this assembly.</summary>
public string Version
{
get
{
return _type.Assembly.GetName().Version.ToString();
}
}
/// <summary>Gets the trademark information of this assembly.</summary>
public string Trademark
{
get
{
Type at = typeof(AssemblyTrademarkAttribute);
Object[] r = _type.Assembly.GetCustomAttributes(at, false);
AssemblyTrademarkAttribute ta = (AssemblyTrademarkAttribute)r[0];
return ta.Trademark;
}
}
} //end class
} //end namespace