diff --git a/AssemblyInfo.cs b/AssemblyInfo.cs index dab1f05..fc0609a 100644 --- a/AssemblyInfo.cs +++ b/AssemblyInfo.cs @@ -1,87 +1,92 @@ +using System.IO; using System.Reflection; namespace MijoSoftware.AssemblyInformation { - /// - /// Provide some assembly information - /// - public static class AssemblyInfo - { - #region Assembly attribute accessors + /// + /// Provide some assembly information + /// + public static class AssemblyInfo + { + #region Assembly attribute accessors - /// - /// Return the title of the assembly - /// - 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); - } - } + /// + /// Return the title of the assembly + /// + 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); + } + } - /// - /// Return the version of the assembly - /// - public static string AssemblyVersion => Assembly.GetExecutingAssembly().GetName().Version.ToString(); + /// + /// Return the version of the assembly + /// + public static string AssemblyVersion => Assembly.GetExecutingAssembly().GetName().Version.ToString(); - /// - /// Return the description of the assembly - /// - 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; - } - } + /// + /// Return the description of the assembly + /// + 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; + } + } - /// - /// Return the product name of the assembly - /// - 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; - } - } + /// + /// Return the product name of the assembly + /// + 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; + } + } - /// - /// Return the copyright of the assembly - /// - 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; - } - } + /// + /// Return the copyright of the assembly + /// + 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; + } + } - /// - /// Return the company name of the assembly - /// - 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 - } + /// + /// Return the company name of the assembly + /// + 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 + } }