Browse Source

sysproxy now use external exe

tags/4.1.9.2-nbbnu
Student Main 5 years ago
parent
commit
c342f191d7
5 changed files with 31 additions and 34 deletions
  1. +0
    -20
      shadowsocks-csharp/Properties/Resources.Designer.cs
  2. +0
    -6
      shadowsocks-csharp/Properties/Resources.resx
  3. +9
    -4
      shadowsocks-csharp/Util/SystemProxy/Sysproxy.cs
  4. +10
    -0
      shadowsocks-csharp/Util/Util.cs
  5. +12
    -4
      shadowsocks-csharp/shadowsocks-csharp.csproj

+ 0
- 20
shadowsocks-csharp/Properties/Resources.Designer.cs View File

@@ -227,26 +227,6 @@ namespace Shadowsocks.Properties {
}
}
/// <summary>
/// 查找 System.Byte[] 类型的本地化资源。
/// </summary>
internal static byte[] sysproxy {
get {
object obj = ResourceManager.GetObject("sysproxy", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// 查找 System.Byte[] 类型的本地化资源。
/// </summary>
internal static byte[] sysproxy64 {
get {
object obj = ResourceManager.GetObject("sysproxy64", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// 查找类似 ! Put user rules line by line in this file.
///! See https://adblockplus.org/en/filter-cheatsheet


+ 0
- 6
shadowsocks-csharp/Properties/Resources.resx View File

@@ -151,12 +151,6 @@
<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>
</data>
<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 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 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>
</data>

+ 9
- 4
shadowsocks-csharp/Util/SystemProxy/Sysproxy.cs View File

@@ -65,8 +65,8 @@ namespace Shadowsocks.Util.SystemProxy
{
try
{
FileManager.ByteArrayToFile(Utils.GetTempPath("sysproxy.exe"),
Environment.Is64BitOperatingSystem ? Resources.sysproxy64 : Resources.sysproxy);
//FileManager.ByteArrayToFile(Utils.GetTempPath("sysproxy.exe"),
// Environment.Is64BitOperatingSystem ? Resources.sysproxy64 : Resources.sysproxy);
}
catch (IOException e)
{
@@ -134,6 +134,11 @@ namespace Shadowsocks.Util.SystemProxy
return true;
}
private static string SysproxyName
{
get { return Environment.Is64BitOperatingSystem ? "sysproxy64.exe" : "sysproxy.exe"; }
}
private static void ExecSysproxy(string arguments)
{
// using event to avoid hanging when redirect standard output/error
@@ -145,9 +150,9 @@ namespace Shadowsocks.Util.SystemProxy
using (var process = new Process())
{
// Configure the process using the StartInfo properties.
process.StartInfo.FileName = Utils.GetTempPath("sysproxy.exe");
process.StartInfo.FileName = Utils.GetDataPath(SysproxyName);
process.StartInfo.Arguments = arguments;
process.StartInfo.WorkingDirectory = Utils.GetTempPath();
process.StartInfo.WorkingDirectory = Utils.GetDataPath();
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardError = true;


+ 10
- 0
shadowsocks-csharp/Util/Util.cs View File

@@ -55,6 +55,16 @@ namespace Shadowsocks.Util
return _tempPath;
}
public static string GetDataPath()
{
return Path.Combine(Directory.GetCurrentDirectory(), "Data");
}
public static string GetDataPath(string filename)
{
return Path.Combine(GetDataPath(), filename);
}
public enum WindowsThemeMode { Dark, Light }
// Support on Windows 10 1903+


+ 12
- 4
shadowsocks-csharp/shadowsocks-csharp.csproj View File

@@ -273,13 +273,21 @@
<Content Include="Data\default-abp-rule.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Data\libsscrypto.dll" />
<Content Include="Data\privoxy.exe" />
<Content Include="Data\libsscrypto.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Data\privoxy.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Data\privoxy_conf.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Data\sysproxy.exe" />
<Content Include="Data\sysproxy64.exe" />
<Content Include="Data\sysproxy.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Data\sysproxy64.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Data\user-rule.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>


Loading…
Cancel
Save