diff --git a/shadowsocks-csharp/PolipoRunner.cs b/shadowsocks-csharp/PolipoRunner.cs
index e99e956d..c7bb1cdc 100755
--- a/shadowsocks-csharp/PolipoRunner.cs
+++ b/shadowsocks-csharp/PolipoRunner.cs
@@ -90,7 +90,14 @@ namespace shadowsocks_csharp
if (process != null)
{
process.Kill();
- process.WaitForExit();
+ try
+ {
+ process.WaitForExit();
+ }
+ catch (InvalidOperationException)
+ {
+ // do nothing
+ }
process = null;
}
}
diff --git a/shadowsocks-csharp/Program.cs b/shadowsocks-csharp/Program.cs
index 12cf932d..7e27dd4a 100755
--- a/shadowsocks-csharp/Program.cs
+++ b/shadowsocks-csharp/Program.cs
@@ -1,12 +1,17 @@
-using System;
+using shadowsocks_csharp.Properties;
+using System;
using System.Collections.Generic;
using System.IO;
+using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace shadowsocks_csharp
{
static class Program
{
+ [DllImport("Kernel32.dll")]
+ private static extern IntPtr LoadLibrary(string path);
+
///
/// 应用程序的主入口点。
///
@@ -14,14 +19,18 @@ namespace shadowsocks_csharp
static void Main()
{
try
- {
+ {
+ string tempPath = Path.GetTempPath();
+ string dllPath = tempPath + "/polarssl.dll";
+ PolipoRunner.UncompressFile(dllPath, Resources.polarssl_dll);
+ LoadLibrary(dllPath);
+
FileStream fs = new FileStream("shadowsocks.log", FileMode.Append);
TextWriter tmp = Console.Out;
StreamWriter sw = new StreamWriter(fs);
sw.AutoFlush = true;
Console.SetOut(sw);
Console.SetError(sw);
-
}
catch (IOException e)
{
diff --git a/shadowsocks-csharp/Properties/AssemblyInfo.cs b/shadowsocks-csharp/Properties/AssemblyInfo.cs
index d2b3f770..4fe88580 100755
--- a/shadowsocks-csharp/Properties/AssemblyInfo.cs
+++ b/shadowsocks-csharp/Properties/AssemblyInfo.cs
@@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// 有关程序集的常规信息通过下列属性集
// 控制。更改这些属性值可修改
// 与程序集关联的信息。
-[assembly: AssemblyTitle("shadowsocks-csharp")]
+[assembly: AssemblyTitle("Shadowsocks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("clowwindy")]
-[assembly: AssemblyProduct("shadowsocks-csharp")]
+[assembly: AssemblyProduct("Shadowsocks")]
[assembly: AssemblyCopyright("Copyright © clowwindy 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.1.2")]
-[assembly: AssemblyFileVersion("1.1.2")]
+[assembly: AssemblyVersion("2.0.0")]
+[assembly: AssemblyFileVersion("2.0.0")]
diff --git a/shadowsocks-csharp/Properties/Resources.Designer.cs b/shadowsocks-csharp/Properties/Resources.Designer.cs
index 0de6d85c..ca8cb5fb 100755
--- a/shadowsocks-csharp/Properties/Resources.Designer.cs
+++ b/shadowsocks-csharp/Properties/Resources.Designer.cs
@@ -61,6 +61,16 @@ namespace shadowsocks_csharp.Properties {
}
///
+ /// Looks up a localized resource of type System.Byte[].
+ ///
+ internal static byte[] polarssl_dll {
+ get {
+ object obj = ResourceManager.GetObject("polarssl_dll", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
+
+ ///
/// Looks up a localized string similar to # Sample configuration file for Polipo. -*-sh-*-
///
///# You should not need to use a configuration file; all configuration
diff --git a/shadowsocks-csharp/Properties/Resources.resx b/shadowsocks-csharp/Properties/Resources.resx
index a716e86e..97ca7965 100755
--- a/shadowsocks-csharp/Properties/Resources.resx
+++ b/shadowsocks-csharp/Properties/Resources.resx
@@ -118,6 +118,9 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ ..\polarssl.dll.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
..\config.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;gb2312
diff --git a/shadowsocks-csharp/polarssl.dll.gz b/shadowsocks-csharp/polarssl.dll.gz
new file mode 100755
index 00000000..1010242e
Binary files /dev/null and b/shadowsocks-csharp/polarssl.dll.gz differ
diff --git a/shadowsocks-csharp/shadowsocks-csharp.csproj b/shadowsocks-csharp/shadowsocks-csharp.csproj
index b96a04e7..c4f4f031 100755
--- a/shadowsocks-csharp/shadowsocks-csharp.csproj
+++ b/shadowsocks-csharp/shadowsocks-csharp.csproj
@@ -115,6 +115,7 @@
True
+
SettingsSingleFileGenerator