@@ -22,24 +22,6 @@ namespace Shadowsocks.Controller | |||||
return false; | 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) | public static string NonExclusiveReadAllText(string path) | ||||
{ | { | ||||
return NonExclusiveReadAllText(path, Encoding.Default); | return NonExclusiveReadAllText(path, Encoding.Default); | ||||
@@ -29,7 +29,7 @@ namespace Shadowsocks.Controller | |||||
_uniqueConfigFile = $"privoxy_{_uid}.conf"; | _uniqueConfigFile = $"privoxy_{_uid}.conf"; | ||||
_privoxyJob = new Job(); | _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) | catch (IOException e) | ||||
{ | { | ||||
@@ -19,7 +19,7 @@ namespace Shadowsocks.Encryption | |||||
string dllPath = Utils.GetTempPath(DLLNAME); | string dllPath = Utils.GetTempPath(DLLNAME); | ||||
try | try | ||||
{ | { | ||||
FileManager.UncompressFile(dllPath, Resources.libsscrypto_dll); | |||||
FileManager.ByteArrayToFile(dllPath, Resources.libsscrypto); | |||||
} | } | ||||
catch (IOException) | catch (IOException) | ||||
{ | { | ||||
@@ -27,7 +27,7 @@ namespace Shadowsocks.Encryption | |||||
string dllPath = Utils.GetTempPath(DLLNAME); | string dllPath = Utils.GetTempPath(DLLNAME); | ||||
try | try | ||||
{ | { | ||||
FileManager.UncompressFile(dllPath, Resources.libsscrypto_dll); | |||||
FileManager.ByteArrayToFile(dllPath, Resources.libsscrypto); | |||||
} | } | ||||
catch (IOException) | catch (IOException) | ||||
{ | { | ||||
@@ -21,7 +21,7 @@ namespace Shadowsocks.Encryption | |||||
string dllPath = Utils.GetTempPath(DLLNAME); | string dllPath = Utils.GetTempPath(DLLNAME); | ||||
try | try | ||||
{ | { | ||||
FileManager.UncompressFile(dllPath, Resources.libsscrypto_dll); | |||||
FileManager.ByteArrayToFile(dllPath, Resources.libsscrypto); | |||||
} | } | ||||
catch (IOException) | catch (IOException) | ||||
{ | { | ||||
@@ -116,21 +116,23 @@ namespace Shadowsocks.Properties { | |||||
/// <summary> | /// <summary> | ||||
/// 查找类似 en,zh-CN,zh-TW,ja | /// 查找类似 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 | ///Shadowsocks,Shadowsocks,Shadowsocks,Shadowsocks | ||||
///,,, | ///,,, | ||||
///#Menu,,, | |||||
///,,, | |||||
///System Proxy,系统代理,系統代理,システムプロキシ | ///System Proxy,系统代理,系統代理,システムプロキシ | ||||
///Disable,禁用,禁用,無効 | ///Disable,禁用,禁用,無効 | ||||
///PAC,PAC 模式,PAC 模式,PAC | ///PAC,PAC 模式,PAC 模式,PAC | ||||
///Global,全局模式,全局模式,全般 | ///Global,全局模式,全局模式,全般 | ||||
///Servers,服务器,伺服器,サーバー | ///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...,编辑服务器...,編 [字符串的其余部分被截断]"; 的本地化字符串。 | |||||
/// </summary> | /// </summary> | ||||
internal static string i18n_csv { | internal static string i18n_csv { | ||||
get { | get { | ||||
@@ -141,9 +143,19 @@ namespace Shadowsocks.Properties { | |||||
/// <summary> | /// <summary> | ||||
/// 查找 System.Byte[] 类型的本地化资源。 | /// 查找 System.Byte[] 类型的本地化资源。 | ||||
/// </summary> | /// </summary> | ||||
internal static byte[] libsscrypto_dll { | |||||
internal static byte[] libsscrypto { | |||||
get { | |||||
object obj = ResourceManager.GetObject("libsscrypto", resourceCulture); | |||||
return ((byte[])(obj)); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 查找 System.Byte[] 类型的本地化资源。 | |||||
/// </summary> | |||||
internal static byte[] privoxy { | |||||
get { | get { | ||||
object obj = ResourceManager.GetObject("libsscrypto_dll", resourceCulture); | |||||
object obj = ResourceManager.GetObject("privoxy", resourceCulture); | |||||
return ((byte[])(obj)); | return ((byte[])(obj)); | ||||
} | } | ||||
} | } | ||||
@@ -165,16 +177,6 @@ namespace Shadowsocks.Properties { | |||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 查找 System.Byte[] 类型的本地化资源。 | |||||
/// </summary> | |||||
internal static byte[] privoxy_exe { | |||||
get { | |||||
object obj = ResourceManager.GetObject("privoxy_exe", resourceCulture); | |||||
return ((byte[])(obj)); | |||||
} | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。 | /// 查找 System.Drawing.Bitmap 类型的本地化资源。 | ||||
/// </summary> | /// </summary> | ||||
@@ -228,9 +230,9 @@ namespace Shadowsocks.Properties { | |||||
/// <summary> | /// <summary> | ||||
/// 查找 System.Byte[] 类型的本地化资源。 | /// 查找 System.Byte[] 类型的本地化资源。 | ||||
/// </summary> | /// </summary> | ||||
internal static byte[] sysproxy_exe { | |||||
internal static byte[] sysproxy { | |||||
get { | get { | ||||
object obj = ResourceManager.GetObject("sysproxy_exe", resourceCulture); | |||||
object obj = ResourceManager.GetObject("sysproxy", resourceCulture); | |||||
return ((byte[])(obj)); | return ((byte[])(obj)); | ||||
} | } | ||||
} | } | ||||
@@ -238,9 +240,9 @@ namespace Shadowsocks.Properties { | |||||
/// <summary> | /// <summary> | ||||
/// 查找 System.Byte[] 类型的本地化资源。 | /// 查找 System.Byte[] 类型的本地化资源。 | ||||
/// </summary> | /// </summary> | ||||
internal static byte[] sysproxy64_exe { | |||||
internal static byte[] sysproxy64 { | |||||
get { | get { | ||||
object obj = ResourceManager.GetObject("sysproxy64_exe", resourceCulture); | |||||
object obj = ResourceManager.GetObject("sysproxy64", resourceCulture); | |||||
return ((byte[])(obj)); | return ((byte[])(obj)); | ||||
} | } | ||||
} | } | ||||
@@ -127,15 +127,15 @@ | |||||
<data name="i18n_csv" type="System.Resources.ResXFileRef, System.Windows.Forms"> | <data name="i18n_csv" type="System.Resources.ResXFileRef, System.Windows.Forms"> | ||||
<value>..\Data\i18n.csv;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> | <value>..\Data\i18n.csv;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> | ||||
</data> | </data> | ||||
<data name="libsscrypto_dll" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||||
<value>..\Data\libsscrypto.dll.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
<data name="libsscrypto" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||||
<value>..\Data\libsscrypto.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
</data> | |||||
<data name="privoxy" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||||
<value>..\Data\privoxy.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
</data> | </data> | ||||
<data name="privoxy_conf" type="System.Resources.ResXFileRef, System.Windows.Forms"> | <data name="privoxy_conf" type="System.Resources.ResXFileRef, System.Windows.Forms"> | ||||
<value>..\data\privoxy_conf.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> | <value>..\data\privoxy_conf.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> | ||||
</data> | </data> | ||||
<data name="privoxy_exe" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||||
<value>..\data\privoxy.exe.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
</data> | |||||
<data name="ss32Fill" type="System.Resources.ResXFileRef, System.Windows.Forms"> | <data name="ss32Fill" type="System.Resources.ResXFileRef, System.Windows.Forms"> | ||||
<value>..\Resources\ss32Fill.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> | <value>..\Resources\ss32Fill.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> | ||||
</data> | </data> | ||||
@@ -151,11 +151,11 @@ | |||||
<data name="ssw128" type="System.Resources.ResXFileRef, System.Windows.Forms"> | <data name="ssw128" type="System.Resources.ResXFileRef, System.Windows.Forms"> | ||||
<value>..\Resources\ssw128.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> | <value>..\Resources\ssw128.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> | ||||
</data> | </data> | ||||
<data name="sysproxy64_exe" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||||
<value>..\Data\sysproxy64.exe.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
<data name="sysproxy" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||||
<value>..\Data\sysproxy.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
</data> | </data> | ||||
<data name="sysproxy_exe" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||||
<value>..\Data\sysproxy.exe.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
<data name="sysproxy64" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||||
<value>..\Data\sysproxy64.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
</data> | </data> | ||||
<data name="user_rule" type="System.Resources.ResXFileRef, System.Windows.Forms"> | <data name="user_rule" type="System.Resources.ResXFileRef, System.Windows.Forms"> | ||||
<value>..\data\user-rule.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> | <value>..\data\user-rule.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> | ||||
@@ -65,8 +65,8 @@ namespace Shadowsocks.Util.SystemProxy | |||||
{ | { | ||||
try | 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) | catch (IOException e) | ||||
{ | { | ||||
@@ -255,13 +255,11 @@ | |||||
<None Include="app.manifest"> | <None Include="app.manifest"> | ||||
<SubType>Designer</SubType> | <SubType>Designer</SubType> | ||||
</None> | </None> | ||||
<None Include="Data\i18n.csv" /> | |||||
<None Include="Data\libsscrypto.dll.gz" /> | |||||
<None Include="Data\privoxy.exe.gz" /> | |||||
<None Include="Data\i18n.csv"> | |||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||||
</None> | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<None Include="Data\sysproxy.exe.gz" /> | |||||
<None Include="Data\sysproxy64.exe.gz" /> | |||||
<None Include="packages.config" /> | <None Include="packages.config" /> | ||||
<None Include="Properties\DataSources\Shadowsocks.Model.StatisticsStrategyConfiguration.datasource" /> | <None Include="Properties\DataSources\Shadowsocks.Model.StatisticsStrategyConfiguration.datasource" /> | ||||
<None Include="Properties\Settings.settings"> | <None Include="Properties\Settings.settings"> | ||||
@@ -269,10 +267,22 @@ | |||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput> | <LastGenOutput>Settings.Designer.cs</LastGenOutput> | ||||
</None> | </None> | ||||
<None Include="Resources\ssw128.png" /> | <None Include="Resources\ssw128.png" /> | ||||
<Content Include="Data\abp.js" /> | |||||
<Content Include="Data\default-abp-rule.js" /> | |||||
<Content Include="Data\privoxy_conf.txt" /> | |||||
<Content Include="Data\user-rule.txt" /> | |||||
<Content Include="Data\abp.js"> | |||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||||
</Content> | |||||
<Content Include="Data\default-abp-rule.js"> | |||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||||
</Content> | |||||
<Content Include="Data\libsscrypto.dll" /> | |||||
<Content Include="Data\privoxy.exe" /> | |||||
<Content Include="Data\privoxy_conf.txt"> | |||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||||
</Content> | |||||
<Content Include="Data\sysproxy.exe" /> | |||||
<Content Include="Data\sysproxy64.exe" /> | |||||
<Content Include="Data\user-rule.txt"> | |||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||||
</Content> | |||||
<None Include="FodyWeavers.xml"> | <None Include="FodyWeavers.xml"> | ||||
<SubType>Designer</SubType> | <SubType>Designer</SubType> | ||||
</None> | </None> | ||||