-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Mijo-Software/mjohne-patch-1
Add files via upload
- Loading branch information
Showing
1 changed file
with
81 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |