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