Replace == null with is null

This commit is contained in:
Bond_009
2022-12-05 15:00:20 +01:00
parent b2def4c9ea
commit c7d50d640e
206 changed files with 627 additions and 627 deletions

View File

@@ -295,7 +295,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
var program = GetProgramInfoFromCache(timer);
if (program == null)
if (program is null)
{
OnTimerOutOfDate(timer);
continue;
@@ -642,7 +642,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
programInfo = GetProgramInfoFromCache(info);
}
if (programInfo == null)
if (programInfo is null)
{
_logger.LogInformation("Unable to find program with Id {0}. Will search using start date", info.ProgramId);
programInfo = GetProgramInfoFromCache(info.ChannelId, info.StartDate);
@@ -744,7 +744,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
var existingTimer = _timerProvider.GetTimer(updatedTimer.Id);
if (existingTimer == null)
if (existingTimer is null)
{
throw new ResourceNotFoundException();
}
@@ -912,7 +912,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var epgChannel = await GetEpgChannelFromTunerChannel(provider.Item1, provider.Item2, channel, cancellationToken).ConfigureAwait(false);
if (epgChannel == null)
if (epgChannel is null)
{
_logger.LogDebug("EPG channel not found for tuner channel {0}-{1} from {2}-{3}", channel.Number, channel.Name, provider.Item1.Name, provider.Item2.ListingsId ?? string.Empty);
continue;
@@ -945,7 +945,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
var provider = _liveTvManager.ListingProviders.FirstOrDefault(l => string.Equals(l.Type, i.Type, StringComparison.OrdinalIgnoreCase));
return provider == null ? null : new Tuple<IListingsProvider, ListingsProviderInfo>(provider, i);
return provider is null ? null : new Tuple<IListingsProvider, ListingsProviderInfo>(provider, i);
})
.Where(i => i != null)
.ToList();
@@ -1232,7 +1232,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
programInfo = GetProgramInfoFromCache(timer);
}
if (programInfo == null)
if (programInfo is null)
{
_logger.LogInformation("Unable to find program with Id {0}. Will search using start date", timer.ProgramId);
programInfo = GetProgramInfoFromCache(timer.ChannelId, timer.StartDate);
@@ -1437,7 +1437,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var parentPath = Path.GetDirectoryName(path);
while (item == null && !string.IsNullOrEmpty(path))
while (item is null && !string.IsNullOrEmpty(path))
{
item = _libraryManager.FindByPath(path, null);
@@ -1474,7 +1474,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var seriesTimerId = timer.SeriesTimerId;
var seriesTimer = _seriesTimerProvider.GetAll().FirstOrDefault(i => string.Equals(i.Id, seriesTimerId, StringComparison.OrdinalIgnoreCase));
if (seriesTimer == null || seriesTimer.KeepUpTo <= 0)
if (seriesTimer is null || seriesTimer.KeepUpTo <= 0)
{
return;
}
@@ -1695,7 +1695,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
_ => null
};
if (imageSaveFilenameWithoutExtension == null)
if (imageSaveFilenameWithoutExtension is null)
{
return;
}
@@ -1782,7 +1782,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}).FirstOrDefault() as LiveTvProgram;
// dummy this up
if (program == null)
if (program is null)
{
program = new LiveTvProgram
{
@@ -2240,7 +2240,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
? null
: _timerProvider.GetTimerByProgramId(timer.ProgramId));
if (existingTimer == null)
if (existingTimer is null)
{
if (ShouldCancelTimerForSeriesTimer(seriesTimer, timer))
{

View File

@@ -49,7 +49,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
var bytes = File.ReadAllBytes(_dataPath);
_items = JsonSerializer.Deserialize<T[]>(bytes, _jsonOptions);
if (_items == null)
if (_items is null)
{
Logger.LogError("Error deserializing {Path}, data was null", _dataPath);
_items = Array.Empty<T>();

View File

@@ -111,7 +111,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
using var response = await Send(options, true, info, cancellationToken).ConfigureAwait(false);
await using var responseStream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
var dailySchedules = await JsonSerializer.DeserializeAsync<IReadOnlyList<DayDto>>(responseStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
if (dailySchedules == null)
if (dailySchedules is null)
{
return Array.Empty<ProgramInfo>();
}
@@ -127,7 +127,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
using var innerResponse = await Send(programRequestOptions, true, info, cancellationToken).ConfigureAwait(false);
await using var innerResponseStream = await innerResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
var programDetails = await JsonSerializer.DeserializeAsync<IReadOnlyList<ProgramDetailsDto>>(innerResponseStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
if (programDetails == null)
if (programDetails is null)
{
return Array.Empty<ProgramInfo>();
}
@@ -228,7 +228,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
private ProgramInfo GetProgram(string channelId, ProgramDto programInfo, ProgramDetailsDto details)
{
if (programInfo.AirDateTime == null)
if (programInfo.AirDateTime is null)
{
return null;
}
@@ -283,7 +283,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
EpisodeTitle = episodeTitle,
Audio = audioType,
// IsNew = programInfo.@new ?? false,
IsRepeat = programInfo.New == null,
IsRepeat = programInfo.New is null,
IsSeries = string.Equals(details.EntityType, "episode", StringComparison.OrdinalIgnoreCase),
ImageUrl = details.PrimaryImage,
ThumbImageUrl = details.ThumbImage,
@@ -407,7 +407,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
.ThenByDescending(i => GetSizeOrder(i))
.FirstOrDefault();
if (match == null)
if (match is null)
{
return null;
}
@@ -785,7 +785,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
using var httpResponse = await Send(options, true, info, cancellationToken).ConfigureAwait(false);
await using var stream = await httpResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
var root = await JsonSerializer.DeserializeAsync<ChannelDto>(stream, _jsonOptions, cancellationToken).ConfigureAwait(false);
if (root == null)
if (root is null)
{
return new List<ChannelInfo>();
}

View File

@@ -162,7 +162,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
HasImage = !string.IsNullOrEmpty(program.Icon?.Source),
OfficialRating = string.IsNullOrEmpty(program.Rating?.Value) ? null : program.Rating.Value,
CommunityRating = program.StarRating,
SeriesId = program.Episode == null ? null : program.Title?.GetMD5().ToString("N", CultureInfo.InvariantCulture)
SeriesId = program.Episode is null ? null : program.Title?.GetMD5().ToString("N", CultureInfo.InvariantCulture)
};
if (string.IsNullOrWhiteSpace(program.ProgramId))

View File

@@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.LiveTv
dto.ProgramId = GetInternalProgramId(info.ProgramId).ToString("N", CultureInfo.InvariantCulture);
}
dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days.ToArray());
dto.DayPattern = info.Days is null ? null : GetDayPattern(info.Days.ToArray());
FillImages(dto, info.Name, info.SeriesId);
@@ -228,7 +228,7 @@ namespace Emby.Server.Implementations.LiveTv
}
}
if (dto.ParentBackdropImageTags == null || dto.ParentBackdropImageTags.Length == 0)
if (dto.ParentBackdropImageTags is null || dto.ParentBackdropImageTags.Length == 0)
{
image = program.GetImageInfo(ImageType.Backdrop, 0);
if (image != null)
@@ -305,7 +305,7 @@ namespace Emby.Server.Implementations.LiveTv
DtoOptions = new DtoOptions(false)
}).FirstOrDefault();
if (program == null)
if (program is null)
{
program = _libraryManager.GetItemList(new InternalItemsQuery
{
@@ -334,7 +334,7 @@ namespace Emby.Server.Implementations.LiveTv
}
}
if (dto.ParentBackdropImageTags == null || dto.ParentBackdropImageTags.Length == 0)
if (dto.ParentBackdropImageTags is null || dto.ParentBackdropImageTags.Length == 0)
{
image = program.GetImageInfo(ImageType.Backdrop, 0);
if (image != null)

View File

@@ -434,7 +434,7 @@ namespace Emby.Server.Implementations.LiveTv
var item = _libraryManager.GetItemById(id) as LiveTvChannel;
if (item == null)
if (item is null)
{
item = new LiveTvChannel
{
@@ -948,7 +948,7 @@ namespace Emby.Server.Implementations.LiveTv
var channel = _libraryManager.GetItemById(program.ChannelId);
if (channel == null)
if (channel is null)
{
return score;
}
@@ -1314,7 +1314,7 @@ namespace Emby.Server.Implementations.LiveTv
private QueryResult<BaseItem> GetEmbyRecordings(RecordingQuery query, DtoOptions dtoOptions, User user)
{
if (user == null)
if (user is null)
{
return new QueryResult<BaseItem>();
}
@@ -1702,7 +1702,7 @@ namespace Emby.Server.Implementations.LiveTv
{
var timer = await GetTimer(id, CancellationToken.None).ConfigureAwait(false);
if (timer == null)
if (timer is null)
{
throw new ResourceNotFoundException(string.Format(CultureInfo.InvariantCulture, "Timer with Id {0} not found", id));
}
@@ -1721,7 +1721,7 @@ namespace Emby.Server.Implementations.LiveTv
{
var timer = await GetSeriesTimer(id, CancellationToken.None).ConfigureAwait(false);
if (timer == null)
if (timer is null)
{
throw new ResourceNotFoundException(string.Format(CultureInfo.InvariantCulture, "SeriesTimer with Id {0} not found", id));
}
@@ -1834,7 +1834,7 @@ namespace Emby.Server.Implementations.LiveTv
{
var internalChannelId = _tvDtoService.GetInternalChannelId(i.Item2.Name, i.Item1.ChannelId);
var channel = _libraryManager.GetItemById(internalChannelId);
channelName = channel == null ? null : channel.Name;
channelName = channel is null ? null : channel.Name;
}
return _tvDtoService.GetSeriesTimerInfoDto(i.Item1, i.Item2, channelName);
@@ -2147,7 +2147,7 @@ namespace Emby.Server.Implementations.LiveTv
var service = _services.FirstOrDefault(i => string.Equals(i.GetType().FullName.GetMD5().ToString("N", CultureInfo.InvariantCulture), parts[0], StringComparison.OrdinalIgnoreCase));
if (service == null)
if (service is null)
{
throw new ArgumentException("Service not found.");
}
@@ -2178,7 +2178,7 @@ namespace Emby.Server.Implementations.LiveTv
var provider = _tunerHosts.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase));
if (provider == null)
if (provider is null)
{
throw new ResourceNotFoundException();
}
@@ -2222,7 +2222,7 @@ namespace Emby.Server.Implementations.LiveTv
var provider = _listingProviders.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase));
if (provider == null)
if (provider is null)
{
throw new ResourceNotFoundException(
string.Format(
@@ -2334,7 +2334,7 @@ namespace Emby.Server.Implementations.LiveTv
{
var provider = _listingProviders.FirstOrDefault(i => string.Equals(providerType, i.Type, StringComparison.OrdinalIgnoreCase));
if (provider == null)
if (provider is null)
{
throw new ResourceNotFoundException();
}
@@ -2347,7 +2347,7 @@ namespace Emby.Server.Implementations.LiveTv
var provider = _listingProviders.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase));
if (provider == null)
if (provider is null)
{
throw new ResourceNotFoundException();
}

View File

@@ -302,7 +302,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
var hdHomerunChannelInfo = channels.FirstOrDefault() as HdHomerunChannelInfo;
if (hdHomerunChannelInfo == null || hdHomerunChannelInfo.IsLegacyTuner)
if (hdHomerunChannelInfo is null || hdHomerunChannelInfo.IsLegacyTuner)
{
return await GetTunerInfosUdp(info, cancellationToken).ConfigureAwait(false);
}