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