FxCop -> Net Analyzers (part 1)

This commit is contained in:
Bond_009
2021-03-09 03:04:47 +01:00
parent 3c46f10e3d
commit 9ed7f429c0
48 changed files with 213 additions and 273 deletions

View File

@@ -640,7 +640,7 @@ namespace MediaBrowser.MediaEncoding.Probing
}
// Filter out junk
if (!string.IsNullOrWhiteSpace(streamInfo.CodecTagString) && streamInfo.CodecTagString.IndexOf("[0]", StringComparison.OrdinalIgnoreCase) == -1)
if (!string.IsNullOrWhiteSpace(streamInfo.CodecTagString) && !streamInfo.CodecTagString.Contains("[0]", StringComparison.OrdinalIgnoreCase))
{
stream.CodecTag = streamInfo.CodecTagString;
}
@@ -1500,11 +1500,23 @@ namespace MediaBrowser.MediaEncoding.Probing
}
else
{
throw new Exception(); // Switch to default parsing
// Switch to default parsing
if (subtitle.Contains('.', StringComparison.Ordinal))
{
// skip the comment, keep the subtitle
description = string.Join('.', subtitle.Split('.'), 1, subtitle.Split('.').Length - 1).Trim(); // skip the first
}
else
{
description = subtitle.Trim(); // Clean up whitespaces and save it
}
}
}
catch // Default parsing
catch (Exception ex)
{
_logger.LogError(ex, "Error while parsing subtitle field");
// Default parsing
if (subtitle.Contains('.', StringComparison.Ordinal))
{
// skip the comment, keep the subtitle