forked from vipoo/iRacingReplayOverlay.net
-
Notifications
You must be signed in to change notification settings - Fork 5
/
AboutBox1.cs
80 lines (71 loc) · 2.02 KB
/
AboutBox1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// This file is part of iRacingReplayDirector.
//
// Copyright 2016 Dean Netherton
// https://github.com/vipoo/iRacingReplayDirector.net
using iRacingSDK.Support;
using System;
using System.Reflection;
using System.Windows.Forms;
namespace iRacingReplayDirector
{
partial class AboutBox1 : Form
{
public AboutBox1()
{
InitializeComponent();
this.Text = "About {0}".F(AssemblyTitle);
this.labelProductName.Text = AssemblyProduct;
this.labelVersion.Text = "Version {0}".F(AssemblyVersion);
this.labelCopyright.Text = AssemblyCopyright;
this.textBoxDescription.Text = AssemblyDescription;
this.trackingId.Text = Settings.Default.TrackingID;
}
public string AssemblyTitle
{
get
{
return GetCustomAttribute<AssemblyTitleAttribute>().Title;
}
}
public static Version AssemblyVersionStamp
{
get
{
var assName = Assembly.GetExecutingAssembly().GetName();
return assName.Version;
}
}
public static string AssemblyVersion
{
get
{
return AssemblyVersionStamp.ToString();
}
}
public string AssemblyDescription
{
get
{
return GetCustomAttribute<AssemblyDescriptionAttribute>().Description;
}
}
public string AssemblyProduct
{
get
{
return GetCustomAttribute<AssemblyProductAttribute>().Product;
}
}
public string AssemblyCopyright
{
get
{
return GetCustomAttribute<AssemblyCopyrightAttribute>().Copyright;
}
}
private static T GetCustomAttribute<T>()
{
return (T)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(T), false)[0];
}
}
}