本文整理汇总了C#中ProcessorArchitecture类的典型用法代码示例。如果您正苦于以下问题:C# ProcessorArchitecture类的具体用法?C# ProcessorArchitecture怎么用?C# ProcessorArchitecture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProcessorArchitecture类属于命名空间,在下文中一共展示了ProcessorArchitecture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFrameworkPath
private static string GetFrameworkPath(
string subfolder, ProcessorArchitecture architecture, string windowsFolder, bool is64BitOperatingSystem)
{
Guard.AgainstNullArgument("windowsFolder", windowsFolder);
switch (architecture)
{
case ProcessorArchitecture.None:
case ProcessorArchitecture.MSIL:
return is64BitOperatingSystem
? Path.Combine(windowsFolder, "Microsoft.NET", "Framework64", subfolder, "MSBuild.exe")
: Path.Combine(windowsFolder, "Microsoft.NET", "Framework", subfolder, "MSBuild.exe");
case ProcessorArchitecture.X86:
return Path.Combine(windowsFolder, "Microsoft.NET", "Framework", subfolder, "MSBuild.exe");
case ProcessorArchitecture.Amd64:
return Path.Combine(windowsFolder, "Microsoft.NET", "Framework64", subfolder, "MSBuild.exe");
default:
var message = string.Format(
CultureInfo.InvariantCulture,
"MSBuild processor architecture '{0}' is not supported.",
architecture.ToString());
throw new NotSupportedException(message);
}
}
示例2: InterpreterConfiguration
/// <summary>
/// <para>Constructs a new interpreter configuration based on the
/// provided values.</para>
/// <para>No validation is performed on the parameters.</para>
/// <para>If winPath is null or empty,
/// <see cref="WindowsInterpreterPath"/> will be set to path.</para>
/// <para>If libraryPath is null or empty and prefixPath is a valid
/// file system path, <see cref="LibraryPath"/> will be set to
/// prefixPath plus "Lib".</para>
/// </summary>
public InterpreterConfiguration(
string prefixPath,
string path,
string winPath,
string libraryPath,
string pathVar,
ProcessorArchitecture arch,
Version version,
InterpreterUIMode uiMode
) {
_prefixPath = prefixPath;
_interpreterPath = path;
_windowsInterpreterPath = string.IsNullOrEmpty(winPath) ? path : winPath;
_libraryPath = libraryPath;
if (string.IsNullOrEmpty(_libraryPath) && !string.IsNullOrEmpty(_prefixPath)) {
try {
_libraryPath = Path.Combine(_prefixPath, "Lib");
} catch (ArgumentException) {
}
}
_pathEnvironmentVariable = pathVar;
_architecture = arch;
_version = version;
Debug.Assert(string.IsNullOrEmpty(_interpreterPath) || !string.IsNullOrEmpty(_prefixPath),
"Anyone providing an interpreter should also specify the prefix path");
_uiMode = uiMode;
}
示例3: FormatArchitecture
private static string FormatArchitecture(ProcessorArchitecture arch) {
switch (arch) {
case ProcessorArchitecture.Amd64: return "x64";
case ProcessorArchitecture.X86: return "x86";
default: return "Unknown";
}
}
示例4: CPythonInterpreterConfiguration
public CPythonInterpreterConfiguration(string pythonPath, string pythonwPath, string pathEnvVar, ProcessorArchitecture arch, Version version) {
_pythonPath = pythonPath;
_pythonwPath = pythonwPath;
_arch = arch;
_version = version;
_pathEnvVar = pathEnvVar;
}
示例5: ClientInformation
public ClientInformation()
{
m_operatingSys = OperatingSystem.Win;
m_architecture = ProcessorArchitecture.x86;
Locale = ClientLocale.English;
TimeZone = 0x258;
IPAddress = new XmlIPAddress(System.Net.IPAddress.Loopback);
}
示例6: CJInterpreterConfiguration
public CJInterpreterConfiguration(string jPath, string jvPath, string pathEnvVar, ProcessorArchitecture arch, Version version)
{
_jPath = jPath;
_jvPath = jvPath;
_arch = arch;
_version = version;
_pathEnvVar = pathEnvVar;
}
示例7: CJInterpreterFactory
public CJInterpreterFactory(Version version, Guid id, string description, string jPath, string jvPath, string pathEnvVar, ProcessorArchitecture arch)
{
if (version == default(Version)) {
version = new Version(6, 0, 2);
}
_description = description;
_id = id;
_config = new CJInterpreterConfiguration(jPath, jvPath, pathEnvVar, arch, version);
}
示例8: DiagResult
/// <summary>
/// Initializes a new instance of the <see cref="CyrusBuilt.MonoPluginFramework.Diagnostics.DiagResult"/>
/// class with the result values.
/// </summary>
/// <param name="exists">
/// Set true if the plugin assembly exists.
/// </param>
/// <param name="valid">
/// Set true if the plugin is valid (compatible with this framework).
/// </param>
/// <param name="isAssm">
/// The inspected file is a Mono/.NET assembly.
/// </param>
/// <param name="reasonInvalid">
/// The reason the plugin is not valid.
/// </param>
/// <param name="ver">
/// The plugin version.
/// </param>
/// <param name="pa">
/// The plugin processor architecture.
/// </param>
public DiagResult(Boolean exists, Boolean valid, Boolean isAssm, String reasonInvalid,
Version ver, ProcessorArchitecture pa)
{
this._exists = exists;
this._isValid = valid;
this._isAssembly = isAssm;
this._reasonNotValid = reasonInvalid;
this._assemblyVersion = ver;
this._arch = pa;
}
示例9: Resolver
protected Resolver(string searchPathElement, GetAssemblyName getAssemblyName, Microsoft.Build.Shared.FileExists fileExists, GetAssemblyRuntimeVersion getRuntimeVersion, Version targetedRuntimeVesion, ProcessorArchitecture targetedProcessorArchitecture, bool compareProcessorArchitecture)
{
this.searchPathElement = searchPathElement;
this.getAssemblyName = getAssemblyName;
this.fileExists = fileExists;
this.getRuntimeVersion = getRuntimeVersion;
this.targetedRuntimeVersion = targetedRuntimeVesion;
this.targetProcessorArchitecture = targetedProcessorArchitecture;
this.compareProcessorArchitecture = compareProcessorArchitecture;
}
示例10: FindVC
private static VCCompiler FindVC(string version, ProcessorArchitecture arch) {
string vcDir = null, vsDir = null;
using (var baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32))
using (var key1 = baseKey.OpenSubKey("SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7"))
using (var key2 = baseKey.OpenSubKey("SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7")) {
if (key1 != null) {
vcDir = key1.GetValue(version) as string;
}
if (key2 != null) {
vsDir = key2.GetValue(version) as string;
}
}
if (string.IsNullOrEmpty(vcDir)) {
using (var baseKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry32))
using (var key = baseKey.OpenSubKey("SOFTWARE\\Microsoft\\DevDiv\\VCForPython\\" + version)) {
if (key != null) {
vcDir = key.GetValue("InstallDir") as string;
}
}
}
if (string.IsNullOrEmpty(vcDir)) {
using (var baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32))
using (var key = baseKey.OpenSubKey("SOFTWARE\\Microsoft\\DevDiv\\VCForPython\\" + version)) {
if (key != null) {
vcDir = key.GetValue("InstallDir") as string;
}
}
}
if (string.IsNullOrEmpty(vcDir)) {
return null;
}
string bin = Path.Combine(vcDir, "bin"), bins = bin;
if (arch == ProcessorArchitecture.Amd64) {
bin = Path.Combine(bin, "x86_amd64");
bins = bin + ";" + bins;
}
if (!string.IsNullOrEmpty(vsDir)) {
bins += ";" + vsDir;
}
string include = Path.Combine(vcDir, "include");
string lib = Path.Combine(vcDir, "lib");
if (arch == ProcessorArchitecture.Amd64) {
lib = Path.Combine(lib, "amd64");
}
AddWindowsSdk(version, arch, ref include, ref lib);
return new VCCompiler(bin, bins, include, lib);
}
示例11: GetLocation
internal static string GetLocation(AssemblyNameExtension strongName, ProcessorArchitecture targetProcessorArchitecture, GetAssemblyRuntimeVersion getRuntimeVersion, Version targetedRuntimeVersion, bool fullFusionName, Microsoft.Build.Shared.FileExists fileExists, GetPathFromFusionName getPathFromFusionName, GetGacEnumerator getGacEnumerator, bool specificVersion)
{
string str = null;
if (((strongName.GetPublicKeyToken() == null) || (strongName.GetPublicKeyToken().Length == 0)) && (strongName.FullName.IndexOf("PublicKeyToken", StringComparison.OrdinalIgnoreCase) != -1))
{
return str;
}
getPathFromFusionName = getPathFromFusionName ?? pathFromFusionName;
getGacEnumerator = getGacEnumerator ?? gacEnumerator;
if (!strongName.HasProcessorArchitectureInFusionName)
{
if ((targetProcessorArchitecture != ProcessorArchitecture.MSIL) && (targetProcessorArchitecture != ProcessorArchitecture.None))
{
string str2 = ResolveAssemblyReference.ProcessorArchitectureToString(targetProcessorArchitecture);
if (fullFusionName)
{
str = CheckForFullFusionNameInGac(strongName, str2, getPathFromFusionName);
}
else
{
str = GetLocationImpl(strongName, str2, getRuntimeVersion, targetedRuntimeVersion, fileExists, getPathFromFusionName, getGacEnumerator, specificVersion);
}
if ((str != null) && (str.Length > 0))
{
return str;
}
}
if (fullFusionName)
{
str = CheckForFullFusionNameInGac(strongName, "MSIL", getPathFromFusionName);
}
else
{
str = GetLocationImpl(strongName, "MSIL", getRuntimeVersion, targetedRuntimeVersion, fileExists, getPathFromFusionName, getGacEnumerator, specificVersion);
}
if ((str != null) && (str.Length > 0))
{
return str;
}
}
if (fullFusionName)
{
str = CheckForFullFusionNameInGac(strongName, null, getPathFromFusionName);
}
else
{
str = GetLocationImpl(strongName, null, getRuntimeVersion, targetedRuntimeVersion, fileExists, getPathFromFusionName, getGacEnumerator, specificVersion);
}
if ((str != null) && (str.Length > 0))
{
return str;
}
return null;
}
示例12: GetConfiguration
private static InterpreterConfiguration GetConfiguration(ProcessorArchitecture arch) {
var prefixPath = IronPythonResolver.GetPythonInstallDir();
return new InterpreterConfiguration(
prefixPath,
Path.Combine(prefixPath, arch == ProcessorArchitecture.Amd64 ? "ipy64.exe" : "ipy.exe"),
Path.Combine(prefixPath, arch == ProcessorArchitecture.Amd64 ? "ipyw64.exe" : "ipyw.exe"),
Path.Combine(prefixPath, "Lib"),
"IRONPYTHONPATH",
arch,
new Version(2, 7));
}
示例13: RegisterInterpreters
private void RegisterInterpreters(HashSet<string> registeredPaths, RegistryKey python, ProcessorArchitecture? arch) {
foreach (var key in python.GetSubKeyNames()) {
Version version;
if (Version.TryParse(key, out version)) {
if (version.Major == 2 && version.Minor <= 4) {
// 2.4 and below not supported.
continue;
}
var installPath = python.OpenSubKey(key + "\\InstallPath");
if (installPath != null) {
var basePathObj = installPath.GetValue("");
if (basePathObj == null) {
// http://pytools.codeplex.com/discussions/301384
// messed up install, we don't know where it lives, we can't use it.
continue;
}
string basePath = basePathObj.ToString();
if (basePath.IndexOfAny(Path.GetInvalidPathChars()) != -1) {
// Invalid path in registry
continue;
}
if (!registeredPaths.Add(basePath)) {
// registered in both HCKU and HKLM
continue;
}
var actualArch = arch;
if (!actualArch.HasValue) {
actualArch = NativeMethods.GetBinaryType(Path.Combine(basePath, "python.exe"));
}
var id = _cpyInterpreterGuid;
var description = "Python";
if (actualArch == ProcessorArchitecture.Amd64) {
id = _cpy64InterpreterGuid;
description = "Python 64-bit";
}
_interpreters.Add(
new CPythonInterpreterFactory(
version,
id,
description,
Path.Combine(basePath, "python.exe"),
Path.Combine(basePath, "pythonw.exe"),
"PYTHONPATH",
actualArch ?? ProcessorArchitecture.None
)
);
}
}
}
}
示例14: UpdateChecker
public UpdateChecker(
Version applicationVersion,
ProcessorArchitecture processorArchitecture,
string variant,
IUpdateNotificationClient updateNotificationClient)
{
this.applicationVersion = applicationVersion;
this.processorArchitecture = processorArchitecture;
this.variant = variant;
this.updateNotificationClient = updateNotificationClient;
}
示例15: FormatForUserAgent
/// <summary>
/// Format a ProcessorArchitecture as it would be expected in a user agent of a browser.
/// </summary>
/// <returns>String containing the format processor architecture.</returns>
private static string FormatForUserAgent(ProcessorArchitecture architecture)
{
switch (architecture)
{
case ProcessorArchitecture.AMD64:
return "x64";
case ProcessorArchitecture.ARM:
return "ARM";
default:
return "";
}
}