aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Mono
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Mono')
-rw-r--r--MediaBrowser.Server.Mono/ApplicationPathHelper.cs51
-rw-r--r--MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj12
-rw-r--r--MediaBrowser.Server.Mono/MonoAppHost.cs2
-rw-r--r--MediaBrowser.Server.Mono/Native/MonoFileSystem.cs2
-rw-r--r--MediaBrowser.Server.Mono/Program.cs54
-rw-r--r--MediaBrowser.Server.Mono/packages.config1
6 files changed, 67 insertions, 55 deletions
diff --git a/MediaBrowser.Server.Mono/ApplicationPathHelper.cs b/MediaBrowser.Server.Mono/ApplicationPathHelper.cs
new file mode 100644
index 0000000000..c8cca40ff8
--- /dev/null
+++ b/MediaBrowser.Server.Mono/ApplicationPathHelper.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Configuration;
+using System.IO;
+
+namespace MediaBrowser.Server.Mono
+{
+ public static class ApplicationPathHelper
+ {
+ /// <summary>
+ /// Gets the path to the application's ProgramDataFolder
+ /// </summary>
+ /// <returns>System.String.</returns>
+ public static string GetProgramDataPath(string applicationPath)
+ {
+ var useDebugPath = false;
+
+#if DEBUG
+ useDebugPath = true;
+#endif
+
+ var programDataPath = useDebugPath ?
+ ConfigurationManager.AppSettings["DebugProgramDataPath"] :
+ ConfigurationManager.AppSettings["ReleaseProgramDataPath"];
+
+ programDataPath = programDataPath.Replace("%ApplicationData%", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
+
+ programDataPath = programDataPath
+ .Replace('/', Path.DirectorySeparatorChar)
+ .Replace('\\', Path.DirectorySeparatorChar);
+
+ // If it's a relative path, e.g. "..\"
+ if (!Path.IsPathRooted(programDataPath))
+ {
+ var path = Path.GetDirectoryName(applicationPath);
+
+ if (string.IsNullOrEmpty(path))
+ {
+ throw new ApplicationException("Unable to determine running assembly location");
+ }
+
+ programDataPath = Path.Combine(path, programDataPath);
+
+ programDataPath = Path.GetFullPath(programDataPath);
+ }
+
+ Directory.CreateDirectory(programDataPath);
+
+ return programDataPath;
+ }
+ }
+}
diff --git a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj
index 48b4fdb4fb..7ddafb6360 100644
--- a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj
+++ b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj
@@ -51,9 +51,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Mono.Posix.4.0.0.0\lib\net40\Mono.Posix.dll</HintPath>
</Reference>
- <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
- <HintPath>..\packages\NLog.4.4.12\lib\net45\NLog.dll</HintPath>
- </Reference>
<Reference Include="ServiceStack.Text, Version=4.5.8.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll</HintPath>
<Private>True</Private>
@@ -89,6 +86,7 @@
<Compile Include="..\SharedVersion.cs">
<Link>Properties\SharedVersion.cs</Link>
</Compile>
+ <Compile Include="ApplicationPathHelper.cs" />
<Compile Include="ImageEncoderHelper.cs" />
<Compile Include="MonoAppHost.cs" />
<Compile Include="Native\MonoFileSystem.cs" />
@@ -106,10 +104,6 @@
<Project>{713f42b5-878e-499d-a878-e4c652b1d5e8}</Project>
<Name>DvdLib</Name>
</ProjectReference>
- <ProjectReference Include="..\Emby.Common.Implementations\Emby.Common.Implementations.csproj">
- <Project>{1e37a338-9f57-4b70-bd6d-bb9c591e319b}</Project>
- <Name>Emby.Common.Implementations</Name>
- </ProjectReference>
<ProjectReference Include="..\Emby.Dlna\Emby.Dlna.csproj">
<Project>{805844ab-e92f-45e6-9d99-4f6d48d129a5}</Project>
<Name>Emby.Dlna</Name>
@@ -138,10 +132,6 @@
<Project>{5624B7B5-B5A7-41D8-9F10-CC5611109619}</Project>
<Name>MediaBrowser.WebDashboard</Name>
</ProjectReference>
- <ProjectReference Include="..\MediaBrowser.Server.Implementations\MediaBrowser.Server.Implementations.csproj">
- <Project>{2E781478-814D-4A48-9D80-BFF206441A65}</Project>
- <Name>MediaBrowser.Server.Implementations</Name>
- </ProjectReference>
<ProjectReference Include="..\MediaBrowser.Providers\MediaBrowser.Providers.csproj">
<Project>{442B5058-DCAF-4263-BB6A-F21E31120A1B}</Project>
<Name>MediaBrowser.Providers</Name>
diff --git a/MediaBrowser.Server.Mono/MonoAppHost.cs b/MediaBrowser.Server.Mono/MonoAppHost.cs
index 1153d0f7db..e51324ec4d 100644
--- a/MediaBrowser.Server.Mono/MonoAppHost.cs
+++ b/MediaBrowser.Server.Mono/MonoAppHost.cs
@@ -19,7 +19,7 @@ namespace MediaBrowser.Server.Mono
{
public class MonoAppHost : ApplicationHost
{
- public MonoAppHost(ServerApplicationPaths applicationPaths, ILogManager logManager, StartupOptions options, IFileSystem fileSystem, IPowerManagement powerManagement, string releaseAssetFilename, IEnvironmentInfo environmentInfo, MediaBrowser.Controller.Drawing.IImageEncoder imageEncoder, ISystemEvents systemEvents, IMemoryStreamFactory memoryStreamFactory, MediaBrowser.Common.Net.INetworkManager networkManager, Action<string, string, string> certificateGenerator, Func<string> defaultUsernameFactory) : base(applicationPaths, logManager, options, fileSystem, powerManagement, releaseAssetFilename, environmentInfo, imageEncoder, systemEvents, memoryStreamFactory, networkManager, certificateGenerator, defaultUsernameFactory)
+ public MonoAppHost(ServerApplicationPaths applicationPaths, ILogManager logManager, StartupOptions options, IFileSystem fileSystem, IPowerManagement powerManagement, string releaseAssetFilename, IEnvironmentInfo environmentInfo, MediaBrowser.Controller.Drawing.IImageEncoder imageEncoder, ISystemEvents systemEvents, MediaBrowser.Common.Net.INetworkManager networkManager) : base(applicationPaths, logManager, options, fileSystem, powerManagement, releaseAssetFilename, environmentInfo, imageEncoder, systemEvents, networkManager)
{
}
diff --git a/MediaBrowser.Server.Mono/Native/MonoFileSystem.cs b/MediaBrowser.Server.Mono/Native/MonoFileSystem.cs
index 91c064efec..e6b77991cd 100644
--- a/MediaBrowser.Server.Mono/Native/MonoFileSystem.cs
+++ b/MediaBrowser.Server.Mono/Native/MonoFileSystem.cs
@@ -1,4 +1,4 @@
-using Emby.Common.Implementations.IO;
+using Emby.Server.Implementations.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.System;
using Mono.Unix.Native;
diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs
index aa6a58b48b..73a568ca97 100644
--- a/MediaBrowser.Server.Mono/Program.cs
+++ b/MediaBrowser.Server.Mono/Program.cs
@@ -11,18 +11,16 @@ using System.Net.Security;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
-using Emby.Common.Implementations.EnvironmentInfo;
-using Emby.Common.Implementations.Logging;
-using Emby.Common.Implementations.Networking;
using Emby.Server.Core.Cryptography;
using Emby.Server.Core;
using Emby.Server.Implementations;
+using Emby.Server.Implementations.EnvironmentInfo;
using Emby.Server.Implementations.IO;
using Emby.Server.Implementations.Logging;
+using Emby.Server.Implementations.Networking;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.System;
using Mono.Unix.Native;
-using NLog;
using ILogger = MediaBrowser.Model.Logging.ILogger;
using X509Certificate = System.Security.Cryptography.X509Certificates.X509Certificate;
@@ -49,7 +47,7 @@ namespace MediaBrowser.Server.Mono
var appPaths = CreateApplicationPaths(applicationPath, customProgramDataPath);
- var logManager = new NlogManager(appPaths.LogDirectoryPath, "server");
+ var logManager = new SimpleLogManager(appPaths.LogDirectoryPath, "server");
logManager.ReloadLogger(LogSeverity.Info);
logManager.AddConsoleOutput();
@@ -85,9 +83,7 @@ namespace MediaBrowser.Server.Mono
var appFolderPath = Path.GetDirectoryName(applicationPath);
- Action<string> createDirectoryFn = s => Directory.CreateDirectory(s);
-
- return new ServerApplicationPaths(programDataPath, appFolderPath, Path.GetDirectoryName(applicationPath), createDirectoryFn);
+ return new ServerApplicationPaths(programDataPath, appFolderPath, Path.GetDirectoryName(applicationPath));
}
private static readonly TaskCompletionSource<bool> ApplicationTaskCompletionSource = new TaskCompletionSource<bool>();
@@ -114,10 +110,7 @@ namespace MediaBrowser.Server.Mono
environmentInfo,
imageEncoder,
new SystemEvents(logManager.GetLogger("SystemEvents")),
- new MemoryStreamProvider(),
- new NetworkManager(logManager.GetLogger("NetworkManager")),
- GenerateCertificate,
- () => Environment.UserName);
+ new NetworkManager(logManager.GetLogger("NetworkManager")));
if (options.ContainsOption("-v"))
{
@@ -142,11 +135,6 @@ namespace MediaBrowser.Server.Mono
Task.WaitAll(task);
}
- private static void GenerateCertificate(string certPath, string certHost, string certPassword)
- {
- CertificateGenerator.CreateSelfSignCertificatePfx(certPath, certHost, certPassword, _logger);
- }
-
private static MonoEnvironmentInfo GetEnvironmentInfo()
{
var info = new MonoEnvironmentInfo();
@@ -157,39 +145,38 @@ namespace MediaBrowser.Server.Mono
if (string.Equals(sysName, "Darwin", StringComparison.OrdinalIgnoreCase))
{
- //info.OperatingSystem = Startup.Common.OperatingSystem.Osx;
+ info.OperatingSystem = Model.System.OperatingSystem.OSX;
}
else if (string.Equals(sysName, "Linux", StringComparison.OrdinalIgnoreCase))
{
- //info.OperatingSystem = Startup.Common.OperatingSystem.Linux;
+ info.OperatingSystem = Model.System.OperatingSystem.Linux;
}
else if (string.Equals(sysName, "BSD", StringComparison.OrdinalIgnoreCase))
{
- //info.OperatingSystem = Startup.Common.OperatingSystem.Bsd;
- info.IsBsd = true;
+ info.OperatingSystem = Model.System.OperatingSystem.BSD;
}
var archX86 = new Regex("(i|I)[3-6]86");
if (archX86.IsMatch(uname.machine))
{
- info.CustomArchitecture = Architecture.X86;
+ info.SystemArchitecture = Architecture.X86;
}
else if (string.Equals(uname.machine, "x86_64", StringComparison.OrdinalIgnoreCase))
{
- info.CustomArchitecture = Architecture.X64;
+ info.SystemArchitecture = Architecture.X64;
}
else if (uname.machine.StartsWith("arm", StringComparison.OrdinalIgnoreCase))
{
- info.CustomArchitecture = Architecture.Arm;
+ info.SystemArchitecture = Architecture.Arm;
}
else if (System.Environment.Is64BitOperatingSystem)
{
- info.CustomArchitecture = Architecture.X64;
+ info.SystemArchitecture = Architecture.X64;
}
else
{
- info.CustomArchitecture = Architecture.X86;
+ info.SystemArchitecture = Architecture.X86;
}
return info;
@@ -309,24 +296,9 @@ namespace MediaBrowser.Server.Mono
public class MonoEnvironmentInfo : EnvironmentInfo
{
- public bool IsBsd { get; set; }
-
public override string GetUserId()
{
return Syscall.getuid().ToString(CultureInfo.InvariantCulture);
}
-
- public override Model.System.OperatingSystem OperatingSystem
- {
- get
- {
- if (IsBsd)
- {
- return Model.System.OperatingSystem.BSD;
- }
-
- return base.OperatingSystem;
- }
- }
}
}
diff --git a/MediaBrowser.Server.Mono/packages.config b/MediaBrowser.Server.Mono/packages.config
index c77327e228..525a0098c8 100644
--- a/MediaBrowser.Server.Mono/packages.config
+++ b/MediaBrowser.Server.Mono/packages.config
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Mono.Posix" version="4.0.0.0" targetFramework="net45" />
- <package id="NLog" version="4.4.12" targetFramework="net46" />
<package id="ServiceStack.Text" version="4.5.8" targetFramework="net46" />
<package id="SharpCompress" version="0.14.0" targetFramework="net46" />
<package id="SimpleInjector" version="4.0.8" targetFramework="net46" />