prep for portable common

This commit is contained in:
Luke Pulverenti 2016-10-23 15:47:34 -04:00
parent 07791d46a5
commit 0f8ccfaf49
38 changed files with 71 additions and 113 deletions

View File

@ -1,5 +1,4 @@
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Tasks;
using ServiceStack;

View File

@ -1,5 +1,4 @@
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Tasks;

View File

@ -445,20 +445,28 @@ namespace MediaBrowser.Common.Implementations
private IPlugin LoadPlugin(IPlugin plugin)
{
var assemblyPlugin = plugin as IPluginAssembly;
if (assemblyPlugin != null)
try
{
var assembly = plugin.GetType().Assembly;
var assemblyName = assembly.GetName();
var assemblyPlugin = plugin as IPluginAssembly;
var attribute = (GuidAttribute)assembly.GetCustomAttributes(typeof(GuidAttribute), true)[0];
var assemblyId = new Guid(attribute.Value);
if (assemblyPlugin != null)
{
var assembly = plugin.GetType().Assembly;
var assemblyName = assembly.GetName();
var assemblyFileName = assemblyName.Name + ".dll";
var assemblyFilePath = Path.Combine(ApplicationPaths.PluginsPath, assemblyFileName);
var attribute = (GuidAttribute)assembly.GetCustomAttributes(typeof(GuidAttribute), true)[0];
var assemblyId = new Guid(attribute.Value);
assemblyPlugin.SetAttributes(assemblyFilePath, assemblyFileName, assemblyName.Version, assemblyId);
var assemblyFileName = assemblyName.Name + ".dll";
var assemblyFilePath = Path.Combine(ApplicationPaths.PluginsPath, assemblyFileName);
assemblyPlugin.SetAttributes(assemblyFilePath, assemblyFileName, assemblyName.Version, assemblyId);
}
}
catch (Exception ex)
{
Logger.ErrorException("Error loading plugin {0}", ex, plugin.GetType().FullName);
return null;
}
return plugin;
@ -596,7 +604,7 @@ namespace MediaBrowser.Common.Implementations
}
catch (Exception ex)
{
Logger.ErrorException("Error creating {0}", ex, type.Name);
Logger.ErrorException("Error creating {0}", ex, type.FullName);
throw;
}
@ -615,7 +623,7 @@ namespace MediaBrowser.Common.Implementations
}
catch (Exception ex)
{
Logger.ErrorException("Error creating {0}", ex, type.Name);
Logger.ErrorException("Error creating {0}", ex, type.FullName);
// Don't blow up in release mode
return null;
}

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -13,7 +13,8 @@
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -67,13 +68,8 @@
<Compile Include="Plugins\IDependencyModule.cs" />
<Compile Include="Plugins\IPlugin.cs" />
<Compile Include="Progress\ActionableProgress.cs" />
<Compile Include="ScheduledTasks\IScheduledTaskWorker.cs" />
<Compile Include="ScheduledTasks\ITaskManager.cs" />
<Compile Include="ScheduledTasks\ITaskTrigger.cs" />
<Compile Include="ScheduledTasks\ScheduledTaskHelpers.cs" />
<Compile Include="Plugins\BasePlugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScheduledTasks\TaskCompletionEventArgs.cs" />
<Compile Include="Security\IRequiresRegistration.cs" />
<Compile Include="Security\ISecurityManager.cs" />
<Compile Include="Security\PaymentRequiredException.cs" />

View File

@ -11,6 +11,7 @@ using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Controller.Entities.Audio
{

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Runtime.Serialization;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Controller.Entities.Audio
{

View File

@ -26,6 +26,7 @@ using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Providers;

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Runtime.Serialization;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Controller.Entities
{

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Controller.Entities
{

View File

@ -6,6 +6,7 @@ using System.Runtime.Serialization;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Controller.Entities
{

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Runtime.Serialization;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Controller.Entities
{

View File

@ -2,17 +2,14 @@
using System.Globalization;
using System.Linq;
using System.Text;
using MediaBrowser.Model.Cryptography;
namespace MediaBrowser.Controller.Extensions
{
/// <summary>
/// Class BaseExtensions
/// </summary>
public static class BaseExtensions
public static class StringExtensions
{
public static ICryptographyProvider CryptographyProvider { get; set; }
public static string RemoveDiacritics(this string text)
{
return String.Concat(

View File

@ -165,7 +165,7 @@
<Compile Include="Entities\TagExtensions.cs" />
<Compile Include="Entities\UserView.cs" />
<Compile Include="Entities\UserViewBuilder.cs" />
<Compile Include="Extensions\BaseExtensions.cs" />
<Compile Include="Extensions\StringExtensions.cs" />
<Compile Include="FileOrganization\IFileOrganizationService.cs" />
<Compile Include="IO\ThrottledStream.cs" />
<Compile Include="Library\DeleteOptions.cs" />

View File

@ -171,7 +171,7 @@ namespace MediaBrowser.Model.Dlna
}
bool expected;
if (BoolHelper.TryParseCultureInvariant(condition.Value, out expected))
if (bool.TryParse(condition.Value, out expected))
{
switch (condition.Condition)
{
@ -196,7 +196,7 @@ namespace MediaBrowser.Model.Dlna
}
float expected;
if (FloatHelper.TryParseCultureInvariant(condition.Value, out expected))
if (float.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out expected))
{
switch (condition.Condition)
{
@ -225,7 +225,7 @@ namespace MediaBrowser.Model.Dlna
}
double expected;
if (DoubleHelper.TryParseCultureInvariant(condition.Value, out expected))
if (double.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out expected))
{
switch (condition.Condition)
{

View File

@ -1111,7 +1111,7 @@ namespace MediaBrowser.Model.Dlna
case ProfileConditionValue.VideoFramerate:
{
float num;
if (FloatHelper.TryParseCultureInvariant(value, out num))
if (float.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
{
item.MaxFramerate = num;
}

View File

@ -1,4 +1,4 @@
using MediaBrowser.Model.Extensions;
using System.Globalization;
namespace MediaBrowser.Model.Drawing
{
@ -71,12 +71,12 @@ namespace MediaBrowser.Model.Drawing
{
double val;
if (DoubleHelper.TryParseCultureInvariant(parts[0], out val))
if (double.TryParse(parts[0], NumberStyles.Any, CultureInfo.InvariantCulture, out val))
{
_width = val;
}
if (DoubleHelper.TryParseCultureInvariant(parts[1], out val))
if (double.TryParse(parts[1], NumberStyles.Any, CultureInfo.InvariantCulture, out val))
{
_height = val;
}

View File

@ -1,16 +0,0 @@
namespace MediaBrowser.Model.Extensions
{
public static class BoolHelper
{
/// <summary>
/// Tries the parse culture invariant.
/// </summary>
/// <param name="s">The s.</param>
/// <param name="result">The result.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public static bool TryParseCultureInvariant(string s, out bool result)
{
return bool.TryParse(s, out result);
}
}
}

View File

@ -1,21 +0,0 @@
using System.Globalization;
namespace MediaBrowser.Model.Extensions
{
/// <summary>
/// Isolating these helpers allow this entire project to be easily converted to Java
/// </summary>
public static class DoubleHelper
{
/// <summary>
/// Tries the parse culture invariant.
/// </summary>
/// <param name="s">The s.</param>
/// <param name="result">The result.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public static bool TryParseCultureInvariant(string s, out double result)
{
return double.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out result);
}
}
}

View File

@ -1,18 +0,0 @@
using System.Globalization;
namespace MediaBrowser.Model.Extensions
{
public static class FloatHelper
{
/// <summary>
/// Tries the parse culture invariant.
/// </summary>
/// <param name="s">The s.</param>
/// <param name="result">The result.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public static bool TryParseCultureInvariant(string s, out float result)
{
return float.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out result);
}
}
}

View File

@ -144,8 +144,6 @@
<Compile Include="Configuration\DynamicDayOfWeek.cs" />
<Compile Include="Entities\ExtraType.cs" />
<Compile Include="Entities\TrailerType.cs" />
<Compile Include="Extensions\BoolHelper.cs" />
<Compile Include="Extensions\FloatHelper.cs" />
<Compile Include="FileOrganization\AutoOrganizeOptions.cs" />
<Compile Include="FileOrganization\TvFileOrganizationOptions.cs" />
<Compile Include="Configuration\BaseApplicationConfiguration.cs" />
@ -218,7 +216,6 @@
<Compile Include="Entities\ScrollDirection.cs" />
<Compile Include="Entities\SortOrder.cs" />
<Compile Include="Events\GenericEventArgs.cs" />
<Compile Include="Extensions\DoubleHelper.cs" />
<Compile Include="Extensions\ListHelper.cs" />
<Compile Include="Extensions\StringHelper.cs" />
<Compile Include="FileOrganization\EpisodeFileOrganizationRequest.cs" />
@ -389,6 +386,11 @@
<Compile Include="System\PublicSystemInfo.cs" />
<Compile Include="Tasks\IConfigurableScheduledTask.cs" />
<Compile Include="Tasks\IScheduledTask.cs" />
<Compile Include="Tasks\IScheduledTaskWorker.cs" />
<Compile Include="Tasks\ITaskManager.cs" />
<Compile Include="Tasks\ITaskTrigger.cs" />
<Compile Include="Tasks\ScheduledTaskHelpers.cs" />
<Compile Include="Tasks\TaskCompletionEventArgs.cs" />
<Compile Include="Tasks\TaskExecutionOptions.cs" />
<Compile Include="Updates\CheckForUpdateResult.cs" />
<Compile Include="Updates\PackageTargetSystem.cs" />

View File

@ -1,8 +1,7 @@
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Tasks;
using System;
using System;
using MediaBrowser.Model.Events;
namespace MediaBrowser.Common.ScheduledTasks
namespace MediaBrowser.Model.Tasks
{
/// <summary>
/// Interface IScheduledTaskWorker
@ -60,7 +59,7 @@ namespace MediaBrowser.Common.ScheduledTasks
/// Gets the triggers that define when the task will run
/// </summary>
/// <value>The triggers.</value>
/// <exception cref="System.ArgumentNullException">value</exception>
/// <exception cref="ArgumentNullException">value</exception>
TaskTriggerInfo[] Triggers { get; set; }
/// <summary>

View File

@ -1,10 +1,9 @@
using MediaBrowser.Model.Events;
using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Model.Events;
namespace MediaBrowser.Common.ScheduledTasks
namespace MediaBrowser.Model.Tasks
{
public interface ITaskManager : IDisposable
{

View File

@ -1,9 +1,8 @@
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Tasks;
using System;
using System;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Logging;
namespace MediaBrowser.Common.ScheduledTasks
namespace MediaBrowser.Model.Tasks
{
/// <summary>
/// Interface ITaskTrigger

View File

@ -1,8 +1,7 @@
using MediaBrowser.Model.Tasks;
using System;
using System;
using System.Linq;
namespace MediaBrowser.Common.ScheduledTasks
namespace MediaBrowser.Model.Tasks
{
/// <summary>
/// Class ScheduledTaskHelpers

View File

@ -1,7 +1,6 @@
using MediaBrowser.Model.Tasks;
using System;
using System;
namespace MediaBrowser.Common.ScheduledTasks
namespace MediaBrowser.Model.Tasks
{
public class TaskCompletionEventArgs : EventArgs
{

View File

@ -1,5 +1,4 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;

View File

@ -11,9 +11,9 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Providers.TV
{

View File

@ -13,6 +13,7 @@ using MediaBrowser.Model.Sync;
using System;
using System.Collections.Generic;
using System.Threading;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.EntryPoints
{

View File

@ -7,6 +7,7 @@ using MediaBrowser.Model.FileOrganization;
using MediaBrowser.Model.Logging;
using System;
using System.Threading;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.FileOrganization
{

View File

@ -18,6 +18,7 @@ using CommonIO;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Events;
using MediaBrowser.Common.Events;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.FileOrganization
{

View File

@ -12,6 +12,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Server.Implementations.ScheduledTasks;
namespace MediaBrowser.Server.Implementations.IO

View File

@ -14,6 +14,7 @@ using System.Linq;
using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Controller;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.IO
{

View File

@ -43,6 +43,7 @@ using MediaBrowser.Server.Implementations.Library.Resolvers;
using SortOrder = MediaBrowser.Model.Entities.SortOrder;
using VideoResolver = MediaBrowser.Naming.Video.VideoResolver;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.Library
{

View File

@ -11,6 +11,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Server.Implementations.Library
{

View File

@ -35,6 +35,7 @@ using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Server.Implementations.LiveTv.Listings;
namespace MediaBrowser.Server.Implementations.LiveTv

View File

@ -26,6 +26,7 @@ using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Controller.Playlists;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Server.Implementations.Devices;

View File

@ -31,6 +31,7 @@ using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.Sync
{

View File

@ -1,6 +1,7 @@
using System.Threading.Tasks;
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Server.Implementations.Persistence;
namespace MediaBrowser.Server.Startup.Common.Migrations