This commit is contained in:
LukePulverenti 2013-03-14 15:53:03 -04:00
commit 08f0ba8335
5 changed files with 17 additions and 9 deletions

View File

@ -500,14 +500,14 @@ namespace MediaBrowser.Common.Implementations
if (ConfigurationManager.CommonConfiguration.RunAtStartup) if (ConfigurationManager.CommonConfiguration.RunAtStartup)
{ {
//Copy our shortut into the startup folder for this user //Copy our shortut into the startup folder for this user
File.Copy(ProductShortcutPath, Environment.GetFolderPath(Environment.SpecialFolder.Startup), true); File.Copy(ProductShortcutPath, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup),Path.GetFileName(ProductShortcutPath) ?? "MBstartup.lnk"), true);
} }
else else
{ {
//Remove our shortcut from the startup folder for this user //Remove our shortcut from the startup folder for this user
try try
{ {
File.Delete(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), Path.GetFileName(ProductShortcutPath))); File.Delete(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), Path.GetFileName(ProductShortcutPath) ?? "MBstartup.lnk"));
} }
catch (FileNotFoundException) catch (FileNotFoundException)
{ {

View File

@ -47,6 +47,13 @@ namespace MediaBrowser.Common.Implementations.Security
private IJsonSerializer _jsonSerializer; private IJsonSerializer _jsonSerializer;
private IApplicationHost _appHost; private IApplicationHost _appHost;
private IEnumerable<IRequiresRegistration> _registeredEntities; private IEnumerable<IRequiresRegistration> _registeredEntities;
protected IEnumerable<IRequiresRegistration> RegisteredEntities
{
get
{
return _registeredEntities ?? (_registeredEntities = _appHost.GetExports<IRequiresRegistration>());
}
}
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="PluginSecurityManager" /> class. /// Initializes a new instance of the <see cref="PluginSecurityManager" /> class.
@ -61,7 +68,6 @@ namespace MediaBrowser.Common.Implementations.Security
_appHost = appHost; _appHost = appHost;
_httpClient = httpClient; _httpClient = httpClient;
_jsonSerializer = jsonSerializer; _jsonSerializer = jsonSerializer;
_registeredEntities = _appHost.GetExports<IRequiresRegistration>();
MBRegistration.Init(appPaths); MBRegistration.Init(appPaths);
} }
@ -74,7 +80,7 @@ namespace MediaBrowser.Common.Implementations.Security
var tasks = new List<Task>(); var tasks = new List<Task>();
ResetSupporterInfo(); ResetSupporterInfo();
tasks.AddRange(_registeredEntities.Select(i => i.LoadRegistrationInfoAsync())); tasks.AddRange(RegisteredEntities.Select(i => i.LoadRegistrationInfoAsync()));
await Task.WhenAll(tasks); await Task.WhenAll(tasks);
} }

View File

@ -699,9 +699,9 @@ namespace MediaBrowser.Controller.Entities
await Task.WhenAll(saveTasks).ConfigureAwait(false); await Task.WhenAll(saveTasks).ConfigureAwait(false);
//and save children in repo... //and save children in repo... but never save virtual plugin folders as they will always be re-created by the plugin
Logger.Info("*** Saving " + newChildren.Count + " children for " + Name); Logger.Info("*** Saving " + newChildren.Count + " children for " + Name);
await Kernel.Instance.ItemRepository.SaveChildren(Id, newChildren, CancellationToken.None).ConfigureAwait(false); await Kernel.Instance.ItemRepository.SaveChildren(Id, newChildren.Where(c => !(c is BasePluginFolder)), CancellationToken.None).ConfigureAwait(false);
} }
if (changedArgs.HasChange) if (changedArgs.HasChange)

View File

@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Net; using System.Net;
using MediaBrowser.Common.Net; using MediaBrowser.Common.Net;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
@ -228,7 +229,8 @@ namespace MediaBrowser.Controller.Providers.Music
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
if (!ConfigurationManager.Configuration.SaveLocalMeta || !HasLocalMeta(item) || (force && !HasLocalMeta(item)) || (RefreshOnVersionChange && item.ProviderData[Id].ProviderVersion != ProviderVersion)) var providerData = item.ProviderData.GetValueOrDefault(Id, new BaseProviderInfo { ProviderId = Id });
if (!ConfigurationManager.Configuration.SaveLocalMeta || !HasLocalMeta(item) || (force && !HasLocalMeta(item)) || (RefreshOnVersionChange && providerData.ProviderVersion != ProviderVersion))
{ {
try try
{ {

View File

@ -52,8 +52,8 @@
if (new Date(pkg.expDate).getTime() < new Date(1970, 1, 1).getTime()) { if (new Date(pkg.expDate).getTime() < new Date(1970, 1, 1).getTime()) {
regStatus += "This feature has no registration information"; regStatus += "This feature has no registration information";
} else { } else {
if (pkg.expDate <= new Date().getTime()) { if (new Date(pkg.expDate).getTime() <= new Date().getTime()) {
regStatus += "The trial period for this feature has expired on this machine"; regStatus += "The trial period for this feature has expired";
} else { } else {
regStatus += "The trial period for this feature will expire in " + Math.round((new Date(pkg.expDate).getTime() - new Date().getTime()) / (86400000)) + " day(s)"; regStatus += "The trial period for this feature will expire in " + Math.round((new Date(pkg.expDate).getTime() - new Date().getTime()) / (86400000)) + " day(s)";
} }