Merge pull request #2731 from Bond-009/minor2

Minor improvements
This commit is contained in:
dkanada 2020-04-03 01:41:05 +09:00 committed by GitHub
commit 5a816f0b22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 8 deletions

View File

@ -308,8 +308,7 @@ namespace Jellyfin.Drawing.Skia
if (requiresTransparencyHack || forceCleanBitmap) if (requiresTransparencyHack || forceCleanBitmap)
{ {
using (var stream = new SKFileStream(NormalizePath(path))) using (var codec = SKCodec.Create(NormalizePath(path)))
using (var codec = SKCodec.Create(stream))
{ {
if (codec == null) if (codec == null)
{ {

View File

@ -22,7 +22,6 @@ namespace MediaBrowser.Common.Net
} }
#pragma warning restore CS1591 #pragma warning restore CS1591
#pragma warning restore SA1600
/// <summary> /// <summary>
/// Gets or sets the type of the content. /// Gets or sets the type of the content.

View File

@ -35,7 +35,7 @@ namespace MediaBrowser.Common.System
case OperatingSystemId.Linux: return "Linux"; case OperatingSystemId.Linux: return "Linux";
case OperatingSystemId.Darwin: return "macOS"; case OperatingSystemId.Darwin: return "macOS";
case OperatingSystemId.Windows: return "Windows"; case OperatingSystemId.Windows: return "Windows";
default: throw new Exception($"Unknown OS {Id}"); default: throw new PlatformNotSupportedException($"Unknown OS {Id}");
} }
} }
} }
@ -53,20 +53,20 @@ namespace MediaBrowser.Common.System
default: default:
{ {
string osDescription = RuntimeInformation.OSDescription; string osDescription = RuntimeInformation.OSDescription;
if (osDescription.IndexOf("linux", StringComparison.OrdinalIgnoreCase) != -1) if (osDescription.Contains("linux", StringComparison.OrdinalIgnoreCase))
{ {
return OperatingSystemId.Linux; return OperatingSystemId.Linux;
} }
else if (osDescription.IndexOf("darwin", StringComparison.OrdinalIgnoreCase) != -1) else if (osDescription.Contains("darwin", StringComparison.OrdinalIgnoreCase))
{ {
return OperatingSystemId.Darwin; return OperatingSystemId.Darwin;
} }
else if (osDescription.IndexOf("bsd", StringComparison.OrdinalIgnoreCase) != -1) else if (osDescription.Contains("bsd", StringComparison.OrdinalIgnoreCase))
{ {
return OperatingSystemId.BSD; return OperatingSystemId.BSD;
} }
throw new Exception($"Can't resolve OS with description: '{osDescription}'"); throw new PlatformNotSupportedException($"Can't resolve OS with description: '{osDescription}'");
} }
} }
} }