resharper suggestions in server implementations
This commit is contained in:
parent
ff1db0a173
commit
7097b9aa75
|
@ -1,5 +1,4 @@
|
|||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Updates;
|
||||
using MediaBrowser.Model.Weather;
|
||||
using ProtoBuf;
|
||||
using System;
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace MediaBrowser.Model.Entities
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ProtoBuf;
|
||||
using ProtoBuf;
|
||||
|
||||
namespace MediaBrowser.Model.Entities
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace MediaBrowser.Model.Querying
|
|||
/// <value>The size of the page.</value>
|
||||
public int? Limit { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="GetItemsByName" /> is recursive.
|
||||
/// Gets or sets a value indicating whether this <see cref="ItemsByNameQuery"/> is recursive.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if recursive; otherwise, <c>false</c>.</value>
|
||||
public bool Recursive { get; set; }
|
||||
|
|
|
@ -598,7 +598,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||
/// </summary>
|
||||
/// <param name="hasOptions">The has options.</param>
|
||||
/// <param name="responseHeaders">The response headers.</param>
|
||||
private void AddResponseHeaders(IHasOptions hasOptions, IDictionary<string, string> responseHeaders)
|
||||
private void AddResponseHeaders(IHasOptions hasOptions, IEnumerable<KeyValuePair<string, string>> responseHeaders)
|
||||
{
|
||||
foreach (var item in responseHeaders)
|
||||
{
|
||||
|
|
|
@ -3,7 +3,6 @@ using MediaBrowser.Common;
|
|||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using ServiceStack.Api.Swagger;
|
||||
using ServiceStack.Common.Web;
|
||||
using ServiceStack.Configuration;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
|
@ -76,7 +75,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
public event EventHandler<ChildrenChangedEventArgs> LibraryChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="E:LibraryChanged" /> event.
|
||||
/// Reports the library changed.
|
||||
/// </summary>
|
||||
/// <param name="args">The <see cref="ChildrenChangedEventArgs" /> instance containing the event data.</param>
|
||||
public void ReportLibraryChanged(ChildrenChangedEventArgs args)
|
||||
|
@ -753,7 +752,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
await RootFolder.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// Start by just validating the children of the root, but go no further
|
||||
await RootFolder.ValidateChildren(new Progress<double> { }, cancellationToken, recursive: false);
|
||||
await RootFolder.ValidateChildren(new Progress<double>(), cancellationToken, recursive: false);
|
||||
|
||||
foreach (var folder in _userManager.Users.Select(u => u.RootFolder).Distinct())
|
||||
{
|
||||
|
@ -777,7 +776,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
await userRootFolder.ValidateChildren(new Progress<double> { }, cancellationToken, recursive: false).ConfigureAwait(false);
|
||||
await userRootFolder.ValidateChildren(new Progress<double>(), cancellationToken, recursive: false).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -84,6 +84,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
|||
/// Sets the provider id from path.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="path">The path.</param>
|
||||
private void SetProviderIdFromPath(Series item, string path)
|
||||
{
|
||||
var justName = Path.GetFileName(path);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
|
|
|
@ -298,7 +298,7 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
|
|||
/// <exception cref="System.ArgumentException">Unrecognized InputType</exception>
|
||||
public string GetInputArgument(string[] inputFiles, InputType type)
|
||||
{
|
||||
string inputPath = null;
|
||||
string inputPath;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
@ -439,7 +439,7 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
|
|||
{
|
||||
var lines = standardError.Split('\n').Select(l => l.TrimStart());
|
||||
|
||||
var chapters = new List<ChapterInfo> { };
|
||||
var chapters = new List<ChapterInfo>();
|
||||
|
||||
ChapterInfo lastChapter = null;
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.IO;
|
||||
|
@ -86,10 +85,7 @@ namespace MediaBrowser.Server.Implementations.Providers
|
|||
void configurationManager_ConfigurationUpdated(object sender, EventArgs e)
|
||||
{
|
||||
// Validate currently executing providers, in the background
|
||||
Task.Run(() =>
|
||||
{
|
||||
ValidateCurrentlyRunningProviders();
|
||||
});
|
||||
Task.Run(() => ValidateCurrentlyRunningProviders());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
|
|||
/// <returns>IEnumerable{System.String}.</returns>
|
||||
private IEnumerable<string> GetPathsInUse(BaseItem item)
|
||||
{
|
||||
IEnumerable<string> images = new List<string> { };
|
||||
IEnumerable<string> images = new List<string>();
|
||||
|
||||
if (item.Images != null)
|
||||
{
|
||||
|
|
|
@ -17,25 +17,20 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
|
|||
/// </summary>
|
||||
public class PluginUpdateTask : IScheduledTask
|
||||
{
|
||||
/// <summary>
|
||||
/// The _kernel
|
||||
/// </summary>
|
||||
private readonly Kernel _kernel;
|
||||
/// <summary>
|
||||
/// The _logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private IInstallationManager _installationManager;
|
||||
private readonly IInstallationManager _installationManager;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PluginUpdateTask" /> class.
|
||||
/// </summary>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
public PluginUpdateTask(Kernel kernel, ILogger logger, IInstallationManager installationManager)
|
||||
/// <param name="installationManager">The installation manager.</param>
|
||||
public PluginUpdateTask(ILogger logger, IInstallationManager installationManager)
|
||||
{
|
||||
_kernel = kernel;
|
||||
_logger = logger;
|
||||
_installationManager = installationManager;
|
||||
}
|
||||
|
@ -78,7 +73,7 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
|
|||
|
||||
try
|
||||
{
|
||||
await _installationManager.InstallPackage(i, new Progress<double> { }, cancellationToken).ConfigureAwait(false);
|
||||
await _installationManager.InstallPackage(i, new Progress<double>(), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
|
|
|
@ -32,12 +32,6 @@ namespace MediaBrowser.Server.Implementations.ServerManager
|
|||
/// <value>The json serializer.</value>
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
|
||||
/// <summary>
|
||||
/// This subscribes to HttpListener requests and finds the appropriate BaseHandler to process it
|
||||
/// </summary>
|
||||
/// <value>The HTTP listener.</value>
|
||||
private IDisposable HttpListener { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The web socket connections
|
||||
/// </summary>
|
||||
|
@ -313,11 +307,6 @@ namespace MediaBrowser.Server.Implementations.ServerManager
|
|||
HttpServer.Dispose();
|
||||
}
|
||||
|
||||
if (HttpListener != null)
|
||||
{
|
||||
HttpListener.Dispose();
|
||||
}
|
||||
|
||||
DisposeExternalWebSocketServer();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller.Persistence;
|
|||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
|
|
@ -25,12 +25,13 @@ namespace MediaBrowser.Server.Implementations.Udp
|
|||
private readonly INetworkManager _networkManager;
|
||||
|
||||
private readonly IServerConfigurationManager _serverConfigurationManager;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UdpServer" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="networkManager">The network manager.</param>
|
||||
/// <param name="serverConfigurationManager">The server configuration manager.</param>
|
||||
public UdpServer(ILogger logger, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
|
||||
{
|
||||
_logger = logger;
|
||||
|
@ -41,10 +42,10 @@ namespace MediaBrowser.Server.Implementations.Udp
|
|||
/// <summary>
|
||||
/// Raises the <see cref="E:MessageReceived" /> event.
|
||||
/// </summary>
|
||||
/// <param name="e">The <see cref="UdpMessageReceivedEventArgs" /> instance containing the event data.</param>
|
||||
/// <param name="e">The <see cref="UdpMessageReceivedEventArgs"/> instance containing the event data.</param>
|
||||
private async void OnMessageReceived(UdpMessageReceivedEventArgs e)
|
||||
{
|
||||
var context = "Server";
|
||||
const string context = "Server";
|
||||
|
||||
var expectedMessage = String.Format("who is MediaBrowser{0}?", context);
|
||||
var expectedMessageBytes = Encoding.UTF8.GetBytes(expectedMessage);
|
||||
|
|
|
@ -335,7 +335,7 @@ namespace MediaBrowser.Server.Implementations.Updates
|
|||
CurrentInstallations.Add(tuple);
|
||||
}
|
||||
|
||||
var innerProgress = new ActionableProgress<double> { };
|
||||
var innerProgress = new ActionableProgress<double>();
|
||||
|
||||
// Whenever the progress updates, update the outer progress object and InstallationInfo
|
||||
innerProgress.RegisterAction(percent =>
|
||||
|
@ -347,7 +347,7 @@ namespace MediaBrowser.Server.Implementations.Updates
|
|||
|
||||
var linkedToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, innerCancellationTokenSource.Token).Token;
|
||||
|
||||
EventHelper.QueueEventIfNotNull(PackageInstalling, this, new GenericEventArgs<InstallationInfo>() { Argument = installationInfo }, _logger);
|
||||
EventHelper.QueueEventIfNotNull(PackageInstalling, this, new GenericEventArgs<InstallationInfo> { Argument = installationInfo }, _logger);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -360,7 +360,7 @@ namespace MediaBrowser.Server.Implementations.Updates
|
|||
|
||||
CompletedInstallations.Add(installationInfo);
|
||||
|
||||
EventHelper.QueueEventIfNotNull(PackageInstallationCompleted, this, new GenericEventArgs<InstallationInfo>() { Argument = installationInfo }, _logger);
|
||||
EventHelper.QueueEventIfNotNull(PackageInstallationCompleted, this, new GenericEventArgs<InstallationInfo> { Argument = installationInfo }, _logger);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
|
@ -371,7 +371,7 @@ namespace MediaBrowser.Server.Implementations.Updates
|
|||
|
||||
_logger.Info("Package installation cancelled: {0} {1}", package.name, package.versionStr);
|
||||
|
||||
EventHelper.QueueEventIfNotNull(PackageInstallationCancelled, this, new GenericEventArgs<InstallationInfo>() { Argument = installationInfo }, _logger);
|
||||
EventHelper.QueueEventIfNotNull(PackageInstallationCancelled, this, new GenericEventArgs<InstallationInfo> { Argument = installationInfo }, _logger);
|
||||
|
||||
throw;
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ namespace MediaBrowser.Server.Implementations.Updates
|
|||
CurrentInstallations.Remove(tuple);
|
||||
}
|
||||
|
||||
EventHelper.QueueEventIfNotNull(PackageInstallationFailed, this, new GenericEventArgs<InstallationInfo>() { Argument = installationInfo }, _logger);
|
||||
EventHelper.QueueEventIfNotNull(PackageInstallationFailed, this, new GenericEventArgs<InstallationInfo> { Argument = installationInfo }, _logger);
|
||||
|
||||
throw;
|
||||
}
|
||||
|
|
|
@ -33,11 +33,12 @@ namespace MediaBrowser.Server.Implementations.WorldWeatherOnline
|
|||
/// The _HTTP client
|
||||
/// </summary>
|
||||
private IHttpClient HttpClient { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WeatherProvider" /> class.
|
||||
/// </summary>
|
||||
/// <param name="jsonSerializer">The json serializer.</param>
|
||||
/// <param name="httpClient">The HTTP client.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <exception cref="System.ArgumentNullException">logger</exception>
|
||||
public WeatherProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, ILogger logger)
|
||||
|
|
Loading…
Reference in New Issue
Block a user