本文整理匯總了C#中Shadowsocks.Model.Configuration.GetCurrentSsServerInfo方法的典型用法代碼示例。如果您正苦於以下問題:C# Configuration.GetCurrentSsServerInfo方法的具體用法?C# Configuration.GetCurrentSsServerInfo怎麽用?C# Configuration.GetCurrentSsServerInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Shadowsocks.Model.Configuration
的用法示例。
在下文中一共展示了Configuration.GetCurrentSsServerInfo方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Start
public void Start(Configuration configuration)
{
SsServerInfo server = configuration.GetCurrentSsServerInfo();
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 polipoConfig = Resources.polipo_config;
_runningPort = this.GetFreePort();
polipoConfig = polipoConfig.Replace("__SOCKS_PORT__", configuration.localPort.ToString());
polipoConfig = polipoConfig.Replace("__POLIPO_BIND_PORT__", _runningPort.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));
_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();
}
}