Exemple #1
0
        public static bool IsSupportedProcessorArchitecture(string arch)
        {
            if ((string.Compare(arch, "msil", StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(arch, "x86", StringComparison.OrdinalIgnoreCase) == 0))
            {
                return(true);
            }
            System.Deployment.Application.NativeMethods.SYSTEM_INFO sysInfo = new System.Deployment.Application.NativeMethods.SYSTEM_INFO();
            bool flag = false;

            try
            {
                System.Deployment.Application.NativeMethods.GetNativeSystemInfo(ref sysInfo);
                flag = true;
            }
            catch (EntryPointNotFoundException)
            {
                Logger.AddInternalState("In IsSupportedProcessorArchitecture: GetNativeSystemInfo API from kernel32.dll is not found.");
                flag = false;
            }
            if (!flag)
            {
                System.Deployment.Application.NativeMethods.GetSystemInfo(ref sysInfo);
                Logger.AddInternalState("In IsSupportedProcessorArchitecture: GetSystemInfo called.");
            }
            switch (sysInfo.uProcessorInfo.wProcessorArchitecture)
            {
            case 6:
                return(string.Compare(arch, "ia64", StringComparison.OrdinalIgnoreCase) == 0);

            case 9:
                return(string.Compare(arch, "amd64", StringComparison.OrdinalIgnoreCase) == 0);
            }
            return(false);
        }
        public static bool IsSupportedProcessorArchitecture(string arch)
        {
            if ((string.Compare(arch, "msil", StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(arch, "x86", StringComparison.OrdinalIgnoreCase) == 0))
            {
                return true;
            }
            System.Deployment.Application.NativeMethods.SYSTEM_INFO sysInfo = new System.Deployment.Application.NativeMethods.SYSTEM_INFO();
            bool flag = false;
            try
            {
                System.Deployment.Application.NativeMethods.GetNativeSystemInfo(ref sysInfo);
                flag = true;
            }
            catch (EntryPointNotFoundException)
            {
                Logger.AddInternalState("In IsSupportedProcessorArchitecture: GetNativeSystemInfo API from kernel32.dll is not found.");
                flag = false;
            }
            if (!flag)
            {
                System.Deployment.Application.NativeMethods.GetSystemInfo(ref sysInfo);
                Logger.AddInternalState("In IsSupportedProcessorArchitecture: GetSystemInfo called.");
            }
            switch (sysInfo.uProcessorInfo.wProcessorArchitecture)
            {
                case 6:
                    return (string.Compare(arch, "ia64", StringComparison.OrdinalIgnoreCase) == 0);

                case 9:
                    return (string.Compare(arch, "amd64", StringComparison.OrdinalIgnoreCase) == 0);
            }
            return false;
        }