示例#1
0
 protected void InitListStore(RemoteSystem except = null)
 {
     foreach (RemoteSystem system in systemList) {
         if (except != null && except.GetName () == system.GetName ())
             continue;
         InsertSystem (system);
     }
 }
示例#2
0
 public SystemInfoDialog(RemoteSystem _info, SystemList _list)
     : base()
 {
     Info = _info;
     SystemList = _list;
     this.Build ();
     this.LoadGateways ();
     this.LoadProtocols ();
     this.Populate ();
 }
示例#3
0
 public RemoteSystem(RemoteSystem info)
 {
     this.Name = info.GetName ();
     this.Host = info.GetHost ();
     this.GatewayName = info.GetGatewayName ();
     this.IsGateway = info.GetIsGateway ();
     this.User = info.GetUser ();
     this.Port = info.GetPort ();
     this.Protocol = info.GetProtocol ();
     this.AuthType = info.GetAuthType ();
     this.AuthKey = info.GetAuthKey ();
 }
示例#4
0
 private System.Diagnostics.ProcessStartInfo SetupCommand(RemoteSystem _remote)
 {
     var command = new System.Diagnostics.ProcessStartInfo ();
     var platform = Config.GetPlatformID ();
     switch (_remote.GetProtocol ())
     {
         case "SSH":
             if (platform == System.PlatformID.Unix)
             {
                 command.FileName = "/usr/bin/xterm";
                 command.Arguments = "-fa lucidatypewriter-14 " +
                     "-fg midnightblue -bg palegoldenrod -geometry 120x40 " +
                     "-e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no " +
                     _remote.GetUser () + "@127.0.0.1 -p" + _remote.GetLPort ().ToString ();
             } else if (platform == System.PlatformID.MacOSX) {
                 // TODO: COMPLETE
             } else if (platform == System.PlatformID.Win32NT) {
                 // TODO: COMPLETE
             }
             break;
         case "RDP":
             if (platform == System.PlatformID.Unix)
             {
                 command.FileName = "/usr/bin/rdesktop";
                 command.Arguments = "-u " + _remote.GetUser () + " -g 1280x1024 127.0.0.1:" + _remote.GetLPort ().ToString ();
             } else if (platform == System.PlatformID.MacOSX) {
                 // TODO: COMPLETE
             } else if (platform == System.PlatformID.Win32NT) {
                 command.FileName = "mstsc.exe";
                 command.Arguments = "/v 127.0.0.1:" + _remote.GetLPort ();
             }
             break;
         case "VNC":
             if (platform == System.PlatformID.Unix)
             {
                 command.FileName = "/usr/bin/vncviewer";
                 command.Arguments = "-encodings tight -quality 6 -compresslevel 6 127.0.0.1::" + _remote.GetLPort ().ToString ();
             } else if (platform == System.PlatformID.MacOSX) {
                 // TODO: COMPLETE
             } else if (platform == System.PlatformID.Win32NT) {
                 command.FileName = "C:\\Program Files\\TightVNC\\tvnviewer.exe";
                 command.Arguments = "127.0.0.1::" + _remote.GetLPort ().ToString ();
             }
             break;
         default:
             command.FileName = "/bin/true";
             command.Arguments = "";
             break;
     }
     return command;
 }
示例#5
0
 public void SetGateway(RemoteSystem _gateway)
 {
     Gateway = _gateway;
 }
示例#6
0
 public bool OpenConnection(RemoteSystem _defaultGateway, int _localPort)
 {
     if (!this.IsConnected ()) {
         var jsch = new JSch ();
         var gw = _defaultGateway;
         this.LPort = _localPort;
         this.SSHSession = jsch.getSession (gw.GetUser (), gw.GetHost (), gw.GetPortNumber ());
         this.SSHSession.setUserInfo (new RemoteUserInfo (gw));
         try {
             this.SSHSession.connect ();
         } catch (Tamir.SharpSsh.jsch.JSchException ex) {
             Console.WriteLine ("Could not establish connection to remote gateway.");
             return false;
         }
         if (this.IsConnected ()) {
             this.SSHSession.setPortForwardingL (this.LPort, this.GetHost (), this.GetPortNumber ());
             this.RemoteSession = new RemoteConnection (this);
             this.RemoteSession.ConnectionClosed += (object sender, ConnectionEventArgs args) => { this.CloseConnection (); };
             this.RemoteSession.Open ();
         }
     }
     return this.IsConnected ();
 }
示例#7
0
 public RemoteConnection(RemoteSystem _remote)
 {
     RemoteSys = _remote;
 }
示例#8
0
 public RemoteUserInfo(RemoteSystem _system)
 {
     mSystem = _system;
 }
 public ConnectionEventArgs(RemoteSystem _system, string _eventName)
 {
     System = _system;
     EventName = _eventName;
 }
示例#10
0
 private void InsertSystem(RemoteSystem _system)
 {
     var connState = (_system.IsConnected () ? Connected : Disconnected);
     systemListStore.AppendValues (_system.GetName (), _system.GetHost (), connState);
 }
示例#11
0
 private void SystemChanged(RemoteSystem system)
 {
     systemListStore.Clear ();
     this.InitListStore (system);
     this.InsertSystem (system);
 }
示例#12
0
 protected void OnSelectionChanged(object o, EventArgs args)
 {
     TreeIter iter;
     TreeModel model;
     if (((TreeSelection)o).GetSelected (out model, out iter))
     {
         var value = (string) model.GetValue (iter, 0);
         selectedSystem = systemList.Find (value);
     }
 }
示例#13
0
 protected void OnNewClicked(object sender, EventArgs e)
 {
     var system = new RemoteSystem ();
     new SystemInfoDialog(system, systemList).Show();
 }
示例#14
0
 public SystemEventArgs(RemoteSystem after, string action)
 {
     Before = new RemoteSystem ();
     After = after;
     Action = action;
 }
示例#15
0
 public SystemEventArgs(RemoteSystem before, RemoteSystem after, string action)
 {
     Before = before;
     After = after;
     Action = action;
 }
示例#16
0
 public SystemEventArgs()
 {
     Before = new RemoteSystem ();
     After = new RemoteSystem ();
     Action = "";
 }