2 using System.Collections.Generic;
3 using System.ComponentModel;
5 using System.Windows.Forms;
6 using System.Reflection;
8 namespace distribution_explorer
10 partial class AboutDistributionExplorer : Form
12 public AboutDistributionExplorer()
14 InitializeComponent();
16 // Initialize the AboutBox to display the product information from the assembly information.
17 // Change assembly information settings for your application through either:
18 // - Project->Properties->Application->Assembly Information
20 this.Text = String.Format("About {0}", AssemblyTitle);
21 this.labelProductName.Text = AssemblyProduct;
22 this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
23 this.labelCopyright.Text = AssemblyCopyright;
24 this.labelCompanyName.Text = AssemblyCompany;
25 this.textBoxDescription.Text = AssemblyDescription;
28 #region Assembly Attribute Accessors
30 public string AssemblyTitle
34 // Get all Title attributes on this assembly
35 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
36 // If there is at least one Title attribute
37 if (attributes.Length > 0)
39 // Select the first one
40 AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
41 // If it is not an empty string, return it
42 if (titleAttribute.Title != "")
43 return titleAttribute.Title;
45 // If there was no Title attribute, or if the Title attribute was the empty string, return the .exe name
46 return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
50 public string AssemblyVersion
54 return Assembly.GetExecutingAssembly().GetName().Version.ToString();
58 public string AssemblyDescription
62 // Get all Description attributes on this assembly
63 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
64 // If there aren't any Description attributes, return an empty string
65 if (attributes.Length == 0)
67 // If there is a Description attribute, return its value
68 return ((AssemblyDescriptionAttribute)attributes[0]).Description;
72 public string AssemblyProduct
76 // Get all Product attributes on this assembly
77 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
78 // If there aren't any Product attributes, return an empty string
79 if (attributes.Length == 0)
81 // If there is a Product attribute, return its value
82 return ((AssemblyProductAttribute)attributes[0]).Product;
86 public string AssemblyCopyright
90 // Get all Copyright attributes on this assembly
91 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
92 // If there aren't any Copyright attributes, return an empty string
93 if (attributes.Length == 0)
95 // If there is a Copyright attribute, return its value
96 return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
100 public string AssemblyCompany
104 // Get all Company attributes on this assembly
105 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
106 // If there aren't any Company attributes, return an empty string
107 if (attributes.Length == 0)
109 // If there is a Company attribute, return its value
110 return ((AssemblyCompanyAttribute)attributes[0]).Company;