diff --git a/src/ImageProcessor/Configuration/ImageProcessorBootstrapper.cs b/src/ImageProcessor/Configuration/ImageProcessorBootstrapper.cs index e2d61b54a..abb4033a9 100644 --- a/src/ImageProcessor/Configuration/ImageProcessorBootstrapper.cs +++ b/src/ImageProcessor/Configuration/ImageProcessorBootstrapper.cs @@ -13,6 +13,7 @@ namespace ImageProcessor.Configuration using System; using System.Collections; using System.Collections.Generic; + using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; @@ -70,19 +71,19 @@ namespace ImageProcessor.Configuration { if (this.SupportedImageFormats == null) { - try - { - Type type = typeof(ISupportedImageFormat); + Type type = typeof(ISupportedImageFormat); - // Get any referenced but not used assemblies. - Assembly executingAssembly = Assembly.GetExecutingAssembly(); - string targetBasePath = Path.GetDirectoryName(new Uri(executingAssembly.Location).LocalPath); + // Get any referenced but not used assemblies. + Assembly executingAssembly = Assembly.GetExecutingAssembly(); + string targetBasePath = Path.GetDirectoryName(new Uri(executingAssembly.Location).LocalPath); - // ReSharper disable once AssignNullToNotNullAttribute - FileInfo[] files = new DirectoryInfo(targetBasePath).GetFiles("*.dll", SearchOption.AllDirectories); + // ReSharper disable once AssignNullToNotNullAttribute + FileInfo[] files = new DirectoryInfo(targetBasePath).GetFiles("*.dll", SearchOption.AllDirectories); - HashSet found = new HashSet(); - foreach (FileInfo fileInfo in files) + HashSet found = new HashSet(); + foreach (FileInfo fileInfo in files) + { + try { AssemblyName assemblyName = AssemblyName.GetAssemblyName(fileInfo.FullName); @@ -91,23 +92,26 @@ namespace ImageProcessor.Configuration { // In a web app, this assembly will automatically be bound from the // Asp.Net Temporary folder from where the site actually runs. + Assembly.Load(assemblyName); this.LoadReferencedAssemblies(found, Assembly.Load(assemblyName)); } } + catch (Exception ex) + { + // Log the exception for debugging only. There could be any old junk + // thrown in to the bin folder by someone else. + Debug.WriteLine(ex.Message); + } + } - List availableTypes = AppDomain.CurrentDomain - .GetAssemblies() - .SelectMany(a => a.GetLoadableTypes()) - .Where(t => type.IsAssignableFrom(t) && t.IsClass && !t.IsAbstract) - .ToList(); + List availableTypes = AppDomain.CurrentDomain + .GetAssemblies() + .SelectMany(a => a.GetLoadableTypes()) + .Where(t => type.IsAssignableFrom(t) && t.IsClass && !t.IsAbstract) + .ToList(); - this.SupportedImageFormats = availableTypes - .Select(f => (Activator.CreateInstance(f) as ISupportedImageFormat)).ToList(); - } - catch (Exception ex) - { - throw new ImageFormatException(ex.Message, ex.InnerException); - } + this.SupportedImageFormats = availableTypes + .Select(f => (Activator.CreateInstance(f) as ISupportedImageFormat)).ToList(); } } diff --git a/src/ImageProcessorConsole/Program.cs b/src/ImageProcessorConsole/Program.cs index a84e4a5db..73490f97c 100644 --- a/src/ImageProcessorConsole/Program.cs +++ b/src/ImageProcessorConsole/Program.cs @@ -40,8 +40,8 @@ namespace ImageProcessorConsole di.Create(); } - IEnumerable files = GetFilesByExtensions(di, ".webp"); - //IEnumerable files = GetFilesByExtensions(di, ".gif", ".webp", ".bmp", ".jpg", ".png"); + //IEnumerable files = GetFilesByExtensions(di, ".jpg"); + IEnumerable files = GetFilesByExtensions(di, ".gif", ".webp", ".bmp", ".jpg", ".png"); foreach (FileInfo fileInfo in files) { diff --git a/src/ImageProcessorConsole/images/input/rotate.jpg.REMOVED.git-id b/src/ImageProcessorConsole/images/input/rotate.jpg.REMOVED.git-id index bf0538b24..7170f80e1 100644 --- a/src/ImageProcessorConsole/images/input/rotate.jpg.REMOVED.git-id +++ b/src/ImageProcessorConsole/images/input/rotate.jpg.REMOVED.git-id @@ -1 +1 @@ -406a6a7916628c0c0bea8243565a7162ebd5a505 \ No newline at end of file +166cc5e22c4caf8740e5771fe7b52e23637dd7fa \ No newline at end of file diff --git a/src/ImageProcessorConsole/images/output/120430.gif b/src/ImageProcessorConsole/images/output/120430.gif deleted file mode 100644 index 4064835ef..000000000 Binary files a/src/ImageProcessorConsole/images/output/120430.gif and /dev/null differ diff --git a/src/ImageProcessorConsole/images/output/120430.gif.REMOVED.git-id b/src/ImageProcessorConsole/images/output/120430.gif.REMOVED.git-id new file mode 100644 index 000000000..71ce555c1 --- /dev/null +++ b/src/ImageProcessorConsole/images/output/120430.gif.REMOVED.git-id @@ -0,0 +1 @@ +30ec5c05548fd350f9b7c699715848b9fbfb8ca9 \ No newline at end of file diff --git a/src/ImageProcessorConsole/images/output/Tl4Yb.gif b/src/ImageProcessorConsole/images/output/Tl4Yb.gif deleted file mode 100644 index 8539339c9..000000000 Binary files a/src/ImageProcessorConsole/images/output/Tl4Yb.gif and /dev/null differ diff --git a/src/ImageProcessorConsole/images/output/Tl4Yb.gif.REMOVED.git-id b/src/ImageProcessorConsole/images/output/Tl4Yb.gif.REMOVED.git-id new file mode 100644 index 000000000..6515d65a0 --- /dev/null +++ b/src/ImageProcessorConsole/images/output/Tl4Yb.gif.REMOVED.git-id @@ -0,0 +1 @@ +fdc62fc2d056ab885eb9e8fd12b9155ee86d7c43 \ No newline at end of file diff --git a/src/ImageProcessorConsole/images/output/circle.png b/src/ImageProcessorConsole/images/output/circle.png new file mode 100644 index 000000000..41fdcd72a Binary files /dev/null and b/src/ImageProcessorConsole/images/output/circle.png differ diff --git a/src/ImageProcessorConsole/images/output/nLpfllv.gif b/src/ImageProcessorConsole/images/output/nLpfllv.gif deleted file mode 100644 index 908147539..000000000 Binary files a/src/ImageProcessorConsole/images/output/nLpfllv.gif and /dev/null differ diff --git a/src/ImageProcessorConsole/images/output/nLpfllv.gif.REMOVED.git-id b/src/ImageProcessorConsole/images/output/nLpfllv.gif.REMOVED.git-id new file mode 100644 index 000000000..4487aede0 --- /dev/null +++ b/src/ImageProcessorConsole/images/output/nLpfllv.gif.REMOVED.git-id @@ -0,0 +1 @@ +23a1c81a2d1422076373796e0c47f5d968c56d0b \ No newline at end of file diff --git a/src/ImageProcessorConsole/images/output/rotate.jpg b/src/ImageProcessorConsole/images/output/rotate.jpg index 45c192cd4..cafd5f805 100644 Binary files a/src/ImageProcessorConsole/images/output/rotate.jpg and b/src/ImageProcessorConsole/images/output/rotate.jpg differ