2 using System.Diagnostics;
6 public class EntryPoint {
7 public static void Main () {
10 ServiceDialog dialog = new ServiceDialog ("Choose SSH Server", null, Stock.Close, ResponseType.Cancel);
11 dialog.BrowseServiceTypes = new string[] { "_ssh._tcp" };
12 dialog.ResolveServiceEnabled = true;
14 if (dialog.Run () == (int) ResponseType.Accept) {
15 Console.WriteLine ("Connecting to {0}:{1}", dialog.Address, dialog.Port);
17 string user = Environment.UserName;
19 foreach (byte[] txtBytes in dialog.TxtData) {
20 string txt = System.Text.Encoding.UTF8.GetString (txtBytes);
21 string[] splitTxt = txt.Split(new char[] { '=' }, 2);
23 if (splitTxt.Length != 2)
26 if (splitTxt[0] == "u") {
30 string args = String.Format ("gnome-terminal -t {0} -x ssh -p {1} -l {2} {3}",
31 dialog.HostName, dialog.Port, user, dialog.Address.ToString ());
32 Console.WriteLine ("Launching: " + args);