The Free Software Media System - Server Backend & API
Fix some warnings in MediaBrowser.Controller
Bond_00932dcd372f475
diff --git a/MediaBrowser.Controller/Entities/Person.cs b/MediaBrowser.Controller/Entities/Person.csindex d9b4b22067..64e216e69f 100644--- a/MediaBrowser.Controller/Entities/Person.cs+++ b/MediaBrowser.Controller/Entities/Person.cs@@ -135,57 +135,4 @@ namespace MediaBrowser.Controller.Entitiesreturn 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);- }- }}diff --git a/MediaBrowser.Controller/Entities/PersonInfo.cs b/MediaBrowser.Controller/Entities/PersonInfo.csnew file mode 100644index 0000000000..600c6f590e--- /dev/null+++ b/MediaBrowser.Controller/Entities/PersonInfo.cs@@ -0,0 +1,63 @@+using System;+using System.Linq;+using System.Collections.Generic;+using MediaBrowser.Model.Entities;++namespace MediaBrowser.Controller.Entities+{+ /// <summary>+ /// This is the 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 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);+ }+ }+}diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csprojindex f85b0949a1..88e9055e84 100644--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj@@ -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>diff --git a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.csindex ee5c1a165a..b710318eee 100644--- a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs+++ b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs@@ -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.NetInitialDelayMs = 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);}