~charlie.poole/nunitv2/equality-handlers

« back to all changes in this revision

Viewing changes to src/ProjectEditor/editor/AboutBox.cs

  • Committer: Charlie Poole
  • Date: 2011-03-29 21:54:46 UTC
  • mfrom: (3257.4.15 standalone-editor)
  • Revision ID: charlie@nunit.org-20110329215446-pu1r6okg4www4zat
Remove integrated project editor and substitute new standalone editor

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ****************************************************************
 
2
// Copyright 2011, Charlie Poole
 
3
// This is free software licensed under the NUnit license. You may
 
4
// obtain a copy of the license at http://nunit.org
 
5
// ****************************************************************
 
6
 
 
7
using System;
 
8
using System.Collections.Generic;
 
9
using System.ComponentModel;
 
10
using System.Drawing;
 
11
using System.Reflection;
 
12
using System.Windows.Forms;
 
13
 
 
14
namespace NUnit.ProjectEditor
 
15
{
 
16
    partial class AboutBox : Form
 
17
    {
 
18
        public AboutBox()
 
19
        {
 
20
            InitializeComponent();
 
21
            this.Text = String.Format("About {0} {0}", AssemblyTitle);
 
22
            this.labelProductName.Text = AssemblyProduct;
 
23
            this.labelVersion.Text = String.Format("Version {0} {0}", AssemblyVersion);
 
24
            this.labelCopyright.Text = AssemblyCopyright;
 
25
            this.labelCompanyName.Text = AssemblyCompany;
 
26
            this.textBoxDescription.Text = AssemblyDescription;
 
27
        }
 
28
 
 
29
        #region Assembly Attribute Accessors
 
30
 
 
31
        public string AssemblyTitle
 
32
        {
 
33
            get
 
34
            {
 
35
                object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
 
36
                if (attributes.Length > 0)
 
37
                {
 
38
                    AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
 
39
                    if (titleAttribute.Title != "")
 
40
                    {
 
41
                        return titleAttribute.Title;
 
42
                    }
 
43
                }
 
44
                return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
 
45
            }
 
46
        }
 
47
 
 
48
        public string AssemblyVersion
 
49
        {
 
50
            get
 
51
            {
 
52
                return Assembly.GetExecutingAssembly().GetName().Version.ToString();
 
53
            }
 
54
        }
 
55
 
 
56
        public string AssemblyDescription
 
57
        {
 
58
            get
 
59
            {
 
60
                object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
 
61
                if (attributes.Length == 0)
 
62
                {
 
63
                    return "";
 
64
                }
 
65
                return ((AssemblyDescriptionAttribute)attributes[0]).Description;
 
66
            }
 
67
        }
 
68
 
 
69
        public string AssemblyProduct
 
70
        {
 
71
            get
 
72
            {
 
73
                object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
 
74
                if (attributes.Length == 0)
 
75
                {
 
76
                    return "";
 
77
                }
 
78
                return ((AssemblyProductAttribute)attributes[0]).Product;
 
79
            }
 
80
        }
 
81
 
 
82
        public string AssemblyCopyright
 
83
        {
 
84
            get
 
85
            {
 
86
                object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
 
87
                if (attributes.Length == 0)
 
88
                {
 
89
                    return "";
 
90
                }
 
91
                return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
 
92
            }
 
93
        }
 
94
 
 
95
        public string AssemblyCompany
 
96
        {
 
97
            get
 
98
            {
 
99
                object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
 
100
                if (attributes.Length == 0)
 
101
                {
 
102
                    return "";
 
103
                }
 
104
                return ((AssemblyCompanyAttribute)attributes[0]).Company;
 
105
            }
 
106
        }
 
107
        #endregion
 
108
    }
 
109
}