mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
update mac project
This commit is contained in:
parent
9700a3be60
commit
9fb11f1a56
@ -7,7 +7,7 @@ using Emby.Server.Core.FFMpeg;
|
|||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
using MediaBrowser.Server.Mono.Native;
|
using Emby.Server.Mac.Native;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Mac
|
namespace MediaBrowser.Server.Mac
|
||||||
|
@ -12,14 +12,16 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Server.Implementations;
|
using MediaBrowser.Server.Implementations;
|
||||||
using MediaBrowser.Server.Startup.Common;
|
|
||||||
using Microsoft.Win32;
|
|
||||||
using MonoMac.AppKit;
|
using MonoMac.AppKit;
|
||||||
using MonoMac.Foundation;
|
using MonoMac.Foundation;
|
||||||
using MonoMac.ObjCRuntime;
|
using MonoMac.ObjCRuntime;
|
||||||
using Emby.Server.Core;
|
using Emby.Server.Core;
|
||||||
using Emby.Common.Implementations.Logging;
|
using Emby.Common.Implementations.Logging;
|
||||||
using Emby.Server.Mac.Native;
|
using Emby.Server.Mac.Native;
|
||||||
|
using Emby.Server.Implementations.IO;
|
||||||
|
using Emby.Common.Implementations.Networking;
|
||||||
|
using MediaBrowser.Server.Startup.Common;
|
||||||
|
using MediaBrowser.Server.Startup.Common.IO;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Mac
|
namespace MediaBrowser.Server.Mac
|
||||||
{
|
{
|
||||||
@ -85,21 +87,34 @@ namespace MediaBrowser.Server.Mac
|
|||||||
ILogManager logManager,
|
ILogManager logManager,
|
||||||
StartupOptions options)
|
StartupOptions options)
|
||||||
{
|
{
|
||||||
SystemEvents.SessionEnding += SystemEvents_SessionEnding;
|
|
||||||
|
|
||||||
// Allow all https requests
|
// Allow all https requests
|
||||||
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; });
|
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; });
|
||||||
|
|
||||||
var fileSystem = new MonoFileSystem(logManager.GetLogger("FileSystem"), false, false);
|
var fileSystem = new MonoFileSystem(logManager.GetLogger("FileSystem"), false, false);
|
||||||
fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));
|
fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));
|
||||||
|
|
||||||
|
var environmentInfo = GetEnvironmentInfo();
|
||||||
|
|
||||||
|
var imageEncoder = ImageEncoderHelper.GetImageEncoder(_logger,
|
||||||
|
logManager,
|
||||||
|
fileSystem,
|
||||||
|
options,
|
||||||
|
() => AppHost.HttpClient,
|
||||||
|
appPaths);
|
||||||
|
|
||||||
AppHost = new MacAppHost(appPaths,
|
AppHost = new MacAppHost(appPaths,
|
||||||
logManager,
|
logManager,
|
||||||
options,
|
options,
|
||||||
fileSystem,
|
fileSystem,
|
||||||
new PowerManagement(),
|
new PowerManagement(),
|
||||||
"Emby.Server.Mac.pkg",
|
"Emby.Server.Mac.pkg",
|
||||||
nativeApp);
|
environmentInfo,
|
||||||
|
imageEncoder,
|
||||||
|
new Startup.Common.SystemEvents(logManager.GetLogger("SystemEvents")),
|
||||||
|
new MemoryStreamProvider(),
|
||||||
|
new NetworkManager(logManager.GetLogger("NetworkManager")),
|
||||||
|
GenerateCertificate,
|
||||||
|
() => Environment.UserName);
|
||||||
|
|
||||||
if (options.ContainsOption("-v")) {
|
if (options.ContainsOption("-v")) {
|
||||||
Console.WriteLine (AppHost.ApplicationVersion.ToString());
|
Console.WriteLine (AppHost.ApplicationVersion.ToString());
|
||||||
@ -125,19 +140,6 @@ namespace MediaBrowser.Server.Mac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handles the SessionEnding event of the SystemEvents control.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender">The source of the event.</param>
|
|
||||||
/// <param name="e">The <see cref="SessionEndingEventArgs"/> instance containing the event data.</param>
|
|
||||||
static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Reason == SessionEndReasons.SystemShutdown)
|
|
||||||
{
|
|
||||||
Shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Shutdown()
|
public static void Shutdown()
|
||||||
{
|
{
|
||||||
ShutdownApp();
|
ShutdownApp();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user