/[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

--- trunk/RomCheater.Core/ProcessorAssemblyArchitecture.cs	2012/05/10 18:12:06	117
+++ trunk/RomCheater.Core/ProcessorAssemblyArchitecture.cs	2012/05/10 18:25:36	118
@@ -10,7 +10,7 @@
     [AttributeUsage(AttributeTargets.Assembly)]
     public class ProcessorAssemblyArchitecture : Attribute
     {
-        public ProcessorAssemblyArchitecture() { ProcessorArchitecture = Undefined; }
+        public ProcessorAssemblyArchitecture() { Architecture = Undefined; }
         public ProcessorAssemblyArchitecture(string arch) 
         {
             Type t = typeof(ProcessorAssemblyArchitecture);
@@ -26,11 +26,11 @@
                     break;
                 }
             }
-            if (!found) { ProcessorArchitecture = Undefined; }
-            else { ProcessorArchitecture = arch; }
-        }  
-        string _ProcessorArchitecture;
-        public string ProcessorArchitecture { get { return _ProcessorArchitecture; } private set { _ProcessorArchitecture = value; } }
+            if (!found) { Architecture = Undefined; }
+            else { Architecture = arch; }
+        }
+        string _Architecture;
+        public string Architecture { get { return _Architecture; } private set { _Architecture = value; } }
         #region processor architecture
         public const string Undefined = "Undefined";
         public const string x86 = "x86";
@@ -38,7 +38,31 @@
         public const string Amd64 = "Amd64";
         public const string Ia64 = "Ia64";
         public const string AnyCpu = "AnyCpu";
+        public const string Msil = "Msil";
         #endregion
+
+        public static string GetProcessorArchitecture(Assembly t)
+        {           
+            string assembly_arch = Undefined;
+
+            // get architecture
+            ProcessorArchitecture o = t.GetName().ProcessorArchitecture;
+            if (o == ProcessorArchitecture.None)
+                assembly_arch = Undefined;
+
+            switch (o)
+            {                
+                case ProcessorArchitecture.Amd64: assembly_arch = Amd64; break;
+                case ProcessorArchitecture.IA64: assembly_arch = Ia64; break;
+                case ProcessorArchitecture.MSIL: assembly_arch = AnyCpu; break;
+                case ProcessorArchitecture.X86: assembly_arch = x86; break;
+                case ProcessorArchitecture.None:  break;
+                default: assembly_arch = Undefined; break;
+            }           
+                           
+            return assembly_arch;
+        }
+
     }
 }
 

 

  ViewVC Help
Powered by ViewVC 1.1.22