Skip to content

Commit

Permalink
Merge pull request #6 from Mijo-Software/mjohne-patch-1
Browse files Browse the repository at this point in the history
Add files via upload
  • Loading branch information
mjohne authored Oct 5, 2023
2 parents 5d82341 + 3503ed4 commit 84e9c1e
Showing 1 changed file with 81 additions and 76 deletions.
157 changes: 81 additions & 76 deletions AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,87 +1,92 @@
using System.IO;
using System.Reflection;

namespace MijoSoftware.AssemblyInformation
{
/// <summary>
/// Provide some assembly information
/// </summary>
public static class AssemblyInfo
{
#region Assembly attribute accessors
/// <summary>
/// Provide some assembly information
/// </summary>
public static class AssemblyInfo
{
#region Assembly attribute accessors

/// <summary>
/// Return the title of the assembly
/// </summary>
public static string AssemblyTitle
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(attributeType: typeof(AssemblyTitleAttribute), inherit: false);
if (attributes.Length > 0)
{
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
if (!string.IsNullOrEmpty(value: titleAttribute.Title))
{
return titleAttribute.Title;
}
}
return System.IO.Path.GetFileNameWithoutExtension(path: Assembly.GetExecutingAssembly().CodeBase);
}
}
/// <summary>
/// Return the title of the assembly
/// </summary>
public static string AssemblyTitle
{
get
{
object[] attributes = Assembly.GetExecutingAssembly()
.GetCustomAttributes(attributeType: typeof(AssemblyTitleAttribute), inherit: false);
if (attributes.Length > 0)
{
AssemblyTitleAttribute titleAttribute = attributes[0] as AssemblyTitleAttribute;
if (!string.IsNullOrEmpty(value: titleAttribute.Title))
{
return titleAttribute.Title;
}
}
return Path.GetFileNameWithoutExtension(path: Assembly.GetExecutingAssembly().CodeBase);
}
}

/// <summary>
/// Return the version of the assembly
/// </summary>
public static string AssemblyVersion => Assembly.GetExecutingAssembly().GetName().Version.ToString();
/// <summary>
/// Return the version of the assembly
/// </summary>
public static string AssemblyVersion => Assembly.GetExecutingAssembly().GetName().Version.ToString();

/// <summary>
/// Return the description of the assembly
/// </summary>
public static string AssemblyDescription
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(attributeType: typeof(AssemblyDescriptionAttribute), inherit: false);
return attributes.Length == 0 ? string.Empty : ((AssemblyDescriptionAttribute)attributes[0]).Description;
}
}
/// <summary>
/// Return the description of the assembly
/// </summary>
public static string AssemblyDescription
{
get
{
object[] attributes = Assembly.GetExecutingAssembly()
.GetCustomAttributes(attributeType: typeof(AssemblyDescriptionAttribute), inherit: false);
return attributes.Length == 0 ? string.Empty : ((AssemblyDescriptionAttribute)attributes[0]).Description;
}
}

/// <summary>
/// Return the product name of the assembly
/// </summary>
public static string AssemblyProduct
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(attributeType: typeof(AssemblyProductAttribute), inherit: false);
return attributes.Length == 0 ? string.Empty : ((AssemblyProductAttribute)attributes[0]).Product;
}
}
/// <summary>
/// Return the product name of the assembly
/// </summary>
public static string AssemblyProduct
{
get
{
object[] attributes = Assembly.GetExecutingAssembly()
.GetCustomAttributes(attributeType: typeof(AssemblyProductAttribute), inherit: false);
return attributes.Length == 0 ? string.Empty : ((AssemblyProductAttribute)attributes[0]).Product;
}
}

/// <summary>
/// Return the copyright of the assembly
/// </summary>
public static string AssemblyCopyright
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(attributeType: typeof(AssemblyCopyrightAttribute), inherit: false);
return attributes.Length == 0 ? string.Empty : ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
}
}
/// <summary>
/// Return the copyright of the assembly
/// </summary>
public static string AssemblyCopyright
{
get
{
object[] attributes = Assembly.GetExecutingAssembly()
.GetCustomAttributes(attributeType: typeof(AssemblyCopyrightAttribute), inherit: false);
return attributes.Length == 0 ? string.Empty : ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
}
}

/// <summary>
/// Return the company name of the assembly
/// </summary>
public static string AssemblyCompany
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(attributeType: typeof(AssemblyCompanyAttribute), inherit: false);
return attributes.Length == 0 ? string.Empty : ((AssemblyCompanyAttribute)attributes[0]).Company;
}
}

#endregion
}
/// <summary>
/// Return the company name of the assembly
/// </summary>
public static string AssemblyCompany
{
get
{
object[] attributes = Assembly.GetExecutingAssembly()
.GetCustomAttributes(attributeType: typeof(AssemblyCompanyAttribute), inherit: false);
return attributes.Length == 0 ? string.Empty : ((AssemblyCompanyAttribute)attributes[0]).Company;
}
}
#endregion
}
}

0 comments on commit 84e9c1e

Please sign in to comment.