Browse Source

Making is64 process public

Former-commit-id: 5025eb7e47a2aa866eb7f976cb75a8b87507b22d
pull/17/head
James South 12 years ago
parent
commit
848c7f65ca
  1. 13
      src/ImageProcessor/Configuration/NativeBinaryFactory.cs
  2. BIN
      src/ImageProcessorConsole/images/output/rotate.jpg
  3. 8
      src/Plugins/ImageProcessor/ImageProcessor.Plugins.WebP/Imaging/Formats/NativeMethods.cs

13
src/ImageProcessor/Configuration/NativeBinaryFactory.cs

@ -71,6 +71,17 @@ namespace ImageProcessor.Configuration
this.Dispose(false);
}
/// <summary>
/// Gets a value indicating whether the operating environment is 64 bit.
/// </summary>
public bool Is64BitEnvironment
{
get
{
return Is64Bit;
}
}
/// <summary>
/// Registers any embedded native (unmanaged) binaries required by ImageProcessor.
/// </summary>
@ -90,7 +101,7 @@ namespace ImageProcessor.Configuration
b =>
{
IntPtr pointer;
string folder = Is64Bit ? "x64" : "x86";
string folder = Is64BitEnvironment ? "x64" : "x86";
Assembly assembly = Assembly.GetExecutingAssembly();
string targetBasePath = new Uri(assembly.Location).LocalPath;
string targetPath = Path.GetFullPath(Path.Combine(targetBasePath, "..\\" + folder + "\\" + name));

BIN
src/ImageProcessorConsole/images/output/rotate.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 18 KiB

8
src/Plugins/ImageProcessor/ImageProcessor.Plugins.WebP/Imaging/Formats/NativeMethods.cs

@ -22,18 +22,12 @@ namespace ImageProcessor.Plugins.WebP.Imaging.Formats
/// </summary>
internal static class NativeMethods
{
/// <summary>
/// Whether the process is running in 64bit mode. Used for calling the correct method.
/// Clunky I know but I couldn't get dynamic methods to work.
/// </summary>
private static readonly bool Is64Bit = Environment.Is64BitProcess;
/// <summary>
/// Initializes static members of the <see cref="NativeMethods"/> class.
/// </summary>
static NativeMethods()
{
string folder = Is64Bit ? "x64" : "x86";
string folder = ImageProcessorBootstrapper.Instance.NativeBinaryFactory.Is64BitEnvironment ? "x64" : "x86";
string name = string.Format("ImageProcessor.Plugins.WebP.Resources.Unmanaged.{0}.libwebp.dll", folder);
Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name);

Loading…
Cancel
Save