source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/BMX41000/IHS BMX Framework/IndianHealthService.BMXNet/Util/EntryAssemblyInfo.cs@ 1240

Last change on this file since 1240 was 1146, checked in by Sam Habiel, 14 years ago

Initial Import of BMX4

File size: 5.5 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Reflection;
5
6namespace IndianHealthService.BMXNet.Util
7{
8 /// <summary>
9 /// Convienence class to provide information from the AssembleInfo
10 /// <code>
11 /// [assembly: AssemblyTitle("IndianHealthService.BMXNet.Test")]
12 /// [assembly: AssemblyDescription("A test application")]
13 /// [assembly: AssemblyCompany("IHS")]
14 /// [assembly: AssemblyProduct("IndianHealthService.BMXNet.Test")]
15 /// [assembly: AssemblyCopyright("IHS 2009")]
16 /// [assembly: AssemblyVersion("2.0.0.0")]
17 /// </code>
18 /// </summary>
19 public static class EntryAssemblyInfo
20 {
21 /// <summary>
22 /// Convienence method to provide information from the AssembleInfo
23 /// <code>
24 /// [assembly: AssemblyTitle("IndianHealthService.BMXNet.Test")]
25 /// </code>
26 /// </summary>
27 public static string AssemblyTitle
28 {
29 get
30 {
31 // Get all Title attributes on this assembly
32 object[] attributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
33 // If there is at least one Title attribute
34 if (attributes.Length > 0)
35 {
36 // Select the first one
37 AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
38 // If it is not an empty string, return it
39 if (titleAttribute.Title != "")
40 return titleAttribute.Title;
41 }
42 // If there was no Title attribute, or if the Title attribute was the empty string, return the .exe name
43 return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
44 }
45 }
46
47 /// <summary>
48 /// Convienence method to provide information from the AssembleInfo
49 /// <code>
50 /// [assembly: AssemblyVersion("2.0.0.0")]
51 /// </code>
52 /// </summary>
53 public static string AssemblyVersion
54 {
55 get
56 {
57 return Assembly.GetEntryAssembly().GetName().Version.ToString();
58 }
59 }
60
61 /// <summary>
62 /// Convienence method to provide information from the AssembleInfo
63 /// <code>
64 /// [assembly: AssemblyDescription("A test application")]
65 /// </code>
66 /// </summary>
67 public static string AssemblyDescription
68 {
69 get
70 {
71 // Get all Description attributes on this assembly
72 object[] attributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
73 // If there aren't any Description attributes, return an empty string
74 if (attributes.Length == 0)
75 return "";
76 // If there is a Description attribute, return its value
77 return ((AssemblyDescriptionAttribute)attributes[0]).Description;
78 }
79 }
80
81 /// <summary>
82 /// Convienence method to provide information from the AssembleInfo
83 /// <code>
84 /// [assembly: AssemblyProduct("IndianHealthService.BMXNet.Test")]
85 /// </code>
86 /// </summary>
87 public static string AssemblyProduct
88 {
89 get
90 {
91 // Get all Product attributes on this assembly
92 object[] attributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
93 // If there aren't any Product attributes, return an empty string
94 if (attributes.Length == 0)
95 return "";
96 // If there is a Product attribute, return its value
97 return ((AssemblyProductAttribute)attributes[0]).Product;
98 }
99 }
100
101 /// <summary>
102 /// Convienence method to provide information from the AssembleInfo
103 /// <code>
104 /// [assembly: AssemblyCopyright("IHS 2009")]
105 /// </code>
106 /// </summary>
107 public static string AssemblyCopyright
108 {
109 get
110 {
111 // Get all Copyright attributes on this assembly
112 object[] attributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
113 // If there aren't any Copyright attributes, return an empty string
114 if (attributes.Length == 0)
115 return "";
116 // If there is a Copyright attribute, return its value
117 return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
118 }
119 }
120
121 /// <summary>
122 /// Convienence method to provide information from the AssembleInfo
123 /// <code>
124 /// [assembly: AssemblyCompany("IHS")]
125 /// </code>
126 /// </summary>
127 public static string AssemblyCompany
128 {
129 get
130 {
131 // Get all Company attributes on this assembly
132 object[] attributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
133 // If there aren't any Company attributes, return an empty string
134 if (attributes.Length == 0)
135 return "";
136 // If there is a Company attribute, return its value
137 return ((AssemblyCompanyAttribute)attributes[0]).Company;
138 }
139 }
140
141 }
142}
Note: See TracBrowser for help on using the repository browser.