Browse Source

don't unpack polipo every time

tags/2.3
clowwindy 10 years ago
parent
commit
4dae44c59b
1 changed files with 14 additions and 2 deletions
  1. +14
    -2
      shadowsocks-csharp/Controller/PolipoRunner.cs

+ 14
- 2
shadowsocks-csharp/Controller/PolipoRunner.cs View File

@@ -12,6 +12,20 @@ namespace Shadowsocks.Controller
class PolipoRunner
{
private Process _process;
private static string temppath;
static PolipoRunner()
{
temppath = Path.GetTempPath();
try
{
FileManager.UncompressFile(temppath + "/ss_polipo.exe", Resources.polipo_exe);
}
catch (IOException e)
{
Logging.LogUsefulException(e);
}
}
public void Start(Configuration configuration)
{
@@ -31,12 +45,10 @@ namespace Shadowsocks.Controller
Console.WriteLine(e.ToString());
}
}
string temppath = Path.GetTempPath();
string polipoConfig = Resources.polipo_config;
polipoConfig = polipoConfig.Replace("__SOCKS_PORT__", server.local_port.ToString());
polipoConfig = polipoConfig.Replace("__POLIPO_BIND_IP__", configuration.shareOverLan ? "0.0.0.0" : "127.0.0.1");
FileManager.ByteArrayToFile(temppath + "/polipo.conf", System.Text.Encoding.UTF8.GetBytes(polipoConfig));
FileManager.UncompressFile(temppath + "/ss_polipo.exe", Resources.polipo_exe);
_process = new Process();
// Configure the process using the StartInfo properties.


Loading…
Cancel
Save