mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-21 13:10:45 +02:00
Enable FxCop Analysis and fix issues
This commit is contained in:
parent
88928118eb
commit
0cf9e59d5a
|
@ -22,4 +22,16 @@
|
||||||
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
|
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Code analysers-->
|
||||||
|
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
|
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.7" PrivateAssets="All" />
|
||||||
|
<!-- <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> -->
|
||||||
|
<!-- <PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> -->
|
||||||
|
<!-- <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> -->
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
|
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
|
|
||||||
|
@ -6,18 +7,19 @@ namespace Jellyfin.Drawing.Skia
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents errors that occur during interaction with Skia codecs.
|
/// Represents errors that occur during interaction with Skia codecs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SuppressMessage("Design", "CA1032:Implement standard exception constructors", Justification = "A custom property, CodecResult, is required when creating this exception type.")]
|
||||||
public class SkiaCodecException : SkiaException
|
public class SkiaCodecException : SkiaException
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the non-successfull codec result returned by Skia.
|
/// Returns the non-successful codec result returned by Skia.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The non-successfull codec result returned by Skia.</value>
|
/// <value>The non-successful codec result returned by Skia.</value>
|
||||||
public SKCodecResult CodecResult { get; }
|
public SKCodecResult CodecResult { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="SkiaCodecException" /> class.
|
/// Initializes a new instance of the <see cref="SkiaCodecException" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="result">The non-successfull codec result returned by Skia.</param>
|
/// <param name="result">The non-successful codec result returned by Skia.</param>
|
||||||
public SkiaCodecException(SKCodecResult result) : base()
|
public SkiaCodecException(SKCodecResult result) : base()
|
||||||
{
|
{
|
||||||
CodecResult = result;
|
CodecResult = result;
|
||||||
|
@ -27,7 +29,7 @@ namespace Jellyfin.Drawing.Skia
|
||||||
/// Initializes a new instance of the <see cref="SkiaCodecException" /> class
|
/// Initializes a new instance of the <see cref="SkiaCodecException" /> class
|
||||||
/// with a specified error message.
|
/// with a specified error message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="result">The non-successfull codec result returned by Skia.</param>
|
/// <param name="result">The non-successful codec result returned by Skia.</param>
|
||||||
/// <param name="message">The message that describes the error.</param>
|
/// <param name="message">The message that describes the error.</param>
|
||||||
public SkiaCodecException(SKCodecResult result, string message)
|
public SkiaCodecException(SKCodecResult result, string message)
|
||||||
: base(message)
|
: base(message)
|
||||||
|
@ -41,6 +43,6 @@ namespace Jellyfin.Drawing.Skia
|
||||||
CultureInfo.InvariantCulture,
|
CultureInfo.InvariantCulture,
|
||||||
"Non-success codec result: {0}\n{1}",
|
"Non-success codec result: {0}\n{1}",
|
||||||
CodecResult,
|
CodecResult,
|
||||||
base.ToString());
|
base.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -540,7 +540,7 @@ namespace Jellyfin.Drawing.Skia
|
||||||
{
|
{
|
||||||
if (bitmap == null)
|
if (bitmap == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException(string.Format("Skia unable to read image {0}", inputPath));
|
throw new ArgumentOutOfRangeException($"Skia unable to read image {inputPath}");
|
||||||
}
|
}
|
||||||
|
|
||||||
var originalImageSize = new ImageDimensions(bitmap.Width, bitmap.Height);
|
var originalImageSize = new ImageDimensions(bitmap.Width, bitmap.Height);
|
||||||
|
|
Loading…
Reference in a new issue