aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/EnvironmentInfo
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-08-16 02:43:41 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-08-16 02:43:41 -0400
commitbfcd1b520fd79b893e721ba916ae5e1656407d2f (patch)
tree6a05119800484435fb384da25c6390054a27c3c3 /Emby.Server.Implementations/EnvironmentInfo
parente3531534b85aeaaa3e4aaf462d5e77ea142dc762 (diff)
merge common implementations and server implementations
Diffstat (limited to 'Emby.Server.Implementations/EnvironmentInfo')
-rw-r--r--Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.cs92
1 files changed, 92 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.cs b/Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.cs
new file mode 100644
index 000000000..0999fa141
--- /dev/null
+++ b/Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.cs
@@ -0,0 +1,92 @@
+using System;
+using System.IO;
+using MediaBrowser.Model.System;
+
+namespace Emby.Server.Implementations.EnvironmentInfo
+{
+ public class EnvironmentInfo : IEnvironmentInfo
+ {
+ public Architecture? CustomArchitecture { get; set; }
+ public MediaBrowser.Model.System.OperatingSystem? CustomOperatingSystem { get; set; }
+
+ public virtual MediaBrowser.Model.System.OperatingSystem OperatingSystem
+ {
+ get
+ {
+ if (CustomOperatingSystem.HasValue)
+ {
+ return CustomOperatingSystem.Value;
+ }
+
+ switch (Environment.OSVersion.Platform)
+ {
+ case PlatformID.MacOSX:
+ return MediaBrowser.Model.System.OperatingSystem.OSX;
+ case PlatformID.Win32NT:
+ return MediaBrowser.Model.System.OperatingSystem.Windows;
+ case PlatformID.Unix:
+ return MediaBrowser.Model.System.OperatingSystem.Linux;
+ }
+
+ return MediaBrowser.Model.System.OperatingSystem.Windows;
+ }
+ }
+
+ public string OperatingSystemName
+ {
+ get
+ {
+ return Environment.OSVersion.Platform.ToString();
+ }
+ }
+
+ public string OperatingSystemVersion
+ {
+ get
+ {
+ return Environment.OSVersion.Version.ToString() + " " + Environment.OSVersion.ServicePack.ToString();
+ }
+ }
+
+ public char PathSeparator
+ {
+ get
+ {
+ return Path.PathSeparator;
+ }
+ }
+
+ public Architecture SystemArchitecture
+ {
+ get
+ {
+ if (CustomArchitecture.HasValue)
+ {
+ return CustomArchitecture.Value;
+ }
+
+ return Environment.Is64BitOperatingSystem ? MediaBrowser.Model.System.Architecture.X64 : MediaBrowser.Model.System.Architecture.X86;
+ }
+ }
+
+ public string GetEnvironmentVariable(string name)
+ {
+ return Environment.GetEnvironmentVariable(name);
+ }
+
+ public virtual string GetUserId()
+ {
+ return null;
+ }
+
+ public string StackTrace
+ {
+ get { return Environment.StackTrace; }
+ }
+
+ public void SetProcessEnvironmentVariable(string name, string value)
+ {
+ Environment.SetEnvironmentVariable(name, value);
+ }
+ }
+} \ No newline at end of file