2016-02-20 01:00:41 +00:00
|
|
|
using System;
|
2016-08-08 22:35:25 +00:00
|
|
|
using Microsoft.DotNet.PlatformAbstractions;
|
2016-02-20 01:00:41 +00:00
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli.Build.Framework
|
|
|
|
{
|
|
|
|
public static class CurrentArchitecture
|
|
|
|
{
|
|
|
|
public static BuildArchitecture Current
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return DetermineCurrentArchitecture();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static bool Isx86
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
2016-04-28 23:30:32 +00:00
|
|
|
var archName = RuntimeEnvironment.RuntimeArchitecture;
|
2016-02-20 01:00:41 +00:00
|
|
|
return string.Equals(archName, "x86", StringComparison.OrdinalIgnoreCase);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static bool Isx64
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
2016-04-28 23:30:32 +00:00
|
|
|
var archName = RuntimeEnvironment.RuntimeArchitecture;
|
2016-02-20 01:00:41 +00:00
|
|
|
return string.Equals(archName, "x64", StringComparison.OrdinalIgnoreCase);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private static BuildArchitecture DetermineCurrentArchitecture()
|
|
|
|
{
|
|
|
|
if (Isx86)
|
|
|
|
{
|
|
|
|
return BuildArchitecture.x86;
|
|
|
|
}
|
|
|
|
else if (Isx64)
|
|
|
|
{
|
|
|
|
return BuildArchitecture.x64;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return default(BuildArchitecture);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|