示例#1
0
 public static void StartTor()
 {
     if ((from p in Process.GetProcesses() where p.ProcessName == "tor" select p).FirstOrDefault() == null)
         Process.Start(_Tor);
     Socket _Socket = new TcpClient("localhost", 9051).Client;
     _Socket.Send("AUTHENTICATE \"er54s4\"\r\n");
     while (true)
     {
         _Socket.Send("getinfo stream-status\r\n");
         string s= _Socket.ReceiveText();
         StringBuilder _StringBuilder = new StringBuilder();
         foreach (Match m in Regex.Matches(s, @"\d\d?\d? (\w+ \d\d?\d?) [\d.]+:\d\d?\d?"))
         {
             _StringBuilder.Append(m.Groups[1].Value+",");
         }
         Title = _StringBuilder.ToString();
         Thread.Sleep(100);
     }
 }