Browse Source

Making is64 process public

Former-commit-id: 5025eb7e47a2aa866eb7f976cb75a8b87507b22d
af/merge-core
James South 12 years ago
parent
commit
7d5e5b4ca8
  1. 13
      src/ImageProcessor/Configuration/NativeBinaryFactory.cs
  2. 4
      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));

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

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fbb53b552f559d93ea5d04ac1dd099938405d497362275ff669070e746f89d35
size 17821
oid sha256:14b2734f6cb4f808fccf8549da1788450bf9b6e1a95ec3c7c10c96c9e07c2ec3
size 18422

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