Fixed: Test for empty strings using isNullOrEmpty

This commit is contained in:
Qstick 2020-10-02 14:52:48 -04:00
parent 4ec71538b9
commit 7d31eb1f55
9 changed files with 10 additions and 12 deletions

View file

@ -185,8 +185,6 @@ dotnet_diagnostic.CA1814.severity = suggestion
dotnet_diagnostic.CA1815.severity = suggestion
dotnet_diagnostic.CA1816.severity = suggestion
dotnet_diagnostic.CA1819.severity = suggestion
dotnet_diagnostic.CA1820.severity = suggestion
dotnet_diagnostic.CA1821.severity = suggestion
dotnet_diagnostic.CA1822.severity = suggestion
dotnet_diagnostic.CA1823.severity = suggestion
dotnet_diagnostic.CA1824.severity = suggestion

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
@ -488,7 +488,7 @@ public static string ToRequestValue(OAuthSignatureMethod signatureMethod)
private static bool IsNullOrBlank(string value)
{
return string.IsNullOrEmpty(value) || (!string.IsNullOrEmpty(value) && value.Trim() == string.Empty);
return string.IsNullOrEmpty(value) || (!string.IsNullOrEmpty(value) && string.IsNullOrEmpty(value.Trim()));
}
}
}

View file

@ -405,7 +405,7 @@ private static string HashWith(string input, HashAlgorithm algorithm)
private static bool IsNullOrBlank(string value)
{
return string.IsNullOrEmpty(value) || (!string.IsNullOrEmpty(value) && value.Trim() == string.Empty);
return string.IsNullOrEmpty(value) || (!string.IsNullOrEmpty(value) && string.IsNullOrEmpty(value.Trim()));
}
}
}

View file

@ -3660,7 +3660,7 @@ private IEnumerable<object> ResolveAllInternal(Type resolveType, bool includeUnn
var registrations = _RegisteredTypes.Keys.Where(tr => tr.Type == resolveType).Concat(GetParentRegistrationsForType(resolveType));
if (!includeUnnamed)
registrations = registrations.Where(tr => tr.Name != string.Empty);
registrations = registrations.Where(tr => !string.IsNullOrEmpty(tr.Name));
return registrations.Select(registration => this.ResolveInternal(registration, NamedParameterOverloads.Default, ResolveOptions.Default));
}

View file

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text.RegularExpressions;
@ -40,7 +40,7 @@ private void ConvertExistingFormatTags(IDbConnection conn, IDbTransaction tran)
modifiers += "RQ";
}
if (modifiers != "")
if (!string.IsNullOrEmpty(modifiers))
{
modifiers = "_" + modifiers;
}

View file

@ -305,7 +305,7 @@ public override MetadataFileResult MovieMetadata(Movie movie, MovieFile movieFil
var metadataFileName = GetMovieMetadataFilename(movieFile.RelativePath);
return xmlResult == string.Empty ? null : new MetadataFileResult(metadataFileName, xmlResult.Trim(Environment.NewLine.ToCharArray()));
return string.IsNullOrEmpty(xmlResult) ? null : new MetadataFileResult(metadataFileName, xmlResult.Trim(Environment.NewLine.ToCharArray()));
}
public override List<ImageFileResult> MovieImages(Movie movie)

View file

@ -348,7 +348,7 @@ public static string FormatVideoCodec(MediaInfoModel mediaInfo, string sceneName
return ""; // Other
}
if (videoCodecLibrary == "")
if (string.IsNullOrEmpty(videoCodecLibrary))
{
return ""; // Unknown mp4v
}

View file

@ -48,7 +48,7 @@ public static IsoLanguage Find(string isoCode)
if (isoArray.Length > 1)
{
isoLanguages = isoLanguages.Any(l => l.CountryCode == isoArray[1].ToLower()) ?
isoLanguages.Where(l => l.CountryCode == isoArray[1].ToLower()).ToList() : isoLanguages.Where(l => l.CountryCode == "").ToList();
isoLanguages.Where(l => l.CountryCode == isoArray[1].ToLower()).ToList() : isoLanguages.Where(l => string.IsNullOrEmpty(l.CountryCode)).ToList();
}
return isoLanguages.FirstOrDefault();

View file

@ -55,7 +55,7 @@ private static void GetPathComponents(string path, out string[] components, out
var target = 0;
for (var i = 0; i < dirs.Length; ++i)
{
if (dirs[i] == "." || dirs[i] == string.Empty)
if (dirs[i] == "." || string.IsNullOrEmpty(dirs[i]))
{
continue;
}