Merge pull request #2374 from Bond-009/warn15
Fix some warnings in MediaBrowser.Controller
This commit is contained in:
commit
9af149b02d
|
@ -135,57 +135,4 @@ namespace MediaBrowser.Controller.Entities
|
|||
return hasChanges;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is the small Person stub that is attached to BaseItems
|
||||
/// </summary>
|
||||
public class PersonInfo : IHasProviderIds
|
||||
{
|
||||
public PersonInfo()
|
||||
{
|
||||
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public Guid ItemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the role.
|
||||
/// </summary>
|
||||
/// <value>The role.</value>
|
||||
public string Role { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the sort order - ascending
|
||||
/// </summary>
|
||||
/// <value>The sort order.</value>
|
||||
public int? SortOrder { get; set; }
|
||||
|
||||
public string ImageUrl { get; set; }
|
||||
|
||||
public Dictionary<string, string> ProviderIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="string" /> that represents this instance.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="string" /> that represents this instance.</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public bool IsType(string type)
|
||||
{
|
||||
return string.Equals(Type, type, StringComparison.OrdinalIgnoreCase) || string.Equals(Role, type, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
63
MediaBrowser.Controller/Entities/PersonInfo.cs
Normal file
63
MediaBrowser.Controller/Entities/PersonInfo.cs
Normal file
|
@ -0,0 +1,63 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a small Person stub that is attached to BaseItems.
|
||||
/// </summary>
|
||||
public sealed class PersonInfo : IHasProviderIds
|
||||
{
|
||||
public PersonInfo()
|
||||
{
|
||||
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public Guid ItemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the role.
|
||||
/// </summary>
|
||||
/// <value>The role.</value>
|
||||
public string Role { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ascending sort order.
|
||||
/// </summary>
|
||||
/// <value>The sort order.</value>
|
||||
public int? SortOrder { get; set; }
|
||||
|
||||
public string ImageUrl { get; set; }
|
||||
|
||||
public Dictionary<string, string> ProviderIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="string" /> that represents this instance.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="string" /> that represents this instance.</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public bool IsType(string type)
|
||||
{
|
||||
return string.Equals(Type, type, StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(Role, type, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,4 +26,16 @@
|
|||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Code Analyzers-->
|
||||
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8" PrivateAssets="All" />
|
||||
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
|
||||
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace MediaBrowser.Controller.Net
|
|||
/// <summary>
|
||||
/// The _active connections
|
||||
/// </summary>
|
||||
protected readonly List<Tuple<IWebSocketConnection, CancellationTokenSource, TStateType>> ActiveConnections =
|
||||
private readonly List<Tuple<IWebSocketConnection, CancellationTokenSource, TStateType>> _activeConnections =
|
||||
new List<Tuple<IWebSocketConnection, CancellationTokenSource, TStateType>>();
|
||||
|
||||
/// <summary>
|
||||
|
@ -100,9 +100,9 @@ namespace MediaBrowser.Controller.Net
|
|||
InitialDelayMs = dueTimeMs
|
||||
};
|
||||
|
||||
lock (ActiveConnections)
|
||||
lock (_activeConnections)
|
||||
{
|
||||
ActiveConnections.Add(new Tuple<IWebSocketConnection, CancellationTokenSource, TStateType>(message.Connection, cancellationTokenSource, state));
|
||||
_activeConnections.Add(new Tuple<IWebSocketConnection, CancellationTokenSource, TStateType>(message.Connection, cancellationTokenSource, state));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,9 +110,9 @@ namespace MediaBrowser.Controller.Net
|
|||
{
|
||||
Tuple<IWebSocketConnection, CancellationTokenSource, TStateType>[] tuples;
|
||||
|
||||
lock (ActiveConnections)
|
||||
lock (_activeConnections)
|
||||
{
|
||||
tuples = ActiveConnections
|
||||
tuples = _activeConnections
|
||||
.Where(c =>
|
||||
{
|
||||
if (c.Item1.State == WebSocketState.Open && !c.Item2.IsCancellationRequested)
|
||||
|
@ -180,9 +180,9 @@ namespace MediaBrowser.Controller.Net
|
|||
/// <param name="message">The message.</param>
|
||||
private void Stop(WebSocketMessageInfo message)
|
||||
{
|
||||
lock (ActiveConnections)
|
||||
lock (_activeConnections)
|
||||
{
|
||||
var connection = ActiveConnections.FirstOrDefault(c => c.Item1 == message.Connection);
|
||||
var connection = _activeConnections.FirstOrDefault(c => c.Item1 == message.Connection);
|
||||
|
||||
if (connection != null)
|
||||
{
|
||||
|
@ -212,9 +212,9 @@ namespace MediaBrowser.Controller.Net
|
|||
//TODO Investigate and properly fix.
|
||||
}
|
||||
|
||||
lock (ActiveConnections)
|
||||
lock (_activeConnections)
|
||||
{
|
||||
ActiveConnections.Remove(connection);
|
||||
_activeConnections.Remove(connection);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,9 +226,9 @@ namespace MediaBrowser.Controller.Net
|
|||
{
|
||||
if (dispose)
|
||||
{
|
||||
lock (ActiveConnections)
|
||||
lock (_activeConnections)
|
||||
{
|
||||
foreach (var connection in ActiveConnections.ToArray())
|
||||
foreach (var connection in _activeConnections.ToArray())
|
||||
{
|
||||
DisposeConnection(connection);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user