/[RomCheater]/trunk/RomCheater.Core/ProcessorAssemblyArchitecture.cs
ViewVC logotype

Diff of /trunk/RomCheater.Core/ProcessorAssemblyArchitecture.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 117 by william, Thu May 10 18:12:06 2012 UTC revision 118 by william, Thu May 10 18:25:36 2012 UTC
# Line 10  namespace System.Reflection Line 10  namespace System.Reflection
10      [AttributeUsage(AttributeTargets.Assembly)]      [AttributeUsage(AttributeTargets.Assembly)]
11      public class ProcessorAssemblyArchitecture : Attribute      public class ProcessorAssemblyArchitecture : Attribute
12      {      {
13          public ProcessorAssemblyArchitecture() { ProcessorArchitecture = Undefined; }          public ProcessorAssemblyArchitecture() { Architecture = Undefined; }
14          public ProcessorAssemblyArchitecture(string arch)          public ProcessorAssemblyArchitecture(string arch)
15          {          {
16              Type t = typeof(ProcessorAssemblyArchitecture);              Type t = typeof(ProcessorAssemblyArchitecture);
# Line 26  namespace System.Reflection Line 26  namespace System.Reflection
26                      break;                      break;
27                  }                  }
28              }              }
29              if (!found) { ProcessorArchitecture = Undefined; }              if (!found) { Architecture = Undefined; }
30              else { ProcessorArchitecture = arch; }              else { Architecture = arch; }
31          }            }
32          string _ProcessorArchitecture;          string _Architecture;
33          public string ProcessorArchitecture { get { return _ProcessorArchitecture; } private set { _ProcessorArchitecture = value; } }          public string Architecture { get { return _Architecture; } private set { _Architecture = value; } }
34          #region processor architecture          #region processor architecture
35          public const string Undefined = "Undefined";          public const string Undefined = "Undefined";
36          public const string x86 = "x86";          public const string x86 = "x86";
# Line 38  namespace System.Reflection Line 38  namespace System.Reflection
38          public const string Amd64 = "Amd64";          public const string Amd64 = "Amd64";
39          public const string Ia64 = "Ia64";          public const string Ia64 = "Ia64";
40          public const string AnyCpu = "AnyCpu";          public const string AnyCpu = "AnyCpu";
41            public const string Msil = "Msil";
42          #endregion          #endregion
43    
44            public static string GetProcessorArchitecture(Assembly t)
45            {          
46                string assembly_arch = Undefined;
47    
48                // get architecture
49                ProcessorArchitecture o = t.GetName().ProcessorArchitecture;
50                if (o == ProcessorArchitecture.None)
51                    assembly_arch = Undefined;
52    
53                switch (o)
54                {                
55                    case ProcessorArchitecture.Amd64: assembly_arch = Amd64; break;
56                    case ProcessorArchitecture.IA64: assembly_arch = Ia64; break;
57                    case ProcessorArchitecture.MSIL: assembly_arch = AnyCpu; break;
58                    case ProcessorArchitecture.X86: assembly_arch = x86; break;
59                    case ProcessorArchitecture.None:  break;
60                    default: assembly_arch = Undefined; break;
61                }          
62                              
63                return assembly_arch;
64            }
65    
66      }      }
67  }  }
68    

Legend:
Removed from v.117  
changed lines
  Added in v.118

  ViewVC Help
Powered by ViewVC 1.1.22