From 918b9ca86d1bdb9758430e9164f5fba72de1d9a7 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 11 Nov 2016 03:13:11 -0500 Subject: update core projects --- Emby.Common.Implementations/BaseApplicationHost.cs | 7 ++++-- .../EnvironmentInfo/EnvironmentInfo.cs | 29 ++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) (limited to 'Emby.Common.Implementations') diff --git a/Emby.Common.Implementations/BaseApplicationHost.cs b/Emby.Common.Implementations/BaseApplicationHost.cs index 0cf11e8255..9571ea3889 100644 --- a/Emby.Common.Implementations/BaseApplicationHost.cs +++ b/Emby.Common.Implementations/BaseApplicationHost.cs @@ -172,7 +172,7 @@ namespace Emby.Common.Implementations protected ICryptoProvider CryptographyProvider = new CryptographyProvider(); - protected IEnvironmentInfo EnvironmentInfo = new Emby.Common.Implementations.EnvironmentInfo.EnvironmentInfo(); + protected IEnvironmentInfo EnvironmentInfo { get; private set; } private DeviceId _deviceId; public string SystemId @@ -205,8 +205,11 @@ namespace Emby.Common.Implementations /// protected BaseApplicationHost(TApplicationPathsType applicationPaths, ILogManager logManager, - IFileSystem fileSystem) + IFileSystem fileSystem, + IEnvironmentInfo environmentInfo) { + EnvironmentInfo = environmentInfo; + // hack alert, until common can target .net core BaseExtensions.CryptographyProvider = CryptographyProvider; diff --git a/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs b/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs index 8cea617eae..6a1b3ef74c 100644 --- a/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs +++ b/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs @@ -9,6 +9,8 @@ namespace Emby.Common.Implementations.EnvironmentInfo { public class EnvironmentInfo : IEnvironmentInfo { + public MediaBrowser.Model.System.Architecture? CustomArchitecture { get; set; } + public MediaBrowser.Model.System.OperatingSystem OperatingSystem { get @@ -66,5 +68,32 @@ namespace Emby.Common.Implementations.EnvironmentInfo return "1.0"; } } + + public MediaBrowser.Model.System.Architecture SystemArchitecture + { + get + { + if (CustomArchitecture.HasValue) + { + return CustomArchitecture.Value; + } +#if NET46 + return Environment.Is64BitOperatingSystem ? MediaBrowser.Model.System.Architecture.X64 : MediaBrowser.Model.System.Architecture.X86; +#elif NETSTANDARD1_6 + switch(System.Runtime.InteropServices.RuntimeInformation.OSArchitecture) + { + case System.Runtime.InteropServices.Architecture.Arm: + return MediaBrowser.Model.System.Architecture.Arm; + case System.Runtime.InteropServices.Architecture.Arm64: + return MediaBrowser.Model.System.Architecture.Arm64; + case System.Runtime.InteropServices.Architecture.X64: + return MediaBrowser.Model.System.Architecture.X64; + case System.Runtime.InteropServices.Architecture.X86: + return MediaBrowser.Model.System.Architecture.X86; + } +#endif + return MediaBrowser.Model.System.Architecture.X64; + } + } } } -- cgit v1.2.3