mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-01 05:18:27 +01:00
make more classes portable
This commit is contained in:
@@ -23,11 +23,14 @@ using Emby.Common.Implementations.Logging;
|
||||
using Emby.Common.Implementations.Networking;
|
||||
using Emby.Common.Implementations.Security;
|
||||
using Emby.Server.Core;
|
||||
using Emby.Server.Core.Logging;
|
||||
using Emby.Server.Implementations;
|
||||
using Emby.Server.Implementations.Browser;
|
||||
using Emby.Server.Implementations.IO;
|
||||
using Emby.Server.Implementations.Logging;
|
||||
using ImageMagickSharp;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Server.Startup.Common.IO;
|
||||
|
||||
namespace MediaBrowser.ServerApplication
|
||||
@@ -47,6 +50,8 @@ namespace MediaBrowser.ServerApplication
|
||||
|
||||
public static string ApplicationPath;
|
||||
|
||||
private static IFileSystem FileSystem;
|
||||
|
||||
public static bool TryGetLocalFromUncDirectory(string local, out string unc)
|
||||
{
|
||||
if ((local == null) || (local == ""))
|
||||
@@ -259,16 +264,18 @@ namespace MediaBrowser.ServerApplication
|
||||
|
||||
var resourcesPath = Path.GetDirectoryName(applicationPath);
|
||||
|
||||
Action<string> createDirectoryFn = s => Directory.CreateDirectory(s);
|
||||
|
||||
if (runAsService)
|
||||
{
|
||||
var systemPath = Path.GetDirectoryName(applicationPath);
|
||||
|
||||
var programDataPath = Path.GetDirectoryName(systemPath);
|
||||
|
||||
return new ServerApplicationPaths(programDataPath, appFolderPath, resourcesPath);
|
||||
return new ServerApplicationPaths(programDataPath, appFolderPath, resourcesPath, createDirectoryFn);
|
||||
}
|
||||
|
||||
return new ServerApplicationPaths(ApplicationPathHelper.GetProgramDataPath(applicationPath), appFolderPath, resourcesPath);
|
||||
return new ServerApplicationPaths(ApplicationPathHelper.GetProgramDataPath(applicationPath), appFolderPath, resourcesPath, createDirectoryFn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -330,6 +337,8 @@ namespace MediaBrowser.ServerApplication
|
||||
|
||||
var imageEncoder = ImageEncoderHelper.GetImageEncoder(_logger, logManager, fileSystem, options, () => _appHost.HttpClient, appPaths);
|
||||
|
||||
FileSystem = fileSystem;
|
||||
|
||||
_appHost = new WindowsAppHost(appPaths,
|
||||
logManager,
|
||||
options,
|
||||
@@ -580,7 +589,7 @@ namespace MediaBrowser.ServerApplication
|
||||
{
|
||||
var exception = (Exception)e.ExceptionObject;
|
||||
|
||||
new UnhandledExceptionWriter(_appHost.ServerConfigurationManager.ApplicationPaths, _logger, _appHost.LogManager).Log(exception);
|
||||
new UnhandledExceptionWriter(_appHost.ServerConfigurationManager.ApplicationPaths, _logger, _appHost.LogManager, FileSystem, new ConsoleLogger()).Log(exception);
|
||||
|
||||
if (!IsRunningAsService)
|
||||
{
|
||||
|
||||
@@ -67,6 +67,9 @@
|
||||
<Reference Include="Emby.Common.Implementations">
|
||||
<HintPath>..\ThirdParty\emby\Emby.Common.Implementations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Emby.Server.Connect">
|
||||
<HintPath>..\ThirdParty\emby\Emby.Server.Connect.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Emby.Server.Core">
|
||||
<HintPath>..\ThirdParty\emby\Emby.Server.Core.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -4,10 +4,12 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using Emby.Server.Connect;
|
||||
using Emby.Server.Core;
|
||||
using Emby.Server.Implementations;
|
||||
using Emby.Server.Implementations.EntryPoints;
|
||||
using Emby.Server.Implementations.FFMpeg;
|
||||
using MediaBrowser.Controller.Connect;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.System;
|
||||
@@ -27,6 +29,11 @@ namespace MediaBrowser.ServerApplication
|
||||
get { return MainStartup.IsRunningAsService; }
|
||||
}
|
||||
|
||||
protected override IConnectManager CreateConnectManager()
|
||||
{
|
||||
return new ConnectManager();
|
||||
}
|
||||
|
||||
protected override void RestartInternal()
|
||||
{
|
||||
MainStartup.Restart();
|
||||
@@ -41,6 +48,7 @@ namespace MediaBrowser.ServerApplication
|
||||
//list.Add(typeof(PismoIsoManager).Assembly);
|
||||
}
|
||||
|
||||
list.Add(typeof(ConnectManager).Assembly);
|
||||
list.Add(GetType().Assembly);
|
||||
|
||||
return list;
|
||||
|
||||
Reference in New Issue
Block a user