Reformat JustAMan review pt1 changes

Refs #575
pull/1154/head
Erwin de Haan 5 years ago
parent a358631040
commit 321c440739

@ -339,7 +339,7 @@ namespace BDInfo
throw new ArgumentNullException(nameof(path)); throw new ArgumentNullException(nameof(path));
} }
var dir = _fileSystem.GetDirectoryInfo(path); FileSystemMetadata dir = _fileSystem.GetDirectoryInfo(path);
while (dir != null) while (dir != null)
{ {

@ -192,7 +192,7 @@ namespace Emby.Dlna.ContentDirectory
public string GetValueOrDefault(IDictionary<string, string> sparams, string key, string defaultValue) public string GetValueOrDefault(IDictionary<string, string> sparams, string key, string defaultValue)
{ {
if (sparams.TryGetValue(key, out var val)) if (sparams.TryGetValue(key, out string val))
{ {
return val; return val;
} }

@ -239,7 +239,7 @@ namespace Emby.Dlna
return false; return false;
} }
if (headers.TryGetValue(header.Name, out var value)) if (headers.TryGetValue(header.Name, out string value))
{ {
switch (header.Match) switch (header.Match)
{ {
@ -286,7 +286,7 @@ namespace Emby.Dlna
{ {
lock (_profiles) lock (_profiles)
{ {
if (_profiles.TryGetValue(path, out var profileTuple)) if (_profiles.TryGetValue(path, out Tuple<InternalProfileInfo, DeviceProfile> profileTuple))
{ {
return profileTuple.Item2; return profileTuple.Item2;
} }

@ -95,7 +95,7 @@ namespace Emby.Dlna.Eventing
{ {
_logger.LogDebug("Cancelling event subscription {0}", subscriptionId); _logger.LogDebug("Cancelling event subscription {0}", subscriptionId);
_subscriptions.TryRemove(subscriptionId, out var sub); _subscriptions.TryRemove(subscriptionId, out EventSubscription sub);
return new EventSubscriptionResponse return new EventSubscriptionResponse
{ {
@ -126,7 +126,7 @@ namespace Emby.Dlna.Eventing
private EventSubscription GetSubscription(string id, bool throwOnMissing) 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."); throw new ResourceNotFoundException("Event with Id " + id + " not found.");
} }

@ -98,11 +98,11 @@ namespace Emby.Dlna.PlayTo
{ {
var info = e.Argument; 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 && if (usn.IndexOf(_device.Properties.UUID, StringComparison.OrdinalIgnoreCase) != -1 &&
!_disposed) !_disposed)
@ -636,7 +636,7 @@ namespace Emby.Dlna.PlayTo
return _device.ToggleMute(cancellationToken); return _device.ToggleMute(cancellationToken);
case GeneralCommandType.SetAudioStreamIndex: 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)) if (int.TryParse(arg, NumberStyles.Integer, _usCulture, out var val))
{ {
@ -650,7 +650,7 @@ namespace Emby.Dlna.PlayTo
} }
case GeneralCommandType.SetSubtitleStreamIndex: 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)) if (int.TryParse(arg, NumberStyles.Integer, _usCulture, out var val))
{ {
@ -664,7 +664,7 @@ namespace Emby.Dlna.PlayTo
} }
case GeneralCommandType.SetVolume: 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)) if (int.TryParse(arg, NumberStyles.Integer, _usCulture, out var volume))
{ {
@ -837,7 +837,7 @@ namespace Emby.Dlna.PlayTo
if (index == -1) return request; if (index == -1) return request;
var query = url.Substring(index + 1); var query = url.Substring(index + 1);
var values = MyHttpUtility.ParseQueryString(query); QueryParamCollection values = MyHttpUtility.ParseQueryString(query);
request.DeviceProfileId = values.Get("DeviceProfileId"); request.DeviceProfileId = values.Get("DeviceProfileId");
request.DeviceId = values.Get("DeviceId"); request.DeviceId = values.Get("DeviceId");

@ -78,9 +78,9 @@ namespace Emby.Dlna.PlayTo
var info = e.Argument; 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(); 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("Attempting to create PlayToController from location {0}", location);
_logger.LogDebug("Logging session activity 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); uuid = GetUuid(uuid);
} }

@ -846,7 +846,7 @@ namespace Emby.Drawing
{ {
lock (_locks) lock (_locks)
{ {
if (_locks.TryGetValue(key, out var info)) if (_locks.TryGetValue(key, out LockInfo info))
{ {
info.Count++; info.Count++;
} }

@ -141,7 +141,7 @@ namespace IsoMounter
public Task<IIsoMount> Mount(string isoPath, CancellationToken cancellationToken) public Task<IIsoMount> Mount(string isoPath, CancellationToken cancellationToken)
{ {
if (MountISO(isoPath, out var mountedISO)) if (MountISO(isoPath, out LinuxMount mountedISO))
{ {
return Task.FromResult<IIsoMount>(mountedISO); return Task.FromResult<IIsoMount>(mountedISO);
} }

@ -1,4 +1,3 @@
namespace Emby.Naming.Audio namespace Emby.Naming.Audio
{ {
public class MultiPartResult public class MultiPartResult

@ -1,4 +1,3 @@
using System; using System;
namespace Emby.Naming.AudioBook namespace Emby.Naming.AudioBook

@ -1,4 +1,3 @@
namespace Emby.Naming.Common namespace Emby.Naming.Common
{ {
public enum MediaType public enum MediaType

@ -1,4 +1,3 @@
namespace Emby.Naming.Subtitles namespace Emby.Naming.Subtitles
{ {
public class SubtitleInfo public class SubtitleInfo

@ -1,4 +1,3 @@
namespace Emby.Naming.TV namespace Emby.Naming.TV
{ {
public class EpisodeInfo public class EpisodeInfo

@ -1,4 +1,3 @@
namespace Emby.Naming.TV namespace Emby.Naming.TV
{ {
public class EpisodePathParserResult public class EpisodePathParserResult

@ -1,4 +1,3 @@
namespace Emby.Naming.TV namespace Emby.Naming.TV
{ {
public class SeasonPathParserResult public class SeasonPathParserResult

@ -1,4 +1,3 @@
namespace Emby.Naming.Video namespace Emby.Naming.Video
{ {
public class CleanDateTimeResult public class CleanDateTimeResult

@ -1,4 +1,3 @@
namespace Emby.Naming.Video namespace Emby.Naming.Video
{ {
public class CleanStringResult public class CleanStringResult

@ -1,4 +1,3 @@
namespace Emby.Naming.Video namespace Emby.Naming.Video
{ {
public enum ExtraRuleType public enum ExtraRuleType

@ -1,4 +1,3 @@
namespace Emby.Naming.Video namespace Emby.Naming.Video
{ {
public class Format3DRule public class Format3DRule

@ -1,4 +1,3 @@
namespace Emby.Naming.Video namespace Emby.Naming.Video
{ {
public class StubTypeRule public class StubTypeRule

@ -1790,7 +1790,7 @@ namespace Emby.Server.Implementations
return false; return false;
} }
if (minRequiredVersions.TryGetValue(filename, out var minRequiredVersion)) if (minRequiredVersions.TryGetValue(filename, out Version minRequiredVersion))
{ {
try try
{ {
@ -2005,7 +2005,7 @@ namespace Emby.Server.Implementations
address = address.Substring(index + 1); address = address.Substring(index + 1);
} }
if (NetworkManager.TryParseIpAddress(address.Trim('/'), out var result)) if (NetworkManager.TryParseIpAddress(address.Trim('/'), out IpAddressInfo result))
{ {
return result; return result;
} }

@ -387,7 +387,7 @@ namespace Emby.Server.Implementations.Channels
private async Task<IEnumerable<MediaSourceInfo>> GetChannelItemMediaSourcesInternal(IRequiresMediaInfoCallback channel, string id, CancellationToken cancellationToken) private async Task<IEnumerable<MediaSourceInfo>> GetChannelItemMediaSourcesInternal(IRequiresMediaInfoCallback channel, string id, CancellationToken cancellationToken)
{ {
if (_channelItemMediaInfo.TryGetValue(id, out var cachedInfo)) if (_channelItemMediaInfo.TryGetValue(id, out Tuple<DateTime, List<MediaSourceInfo>> cachedInfo))
{ {
if ((DateTime.UtcNow - cachedInfo.Item1).TotalMinutes < 5) if ((DateTime.UtcNow - cachedInfo.Item1).TotalMinutes < 5)
{ {

@ -199,7 +199,7 @@ namespace Emby.Server.Implementations.Data
public static void TryBind(this IStatement statement, string name, double value) 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); bindParam.Bind(value);
} }
@ -211,7 +211,7 @@ namespace Emby.Server.Implementations.Data
public static void TryBind(this IStatement statement, string name, string value) 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) if (value == null)
{ {
@ -230,7 +230,7 @@ namespace Emby.Server.Implementations.Data
public static void TryBind(this IStatement statement, string name, bool value) 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); bindParam.Bind(value);
} }
@ -242,7 +242,7 @@ namespace Emby.Server.Implementations.Data
public static void TryBind(this IStatement statement, string name, float value) 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); bindParam.Bind(value);
} }
@ -254,7 +254,7 @@ namespace Emby.Server.Implementations.Data
public static void TryBind(this IStatement statement, string name, int value) 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); bindParam.Bind(value);
} }
@ -266,7 +266,7 @@ namespace Emby.Server.Implementations.Data
public static void TryBind(this IStatement statement, string name, Guid value) 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()); bindParam.Bind(value.ToGuidBlob());
} }
@ -278,7 +278,7 @@ namespace Emby.Server.Implementations.Data
public static void TryBind(this IStatement statement, string name, DateTime value) 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()); bindParam.Bind(value.ToDateTimeParamValue());
} }
@ -290,7 +290,7 @@ namespace Emby.Server.Implementations.Data
public static void TryBind(this IStatement statement, string name, long value) 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); bindParam.Bind(value);
} }
@ -302,7 +302,7 @@ namespace Emby.Server.Implementations.Data
public static void TryBind(this IStatement statement, string name, byte[] value) 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); bindParam.Bind(value);
} }
@ -314,7 +314,7 @@ namespace Emby.Server.Implementations.Data
public static void TryBindNull(this IStatement statement, string name) 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(); bindParam.BindNull();
} }

@ -5139,7 +5139,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
private IEnumerable<string> MapIncludeItemTypes(string value) private IEnumerable<string> MapIncludeItemTypes(string value)
{ {
if (_types.TryGetValue(value, out var result)) if (_types.TryGetValue(value, out string[] result))
{ {
return result; return result;
} }

@ -637,7 +637,7 @@ namespace Emby.Server.Implementations.Dto
Type = person.Type 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.PrimaryImageTag = GetImageCacheTag(entity, ImageType.Primary);
baseItemPerson.Id = entity.Id.ToString("N"); baseItemPerson.Id = entity.Id.ToString("N");

@ -108,9 +108,9 @@ namespace Emby.Server.Implementations.EntryPoints
var info = e.Argument; 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 // Filter device type
if (usn.IndexOf("WANIPConnection:", StringComparison.OrdinalIgnoreCase) == -1 && if (usn.IndexOf("WANIPConnection:", StringComparison.OrdinalIgnoreCase) == -1 &&

@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.EntryPoints
UpdateTimer.Change(UpdateDuration, Timeout.Infinite); UpdateTimer.Change(UpdateDuration, Timeout.Infinite);
} }
if (!_changedItems.TryGetValue(e.UserId, out var keys)) if (!_changedItems.TryGetValue(e.UserId, out List<BaseItem> keys))
{ {
keys = new List<BaseItem>(); keys = new List<BaseItem>();
_changedItems[e.UserId] = keys; _changedItems[e.UserId] = keys;

@ -1,4 +1,3 @@
namespace Emby.Server.Implementations.FFMpeg namespace Emby.Server.Implementations.FFMpeg
{ {
public class FFMpegInstallInfo public class FFMpegInstallInfo

@ -700,7 +700,7 @@ namespace Emby.Server.Implementations.HttpServer
return null; 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) if (restPath != null)
{ {

@ -96,7 +96,7 @@ namespace Emby.Server.Implementations.HttpServer
responseHeaders = new Dictionary<string, string>(); responseHeaders = new Dictionary<string, string>();
} }
if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out var expires)) if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out string expires))
{ {
responseHeaders["Expires"] = "-1"; responseHeaders["Expires"] = "-1";
} }
@ -142,7 +142,7 @@ namespace Emby.Server.Implementations.HttpServer
responseHeaders = new Dictionary<string, string>(); responseHeaders = new Dictionary<string, string>();
} }
if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out var expires)) if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out string expires))
{ {
responseHeaders["Expires"] = "-1"; responseHeaders["Expires"] = "-1";
} }
@ -186,7 +186,7 @@ namespace Emby.Server.Implementations.HttpServer
responseHeaders = new Dictionary<string, string>(); responseHeaders = new Dictionary<string, string>();
} }
if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out var expires)) if (addCachePrevention && !responseHeaders.TryGetValue("Expires", out string expires))
{ {
responseHeaders["Expires"] = "-1"; responseHeaders["Expires"] = "-1";
} }

@ -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 // 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); var length = long.Parse(contentLength, UsCulture);

@ -432,7 +432,7 @@ namespace Emby.Server.Implementations.Library
ItemRepository.DeleteItem(child.Id, CancellationToken.None); ItemRepository.DeleteItem(child.Id, CancellationToken.None);
} }
_libraryItemsCache.TryRemove(item.Id, out var removed); _libraryItemsCache.TryRemove(item.Id, out BaseItem removed);
ReportItemRemoved(item, parent); ReportItemRemoved(item, parent);
} }
@ -1240,7 +1240,7 @@ namespace Emby.Server.Implementations.Library
throw new ArgumentNullException(nameof(id)); throw new ArgumentNullException(nameof(id));
} }
if (LibraryItemsCache.TryGetValue(id, out var item)) if (LibraryItemsCache.TryGetValue(id, out BaseItem item))
{ {
return item; return item;
} }

@ -777,7 +777,7 @@ namespace Emby.Server.Implementations.Library
try try
{ {
if (_openStreams.TryGetValue(id, out var info)) if (_openStreams.TryGetValue(id, out ILiveStream info))
{ {
return info; return info;
} }
@ -809,7 +809,7 @@ namespace Emby.Server.Implementations.Library
try try
{ {
if (_openStreams.TryGetValue(id, out var liveStream)) if (_openStreams.TryGetValue(id, out ILiveStream liveStream))
{ {
liveStream.ConsumerCount--; liveStream.ConsumerCount--;

@ -473,7 +473,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
private static string GetMappedChannel(string channelId, NameValuePair[] mappings) private static string GetMappedChannel(string channelId, NameValuePair[] mappings)
{ {
foreach (var mapping in mappings) foreach (NameValuePair mapping in mappings)
{ {
if (StringHelper.EqualsIgnoreCase(mapping.Name, channelId)) if (StringHelper.EqualsIgnoreCase(mapping.Name, channelId))
{ {
@ -1988,8 +1988,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{ {
writer.WriteStartDocument(true); writer.WriteStartDocument(true);
writer.WriteStartElement("tvshow"); writer.WriteStartElement("tvshow");
string id;
if (timer.SeriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out var id)) if (timer.SeriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id))
{ {
writer.WriteElementString("id", 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 (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 channel = _libraryManager.GetItemList(new InternalItemsQuery
{ {
@ -2579,7 +2579,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (!programInfo.ChannelId.Equals(Guid.Empty)) 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 channel = _libraryManager.GetItemList(new InternalItemsQuery
{ {

@ -137,7 +137,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken).ConfigureAwait(false); var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken).ConfigureAwait(false);
var programsInfo = new List<ProgramInfo>(); var programsInfo = new List<ProgramInfo>();
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 + //_logger.LogDebug("Proccesing Schedule for statio ID " + stationID +
// " which corresponds to channel " + channelNumber + " and program id " + // " which corresponds to channel " + channelNumber + " and program id " +
@ -526,15 +526,15 @@ namespace Emby.Server.Implementations.LiveTv.Listings
try try
{ {
using (var httpResponse = await Get(options, false, info).ConfigureAwait(false)) 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<List<ScheduleDirect.Headends>>(responce).ConfigureAwait(false); var root = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.Headends>>(responce).ConfigureAwait(false);
if (root != null) 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 lineups.Add(new NameIdPair
{ {
@ -887,7 +887,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
var allStations = root.stations ?? Enumerable.Empty<ScheduleDirect.Station>(); var allStations = root.stations ?? Enumerable.Empty<ScheduleDirect.Station>();
foreach (var map in root.map) foreach (ScheduleDirect.Map map in root.map)
{ {
var channelNumber = GetChannelNumber(map); var channelNumber = GetChannelNumber(map);

@ -540,7 +540,7 @@ namespace Emby.Server.Implementations.LiveTv
var isNew = false; var isNew = false;
var forceUpdate = false; var forceUpdate = false;
if (!allExistingPrograms.TryGetValue(id, out var item)) if (!allExistingPrograms.TryGetValue(id, out LiveTvProgram item))
{ {
isNew = true; isNew = true;
item = new LiveTvProgram item = new LiveTvProgram
@ -1951,7 +1951,7 @@ namespace Emby.Server.Implementations.LiveTv
foreach (var programDto in currentProgramDtos) foreach (var programDto in currentProgramDtos)
{ {
if (currentChannelsDict.TryGetValue(programDto.ChannelId, out var channelDto)) if (currentChannelsDict.TryGetValue(programDto.ChannelId, out BaseItemDto channelDto))
{ {
channelDto.CurrentProgram = programDto; channelDto.CurrentProgram = programDto;
} }
@ -2315,7 +2315,7 @@ namespace Emby.Server.Implementations.LiveTv
await provider.Validate(info, validateLogin, validateListings).ConfigureAwait(false); await provider.Validate(info, validateLogin, validateListings).ConfigureAwait(false);
var config = GetConfiguration(); LiveTvOptions config = GetConfiguration();
var list = config.ListingProviders.ToList(); var list = config.ListingProviders.ToList();
int index = list.FindIndex(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase)); int index = list.FindIndex(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));

@ -118,7 +118,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{ {
if (!string.IsNullOrEmpty(cacheKey)) if (!string.IsNullOrEmpty(cacheKey))
{ {
if (_modelCache.TryGetValue(cacheKey, out var response)) if (_modelCache.TryGetValue(cacheKey, out DiscoverResponse response))
{ {
return response; return response;
} }

@ -132,7 +132,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
var receiveBuffer = new byte[8192]; var receiveBuffer = new byte[8192];
var response = await socket.ReceiveAsync(receiveBuffer, 0, receiveBuffer.Length, cancellationToken).ConfigureAwait(false); 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); return string.Equals(returnVal, "none", StringComparison.OrdinalIgnoreCase);
} }
@ -171,7 +171,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
continue; continue;
var commandList = commands.GetCommands(); var commandList = commands.GetCommands();
foreach (var command in commandList) foreach (Tuple<string, string> command in commandList)
{ {
var channelMsg = CreateSetMessage(i, command.Item1, command.Item2, lockKeyValue); var channelMsg = CreateSetMessage(i, command.Item1, command.Item2, lockKeyValue);
await tcpClient.SendToAsync(channelMsg, 0, channelMsg.Length, ipEndPoint, cancellationToken).ConfigureAwait(false); 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 commandList = commands.GetCommands();
var receiveBuffer = new byte[8192]; var receiveBuffer = new byte[8192];
foreach (var command in commandList) foreach (Tuple<string, string> command in commandList)
{ {
var channelMsg = CreateSetMessage(_activeTuner, command.Item1, command.Item2, _lockkey); var channelMsg = CreateSetMessage(_activeTuner, command.Item1, command.Item2, _lockkey);
await tcpClient.SendToAsync(channelMsg, 0, channelMsg.Length, new IpEndPointInfo(_remoteIp, HdHomeRunPort), cancellationToken).ConfigureAwait(false); 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); var response = await tcpClient.ReceiveAsync(receiveBuffer, 0, receiveBuffer.Length, cancellationToken).ConfigureAwait(false);
// parse response to make sure it worked // 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; return;
} }

@ -117,10 +117,10 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
extInf = extInf.Trim(); extInf = extInf.Trim();
var attributes = ParseExtInf(extInf, out var remaining); var attributes = ParseExtInf(extInf, out string remaining);
extInf = remaining; extInf = remaining;
if (attributes.TryGetValue("tvg-logo", out var value)) if (attributes.TryGetValue("tvg-logo", out string value))
{ {
channel.ImageUrl = value; channel.ImageUrl = value;
} }
@ -128,9 +128,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
channel.Name = GetChannelName(extInf, attributes); channel.Name = GetChannelName(extInf, attributes);
channel.Number = GetChannelNumber(extInf, attributes, mediaUrl); 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; channel.TunerChannelId = string.IsNullOrWhiteSpace(tvgId) ? channelId : tvgId;
@ -182,7 +182,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
if (!IsValidChannelNumber(numberString)) 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)) 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 (!IsValidChannelNumber(numberString))
{ {
if (attributes.TryGetValue("channel-id", out var value)) if (attributes.TryGetValue("channel-id", out string value))
{ {
numberString = 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)) if (string.IsNullOrWhiteSpace(name))
{ {
@ -291,7 +291,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
if (string.IsNullOrWhiteSpace(name)) if (string.IsNullOrWhiteSpace(name))
{ {
attributes.TryGetValue("tvg-id", out name); attributes.TryGetValue("tvg-id", string name);
} }
if (string.IsNullOrWhiteSpace(name)) if (string.IsNullOrWhiteSpace(name))

@ -360,7 +360,7 @@ namespace Emby.Server.Implementations.Localization
var ratingsDictionary = GetParentalRatingsDictionary(); var ratingsDictionary = GetParentalRatingsDictionary();
if (ratingsDictionary.TryGetValue(rating, out var value)) if (ratingsDictionary.TryGetValue(rating, out ParentalRating value))
{ {
return value.Value; return value.Value;
} }

@ -89,7 +89,7 @@ namespace Emby.Server.Implementations.Services
if (restPath.Path.IndexOfAny(InvalidRouteChars) != -1) if (restPath.Path.IndexOfAny(InvalidRouteChars) != -1)
throw new ArgumentException(string.Format("Route '{0}' on '{1}' contains invalid chars. ", restPath.Path, restPath.RequestType.GetMethodName())); 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<RestPath> pathsAtFirstMatch))
{ {
pathsAtFirstMatch = new List<RestPath>(); pathsAtFirstMatch = new List<RestPath>();
RestPathMap[restPath.FirstMatchHashKey] = pathsAtFirstMatch; RestPathMap[restPath.FirstMatchHashKey] = pathsAtFirstMatch;

@ -73,7 +73,7 @@ namespace Emby.Server.Implementations.Services
{ {
var actionName = request.Verb ?? "POST"; 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) if (actionContext.RequestFilters != null)
{ {

@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.Services
{ {
if (this.RestPath == null) if (this.RestPath == null)
{ {
this.RestPath = FindMatchingRestPath(httpMethod, pathInfo, out var contentType); this.RestPath = FindMatchingRestPath(httpMethod, pathInfo, out string contentType);
if (contentType != null) if (contentType != null)
ResponseContentType = contentType; ResponseContentType = contentType;
@ -137,7 +137,7 @@ namespace Emby.Server.Implementations.Services
public static object CreateRequest(IRequest httpReq, RestPath restPath, Dictionary<string, string> requestParams, object requestDto) public static object CreateRequest(IRequest httpReq, RestPath restPath, Dictionary<string, string> requestParams, object requestDto)
{ {
var pathInfo = !restPath.IsWildCardPath var pathInfo = !restPath.IsWildCardPath
? GetSanitizedPathInfo(httpReq.PathInfo, out var contentType) ? GetSanitizedPathInfo(httpReq.PathInfo, out string contentType)
: httpReq.PathInfo; : httpReq.PathInfo;
return restPath.CreateRequest(pathInfo, requestParams, requestDto); return restPath.CreateRequest(pathInfo, requestParams, requestDto);

@ -164,7 +164,7 @@ namespace NLangDetect.Core
public string Detect() public string Detect()
{ {
var probabilities = GetProbabilities(); List<Language> probabilities = GetProbabilities();
return return
probabilities.Count > 0 probabilities.Count > 0
@ -241,7 +241,7 @@ namespace NLangDetect.Core
{ {
CleanText(); CleanText();
var ngrams = ExtractNGrams(); List<string> ngrams = ExtractNGrams();
if (ngrams.Count == 0) if (ngrams.Count == 0)
{ {
@ -332,7 +332,7 @@ namespace NLangDetect.Core
return; return;
} }
var langProbMap = _wordLangProbMap[word]; ProbVector langProbMap = _wordLangProbMap[word];
double weight = alpha / _BaseFreq; double weight = alpha / _BaseFreq;
for (int i = 0; i < prob.Length; i++) for (int i = 0; i < prob.Length; i++)

@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.TextEncoding
public CharacterEncoding DetectEncoding(byte[] buffer, int size) public CharacterEncoding DetectEncoding(byte[] buffer, int size)
{ {
// First check if we have a BOM and return that if so // 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) if (encoding != CharacterEncoding.None)
{ {
return encoding; return encoding;

@ -84,7 +84,7 @@ namespace UniversalDetector.Core
} }
else if (j != activeSM) else if (j != activeSM)
{ {
var t = codingSM[activeSM]; CodingStateMachine t = codingSM[activeSM];
codingSM[activeSM] = codingSM[j]; codingSM[activeSM] = codingSM[j];
codingSM[j] = t; codingSM[j] = t;
} }

Loading…
Cancel
Save