Exemplo n.º 1
0
        public TargetPlatformInfo GetTargetPlatformInfoFromManagedBinary(string filePath)
        {
            AssemblyName       assemblyName       = System.Reflection.AssemblyName.GetAssemblyName(filePath);
            TargetPlatformInfo targetPlatformInfo = new TargetPlatformInfo();

            targetPlatformInfo.FilePath       = filePath;
            targetPlatformInfo.BinaryPlatform = "Managed Binary";
            switch (assemblyName.ProcessorArchitecture)
            {
            case ProcessorArchitecture.Amd64:
            case ProcessorArchitecture.IA64:
                targetPlatformInfo.ProcessorArchitecture = "x64";
                break;

            case ProcessorArchitecture.X86:
                targetPlatformInfo.ProcessorArchitecture = "x86";
                break;

            case ProcessorArchitecture.MSIL:
                targetPlatformInfo.ProcessorArchitecture = "anycpu";
                break;

            case ProcessorArchitecture.Arm:
                targetPlatformInfo.ProcessorArchitecture = "arm";
                break;

            default:
                targetPlatformInfo.ProcessorArchitecture = "unknown";
                break;
            }

            return(targetPlatformInfo);
        }
Exemplo n.º 2
0
        public TargetPlatformInfo GetTargetPlatformInfoFromNativeBinary(string filePath)
        {
            var is64bit = UnmanagedDllIs64Bit(filePath);
            TargetPlatformInfo targetPlatformInfo = new TargetPlatformInfo();

            targetPlatformInfo.FilePath       = filePath;
            targetPlatformInfo.BinaryPlatform = "Native Binary";
            if (is64bit == null)
            {
                targetPlatformInfo.ProcessorArchitecture = "unknown";
            }
            else
            {
                targetPlatformInfo.ProcessorArchitecture = (bool)is64bit ? "x64" : "x86";
            }

            return(targetPlatformInfo);
        }