diff --git a/Pechkin/Pechkin.csproj b/Pechkin/Pechkin.csproj
index 5547647..6827946 100644
--- a/Pechkin/Pechkin.csproj
+++ b/Pechkin/Pechkin.csproj
@@ -130,10 +130,8 @@
-
-
-
-
+
+
diff --git a/Pechkin/PechkinBindings.cs b/Pechkin/PechkinBindings.cs
index 40cd391..aae5d54 100644
--- a/Pechkin/PechkinBindings.cs
+++ b/Pechkin/PechkinBindings.cs
@@ -1,5 +1,6 @@
using System;
using System.IO;
+using System.IO.Compression;
using System.Reflection;
using System.Runtime.InteropServices;
using Pechkin.Properties;
@@ -12,7 +13,7 @@ internal static class PechkinBindings
{
static PechkinBindings()
{
- var raw = (IntPtr.Size == 8) ? Resources.wkhtmltox_64 : Resources.wkhtmltox_32;
+ var raw = (IntPtr.Size == 8) ? Resources.wkhtmltox_64_dll : Resources.wkhtmltox_32_dll;
SetupUnmanagedAssembly("wkhtmltox.dll", raw);
}
@@ -127,10 +128,11 @@ private static void SetupUnmanagedAssembly(string fileName, byte[] assemblyRaw)
var basePath = Path.Combine(
Path.GetTempPath(),
String.Format(
- "{0}{1}_{2}",
+ "{0}{1}_{2}_{3}",
assemblyName.Name.ToString(),
assemblyName.Version.ToString(),
- IntPtr.Size == 8 ? "x64" : "x86"));
+ IntPtr.Size == 8 ? "x64" : "x86",
+ String.Join(String.Empty, AppDomain.CurrentDomain.BaseDirectory.Split(Path.GetInvalidFileNameChars()))));
if (!Directory.Exists(basePath))
{
@@ -141,7 +143,17 @@ private static void SetupUnmanagedAssembly(string fileName, byte[] assemblyRaw)
if (!File.Exists(fileName))
{
- File.WriteAllBytes(fileName, assemblyRaw);
+ var decompressed = new GZipStream(new MemoryStream(assemblyRaw), CompressionMode.Decompress);
+ var writeBuffer = new byte[8192];
+ var writeLength = 0;
+
+ using (var newFile = File.Open(fileName, FileMode.Create))
+ {
+ while((writeLength = decompressed.Read(writeBuffer, 0, writeBuffer.Length)) > 0)
+ {
+ newFile.Write(writeBuffer, 0, writeLength);
+ }
+ }
}
WinApiHelper.LoadLibrary(fileName);
diff --git a/Pechkin/Properties/AssemblyInfo.cs b/Pechkin/Properties/AssemblyInfo.cs
index 6df2a1c..a080b83 100644
--- a/Pechkin/Properties/AssemblyInfo.cs
+++ b/Pechkin/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.9.3.1")]
-[assembly: AssemblyFileVersion("0.9.3.1")]
+[assembly: AssemblyVersion("0.9.3.2")]
+[assembly: AssemblyFileVersion("0.9.3.2")]
diff --git a/Pechkin/Properties/Resources.Designer.cs b/Pechkin/Properties/Resources.Designer.cs
index edb9bcc..8e569b9 100644
--- a/Pechkin/Properties/Resources.Designer.cs
+++ b/Pechkin/Properties/Resources.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.17929
+// Runtime Version:4.0.30319.18408
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -63,9 +63,9 @@ internal Resources() {
///
/// Looks up a localized resource of type System.Byte[].
///
- internal static byte[] wkhtmltox_32 {
+ internal static byte[] wkhtmltox_32_dll {
get {
- object obj = ResourceManager.GetObject("wkhtmltox_32", resourceCulture);
+ object obj = ResourceManager.GetObject("wkhtmltox_32_dll", resourceCulture);
return ((byte[])(obj));
}
}
@@ -73,9 +73,9 @@ internal static byte[] wkhtmltox_32 {
///
/// Looks up a localized resource of type System.Byte[].
///
- internal static byte[] wkhtmltox_64 {
+ internal static byte[] wkhtmltox_64_dll {
get {
- object obj = ResourceManager.GetObject("wkhtmltox_64", resourceCulture);
+ object obj = ResourceManager.GetObject("wkhtmltox_64_dll", resourceCulture);
return ((byte[])(obj));
}
}
diff --git a/Pechkin/Properties/Resources.resx b/Pechkin/Properties/Resources.resx
index 78ddfd9..7f0e10d 100644
--- a/Pechkin/Properties/Resources.resx
+++ b/Pechkin/Properties/Resources.resx
@@ -118,10 +118,10 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- ..\wkhtmltox_32.dll;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ ..\wkhtmltox_32.dll.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- ..\wkhtmltox_64.dll;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ ..\wkhtmltox_64.dll.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/Pechkin/wkhtmltox_32.dll b/Pechkin/wkhtmltox_32.dll
deleted file mode 100644
index 4e2642f..0000000
Binary files a/Pechkin/wkhtmltox_32.dll and /dev/null differ
diff --git a/Pechkin/wkhtmltox_32.dll.gz b/Pechkin/wkhtmltox_32.dll.gz
new file mode 100644
index 0000000..dc57438
Binary files /dev/null and b/Pechkin/wkhtmltox_32.dll.gz differ
diff --git a/Pechkin/wkhtmltox_64.dll b/Pechkin/wkhtmltox_64.dll
deleted file mode 100644
index 2ec3b98..0000000
Binary files a/Pechkin/wkhtmltox_64.dll and /dev/null differ
diff --git a/Pechkin/wkhtmltox_64.dll.gz b/Pechkin/wkhtmltox_64.dll.gz
new file mode 100644
index 0000000..dcd608b
Binary files /dev/null and b/Pechkin/wkhtmltox_64.dll.gz differ