mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-22 22:34:53 -04:00
Fix regression for missing libgdiplus (#1073)
* Fix regression for missing libgdiplus Add back error handling for systems where libgdiplus is not available. Should fix #1065 * Create GdiPlusInterop.cs * Update DiskProviderBase.cs * Update ImageResizer.cs * Delete GdiPlusInterop.cs * Update NzbDrone.Core.csproj * Update NzbDrone.Common.csproj * Update DiskProviderBase.cs * Update IDiskProvider.cs * Update ImageResizer.cs * Update DiskProviderBase.cs * Update IDiskProvider.cs * Update ImageResizer.cs This is really ugly... :( * Update ImageResizer.cs Never written C# before * Update ImageResizerFixture.cs * Fix test
This commit is contained in:
@@ -108,9 +108,28 @@ namespace NzbDrone.Common.Disk
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanUseGDIPlus()
|
||||
{
|
||||
try
|
||||
{
|
||||
GdiPlusInterop.CheckGdiPlus();
|
||||
return true;
|
||||
}
|
||||
catch (DllNotFoundException ex)
|
||||
{
|
||||
Logger.Trace(ex, "System does not have libgdiplus.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsValidGDIPlusImage(string filename)
|
||||
{
|
||||
if (!CanUseGDIPlus())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using (var bmp = new Bitmap(filename))
|
||||
@@ -120,7 +139,7 @@ namespace NzbDrone.Common.Disk
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//_logger.Debug(ex, "Corrupted image found at: {0}. Redownloading...", filename);
|
||||
Logger.Debug(ex, "Corrupted image found at: {0}.", filename);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user