• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Drawing;
5 using System.Windows.Forms;
6 using System.Reflection;
7 
8 namespace distribution_explorer
9 {
10     partial class distexAboutBox : Form
11     {
distexAboutBox()12         public distexAboutBox()
13         {
14             InitializeComponent();
15 
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
19             //  - AssemblyInfo.cs
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
27         }
28 
29        #region Assembly Attribute Accessors
30 
31         public string AssemblyTitle
32         {
33             get
34             {
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)
39                 {
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;
45                 }
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);
48             }
49         }
50 
51         public string AssemblyVersion
52         {
53             get
54             {
55                 return Assembly.GetExecutingAssembly().GetName().Version.ToString();
56             }
57         }
58 
59         public string AssemblyDescription
60         {
61             get
62             {
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)
67                     return "";
68                 // If there is a Description attribute, return its value
69                 return ((AssemblyDescriptionAttribute)attributes[0]).Description;
70             }
71         }
72 
73         public string AssemblyProduct
74         {
75             get
76             {
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)
81                     return "";
82                 // If there is a Product attribute, return its value
83                 return ((AssemblyProductAttribute)attributes[0]).Product;
84             }
85         }
86 
87         public string AssemblyCopyright
88         {
89             get
90             {
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)
95                     return "";
96                 // If there is a Copyright attribute, return its value
97                 return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
98             }
99         }
100 
101         public string AssemblyCompany
102         {
103             get
104             {
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)
109                     return "";
110                 // If there is a Company attribute, return its value
111                 return ((AssemblyCompanyAttribute)attributes[0]).Company;
112             }
113         }
114         #endregion
115     }
116 }
117