2017-03-02 21:04:03 -08:00
|
|
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
|
2016-02-19 17:00:41 -08:00
|
|
|
using System;
|
2016-08-08 15:35:25 -07:00
|
|
|
using Microsoft.DotNet.PlatformAbstractions;
|
2016-02-19 17:00:41 -08: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 16:30:32 -07:00
|
|
|
var archName = RuntimeEnvironment.RuntimeArchitecture;
|
2016-02-19 17:00:41 -08:00
|
|
|
return string.Equals(archName, "x86", StringComparison.OrdinalIgnoreCase);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static bool Isx64
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
2016-04-28 16:30:32 -07:00
|
|
|
var archName = RuntimeEnvironment.RuntimeArchitecture;
|
2016-02-19 17:00:41 -08: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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-03-02 20:35:20 -08:00
|
|
|
}
|