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