1 |
using System; |
2 |
using System.Collections.Generic; |
3 |
using System.Linq; |
4 |
using System.Text; |
5 |
|
6 |
namespace System.Reflection |
7 |
{ |
8 |
|
9 |
|
10 |
[AttributeUsage(AttributeTargets.Assembly)] |
11 |
public class ProcessorAssemblyArchitecture : Attribute |
12 |
{ |
13 |
public ProcessorAssemblyArchitecture() { ProcessorArchitecture = Undefined; } |
14 |
public ProcessorAssemblyArchitecture(string arch) |
15 |
{ |
16 |
Type t = typeof(ProcessorAssemblyArchitecture); |
17 |
FieldInfo[] fields = t.GetFields(BindingFlags.Public | BindingFlags.Static); |
18 |
|
19 |
bool found = false; |
20 |
foreach (FieldInfo field in fields) |
21 |
{ |
22 |
string o = field.GetValue(null).ToString(); |
23 |
if (arch == o) |
24 |
{ |
25 |
found = true; |
26 |
break; |
27 |
} |
28 |
} |
29 |
if (!found) { ProcessorArchitecture = Undefined; } |
30 |
else { ProcessorArchitecture = arch; } |
31 |
} |
32 |
string _ProcessorArchitecture; |
33 |
public string ProcessorArchitecture { get { return _ProcessorArchitecture; } private set { _ProcessorArchitecture = value; } } |
34 |
#region processor architecture |
35 |
public const string Undefined = "Undefined"; |
36 |
public const string x86 = "x86"; |
37 |
public const string x64 = "x64"; |
38 |
public const string Amd64 = "Amd64"; |
39 |
public const string Ia64 = "Ia64"; |
40 |
public const string AnyCpu = "AnyCpu"; |
41 |
#endregion |
42 |
} |
43 |
} |
44 |
|