master
 1using System.IO;
 2using System.Reflection;
 3using System.Windows.Forms;
 4
 5namespace Notepad.Presentation.Views.Menu.Help {
 6    public partial class AboutApplicationView : Form, IAboutApplicationView {
 7        public AboutApplicationView() {
 8            InitializeComponent();
 9            labelProductName.Text = AssemblyProduct;
10            labelVersion.Text = string.Format("Version {0} {0}", AssemblyVersion);
11            uxCopyright.Text = AssemblyCopyright;
12            uxCompanyName.Text = AssemblyCompany;
13            uxDescription.Text = AssemblyDescription;
14        }
15
16        public void Display() {
17            ShowDialog();
18        }
19
20        public string AssemblyTitle
21        {
22            get
23            {
24                object[] attributes =
25                    Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
26                if (attributes.Length > 0)
27                {
28                    AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
29                    if (titleAttribute.Title != "")
30                    {
31                        return titleAttribute.Title;
32                    }
33                }
34                return Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
35            }
36        }
37
38        public string AssemblyVersion
39        {
40            get { return Assembly.GetExecutingAssembly().GetName().Version.ToString(); }
41        }
42
43        public string AssemblyDescription
44        {
45            get
46            {
47                object[] attributes =
48                    Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
49                if (attributes.Length == 0)
50                {
51                    return "";
52                }
53                return ((AssemblyDescriptionAttribute)attributes[0]).Description;
54            }
55        }
56
57        public string AssemblyProduct
58        {
59            get
60            {
61                object[] attributes =
62                    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 =
76                    Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
77                if (attributes.Length == 0)
78                {
79                    return "";
80                }
81                return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
82            }
83        }
84
85        public string AssemblyCompany
86        {
87            get
88            {
89                object[] attributes =
90                    Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
91                if (attributes.Length == 0)
92                {
93                    return "";
94                }
95                return ((AssemblyCompanyAttribute)attributes[0]).Company;
96            }
97        }
98    }
99}