diff --git a/shadowsocks-csharp/Controller/Service/PrivoxyRunner.cs b/shadowsocks-csharp/Controller/Service/PrivoxyRunner.cs index d35938ad..c050b56d 100644 --- a/shadowsocks-csharp/Controller/Service/PrivoxyRunner.cs +++ b/shadowsocks-csharp/Controller/Service/PrivoxyRunner.cs @@ -28,8 +28,7 @@ namespace Shadowsocks.Controller _uid = Application.StartupPath.GetHashCode(); // Currently we use ss's StartupPath to identify different Privoxy instance. _uniqueConfigFile = $"privoxy_{_uid}.conf"; _privoxyJob = new Job(); - - FileManager.ByteArrayToFile(Utils.GetTempPath("ss_privoxy.exe"), Resources.privoxy); + File.Copy(Utils.GetDataPath("privoxy.exe"), Utils.GetTempPath("ss_privoxy.exe")); } catch (IOException e) { @@ -48,7 +47,7 @@ namespace Shadowsocks.Controller { KillProcess(p); } - string privoxyConfig = Resources.privoxy_conf; + string privoxyConfig = File.ReadAllText(Utils.GetDataPath("privoxy_conf.txt")); _runningPort = GetFreePort(configuration.isIPv6Enabled); privoxyConfig = privoxyConfig.Replace("__SOCKS_PORT__", configuration.localPort.ToString()); privoxyConfig = privoxyConfig.Replace("__PRIVOXY_BIND_PORT__", _runningPort.ToString()); diff --git a/shadowsocks-csharp/Encryption/MbedTLS.cs b/shadowsocks-csharp/Encryption/MbedTLS.cs index 07becca2..3aa077aa 100644 --- a/shadowsocks-csharp/Encryption/MbedTLS.cs +++ b/shadowsocks-csharp/Encryption/MbedTLS.cs @@ -16,19 +16,7 @@ namespace Shadowsocks.Encryption static MbedTLS() { - string dllPath = Utils.GetTempPath(DLLNAME); - try - { - FileManager.ByteArrayToFile(dllPath, Resources.libsscrypto); - } - catch (IOException) - { - } - catch (System.Exception e) - { - Logging.LogUsefulException(e); - } - LoadLibrary(dllPath); + LoadLibrary(Utils.GetDataPath(DLLNAME)); } public static byte[] MD5(byte[] input) diff --git a/shadowsocks-csharp/Encryption/OpenSSL.cs b/shadowsocks-csharp/Encryption/OpenSSL.cs index 30430144..3d1870c8 100644 --- a/shadowsocks-csharp/Encryption/OpenSSL.cs +++ b/shadowsocks-csharp/Encryption/OpenSSL.cs @@ -24,19 +24,7 @@ namespace Shadowsocks.Encryption static OpenSSL() { - string dllPath = Utils.GetTempPath(DLLNAME); - try - { - FileManager.ByteArrayToFile(dllPath, Resources.libsscrypto); - } - catch (IOException) - { - } - catch (System.Exception e) - { - Logging.LogUsefulException(e); - } - LoadLibrary(dllPath); + LoadLibrary(Utils.GetDataPath(DLLNAME)); } public static IntPtr GetCipherInfo(string cipherName) diff --git a/shadowsocks-csharp/Encryption/Sodium.cs b/shadowsocks-csharp/Encryption/Sodium.cs index 6a4c8a54..50bc5c68 100755 --- a/shadowsocks-csharp/Encryption/Sodium.cs +++ b/shadowsocks-csharp/Encryption/Sodium.cs @@ -18,19 +18,7 @@ namespace Shadowsocks.Encryption static Sodium() { - string dllPath = Utils.GetTempPath(DLLNAME); - try - { - FileManager.ByteArrayToFile(dllPath, Resources.libsscrypto); - } - catch (IOException) - { - } - catch (System.Exception e) - { - Logging.LogUsefulException(e); - } - LoadLibrary(dllPath); + LoadLibrary(Utils.GetDataPath(DLLNAME)); lock (_initLock) { diff --git a/shadowsocks-csharp/Properties/Resources.Designer.cs b/shadowsocks-csharp/Properties/Resources.Designer.cs index 39b87370..98678ffc 100644 --- a/shadowsocks-csharp/Properties/Resources.Designer.cs +++ b/shadowsocks-csharp/Properties/Resources.Designer.cs @@ -60,43 +60,6 @@ namespace Shadowsocks.Properties { } } - /// - /// 查找 System.Byte[] 类型的本地化资源。 - /// - internal static byte[] libsscrypto { - get { - object obj = ResourceManager.GetObject("libsscrypto", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// 查找 System.Byte[] 类型的本地化资源。 - /// - internal static byte[] privoxy { - get { - object obj = ResourceManager.GetObject("privoxy", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// 查找类似 listen-address __PRIVOXY_BIND_IP__:__PRIVOXY_BIND_PORT__ - ///toggle 0 - ///logfile ss_privoxy.log - ///show-on-task-bar 0 - ///activity-animation 0 - ///forward-socks5 / __SOCKS_HOST__:__SOCKS_PORT__ . - ///max-client-connections 2048 - ///hide-console - /// 的本地化字符串。 - /// - internal static string privoxy_conf { - get { - return ResourceManager.GetString("privoxy_conf", resourceCulture); - } - } - /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// diff --git a/shadowsocks-csharp/Properties/Resources.resx b/shadowsocks-csharp/Properties/Resources.resx index 1842f535..9fed8b84 100755 --- a/shadowsocks-csharp/Properties/Resources.resx +++ b/shadowsocks-csharp/Properties/Resources.resx @@ -118,15 +118,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Data\libsscrypto.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Data\privoxy.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\data\privoxy_conf.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - ..\Resources\ss32Fill.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a