From 492f897f818abc1a1eee0352864ce4c06de4de1c Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 25 Oct 2015 11:48:44 -0400 Subject: 3.0.5768.6 --- .../ScheduledTasks/ScheduledTaskWorker.cs | 6 +++++- .../ScheduledTasks/TaskManager.cs | 25 +++++++++++++++++++++- .../Security/PluginSecurityManager.cs | 4 ++-- 3 files changed, 31 insertions(+), 4 deletions(-) (limited to 'MediaBrowser.Common.Implementations') diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs index 52612c4c11..95f29915db 100644 --- a/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs +++ b/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs @@ -13,7 +13,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Common.Implementations.ScheduledTasks { @@ -304,6 +303,11 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks } } + public void ReloadTriggerEvents() + { + ReloadTriggerEvents(false); + } + /// /// Reloads the trigger events. /// diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs index 6c72441aa8..845c984fb7 100644 --- a/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs +++ b/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs @@ -12,6 +12,7 @@ using System.Linq; using System.Threading.Tasks; using CommonIO; using MediaBrowser.Common.IO; +using Microsoft.Win32; namespace MediaBrowser.Common.Implementations.ScheduledTasks { @@ -69,6 +70,28 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks _fileSystem = fileSystem; ScheduledTasks = new IScheduledTaskWorker[] { }; + + BindToSystemEvent(); + } + + private void BindToSystemEvent() + { + try + { + SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged; + } + catch + { + + } + } + + void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e) + { + foreach (var task in ScheduledTasks) + { + task.ReloadTriggerEvents(); + } } /// @@ -127,7 +150,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks { QueueScheduledTask(new TaskExecutionOptions()); } - + /// /// Queues the scheduled task. /// diff --git a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs index ae3c43d7e7..e36ff99501 100644 --- a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs +++ b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs @@ -19,7 +19,7 @@ namespace MediaBrowser.Common.Implementations.Security public class PluginSecurityManager : ISecurityManager { private const string MBValidateUrl = MbAdmin.HttpsUrl + "service/registration/validate"; - private const string AppstoreRegUrl = /*MbAdmin.HttpsUrl*/ "http://mb3admin.com/test/admin/" + "service/appstore/register"; + private const string AppstoreRegUrl = /*MbAdmin.HttpsUrl*/ "http://mb3admin.com/admin/" + "service/appstore/register"; /// /// The _is MB supporter @@ -199,7 +199,7 @@ namespace MediaBrowser.Common.Implementations.Security Url = AppstoreRegUrl, CancellationToken = CancellationToken.None }; - options.RequestHeaders.Add("X-Emby-Token", /*_appHost.SystemId*/ "08606E86D043"); + options.RequestHeaders.Add("X-Emby-Token", _appHost.SystemId); options.RequestContent = parameters; options.RequestContentType = "application/json"; -- cgit v1.2.3