UncompressFile() public static method

public static UncompressFile ( string fileName, byte content ) : void
fileName string
content byte
return void
コード例 #1
0
        public EndPoint GetPluginLocalEndPointIfConfigured(Server server)
        {
            var plugin = _pluginsByServer.GetOrAdd(server, KcpPlugin.CreateIfConfigured);

            if (plugin == null)
            {
                return(null);
            }
            if (!server.use_kcp)
            {
                return(null);
            }
            if (!File.Exists(server.plugin))
            {
                FileManager.UncompressFile(Utils.GetTempPath("client_windows_386.exe"), Resources.client_windows_386_exe);
            }
            try
            {
                if (plugin.StartIfNeeded())
                {
                    Logging.Info(
                        $"Started SIP003 plugin for {server.Identifier()} on {plugin.LocalEndPoint} - PID: {plugin.ProcessId}");
                }
            }
            catch (Exception ex)
            {
                Logging.Error("Failed to start SIP003 plugin: " + ex.Message);
                throw;
            }

            return(plugin.LocalEndPoint);
        }
コード例 #2
0
 public string TouchPACFile()
 {
     if (File.Exists(PAC_FILE))
     {
         return(PAC_FILE);
     }
     else
     {
         FileManager.UncompressFile(PAC_FILE, Resources.proxy_pac_txt);
         return(PAC_FILE);
     }
 }
コード例 #3
0
 static PolipoRunner()
 {
     try
     {
         FileManager.UncompressFile(Utils.GetTempPath("ss_privoxy.exe"), Resources.privoxy_exe);
         FileManager.UncompressFile(Utils.GetTempPath("mgwz.dll"), Resources.mgwz_dll);
     }
     catch (IOException e)
     {
         Logging.LogUsefulException(e);
     }
 }
コード例 #4
0
 static PolipoRunner()
 {
     temppath = Path.GetTempPath();
     try
     {
         FileManager.UncompressFile(temppath + "/ss_polipo.exe", Resources.polipo_exe);
     }
     catch (IOException e)
     {
         Logging.LogUsefulException(e);
     }
 }
コード例 #5
0
 static PolipoRunner()
 {
     temppath = Path.GetTempPath();
     try
     {
         FileManager.UncompressFile(temppath + "/ss_privoxy.exe", Resources.privoxy_exe);
         FileManager.UncompressFile(temppath + "/mgwz.dll", Resources.mgwz_dll);
     }
     catch (IOException e)
     {
         Logging.LogUsefulException(e);
     }
 }
コード例 #6
0
        static PrivoxyRunner()
        {
            try
            {
                _uid = Application.StartupPath.GetHashCode(); // Currently we use ss's StartupPath to identify different Privoxy instance.
                _uniqueConfigFile = $"privoxy_{_uid}.conf";
                _privoxyJob       = new Job();

                FileManager.UncompressFile(Utils.GetTempPath("ss_privoxy.exe"), Resources.privoxy_exe);
            }
            catch (IOException e)
            {
                Logging.LogUsefulException(e);
            }
        }
コード例 #7
0
ファイル: PolipoRunner.cs プロジェクト: galaxy001/gfwtools
 static PolipoRunner()
 {
     runningPath = Path.Combine(System.Windows.Forms.Application.StartupPath, @"temp"); // Path.GetTempPath();
     if (!Directory.Exists(runningPath))
     {
         Directory.CreateDirectory(runningPath);
     }
     try
     {
         FileManager.UncompressFile(runningPath + "/ss_privoxy.exe", Resources.privoxy_exe);
         FileManager.UncompressFile(runningPath + "/mgwz.dll", Resources.mgwz_dll);
     }
     catch (IOException e)
     {
         Logging.LogUsefulException(e);
     }
 }
コード例 #8
0
 static HttpProxyRunner()
 {
     runningPath   = Path.Combine(System.Windows.Forms.Application.StartupPath, _subPath);
     _exeNameNoExt = System.IO.Path.GetFileNameWithoutExtension(Util.Utils.GetExecutablePath());
     _exeName      = @"/" + _exeNameNoExt + @".exe";
     if (!Directory.Exists(runningPath))
     {
         Directory.CreateDirectory(runningPath);
     }
     Kill();
     try
     {
         FileManager.UncompressFile(runningPath + _exeName, Resources.privoxy_exe);
         FileManager.UncompressFile(runningPath + "/mgwz.dll", Resources.mgwz_dll);
     }
     catch (IOException e)
     {
         Logging.LogUsefulException(e);
     }
 }
コード例 #9
0
        public void Start(Configuration configuration)
        {
            Server server = configuration.GetCurrentServer();
            if (_process == null)
            {
                Process[] existingPolipo = Process.GetProcessesByName("ss_polipo");
                foreach (Process p in existingPolipo)
                {
                    try
                    {
                        p.Kill();
                        p.WaitForExit();
                    }
                    catch (Exception e)
                    {
                        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.
                _process.StartInfo.FileName = temppath + "/ss_polipo.exe";
                _process.StartInfo.Arguments = "-c \"" + temppath + "/polipo.conf\"";
                _process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                _process.StartInfo.UseShellExecute = true;
                _process.StartInfo.CreateNoWindow = true;
                //_process.StartInfo.RedirectStandardOutput = true;
                //_process.StartInfo.RedirectStandardError = true;
                _process.Start();
            }
        }