diff --git a/shadowsocks-csharp/Controller/FileManager.cs b/shadowsocks-csharp/Controller/FileManager.cs index d7db51c1..7adb1f9a 100755 --- a/shadowsocks-csharp/Controller/FileManager.cs +++ b/shadowsocks-csharp/Controller/FileManager.cs @@ -22,24 +22,6 @@ namespace Shadowsocks.Controller return false; } - public static void UncompressFile(string fileName, byte[] content) - { - // Because the uncompressed size of the file is unknown, - // we are using an arbitrary buffer size. - byte[] buffer = new byte[4096]; - int n; - - using(var fs = File.Create(fileName)) - using (var input = new GZipStream(new MemoryStream(content), - CompressionMode.Decompress, false)) - { - while ((n = input.Read(buffer, 0, buffer.Length)) > 0) - { - fs.Write(buffer, 0, n); - } - } - } - public static string NonExclusiveReadAllText(string path) { return NonExclusiveReadAllText(path, Encoding.Default); diff --git a/shadowsocks-csharp/Controller/Service/PrivoxyRunner.cs b/shadowsocks-csharp/Controller/Service/PrivoxyRunner.cs index 187e7a09..d35938ad 100644 --- a/shadowsocks-csharp/Controller/Service/PrivoxyRunner.cs +++ b/shadowsocks-csharp/Controller/Service/PrivoxyRunner.cs @@ -29,7 +29,7 @@ namespace Shadowsocks.Controller _uniqueConfigFile = $"privoxy_{_uid}.conf"; _privoxyJob = new Job(); - FileManager.UncompressFile(Utils.GetTempPath("ss_privoxy.exe"), Resources.privoxy_exe); + FileManager.ByteArrayToFile(Utils.GetTempPath("ss_privoxy.exe"), Resources.privoxy); } catch (IOException e) { diff --git a/shadowsocks-csharp/Data/libsscrypto.dll b/shadowsocks-csharp/Data/libsscrypto.dll new file mode 100644 index 00000000..1cfd85c8 Binary files /dev/null and b/shadowsocks-csharp/Data/libsscrypto.dll differ diff --git a/shadowsocks-csharp/Data/libsscrypto.dll.gz b/shadowsocks-csharp/Data/libsscrypto.dll.gz deleted file mode 100755 index ff39152f..00000000 Binary files a/shadowsocks-csharp/Data/libsscrypto.dll.gz and /dev/null differ diff --git a/shadowsocks-csharp/Data/privoxy.exe b/shadowsocks-csharp/Data/privoxy.exe new file mode 100644 index 00000000..c21368b9 Binary files /dev/null and b/shadowsocks-csharp/Data/privoxy.exe differ diff --git a/shadowsocks-csharp/Data/privoxy.exe.gz b/shadowsocks-csharp/Data/privoxy.exe.gz deleted file mode 100644 index bf58503c..00000000 Binary files a/shadowsocks-csharp/Data/privoxy.exe.gz and /dev/null differ diff --git a/shadowsocks-csharp/Data/sysproxy.exe b/shadowsocks-csharp/Data/sysproxy.exe new file mode 100644 index 00000000..a586140e Binary files /dev/null and b/shadowsocks-csharp/Data/sysproxy.exe differ diff --git a/shadowsocks-csharp/Data/sysproxy.exe.gz b/shadowsocks-csharp/Data/sysproxy.exe.gz deleted file mode 100644 index 980d304b..00000000 Binary files a/shadowsocks-csharp/Data/sysproxy.exe.gz and /dev/null differ diff --git a/shadowsocks-csharp/Data/sysproxy64.exe b/shadowsocks-csharp/Data/sysproxy64.exe new file mode 100644 index 00000000..979858ba Binary files /dev/null and b/shadowsocks-csharp/Data/sysproxy64.exe differ diff --git a/shadowsocks-csharp/Data/sysproxy64.exe.gz b/shadowsocks-csharp/Data/sysproxy64.exe.gz deleted file mode 100644 index c5ff36af..00000000 Binary files a/shadowsocks-csharp/Data/sysproxy64.exe.gz and /dev/null differ diff --git a/shadowsocks-csharp/Encryption/MbedTLS.cs b/shadowsocks-csharp/Encryption/MbedTLS.cs index 4e0b76d8..07becca2 100644 --- a/shadowsocks-csharp/Encryption/MbedTLS.cs +++ b/shadowsocks-csharp/Encryption/MbedTLS.cs @@ -19,7 +19,7 @@ namespace Shadowsocks.Encryption string dllPath = Utils.GetTempPath(DLLNAME); try { - FileManager.UncompressFile(dllPath, Resources.libsscrypto_dll); + FileManager.ByteArrayToFile(dllPath, Resources.libsscrypto); } catch (IOException) { diff --git a/shadowsocks-csharp/Encryption/OpenSSL.cs b/shadowsocks-csharp/Encryption/OpenSSL.cs index c88404ed..30430144 100644 --- a/shadowsocks-csharp/Encryption/OpenSSL.cs +++ b/shadowsocks-csharp/Encryption/OpenSSL.cs @@ -27,7 +27,7 @@ namespace Shadowsocks.Encryption string dllPath = Utils.GetTempPath(DLLNAME); try { - FileManager.UncompressFile(dllPath, Resources.libsscrypto_dll); + FileManager.ByteArrayToFile(dllPath, Resources.libsscrypto); } catch (IOException) { diff --git a/shadowsocks-csharp/Encryption/Sodium.cs b/shadowsocks-csharp/Encryption/Sodium.cs index 66b1abbe..6a4c8a54 100755 --- a/shadowsocks-csharp/Encryption/Sodium.cs +++ b/shadowsocks-csharp/Encryption/Sodium.cs @@ -21,7 +21,7 @@ namespace Shadowsocks.Encryption string dllPath = Utils.GetTempPath(DLLNAME); try { - FileManager.UncompressFile(dllPath, Resources.libsscrypto_dll); + FileManager.ByteArrayToFile(dllPath, Resources.libsscrypto); } catch (IOException) { diff --git a/shadowsocks-csharp/Properties/Resources.Designer.cs b/shadowsocks-csharp/Properties/Resources.Designer.cs index dea95e63..b08ec5a9 100644 --- a/shadowsocks-csharp/Properties/Resources.Designer.cs +++ b/shadowsocks-csharp/Properties/Resources.Designer.cs @@ -116,21 +116,23 @@ namespace Shadowsocks.Properties { /// /// 查找类似 en,zh-CN,zh-TW,ja + ///#Restart program to apply translation,,, + ///#This is comment line,,, + ///#Always keep language name at head of file,,, + ///#Language name is output in log,,, + ///"#You can find it by search ""Current language is:""",,, + ///#Please use UTF-8 with BOM encoding so we can edit it in Excel,,, ///,,, ///Shadowsocks,Shadowsocks,Shadowsocks,Shadowsocks ///,,, + ///#Menu,,, + ///,,, ///System Proxy,系统代理,系統代理,システムプロキシ ///Disable,禁用,禁用,無効 ///PAC,PAC 模式,PAC 模式,PAC ///Global,全局模式,全局模式,全般 ///Servers,服务器,伺服器,サーバー - ///Edit Servers...,编辑服务器...,編輯伺服器...,サーバーの編集... - ///Statistics Config...,统计配置...,統計設定檔...,統計情報の設定... - ///Start on Boot,开机启动,開機啟動,システムと同時に起動 - ///Forward Proxy...,正向代理设置...,正向 Proxy 設定...,フォワードプロキシの設定... - ///Allow other Devices to connect,允许其他设备连入,允許其他裝置連入,他のデバイスからの接続を許可する - ///Local PAC,使用本地 PAC,使用本機 PAC,ローカル PAC - ///Online PAC,使用在线 PAC,使 [字符串的其余部分被截断]"; 的本地化字符串。 + ///Edit Servers...,编辑服务器...,編 [字符串的其余部分被截断]"; 的本地化字符串。 /// internal static string i18n_csv { get { @@ -141,9 +143,19 @@ namespace Shadowsocks.Properties { /// /// 查找 System.Byte[] 类型的本地化资源。 /// - internal static byte[] libsscrypto_dll { + 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("libsscrypto_dll", resourceCulture); + object obj = ResourceManager.GetObject("privoxy", resourceCulture); return ((byte[])(obj)); } } @@ -165,16 +177,6 @@ namespace Shadowsocks.Properties { } } - /// - /// 查找 System.Byte[] 类型的本地化资源。 - /// - internal static byte[] privoxy_exe { - get { - object obj = ResourceManager.GetObject("privoxy_exe", resourceCulture); - return ((byte[])(obj)); - } - } - /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// @@ -228,9 +230,9 @@ namespace Shadowsocks.Properties { /// /// 查找 System.Byte[] 类型的本地化资源。 /// - internal static byte[] sysproxy_exe { + internal static byte[] sysproxy { get { - object obj = ResourceManager.GetObject("sysproxy_exe", resourceCulture); + object obj = ResourceManager.GetObject("sysproxy", resourceCulture); return ((byte[])(obj)); } } @@ -238,9 +240,9 @@ namespace Shadowsocks.Properties { /// /// 查找 System.Byte[] 类型的本地化资源。 /// - internal static byte[] sysproxy64_exe { + internal static byte[] sysproxy64 { get { - object obj = ResourceManager.GetObject("sysproxy64_exe", resourceCulture); + object obj = ResourceManager.GetObject("sysproxy64", resourceCulture); return ((byte[])(obj)); } } diff --git a/shadowsocks-csharp/Properties/Resources.resx b/shadowsocks-csharp/Properties/Resources.resx index 9661ee9a..e2532302 100755 --- a/shadowsocks-csharp/Properties/Resources.resx +++ b/shadowsocks-csharp/Properties/Resources.resx @@ -127,15 +127,15 @@ ..\Data\i18n.csv;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - ..\Data\libsscrypto.dll.gz;System.Byte[], mscorlib, 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 - - ..\data\privoxy.exe.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - ..\Resources\ss32Fill.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -151,11 +151,11 @@ ..\Resources\ssw128.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Data\sysproxy64.exe.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Data\sysproxy.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Data\sysproxy.exe.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Data\sysproxy64.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ..\data\user-rule.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 diff --git a/shadowsocks-csharp/Util/SystemProxy/Sysproxy.cs b/shadowsocks-csharp/Util/SystemProxy/Sysproxy.cs index 863be1df..77fa2e68 100644 --- a/shadowsocks-csharp/Util/SystemProxy/Sysproxy.cs +++ b/shadowsocks-csharp/Util/SystemProxy/Sysproxy.cs @@ -65,8 +65,8 @@ namespace Shadowsocks.Util.SystemProxy { try { - FileManager.UncompressFile(Utils.GetTempPath("sysproxy.exe"), - Environment.Is64BitOperatingSystem ? Resources.sysproxy64_exe : Resources.sysproxy_exe); + FileManager.ByteArrayToFile(Utils.GetTempPath("sysproxy.exe"), + Environment.Is64BitOperatingSystem ? Resources.sysproxy64 : Resources.sysproxy); } catch (IOException e) { diff --git a/shadowsocks-csharp/shadowsocks-csharp.csproj b/shadowsocks-csharp/shadowsocks-csharp.csproj index dd59f561..cbb39511 100644 --- a/shadowsocks-csharp/shadowsocks-csharp.csproj +++ b/shadowsocks-csharp/shadowsocks-csharp.csproj @@ -255,13 +255,11 @@ Designer - - - + + PreserveNewest + - - @@ -269,10 +267,22 @@ Settings.Designer.cs - - - - + + PreserveNewest + + + PreserveNewest + + + + + PreserveNewest + + + + + PreserveNewest + Designer