lantool

ein feines Tool für LANs (damals)
git clone https://git.clttr.info/lantool.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

AboutBox.cs (3296B)


      1 using System;
      2 using System.Reflection;
      3 using System.Windows.Forms;
      4 
      5 namespace LanTool
      6 {
      7     partial class AboutBox : Form
      8     {
      9         public AboutBox()
     10         {
     11             InitializeComponent();
     12             this.Text = String.Format("Info über {0}", AssemblyTitle);
     13             this.labelProductName.Text = AssemblyProduct;
     14             this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
     15             this.labelCopyright.Text = AssemblyCopyright;
     16             this.labelCompanyName.Text = AssemblyCompany;
     17             this.textBoxDescription.Text = AssemblyDescription;
     18         }
     19 
     20         #region Assemblyattributaccessoren
     21 
     22         public static string AssemblyTitle
     23         {
     24             get
     25             {
     26                 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
     27                 if (attributes.Length > 0)
     28                 {
     29                     AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
     30                     if (!String.IsNullOrEmpty(titleAttribute.Title))
     31                     {
     32                         return titleAttribute.Title;
     33                     }
     34                 }
     35                 return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
     36             }
     37         }
     38 
     39         public static string AssemblyVersion
     40         {
     41             get
     42             {
     43                 return Assembly.GetExecutingAssembly().GetName().Version.ToString();
     44             }
     45         }
     46 
     47         public static string AssemblyDescription
     48         {
     49             get
     50             {
     51                 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
     52                 if (attributes.Length == 0)
     53                 {
     54                     return "";
     55                 }
     56                 return ((AssemblyDescriptionAttribute)attributes[0]).Description;
     57             }
     58         }
     59 
     60         public static string AssemblyProduct
     61         {
     62             get
     63             {
     64                 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
     65                 if (attributes.Length == 0)
     66                 {
     67                     return "";
     68                 }
     69                 return ((AssemblyProductAttribute)attributes[0]).Product;
     70             }
     71         }
     72 
     73         public static string AssemblyCopyright
     74         {
     75             get
     76             {
     77                 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
     78                 if (attributes.Length == 0)
     79                 {
     80                     return "";
     81                 }
     82                 return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
     83             }
     84         }
     85 
     86         public static string AssemblyCompany
     87         {
     88             get
     89             {
     90                 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
     91                 if (attributes.Length == 0)
     92                 {
     93                     return "";
     94                 }
     95                 return ((AssemblyCompanyAttribute)attributes[0]).Company;
     96             }
     97         }
     98         #endregion
     99 
    100     }
    101 }