diff --git a/BDInfo/BDROM.cs b/BDInfo/BDROM.cs index 2fadf3b77f..b747d996f1 100644 --- a/BDInfo/BDROM.cs +++ b/BDInfo/BDROM.cs @@ -339,7 +339,7 @@ namespace BDInfo throw new ArgumentNullException(nameof(path)); } - var dir = _fileSystem.GetDirectoryInfo(path); + FileSystemMetadata dir = _fileSystem.GetDirectoryInfo(path); while (dir != null) { diff --git a/Emby.Dlna/ContentDirectory/ControlHandler.cs b/Emby.Dlna/ContentDirectory/ControlHandler.cs index ed2114e6aa..2f6a0ecee9 100644 --- a/Emby.Dlna/ContentDirectory/ControlHandler.cs +++ b/Emby.Dlna/ContentDirectory/ControlHandler.cs @@ -192,7 +192,7 @@ namespace Emby.Dlna.ContentDirectory public string GetValueOrDefault(IDictionary sparams, string key, string defaultValue) { - if (sparams.TryGetValue(key, out var val)) + if (sparams.TryGetValue(key, out string val)) { return val; } diff --git a/Emby.Dlna/DlnaManager.cs b/Emby.Dlna/DlnaManager.cs index 45ba44870d..5e99416b3f 100644 --- a/Emby.Dlna/DlnaManager.cs +++ b/Emby.Dlna/DlnaManager.cs @@ -239,7 +239,7 @@ namespace Emby.Dlna return false; } - if (headers.TryGetValue(header.Name, out var value)) + if (headers.TryGetValue(header.Name, out string value)) { switch (header.Match) { @@ -286,7 +286,7 @@ namespace Emby.Dlna { lock (_profiles) { - if (_profiles.TryGetValue(path, out var profileTuple)) + if (_profiles.TryGetValue(path, out Tuple profileTuple)) { return profileTuple.Item2; } diff --git a/Emby.Dlna/Eventing/EventManager.cs b/Emby.Dlna/Eventing/EventManager.cs index c17f64a57a..b4ff3ec1d5 100644 --- a/Emby.Dlna/Eventing/EventManager.cs +++ b/Emby.Dlna/Eventing/EventManager.cs @@ -95,7 +95,7 @@ namespace Emby.Dlna.Eventing { _logger.LogDebug("Cancelling event subscription {0}", subscriptionId); - _subscriptions.TryRemove(subscriptionId, out var sub); + _subscriptions.TryRemove(subscriptionId, out EventSubscription sub); return new EventSubscriptionResponse { @@ -126,7 +126,7 @@ namespace Emby.Dlna.Eventing private EventSubscription GetSubscription(string id, bool throwOnMissing) { - if (!_subscriptions.TryGetValue(id, out var e) && throwOnMissing) + if (!_subscriptions.TryGetValue(id, out EventSubscription e) && throwOnMissing) { throw new ResourceNotFoundException("Event with Id " + id + " not found."); } diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs index c615b9fbc3..409b8442cd 100644 --- a/Emby.Dlna/PlayTo/PlayToController.cs +++ b/Emby.Dlna/PlayTo/PlayToController.cs @@ -98,11 +98,11 @@ namespace Emby.Dlna.PlayTo { var info = e.Argument; - info.Headers.TryGetValue("NTS", out var nts); + info.Headers.TryGetValue("NTS", out string nts); - if (!info.Headers.TryGetValue("USN", out var usn)) usn = string.Empty; + if (!info.Headers.TryGetValue("USN", out string usn)) usn = string.Empty; - if (!info.Headers.TryGetValue("NT", out var nt)) nt = string.Empty; + if (!info.Headers.TryGetValue("NT", out string nt)) nt = string.Empty; if (usn.IndexOf(_device.Properties.UUID, StringComparison.OrdinalIgnoreCase) != -1 && !_disposed) @@ -636,7 +636,7 @@ namespace Emby.Dlna.PlayTo return _device.ToggleMute(cancellationToken); case GeneralCommandType.SetAudioStreamIndex: { - if (command.Arguments.TryGetValue("Index", out var arg)) + if (command.Arguments.TryGetValue("Index", out string arg)) { if (int.TryParse(arg, NumberStyles.Integer, _usCulture, out var val)) { @@ -650,7 +650,7 @@ namespace Emby.Dlna.PlayTo } case GeneralCommandType.SetSubtitleStreamIndex: { - if (command.Arguments.TryGetValue("Index", out var arg)) + if (command.Arguments.TryGetValue("Index", out string arg)) { if (int.TryParse(arg, NumberStyles.Integer, _usCulture, out var val)) { @@ -664,7 +664,7 @@ namespace Emby.Dlna.PlayTo } case GeneralCommandType.SetVolume: { - if (command.Arguments.TryGetValue("Volume", out var arg)) + if (command.Arguments.TryGetValue("Volume", out string arg)) { if (int.TryParse(arg, NumberStyles.Integer, _usCulture, out var volume)) { @@ -837,7 +837,7 @@ namespace Emby.Dlna.PlayTo if (index == -1) return request; var query = url.Substring(index + 1); - var values = MyHttpUtility.ParseQueryString(query); + QueryParamCollection values = MyHttpUtility.ParseQueryString(query); request.DeviceProfileId = values.Get("DeviceProfileId"); request.DeviceId = values.Get("DeviceId"); diff --git a/Emby.Dlna/PlayTo/PlayToManager.cs b/Emby.Dlna/PlayTo/PlayToManager.cs index 12280d1bf7..2836ee95d9 100644 --- a/Emby.Dlna/PlayTo/PlayToManager.cs +++ b/Emby.Dlna/PlayTo/PlayToManager.cs @@ -78,9 +78,9 @@ namespace Emby.Dlna.PlayTo var info = e.Argument; - if (!info.Headers.TryGetValue("USN", out var usn)) usn = string.Empty; + if (!info.Headers.TryGetValue("USN", out string usn)) usn = string.Empty; - if (!info.Headers.TryGetValue("NT", out var nt)) nt = string.Empty; + if (!info.Headers.TryGetValue("NT", out string nt)) nt = string.Empty; string location = info.Location.ToString(); @@ -153,7 +153,7 @@ namespace Emby.Dlna.PlayTo _logger.LogDebug("Attempting to create PlayToController from location {0}", location); _logger.LogDebug("Logging session activity from location {0}", location); - if (info.Headers.TryGetValue("USN", out var uuid)) + if (info.Headers.TryGetValue("USN", out string uuid)) { uuid = GetUuid(uuid); } diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index ac6c7e9dba..28aae9caec 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -846,7 +846,7 @@ namespace Emby.Drawing { lock (_locks) { - if (_locks.TryGetValue(key, out var info)) + if (_locks.TryGetValue(key, out LockInfo info)) { info.Count++; } diff --git a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs index 4729b5b5a6..ac486f1675 100644 --- a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs +++ b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs @@ -141,7 +141,7 @@ namespace IsoMounter public Task Mount(string isoPath, CancellationToken cancellationToken) { - if (MountISO(isoPath, out var mountedISO)) + if (MountISO(isoPath, out LinuxMount mountedISO)) { return Task.FromResult(mountedISO); } diff --git a/Emby.Naming/Audio/MultiPartResult.cs b/Emby.Naming/Audio/MultiPartResult.cs index 983b9fe675..b1fa6e5639 100644 --- a/Emby.Naming/Audio/MultiPartResult.cs +++ b/Emby.Naming/Audio/MultiPartResult.cs @@ -1,4 +1,3 @@ - namespace Emby.Naming.Audio { public class MultiPartResult diff --git a/Emby.Naming/AudioBook/AudioBookFileInfo.cs b/Emby.Naming/AudioBook/AudioBookFileInfo.cs index 5ece6771a3..de66a54022 100644 --- a/Emby.Naming/AudioBook/AudioBookFileInfo.cs +++ b/Emby.Naming/AudioBook/AudioBookFileInfo.cs @@ -1,4 +1,3 @@ - using System; namespace Emby.Naming.AudioBook diff --git a/Emby.Naming/Common/MediaType.cs b/Emby.Naming/Common/MediaType.cs index 2332b64559..49cc9ee39b 100644 --- a/Emby.Naming/Common/MediaType.cs +++ b/Emby.Naming/Common/MediaType.cs @@ -1,4 +1,3 @@ - namespace Emby.Naming.Common { public enum MediaType diff --git a/Emby.Naming/Subtitles/SubtitleInfo.cs b/Emby.Naming/Subtitles/SubtitleInfo.cs index 6cb683a36c..e4709dfbb6 100644 --- a/Emby.Naming/Subtitles/SubtitleInfo.cs +++ b/Emby.Naming/Subtitles/SubtitleInfo.cs @@ -1,4 +1,3 @@ - namespace Emby.Naming.Subtitles { public class SubtitleInfo diff --git a/Emby.Naming/TV/EpisodeInfo.cs b/Emby.Naming/TV/EpisodeInfo.cs index ce77da14f6..c8aca7a6f3 100644 --- a/Emby.Naming/TV/EpisodeInfo.cs +++ b/Emby.Naming/TV/EpisodeInfo.cs @@ -1,4 +1,3 @@ - namespace Emby.Naming.TV { public class EpisodeInfo diff --git a/Emby.Naming/TV/EpisodePathParserResult.cs b/Emby.Naming/TV/EpisodePathParserResult.cs index 0d9e4dd8c0..e1a48bfbc9 100644 --- a/Emby.Naming/TV/EpisodePathParserResult.cs +++ b/Emby.Naming/TV/EpisodePathParserResult.cs @@ -1,4 +1,3 @@ - namespace Emby.Naming.TV { public class EpisodePathParserResult diff --git a/Emby.Naming/TV/SeasonPathParserResult.cs b/Emby.Naming/TV/SeasonPathParserResult.cs index 048b390ae6..eab27a4a5f 100644 --- a/Emby.Naming/TV/SeasonPathParserResult.cs +++ b/Emby.Naming/TV/SeasonPathParserResult.cs @@ -1,4 +1,3 @@ - namespace Emby.Naming.TV { public class SeasonPathParserResult diff --git a/Emby.Naming/Video/CleanDateTimeResult.cs b/Emby.Naming/Video/CleanDateTimeResult.cs index a1794ed381..6bf24e4d85 100644 --- a/Emby.Naming/Video/CleanDateTimeResult.cs +++ b/Emby.Naming/Video/CleanDateTimeResult.cs @@ -1,4 +1,3 @@ - namespace Emby.Naming.Video { public class CleanDateTimeResult diff --git a/Emby.Naming/Video/CleanStringResult.cs b/Emby.Naming/Video/CleanStringResult.cs index 0c1360a779..b3bc597125 100644 --- a/Emby.Naming/Video/CleanStringResult.cs +++ b/Emby.Naming/Video/CleanStringResult.cs @@ -1,4 +1,3 @@ - namespace Emby.Naming.Video { public class CleanStringResult diff --git a/Emby.Naming/Video/ExtraRuleType.cs b/Emby.Naming/Video/ExtraRuleType.cs index eda3157799..565239ff9a 100644 --- a/Emby.Naming/Video/ExtraRuleType.cs +++ b/Emby.Naming/Video/ExtraRuleType.cs @@ -1,4 +1,3 @@ - namespace Emby.Naming.Video { public enum ExtraRuleType diff --git a/Emby.Naming/Video/Format3DRule.cs b/Emby.Naming/Video/Format3DRule.cs index 7c815524f2..dc260175af 100644 --- a/Emby.Naming/Video/Format3DRule.cs +++ b/Emby.Naming/Video/Format3DRule.cs @@ -1,4 +1,3 @@ - namespace Emby.Naming.Video { public class Format3DRule diff --git a/Emby.Naming/Video/StubTypeRule.cs b/Emby.Naming/Video/StubTypeRule.cs index d8fee617ed..b46050085d 100644 --- a/Emby.Naming/Video/StubTypeRule.cs +++ b/Emby.Naming/Video/StubTypeRule.cs @@ -1,4 +1,3 @@ - namespace Emby.Naming.Video { public class StubTypeRule diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 5530c1b9d4..d4144d5c5c 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -1790,7 +1790,7 @@ namespace Emby.Server.Implementations return false; } - if (minRequiredVersions.TryGetValue(filename, out var minRequiredVersion)) + if (minRequiredVersions.TryGetValue(filename, out Version minRequiredVersion)) { try { @@ -2005,7 +2005,7 @@ namespace Emby.Server.Implementations address = address.Substring(index + 1); } - if (NetworkManager.TryParseIpAddress(address.Trim('/'), out var result)) + if (NetworkManager.TryParseIpAddress(address.Trim('/'), out IpAddressInfo result)) { return result; } diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs index 3650900c36..f98e199e6b 100644 --- a/Emby.Server.Implementations/Channels/ChannelManager.cs +++ b/Emby.Server.Implementations/Channels/ChannelManager.cs @@ -387,7 +387,7 @@ namespace Emby.Server.Implementations.Channels private async Task> GetChannelItemMediaSourcesInternal(IRequiresMediaInfoCallback channel, string id, CancellationToken cancellationToken) { - if (_channelItemMediaInfo.TryGetValue(id, out var cachedInfo)) + if (_channelItemMediaInfo.TryGetValue(id, out Tuple> cachedInfo)) { if ((DateTime.UtcNow - cachedInfo.Item1).TotalMinutes < 5) { diff --git a/Emby.Server.Implementations/Data/SqliteExtensions.cs b/Emby.Server.Implementations/Data/SqliteExtensions.cs index d990e71493..a486cb1a06 100644 --- a/Emby.Server.Implementations/Data/SqliteExtensions.cs +++ b/Emby.Server.Implementations/Data/SqliteExtensions.cs @@ -199,7 +199,7 @@ namespace Emby.Server.Implementations.Data public static void TryBind(this IStatement statement, string name, double value) { - if (statement.BindParameters.TryGetValue(name, out var bindParam)) + if (statement.BindParameters.TryGetValue(name, out IBindParameter bindParam)) { bindParam.Bind(value); } @@ -211,7 +211,7 @@ namespace Emby.Server.Implementations.Data public static void TryBind(this IStatement statement, string name, string value) { - if (statement.BindParameters.TryGetValue(name, out var bindParam)) + if (statement.BindParameters.TryGetValue(name, out IBindParameter bindParam)) { if (value == null) { @@ -230,7 +230,7 @@ namespace Emby.Server.Implementations.Data public static void TryBind(this IStatement statement, string name, bool value) { - if (statement.BindParameters.TryGetValue(name, out var bindParam)) + if (statement.BindParameters.TryGetValue(name, out IBindParameter bindParam)) { bindParam.Bind(value); } @@ -242,7 +242,7 @@ namespace Emby.Server.Implementations.Data public static void TryBind(this IStatement statement, string name, float value) { - if (statement.BindParameters.TryGetValue(name, out var bindParam)) + if (statement.BindParameters.TryGetValue(name, out IBindParameter bindParam)) { bindParam.Bind(value); } @@ -254,7 +254,7 @@ namespace Emby.Server.Implementations.Data public static void TryBind(this IStatement statement, string name, int value) { - if (statement.BindParameters.TryGetValue(name, out var bindParam)) + if (statement.BindParameters.TryGetValue(name, out IBindParameter bindParam)) { bindParam.Bind(value); } @@ -266,7 +266,7 @@ namespace Emby.Server.Implementations.Data public static void TryBind(this IStatement statement, string name, Guid value) { - if (statement.BindParameters.TryGetValue(name, out var bindParam)) + if (statement.BindParameters.TryGetValue(name, out IBindParameter bindParam)) { bindParam.Bind(value.ToGuidBlob()); } @@ -278,7 +278,7 @@ namespace Emby.Server.Implementations.Data public static void TryBind(this IStatement statement, string name, DateTime value) { - if (statement.BindParameters.TryGetValue(name, out var bindParam)) + if (statement.BindParameters.TryGetValue(name, out IBindParameter bindParam)) { bindParam.Bind(value.ToDateTimeParamValue()); } @@ -290,7 +290,7 @@ namespace Emby.Server.Implementations.Data public static void TryBind(this IStatement statement, string name, long value) { - if (statement.BindParameters.TryGetValue(name, out var bindParam)) + if (statement.BindParameters.TryGetValue(name, out IBindParameter bindParam)) { bindParam.Bind(value); } @@ -302,7 +302,7 @@ namespace Emby.Server.Implementations.Data public static void TryBind(this IStatement statement, string name, byte[] value) { - if (statement.BindParameters.TryGetValue(name, out var bindParam)) + if (statement.BindParameters.TryGetValue(name, out IBindParameter bindParam)) { bindParam.Bind(value); } @@ -314,7 +314,7 @@ namespace Emby.Server.Implementations.Data public static void TryBindNull(this IStatement statement, string name) { - if (statement.BindParameters.TryGetValue(name, out var bindParam)) + if (statement.BindParameters.TryGetValue(name, out IBindParameter bindParam)) { bindParam.BindNull(); } diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 972c5c52d0..727a9e8688 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -5139,7 +5139,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type private IEnumerable MapIncludeItemTypes(string value) { - if (_types.TryGetValue(value, out var result)) + if (_types.TryGetValue(value, out string[] result)) { return result; } diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index 6cb8207160..a45cde9805 100644 --- a/Emby.Server.Implementations/Dto/DtoService.cs +++ b/Emby.Server.Implementations/Dto/DtoService.cs @@ -637,7 +637,7 @@ namespace Emby.Server.Implementations.Dto Type = person.Type }; - if (dictionary.TryGetValue(person.Name, out var entity)) + if (dictionary.TryGetValue(person.Name, out Person entity)) { baseItemPerson.PrimaryImageTag = GetImageCacheTag(entity, ImageType.Primary); baseItemPerson.Id = entity.Id.ToString("N"); diff --git a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs index 7faad05e3c..8755ee3a7d 100644 --- a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs +++ b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs @@ -108,9 +108,9 @@ namespace Emby.Server.Implementations.EntryPoints var info = e.Argument; - if (!info.Headers.TryGetValue("USN", out var usn)) usn = string.Empty; + if (!info.Headers.TryGetValue("USN", out string usn)) usn = string.Empty; - if (!info.Headers.TryGetValue("NT", out var nt)) nt = string.Empty; + if (!info.Headers.TryGetValue("NT", out string nt)) nt = string.Empty; // Filter device type if (usn.IndexOf("WANIPConnection:", StringComparison.OrdinalIgnoreCase) == -1 && diff --git a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs index 93e222ebea..9e71ffceb7 100644 --- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs @@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.EntryPoints UpdateTimer.Change(UpdateDuration, Timeout.Infinite); } - if (!_changedItems.TryGetValue(e.UserId, out var keys)) + if (!_changedItems.TryGetValue(e.UserId, out List keys)) { keys = new List(); _changedItems[e.UserId] = keys; diff --git a/Emby.Server.Implementations/FFMpeg/FFMpegInstallInfo.cs b/Emby.Server.Implementations/FFMpeg/FFMpegInstallInfo.cs index 715a269134..fa9cb5e01b 100644 --- a/Emby.Server.Implementations/FFMpeg/FFMpegInstallInfo.cs +++ b/Emby.Server.Implementations/FFMpeg/FFMpegInstallInfo.cs @@ -1,4 +1,3 @@ - namespace Emby.Server.Implementations.FFMpeg { public class FFMpegInstallInfo diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs index 8ae66843c4..163b54e39d 100644 --- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -700,7 +700,7 @@ namespace Emby.Server.Implementations.HttpServer return null; } - var restPath = ServiceHandler.FindMatchingRestPath(httpReq.HttpMethod, pathInfo, out var contentType); + var restPath = ServiceHandler.FindMatchingRestPath(httpReq.HttpMethod, pathInfo, out string contentType); if (restPath != null) { diff --git a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs index 3cfa2bc75f..851250ecd1 100644 --- a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs +++ b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs @@ -96,7 +96,7 @@ namespace Emby.Server.Implementations.HttpServer responseHeaders = new Dictionary(); } - if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out var expires)) + if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out string expires)) { responseHeaders["Expires"] = "-1"; } @@ -142,7 +142,7 @@ namespace Emby.Server.Implementations.HttpServer responseHeaders = new Dictionary(); } - if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out var expires)) + if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out string expires)) { responseHeaders["Expires"] = "-1"; } @@ -186,7 +186,7 @@ namespace Emby.Server.Implementations.HttpServer responseHeaders = new Dictionary(); } - if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out var expires)) + if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out string expires)) { responseHeaders["Expires"] = "-1"; } diff --git a/Emby.Server.Implementations/HttpServer/ResponseFilter.cs b/Emby.Server.Implementations/HttpServer/ResponseFilter.cs index ed8644e33e..80386f35e9 100644 --- a/Emby.Server.Implementations/HttpServer/ResponseFilter.cs +++ b/Emby.Server.Implementations/HttpServer/ResponseFilter.cs @@ -57,7 +57,7 @@ namespace Emby.Server.Implementations.HttpServer // Content length has to be explicitly set on on HttpListenerResponse or it won't be happy - if (hasHeaders.Headers.TryGetValue("Content-Length", out var contentLength) && !string.IsNullOrEmpty(contentLength)) + if (hasHeaders.Headers.TryGetValue("Content-Length", out string contentLength) && !string.IsNullOrEmpty(contentLength)) { var length = long.Parse(contentLength, UsCulture); diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 9f999cb7f3..073005a1eb 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -432,7 +432,7 @@ namespace Emby.Server.Implementations.Library ItemRepository.DeleteItem(child.Id, CancellationToken.None); } - _libraryItemsCache.TryRemove(item.Id, out var removed); + _libraryItemsCache.TryRemove(item.Id, out BaseItem removed); ReportItemRemoved(item, parent); } @@ -1240,7 +1240,7 @@ namespace Emby.Server.Implementations.Library throw new ArgumentNullException(nameof(id)); } - if (LibraryItemsCache.TryGetValue(id, out var item)) + if (LibraryItemsCache.TryGetValue(id, out BaseItem item)) { return item; } diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs index 321a82c78c..e0ecb2bcec 100644 --- a/Emby.Server.Implementations/Library/MediaSourceManager.cs +++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs @@ -777,7 +777,7 @@ namespace Emby.Server.Implementations.Library try { - if (_openStreams.TryGetValue(id, out var info)) + if (_openStreams.TryGetValue(id, out ILiveStream info)) { return info; } @@ -809,7 +809,7 @@ namespace Emby.Server.Implementations.Library try { - if (_openStreams.TryGetValue(id, out var liveStream)) + if (_openStreams.TryGetValue(id, out ILiveStream liveStream)) { liveStream.ConsumerCount--; diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 4ec57096f0..64e5affd70 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -473,7 +473,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV private static string GetMappedChannel(string channelId, NameValuePair[] mappings) { - foreach (var mapping in mappings) + foreach (NameValuePair mapping in mappings) { if (StringHelper.EqualsIgnoreCase(mapping.Name, channelId)) { @@ -1988,8 +1988,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV { writer.WriteStartDocument(true); writer.WriteStartElement("tvshow"); - - if (timer.SeriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out var id)) + string id; + if (timer.SeriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id)) { writer.WriteElementString("id", id); } @@ -2520,7 +2520,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV if (string.IsNullOrWhiteSpace(channelId) && !parent.ChannelId.Equals(Guid.Empty)) { - if (!tempChannelCache.TryGetValue(parent.ChannelId, out var channel)) + if (!tempChannelCache.TryGetValue(parent.ChannelId, out LiveTvChannel channel)) { channel = _libraryManager.GetItemList(new InternalItemsQuery { @@ -2579,7 +2579,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV if (!programInfo.ChannelId.Equals(Guid.Empty)) { - if (!tempChannelCache.TryGetValue(programInfo.ChannelId, out var channel)) + if (!tempChannelCache.TryGetValue(programInfo.ChannelId, out LiveTvChannel channel)) { channel = _libraryManager.GetItemList(new InternalItemsQuery { diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index 05d92dfcb8..d3066e9161 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -137,7 +137,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken).ConfigureAwait(false); var programsInfo = new List(); - foreach (var schedule in dailySchedules.SelectMany(d => d.programs)) + foreach (ScheduleDirect.Program schedule in dailySchedules.SelectMany(d => d.programs)) { //_logger.LogDebug("Proccesing Schedule for statio ID " + stationID + // " which corresponds to channel " + channelNumber + " and program id " + @@ -526,15 +526,15 @@ namespace Emby.Server.Implementations.LiveTv.Listings try { using (var httpResponse = await Get(options, false, info).ConfigureAwait(false)) - using (var responce = httpResponse.Content) + using (Stream responce = httpResponse.Content) { var root = await _jsonSerializer.DeserializeFromStreamAsync>(responce).ConfigureAwait(false); if (root != null) { - foreach (var headend in root) + foreach (ScheduleDirect.Headends headend in root) { - foreach (var lineup in headend.lineups) + foreach (ScheduleDirect.Lineup lineup in headend.lineups) { lineups.Add(new NameIdPair { @@ -887,7 +887,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings var allStations = root.stations ?? Enumerable.Empty(); - foreach (var map in root.map) + foreach (ScheduleDirect.Map map in root.map) { var channelNumber = GetChannelNumber(map); diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index 3f64a40d87..11d7facbe3 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -540,7 +540,7 @@ namespace Emby.Server.Implementations.LiveTv var isNew = false; var forceUpdate = false; - if (!allExistingPrograms.TryGetValue(id, out var item)) + if (!allExistingPrograms.TryGetValue(id, out LiveTvProgram item)) { isNew = true; item = new LiveTvProgram @@ -1951,7 +1951,7 @@ namespace Emby.Server.Implementations.LiveTv foreach (var programDto in currentProgramDtos) { - if (currentChannelsDict.TryGetValue(programDto.ChannelId, out var channelDto)) + if (currentChannelsDict.TryGetValue(programDto.ChannelId, out BaseItemDto channelDto)) { channelDto.CurrentProgram = programDto; } @@ -2315,7 +2315,7 @@ namespace Emby.Server.Implementations.LiveTv await provider.Validate(info, validateLogin, validateListings).ConfigureAwait(false); - var config = GetConfiguration(); + LiveTvOptions config = GetConfiguration(); var list = config.ListingProviders.ToList(); int index = list.FindIndex(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase)); diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs index 09d33342e9..e8e4bc7238 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs @@ -118,7 +118,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun { if (!string.IsNullOrEmpty(cacheKey)) { - if (_modelCache.TryGetValue(cacheKey, out var response)) + if (_modelCache.TryGetValue(cacheKey, out DiscoverResponse response)) { return response; } diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs index 8268802fb9..2205c0ecca 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs @@ -132,7 +132,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun var receiveBuffer = new byte[8192]; var response = await socket.ReceiveAsync(receiveBuffer, 0, receiveBuffer.Length, cancellationToken).ConfigureAwait(false); - ParseReturnMessage(response.Buffer, response.ReceivedBytes, out var returnVal); + ParseReturnMessage(response.Buffer, response.ReceivedBytes, out string returnVal); return string.Equals(returnVal, "none", StringComparison.OrdinalIgnoreCase); } @@ -171,7 +171,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun continue; var commandList = commands.GetCommands(); - foreach (var command in commandList) + foreach (Tuple command in commandList) { var channelMsg = CreateSetMessage(i, command.Item1, command.Item2, lockKeyValue); await tcpClient.SendToAsync(channelMsg, 0, channelMsg.Length, ipEndPoint, cancellationToken).ConfigureAwait(false); @@ -214,13 +214,13 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun var commandList = commands.GetCommands(); var receiveBuffer = new byte[8192]; - foreach (var command in commandList) + foreach (Tuple command in commandList) { var channelMsg = CreateSetMessage(_activeTuner, command.Item1, command.Item2, _lockkey); await tcpClient.SendToAsync(channelMsg, 0, channelMsg.Length, new IpEndPointInfo(_remoteIp, HdHomeRunPort), cancellationToken).ConfigureAwait(false); var response = await tcpClient.ReceiveAsync(receiveBuffer, 0, receiveBuffer.Length, cancellationToken).ConfigureAwait(false); // parse response to make sure it worked - if (!ParseReturnMessage(response.Buffer, response.ReceivedBytes, out var returnVal)) + if (!ParseReturnMessage(response.Buffer, response.ReceivedBytes, out string returnVal)) { return; } diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs index c1ee059f48..c77559c75d 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs @@ -117,10 +117,10 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts extInf = extInf.Trim(); - var attributes = ParseExtInf(extInf, out var remaining); + var attributes = ParseExtInf(extInf, out string remaining); extInf = remaining; - if (attributes.TryGetValue("tvg-logo", out var value)) + if (attributes.TryGetValue("tvg-logo", out string value)) { channel.ImageUrl = value; } @@ -128,9 +128,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts channel.Name = GetChannelName(extInf, attributes); channel.Number = GetChannelNumber(extInf, attributes, mediaUrl); - attributes.TryGetValue("tvg-id", out var tvgId); + attributes.TryGetValue("tvg-id", out string tvgId); - attributes.TryGetValue("channel-id", out var channelId); + attributes.TryGetValue("channel-id", out string channelId); channel.TunerChannelId = string.IsNullOrWhiteSpace(tvgId) ? channelId : tvgId; @@ -182,7 +182,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts if (!IsValidChannelNumber(numberString)) { - if (attributes.TryGetValue("tvg-id", out var value)) + if (attributes.TryGetValue("tvg-id", out string value)) { if (double.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var doubleValue)) { @@ -198,7 +198,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts if (!IsValidChannelNumber(numberString)) { - if (attributes.TryGetValue("channel-id", out var value)) + if (attributes.TryGetValue("channel-id", out string value)) { numberString = value; } @@ -282,7 +282,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts } } - attributes.TryGetValue("tvg-name", out var name); + attributes.TryGetValue("tvg-name", out string name); if (string.IsNullOrWhiteSpace(name)) { @@ -291,7 +291,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts if (string.IsNullOrWhiteSpace(name)) { - attributes.TryGetValue("tvg-id", out name); + attributes.TryGetValue("tvg-id", string name); } if (string.IsNullOrWhiteSpace(name)) diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs index b71e89c5ae..5d3c39af47 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -360,7 +360,7 @@ namespace Emby.Server.Implementations.Localization var ratingsDictionary = GetParentalRatingsDictionary(); - if (ratingsDictionary.TryGetValue(rating, out var value)) + if (ratingsDictionary.TryGetValue(rating, out ParentalRating value)) { return value.Value; } diff --git a/Emby.Server.Implementations/Services/ServiceController.cs b/Emby.Server.Implementations/Services/ServiceController.cs index 9afa7f5023..5796956d87 100644 --- a/Emby.Server.Implementations/Services/ServiceController.cs +++ b/Emby.Server.Implementations/Services/ServiceController.cs @@ -89,7 +89,7 @@ namespace Emby.Server.Implementations.Services if (restPath.Path.IndexOfAny(InvalidRouteChars) != -1) throw new ArgumentException(string.Format("Route '{0}' on '{1}' contains invalid chars. ", restPath.Path, restPath.RequestType.GetMethodName())); - if (!RestPathMap.TryGetValue(restPath.FirstMatchHashKey, out var pathsAtFirstMatch)) + if (!RestPathMap.TryGetValue(restPath.FirstMatchHashKey, out List pathsAtFirstMatch)) { pathsAtFirstMatch = new List(); RestPathMap[restPath.FirstMatchHashKey] = pathsAtFirstMatch; diff --git a/Emby.Server.Implementations/Services/ServiceExec.cs b/Emby.Server.Implementations/Services/ServiceExec.cs index 0f2247a012..45c918fa1b 100644 --- a/Emby.Server.Implementations/Services/ServiceExec.cs +++ b/Emby.Server.Implementations/Services/ServiceExec.cs @@ -73,7 +73,7 @@ namespace Emby.Server.Implementations.Services { var actionName = request.Verb ?? "POST"; - if (ServiceExecGeneral.execMap.TryGetValue(ServiceMethod.Key(serviceType, actionName, requestName), out var actionContext)) + if (execMap.TryGetValue(ServiceMethod.Key(serviceType, actionName, requestName), out ServiceMethod actionContext)) { if (actionContext.RequestFilters != null) { diff --git a/Emby.Server.Implementations/Services/ServiceHandler.cs b/Emby.Server.Implementations/Services/ServiceHandler.cs index dcf4f41723..7e836e22c3 100644 --- a/Emby.Server.Implementations/Services/ServiceHandler.cs +++ b/Emby.Server.Implementations/Services/ServiceHandler.cs @@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.Services { if (this.RestPath == null) { - this.RestPath = FindMatchingRestPath(httpMethod, pathInfo, out var contentType); + this.RestPath = FindMatchingRestPath(httpMethod, pathInfo, out string contentType); if (contentType != null) ResponseContentType = contentType; @@ -137,7 +137,7 @@ namespace Emby.Server.Implementations.Services public static object CreateRequest(IRequest httpReq, RestPath restPath, Dictionary requestParams, object requestDto) { var pathInfo = !restPath.IsWildCardPath - ? GetSanitizedPathInfo(httpReq.PathInfo, out var contentType) + ? GetSanitizedPathInfo(httpReq.PathInfo, out string contentType) : httpReq.PathInfo; return restPath.CreateRequest(pathInfo, requestParams, requestDto); diff --git a/Emby.Server.Implementations/TextEncoding/NLangDetect/Detector.cs b/Emby.Server.Implementations/TextEncoding/NLangDetect/Detector.cs index 097c7b8b75..991ee86887 100644 --- a/Emby.Server.Implementations/TextEncoding/NLangDetect/Detector.cs +++ b/Emby.Server.Implementations/TextEncoding/NLangDetect/Detector.cs @@ -164,7 +164,7 @@ namespace NLangDetect.Core public string Detect() { - var probabilities = GetProbabilities(); + List probabilities = GetProbabilities(); return probabilities.Count > 0 @@ -241,7 +241,7 @@ namespace NLangDetect.Core { CleanText(); - var ngrams = ExtractNGrams(); + List ngrams = ExtractNGrams(); if (ngrams.Count == 0) { @@ -332,7 +332,7 @@ namespace NLangDetect.Core return; } - var langProbMap = _wordLangProbMap[word]; + ProbVector langProbMap = _wordLangProbMap[word]; double weight = alpha / _BaseFreq; for (int i = 0; i < prob.Length; i++) diff --git a/Emby.Server.Implementations/TextEncoding/TextEncodingDetect.cs b/Emby.Server.Implementations/TextEncoding/TextEncodingDetect.cs index 03ff0863f2..49a371efad 100644 --- a/Emby.Server.Implementations/TextEncoding/TextEncodingDetect.cs +++ b/Emby.Server.Implementations/TextEncoding/TextEncodingDetect.cs @@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.TextEncoding public CharacterEncoding DetectEncoding(byte[] buffer, int size) { // First check if we have a BOM and return that if so - var encoding = CheckBom(buffer, size); + CharacterEncoding encoding = CheckBom(buffer, size); if (encoding != CharacterEncoding.None) { return encoding; diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscCharsetProber.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscCharsetProber.cs index b10c41c77f..e8da73c1c7 100644 --- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscCharsetProber.cs +++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscCharsetProber.cs @@ -84,7 +84,7 @@ namespace UniversalDetector.Core } else if (j != activeSM) { - var t = codingSM[activeSM]; + CodingStateMachine t = codingSM[activeSM]; codingSM[activeSM] = codingSM[j]; codingSM[j] = t; }