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 { { "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 /// public static class BaseExtensions { - /// - /// Tries the add. - /// - /// The type of the T key. - /// The type of the T value. - /// The dictionary. - /// The key. - /// The value. - /// true if XXXX, false otherwise - public static bool TryAdd(this Dictionary dictionary, TKey key, TValue value) - { - if (dictionary.ContainsKey(key)) - { - return false; - } - - dictionary.Add(key, value); - return true; - } - - /// - /// Provides an additional overload for string.split - /// - /// The val. - /// The separator. - /// The options. - /// System.String[][]. - public static string[] Split(this string val, char separator, StringSplitOptions options) - { - return val.Split(new[] { separator }, options); - } /// /// Strips the HTML. @@ -55,17 +24,6 @@ namespace MediaBrowser.Common.Extensions const string pattern = @"<(.|\n)*?>"; return Regex.Replace(htmlString, pattern, string.Empty).Trim(); } - - /// - /// Shuffles an IEnumerable - /// - /// - /// The list. - /// IEnumerable{``0}. - public static IEnumerable Shuffle(this IEnumerable list) - { - return list.OrderBy(x => Guid.NewGuid()); - } /// /// 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 @@ - - True - True - Resources.resx - @@ -123,13 +118,6 @@ MediaBrowser.Model - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - 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 @@ -43,12 +43,6 @@ namespace MediaBrowser.Common.Plugins get { return string.Empty; } } - /// - /// Gets a value indicating whether this instance is first run. - /// - /// true if this instance is first run; otherwise, false. - public bool IsFirstRun { get; private set; } - /// /// Gets the type of configuration this plugin uses /// 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. /// void OnUninstalling(); - - /// - /// Gets a value indicating whether this instance is first run. - /// - /// true if this instance is first run; otherwise, false. - 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 @@ -//------------------------------------------------------------------------------ -// -// 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. -// -//------------------------------------------------------------------------------ - -namespace MediaBrowser.Common.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // 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() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [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; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - \ 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 @@ -35,6 +35,26 @@ namespace MediaBrowser.Controller.Localization /// private static readonly Dictionary ratingsStrings = new Dictionary(); + /// + /// Tries the add. + /// + /// The type of the T key. + /// The type of the T value. + /// The dictionary. + /// The key. + /// The value. + /// true if XXXX, false otherwise + private static bool TryAdd(Dictionary dictionary, TKey key, TValue value) + { + if (dictionary.ContainsKey(key)) + { + return false; + } + + dictionary.Add(key, value); + return true; + } + /// /// Initializes the specified block unrated. /// @@ -48,19 +68,19 @@ namespace MediaBrowser.Controller.Localization var dict = new Dictionary {{"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); } + + /// + /// Provides an additional overload for string.split + /// + /// The val. + /// The separator. + /// The options. + /// System.String[][]. + 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 CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress 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 };