2 using System.Collections.Generic;
3 using System.ComponentModel;
7 using System.Windows.Forms;
8 using System.Reflection;
10 namespace distribution_explorer
11 { /// namespace distribution_explorer
12 public partial class distexSplash : Form
16 InitializeComponent();
17 this.labelApplicationTitle.Text = AssemblyTitle;
18 this.labelApplicationDescription.Text = AssemblyDescription;
19 this.labelApplicationCopyright.Text = AssemblyCopyright;
20 this.labelApplicationVersion.Text = "Version " + AssemblyVersion;
23 #region Assembly Attribute Accessors
25 public string AssemblyTitle
29 // Get all Title attributes on this assembly
30 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
31 // If there is at least one Title attribute
32 if (attributes.Length > 0)
34 // Select the first one
35 AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
36 // If it is not an empty string, return it
37 if (titleAttribute.Title != "")
38 return titleAttribute.Title;
40 // If there was no Title attribute, or if the Title attribute was the empty string, return the .exe name
41 return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
44 /// get AssemblyVersion
45 public string AssemblyVersion
49 return Assembly.GetExecutingAssembly().GetName().Version.ToString();
53 //public string AssemblyGuid
54 //{ // error CS0117: 'System.Reflection.AssemblyName' does not contain a definition for 'Guid'
57 // return Assembly.GetExecutingAssembly().GetName().Guid.ToString();
60 /// get AssemblyDescription
61 public string AssemblyDescription
65 // Get all Description attributes on this assembly
66 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
67 // If there aren't any Description attributes, return an empty string
68 if (attributes.Length == 0)
70 // If there is a Description attribute, return its value
71 return ((AssemblyDescriptionAttribute)attributes[0]).Description;
74 /// get AssemblyProduct
75 public string AssemblyProduct
79 // Get all Product attributes on this assembly
80 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
81 // If there aren't any Product attributes, return an empty string
82 if (attributes.Length == 0)
84 // If there is a Product attribute, return its value
85 return ((AssemblyProductAttribute)attributes[0]).Product;
88 /// get AssemblyCopyright
89 public string AssemblyCopyright
93 // Get all Copyright attributes on this assembly
94 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
95 // If there aren't any Copyright attributes, return an empty string
96 if (attributes.Length == 0)
98 // If there is a Copyright attribute, return its value
99 return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
102 /// get AssemblyCompany
103 public string AssemblyCompany
107 // Get all Company attributes on this assembly
108 object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
109 // If there aren't any Company attributes, return an empty string
110 if (attributes.Length == 0)
112 // If there is a Company attribute, return its value
113 return ((AssemblyCompanyAttribute)attributes[0]).Company;
118 private void labelApplicationVersion_Click(object sender, EventArgs e)