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 distexAboutBox : Form
12 public distexAboutBox()
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;
26 // URL http://sourceforge.net/projects/distexplorer
29 #region Assembly Attribute Accessors
31 public string AssemblyTitle
35 // Get all Title attributes on this assembly
36 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
37 // If there is at least one Title attribute
38 if (attributes.Length > 0)
40 // Select the first one
41 AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
42 // If it is not an empty string, return it
43 if (titleAttribute.Title != "")
44 return titleAttribute.Title;
46 // If there was no Title attribute, or if the Title attribute was the empty string, return the .exe name
47 return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
51 public string AssemblyVersion
55 return Assembly.GetExecutingAssembly().GetName().Version.ToString();
59 public string AssemblyDescription
63 // Get all Description attributes on this assembly
64 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
65 // If there aren't any Description attributes, return an empty string
66 if (attributes.Length == 0)
68 // If there is a Description attribute, return its value
69 return ((AssemblyDescriptionAttribute)attributes[0]).Description;
73 public string AssemblyProduct
77 // Get all Product attributes on this assembly
78 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
79 // If there aren't any Product attributes, return an empty string
80 if (attributes.Length == 0)
82 // If there is a Product attribute, return its value
83 return ((AssemblyProductAttribute)attributes[0]).Product;
87 public string AssemblyCopyright
91 // Get all Copyright attributes on this assembly
92 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
93 // If there aren't any Copyright attributes, return an empty string
94 if (attributes.Length == 0)
96 // If there is a Copyright attribute, return its value
97 return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
101 public string AssemblyCompany
105 // Get all Company attributes on this assembly
106 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
107 // If there aren't any Company attributes, return an empty string
108 if (attributes.Length == 0)
110 // If there is a Company attribute, return its value
111 return ((AssemblyCompanyAttribute)attributes[0]).Company;