aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.Common.Implementations/Updates/PackageManager.cs2
-rw-r--r--MediaBrowser.Common/Constants/Constants.cs13
-rw-r--r--MediaBrowser.Common/Extensions/BaseExtensions.cs42
-rw-r--r--MediaBrowser.Common/MediaBrowser.Common.csproj12
-rw-r--r--MediaBrowser.Common/Plugins/BasePlugin.cs6
-rw-r--r--MediaBrowser.Common/Plugins/IPlugin.cs6
-rw-r--r--MediaBrowser.Common/Properties/Resources.Designer.cs63
-rw-r--r--MediaBrowser.Common/Properties/Resources.resx121
-rw-r--r--MediaBrowser.Controller/Localization/Ratings.cs32
-rw-r--r--MediaBrowser.Controller/Providers/BaseItemXmlParser.cs15
-rw-r--r--MediaBrowser.ServerApplication/App.xaml.cs2
-rw-r--r--MediaBrowser.ServerApplication/ApplicationHost.cs2
12 files changed, 47 insertions, 269 deletions
diff --git a/MediaBrowser.Common.Implementations/Updates/PackageManager.cs b/MediaBrowser.Common.Implementations/Updates/PackageManager.cs
index 85edf038e..02a7a524f 100644
--- a/MediaBrowser.Common.Implementations/Updates/PackageManager.cs
+++ b/MediaBrowser.Common.Implementations/Updates/PackageManager.cs
@@ -47,7 +47,7 @@ namespace MediaBrowser.Common.Implementations.Updates
{
var data = new Dictionary<string, string> { { "key", _securityManager.SupporterKey }, { "mac", _networkManager.GetMacAddress() } };
- using (var json = await _httpClient.Post(Constants.Constants.MBAdminUrl + "service/package/retrieveall", data, cancellationToken).ConfigureAwait(false))
+ using (var json = await _httpClient.Post(Constants.Constants.MbAdminUrl + "service/package/retrieveall", data, cancellationToken).ConfigureAwait(false))
{
cancellationToken.ThrowIfCancellationRequested();
diff --git a/MediaBrowser.Common/Constants/Constants.cs b/MediaBrowser.Common/Constants/Constants.cs
index c1c79d199..27037db93 100644
--- a/MediaBrowser.Common/Constants/Constants.cs
+++ b/MediaBrowser.Common/Constants/Constants.cs
@@ -1,15 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
+
namespace MediaBrowser.Common.Constants
{
public static class Constants
{
- public const string MBAdminUrl = "http://www.mb3admin.com/admin/";
- public const string MBServerPkgName = "MBServer";
- public const string MBTheaterPkgName = "MBTheater";
+ public const string MbAdminUrl = "http://www.mb3admin.com/admin/";
+ public const string MbServerPkgName = "MBServer";
+ public const string MbTheaterPkgName = "MBTheater";
}
}
diff --git a/MediaBrowser.Common/Extensions/BaseExtensions.cs b/MediaBrowser.Common/Extensions/BaseExtensions.cs
index 604b2bdd2..9591862e7 100644
--- a/MediaBrowser.Common/Extensions/BaseExtensions.cs
+++ b/MediaBrowser.Common/Extensions/BaseExtensions.cs
@@ -12,37 +12,6 @@ namespace MediaBrowser.Common.Extensions
/// </summary>
public static class BaseExtensions
{
- /// <summary>
- /// Tries the add.
- /// </summary>
- /// <typeparam name="TKey">The type of the T key.</typeparam>
- /// <typeparam name="TValue">The type of the T value.</typeparam>
- /// <param name="dictionary">The dictionary.</param>
- /// <param name="key">The key.</param>
- /// <param name="value">The value.</param>
- /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
- public static bool TryAdd<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key, TValue value)
- {
- if (dictionary.ContainsKey(key))
- {
- return false;
- }
-
- dictionary.Add(key, value);
- return true;
- }
-
- /// <summary>
- /// Provides an additional overload for string.split
- /// </summary>
- /// <param name="val">The val.</param>
- /// <param name="separator">The separator.</param>
- /// <param name="options">The options.</param>
- /// <returns>System.String[][].</returns>
- public static string[] Split(this string val, char separator, StringSplitOptions options)
- {
- return val.Split(new[] { separator }, options);
- }
/// <summary>
/// Strips the HTML.
@@ -55,17 +24,6 @@ namespace MediaBrowser.Common.Extensions
const string pattern = @"<(.|\n)*?>";
return Regex.Replace(htmlString, pattern, string.Empty).Trim();
}
-
- /// <summary>
- /// Shuffles an IEnumerable
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="list">The list.</param>
- /// <returns>IEnumerable{``0}.</returns>
- public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> list)
- {
- return list.OrderBy(x => Guid.NewGuid());
- }
/// <summary>
/// Gets the M d5.
diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj
index f1e99f1e5..3af352291 100644
--- a/MediaBrowser.Common/MediaBrowser.Common.csproj
+++ b/MediaBrowser.Common/MediaBrowser.Common.csproj
@@ -91,11 +91,6 @@
<Compile Include="Net\WebSocketConnectEventArgs.cs" />
<Compile Include="Plugins\IPlugin.cs" />
<Compile Include="Progress\ActionableProgress.cs" />
- <Compile Include="Properties\Resources.Designer.cs">
- <AutoGen>True</AutoGen>
- <DesignTime>True</DesignTime>
- <DependentUpon>Resources.resx</DependentUpon>
- </Compile>
<Compile Include="ScheduledTasks\IScheduledTask.cs" />
<Compile Include="ScheduledTasks\IScheduledTaskWorker.cs" />
<Compile Include="ScheduledTasks\ITaskManager.cs" />
@@ -123,13 +118,6 @@
<Name>MediaBrowser.Model</Name>
</ProjectReference>
</ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Properties\Resources.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Resources.Designer.cs</LastGenOutput>
- <SubType>Designer</SubType>
- </EmbeddedResource>
- </ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs
index ebf1497f4..f0f5337cc 100644
--- a/MediaBrowser.Common/Plugins/BasePlugin.cs
+++ b/MediaBrowser.Common/Plugins/BasePlugin.cs
@@ -44,12 +44,6 @@ namespace MediaBrowser.Common.Plugins
}
/// <summary>
- /// Gets a value indicating whether this instance is first run.
- /// </summary>
- /// <value><c>true</c> if this instance is first run; otherwise, <c>false</c>.</value>
- public bool IsFirstRun { get; private set; }
-
- /// <summary>
/// Gets the type of configuration this plugin uses
/// </summary>
/// <value>The type of the configuration.</value>
diff --git a/MediaBrowser.Common/Plugins/IPlugin.cs b/MediaBrowser.Common/Plugins/IPlugin.cs
index 12aaa3fe7..c3b34869f 100644
--- a/MediaBrowser.Common/Plugins/IPlugin.cs
+++ b/MediaBrowser.Common/Plugins/IPlugin.cs
@@ -110,11 +110,5 @@ namespace MediaBrowser.Common.Plugins
/// Called when just before the plugin is uninstalled from the server.
/// </summary>
void OnUninstalling();
-
- /// <summary>
- /// Gets a value indicating whether this instance is first run.
- /// </summary>
- /// <value><c>true</c> if this instance is first run; otherwise, <c>false</c>.</value>
- bool IsFirstRun { get; }
}
} \ No newline at end of file
diff --git a/MediaBrowser.Common/Properties/Resources.Designer.cs b/MediaBrowser.Common/Properties/Resources.Designer.cs
deleted file mode 100644
index f39a1c1d9..000000000
--- a/MediaBrowser.Common/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.17929
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace MediaBrowser.Common.Properties {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediaBrowser.Common.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/MediaBrowser.Common/Properties/Resources.resx b/MediaBrowser.Common/Properties/Resources.resx
deleted file mode 100644
index 7c0911ec1..000000000
--- a/MediaBrowser.Common/Properties/Resources.resx
+++ /dev/null
@@ -1,121 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
-</root> \ No newline at end of file
diff --git a/MediaBrowser.Controller/Localization/Ratings.cs b/MediaBrowser.Controller/Localization/Ratings.cs
index a8fbdbc80..1220dd8a7 100644
--- a/MediaBrowser.Controller/Localization/Ratings.cs
+++ b/MediaBrowser.Controller/Localization/Ratings.cs
@@ -36,6 +36,26 @@ namespace MediaBrowser.Controller.Localization
private static readonly Dictionary<int, string> ratingsStrings = new Dictionary<int, string>();
/// <summary>
+ /// Tries the add.
+ /// </summary>
+ /// <typeparam name="TKey">The type of the T key.</typeparam>
+ /// <typeparam name="TValue">The type of the T value.</typeparam>
+ /// <param name="dictionary">The dictionary.</param>
+ /// <param name="key">The key.</param>
+ /// <param name="value">The value.</param>
+ /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
+ private static bool TryAdd<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, TValue value)
+ {
+ if (dictionary.ContainsKey(key))
+ {
+ return false;
+ }
+
+ dictionary.Add(key, value);
+ return true;
+ }
+
+ /// <summary>
/// Initializes the specified block unrated.
/// </summary>
/// <param name="blockUnrated">if set to <c>true</c> [block unrated].</param>
@@ -48,19 +68,19 @@ namespace MediaBrowser.Controller.Localization
var dict = new Dictionary<string, int> {{"None", -1}};
foreach (var pair in ratingsDef.RatingsDict)
{
- dict.TryAdd(pair.Key, pair.Value);
+ TryAdd(dict, pair.Key, pair.Value);
}
if (configurationManager.Configuration.MetadataCountryCode.ToUpper() != "US")
{
foreach (var pair in new USRatingsDictionary())
{
- dict.TryAdd(pair.Key, pair.Value);
+ TryAdd(dict, pair.Key, pair.Value);
}
}
//global values of CS
- dict.TryAdd("CS", 1000);
+ TryAdd(dict, "CS", 1000);
- dict.TryAdd("", blockUnrated ? 1000 : 0);
+ TryAdd(dict, "", blockUnrated ? 1000 : 0);
//and rating reverse lookup dictionary (non-redundant ones)
ratingsStrings.Clear();
@@ -71,11 +91,11 @@ namespace MediaBrowser.Controller.Localization
if (pair.Value > lastLevel)
{
lastLevel = pair.Value;
- ratingsStrings.TryAdd(pair.Value, pair.Key);
+ TryAdd(ratingsStrings, pair.Value, pair.Key);
}
}
- ratingsStrings.TryAdd(999, "CS");
+ TryAdd(ratingsStrings, 999, "CS");
return dict;
}
diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs
index 14c4b7ea4..41a32d7fd 100644
--- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs
+++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs
@@ -617,7 +617,20 @@ namespace MediaBrowser.Controller.Providers
value = value.Trim().Trim(separator);
- return string.IsNullOrWhiteSpace(value) ? new string[] { } : value.Split(separator, StringSplitOptions.RemoveEmptyEntries);
+ return string.IsNullOrWhiteSpace(value) ? new string[] { } : Split(value, separator, StringSplitOptions.RemoveEmptyEntries);
}
+
+ /// <summary>
+ /// Provides an additional overload for string.split
+ /// </summary>
+ /// <param name="val">The val.</param>
+ /// <param name="separator">The separator.</param>
+ /// <param name="options">The options.</param>
+ /// <returns>System.String[][].</returns>
+ private static string[] Split(string val, char separator, StringSplitOptions options)
+ {
+ return val.Split(new[] { separator }, options);
+ }
+
}
}
diff --git a/MediaBrowser.ServerApplication/App.xaml.cs b/MediaBrowser.ServerApplication/App.xaml.cs
index 3161048f0..f446b4dc4 100644
--- a/MediaBrowser.ServerApplication/App.xaml.cs
+++ b/MediaBrowser.ServerApplication/App.xaml.cs
@@ -32,7 +32,7 @@ namespace MediaBrowser.ServerApplication
{
// Look for the existence of an update archive
var appPaths = new ServerApplicationPaths();
- var updateArchive = Path.Combine(appPaths.TempUpdatePath, Constants.MBServerPkgName + ".zip");
+ var updateArchive = Path.Combine(appPaths.TempUpdatePath, Constants.MbServerPkgName + ".zip");
if (File.Exists(updateArchive))
{
// Update is there - execute update
diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs
index 582b73a31..afc68fe67 100644
--- a/MediaBrowser.ServerApplication/ApplicationHost.cs
+++ b/MediaBrowser.ServerApplication/ApplicationHost.cs
@@ -424,7 +424,7 @@ namespace MediaBrowser.ServerApplication
public async override Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress)
{
var availablePackages = await PackageManager.GetAvailablePackages(CancellationToken.None).ConfigureAwait(false);
- var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, Constants.MBServerPkgName, ConfigurationManager.CommonConfiguration.SystemUpdateLevel);
+ var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, Constants.MbServerPkgName, ConfigurationManager.CommonConfiguration.SystemUpdateLevel);
return version != null ? new CheckForUpdateResult { AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version } :
new CheckForUpdateResult { AvailableVersion = ApplicationVersion, IsUpdateAvailable = false };