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:
SWu
2017-03-09 13:11:41 -05:00
committed by Devin Buhl
parent 3d9fd3ff25
commit 51e0cdf982
7 changed files with 35 additions and 7 deletions
+20 -1
View File
@@ -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;
}
}