2016-11-04 19:51:59 +00:00
|
|
|
|
using System;
|
2017-04-08 18:31:18 +00:00
|
|
|
|
using System.IO;
|
2016-11-04 19:51:59 +00:00
|
|
|
|
using MediaBrowser.Model.System;
|
2019-01-01 15:27:11 +00:00
|
|
|
|
using System.Runtime.InteropServices;
|
2016-11-04 19:51:59 +00:00
|
|
|
|
|
2017-08-16 06:43:41 +00:00
|
|
|
|
namespace Emby.Server.Implementations.EnvironmentInfo
|
2016-11-04 19:51:59 +00:00
|
|
|
|
{
|
2019-01-01 17:41:02 +00:00
|
|
|
|
// TODO: Rework @bond
|
2016-11-04 19:51:59 +00:00
|
|
|
|
public class EnvironmentInfo : IEnvironmentInfo
|
|
|
|
|
{
|
2019-01-01 23:41:47 +00:00
|
|
|
|
public EnvironmentInfo(MediaBrowser.Model.System.OperatingSystem operatingSystem)
|
2016-11-04 19:51:59 +00:00
|
|
|
|
{
|
2019-01-01 23:41:47 +00:00
|
|
|
|
OperatingSystem = operatingSystem;
|
2016-11-04 19:51:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-01-01 23:41:47 +00:00
|
|
|
|
public MediaBrowser.Model.System.OperatingSystem OperatingSystem { get; private set; }
|
|
|
|
|
|
2016-11-04 19:51:59 +00:00
|
|
|
|
public string OperatingSystemName
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2019-01-01 23:21:06 +00:00
|
|
|
|
switch (OperatingSystem)
|
|
|
|
|
{
|
2019-01-01 17:41:02 +00:00
|
|
|
|
case MediaBrowser.Model.System.OperatingSystem.Android: return "Android";
|
|
|
|
|
case MediaBrowser.Model.System.OperatingSystem.BSD: return "BSD";
|
|
|
|
|
case MediaBrowser.Model.System.OperatingSystem.Linux: return "Linux";
|
|
|
|
|
case MediaBrowser.Model.System.OperatingSystem.OSX: return "macOS";
|
|
|
|
|
case MediaBrowser.Model.System.OperatingSystem.Windows: return "Windows";
|
|
|
|
|
default: throw new Exception($"Unknown OS {OperatingSystem}");
|
|
|
|
|
}
|
2016-11-04 19:51:59 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string OperatingSystemVersion
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2017-04-29 17:30:28 +00:00
|
|
|
|
return Environment.OSVersion.Version.ToString() + " " + Environment.OSVersion.ServicePack.ToString();
|
2016-11-04 19:51:59 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-11-11 08:13:11 +00:00
|
|
|
|
|
2017-04-08 18:31:18 +00:00
|
|
|
|
public char PathSeparator
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Path.PathSeparator;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-01 23:41:47 +00:00
|
|
|
|
public Architecture SystemArchitecture { get { return RuntimeInformation.OSArchitecture; } }
|
2016-11-13 21:04:21 +00:00
|
|
|
|
|
|
|
|
|
public string GetEnvironmentVariable(string name)
|
|
|
|
|
{
|
|
|
|
|
return Environment.GetEnvironmentVariable(name);
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-21 08:54:53 +00:00
|
|
|
|
public string StackTrace
|
|
|
|
|
{
|
|
|
|
|
get { return Environment.StackTrace; }
|
|
|
|
|
}
|
2016-11-29 19:13:20 +00:00
|
|
|
|
|
|
|
|
|
public void SetProcessEnvironmentVariable(string name, string value)
|
|
|
|
|
{
|
|
|
|
|
Environment.SetEnvironmentVariable(name, value);
|
|
|
|
|
}
|
2016-11-04 19:51:59 +00:00
|
|
|
|
}
|
2018-12-13 13:18:25 +00:00
|
|
|
|
}
|