Пример #1
0
 public IEnumerable<Connection.Info> GetConnections()
 {
     var result = new List<Connection.Info>();
     try
     {
         var allSessionsKey = Registry.CurrentUser.OpenSubKey("Software\\SimonTatham\\PuTTY\\Sessions");
         if (allSessionsKey != null)
         {
             var allSessions = allSessionsKey.GetSubKeyNames();
             foreach (var session in allSessions)
             {
                 var coni = new Connection.Info { PuttySession = session, Description = "PuTTY Session", Icon = "PuTTY" };
                 var sessionKey = allSessionsKey.OpenSubKey(session);
                 if (sessionKey != null)
                 {
                     coni.Hostname = sessionKey.GetValue("HostName").ToString();
                     if (string.IsNullOrWhiteSpace(coni.Hostname))
                     {
                         continue;
                     }
                     coni.Username = sessionKey.GetValue("UserName").ToString();
                     var prot = sessionKey.GetValue("Protocol").ToString();
                     switch (prot)
                     {
                         case "ssh":
                             coni.Protocol = Convert.ToInt32(sessionKey.GetValue("SshProt")) == 1 ? Protocols.SSH1 : Protocols.SSH2;
                             coni.Icon = "SSH";
                             break;
                         case "raw":
                             coni.Protocol = Protocols.RAW;
                             break;
                         case "telnet":
                             coni.Protocol = Protocols.Telnet;
                             break;
                         case "rlogin":
                             coni.Protocol = Protocols.Rlogin;
                             break;
                         case "serial":
                             coni.Protocol = Protocols.Rlogin;
                             break;
                         default:
                             coni.Protocol = Protocols.NONE;
                             break;
                     }
                     coni.Port = Convert.ToInt32(sessionKey.GetValue("PortNumber"));
                     coni.Name = session + " - Imported";
                     result.Add(coni);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.ToString());
     }
     return result;
 }
Пример #2
0
        // Start external app
        public Process Start(Connection.Info ConnectionInfo = null)
        {
            try
            {
                if (_FileName == "")
                {
                    throw (new Exception("No Filename specified!"));
                }

                if (_TryIntegrate)
                {
                    StartIntApp(ConnectionInfo);
                    return(null);
                }

                _ConnectionInfo = ConnectionInfo;

                Process          p  = new Process();
                ProcessStartInfo pI = new ProcessStartInfo();

                pI.UseShellExecute = false;
                pI.FileName        = ParseText(_FileName);
                pI.Arguments       = CommandLineArguments.EscapeBackslashes(ParseText(_Arguments));

                p.StartInfo = pI;

                p.Start();

                if (_WaitForExit)
                {
                    p.WaitForExit();
                }

                return(p);
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
                                                    (string)
                                                    ("Couldn\'t start external application." + Constants.vbNewLine +
                                                     ex.Message));
                return(null);
            }
        }
Пример #3
0
 bool TestStatus(Connection.Info con)
 {
     try
     {
         bool upPing    = true;
         bool upConnect = true;
         if (Settings.Default.ConnectStatusTestType == "Ping" || Settings.Default.ConnectStatusTestType == "Both")
         {
             upPing = Misc.Pinger(con.Hostname);
         }
         if (Settings.Default.ConnectStatusTestType == "Connect" || Settings.Default.ConnectStatusTestType == "Both")
         {
             upConnect = Misc.TestConnect(con.Hostname, con.Port);
         }
         return(upPing && upConnect);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Пример #4
0
            public static Connection.Info CreateQuicky(string ConString,
                                                       Protocols Protocol = Protocols.NONE)
            {
                try
                {
                    Uri Uri = new Uri((string)("dummyscheme" + Uri.SchemeDelimiter + ConString));

                    if (!string.IsNullOrEmpty(Uri.Host))
                    {
                        Connection.Info newConnectionInfo = new Connection.Info();

                        newConnectionInfo.Name = string.Format(Language.strQuick, Uri.Host);
                        newConnectionInfo.Protocol = Protocol;
                        newConnectionInfo.Hostname = Uri.Host;
                        if (Uri.Port == -1)
                        {
                            newConnectionInfo.Port = 0;
                        }
                        else
                        {
                            newConnectionInfo.Port = Uri.Port;
                        }
                        newConnectionInfo.IsQuicky = true;

                        Windows.quickyForm.ConnectionInfo = newConnectionInfo;

                        if (Protocol == Protocols.NONE)
                        {
                            Windows.quickyPanel.Show(frmMain.Default.pnlDock, DockState.DockBottom);
                            Windows.quickyPanel.BringToFront();
                            Windows.quickyPanel.Activate();
                            Windows.quickyPanel.Show();
                            Windows.quickyPanel.Focus();
                        }

                        return newConnectionInfo;
                    }
                }
                catch (Exception ex)
                {
                    MessageCollector.AddMessage(MessageClass.ErrorMsg,
                                                Language.strQuickConnectFailed + Constants.vbNewLine +
                                                ex.Message);
                }

                return null;
            }
Пример #5
0
            public static void ImportConnectionsFromPortScan(ArrayList Hosts, Protocols Protocol)
            {
                foreach (ScanHost Host in Hosts)
                {
                    Protocols finalProt = Protocols.NONE;
                    bool protOK = false;

                    TreeNode nNode = Node.AddNode(Node.Type.Connection, (string)Host.HostNameWithoutDomain);

                    Connection.Info nConI = new Connection.Info();
                    nConI.Inherit = new Connection.Info.Inheritance(nConI);

                    nConI.Name = Host.HostNameWithoutDomain;
                    nConI.Hostname = Host.HostName;

                    switch (Protocol)
                    {
                        case Protocols.SSH2:
                            if (Host.SSH)
                            {
                                finalProt = Protocols.SSH2;
                                protOK = true;
                            }
                            break;
                        case Protocols.Telnet:
                            if (Host.Telnet)
                            {
                                finalProt = Protocols.Telnet;
                                protOK = true;
                            }
                            break;
                        case Protocols.HTTP:
                            if (Host.HTTP)
                            {
                                finalProt = Protocols.HTTP;
                                protOK = true;
                            }
                            break;
                        case Protocols.HTTPS:
                            if (Host.HTTPS)
                            {
                                finalProt = Protocols.HTTPS;
                                protOK = true;
                            }
                            break;
                        case Protocols.Rlogin:
                            if (Host.Rlogin)
                            {
                                finalProt = Protocols.Rlogin;
                                protOK = true;
                            }
                            break;
                        case Protocols.Serial:
                            if (Host.Serial)
                            {
                                finalProt = Protocols.Serial;
                                protOK = true;
                            }
                            break;
                        case Protocols.RDP:
                            if (Host.RDP)
                            {
                                finalProt = Protocols.RDP;
                                protOK = true;
                            }
                            break;
                        case Protocols.VNC:
                            if (Host.VNC)
                            {
                                finalProt = Protocols.VNC;
                                protOK = true;
                            }
                            break;
                    }

                    if (protOK == false)
                    {
                        nConI = null;
                    }
                    else
                    {
                        nConI.Protocol = finalProt;
                        nConI.SetDefaultPort();

                        nNode.Tag = nConI;
                        Windows.treeForm.tvConnections.SelectedNode.Nodes.Add(nNode);

                        if (Node.GetNodeType(nNode.Parent) == Node.Type.Container)
                        {
                            nConI.Parent = nNode.Parent.Tag;
                        }

                        ConnectionList.Add(nConI);
                    }
                }
            }
Пример #6
0
            public static void ImportConnectionsFromRDPFiles()
            {
                try
                {
                    OpenFileDialog lD = Controls.ConnectionsRDPImportDialog();
                    lD.Multiselect = true;

                    if (lD.ShowDialog() == DialogResult.OK)
                    {
                        for (int i = 0; i <= lD.FileNames.Length - 1; i++)
                        {
                            string[] lines = File.ReadAllLines(lD.FileNames[i]);

                            TreeNode nNode = Node.AddNode(Node.Type.Connection,
                                                          Path.GetFileNameWithoutExtension(lD.FileNames[i]));

                            Connection.Info nConI = new Connection.Info();
                            nConI.Inherit = new Connection.Info.Inheritance(nConI);

                            nConI.Name = nNode.Text;

                            foreach (string l in lines)
                            {
                                string pName = l.Substring(0, l.IndexOf(":"));
                                string pValue = l.Substring(Convert.ToInt32(l.LastIndexOf(":") + 1));

                                switch (pName.ToLower())
                                {
                                    case "full address":
                                        nConI.Hostname = pValue;
                                        break;
                                    case "server port":
                                        nConI.Port = Convert.ToInt32(pValue);
                                        break;
                                    case "username":
                                        nConI.Username = pValue;
                                        break;
                                    case "domain":
                                        nConI.Domain = pValue;
                                        break;
                                    case "session bpp":
                                        switch (Convert.ToInt32(pValue))
                                        {
                                            case 8:
                                                nConI.Colors = RDP.RDPColors.Colors256;
                                                break;
                                            case 15:
                                                nConI.Colors = RDP.RDPColors.Colors15Bit;
                                                break;
                                            case 16:
                                                nConI.Colors = RDP.RDPColors.Colors16Bit;
                                                break;
                                            case 24:
                                                nConI.Colors = RDP.RDPColors.Colors24Bit;
                                                break;
                                            case 32:
                                                nConI.Colors = RDP.RDPColors.Colors32Bit;
                                                break;
                                        }
                                        break;
                                    case "bitmapcachepersistenable":
                                        nConI.CacheBitmaps = pValue == "1";
                                        break;
                                    case "screen mode id":
                                        nConI.Resolution = pValue == "2"
                                                               ? RDP.RDPResolutions.Fullscreen
                                                               : RDP.RDPResolutions.FitToWindow;
                                        break;
                                    case "connect to console":
                                        if (pValue == "1")
                                        {
                                            nConI.UseConsoleSession = true;
                                        }
                                        break;
                                    case "disable wallpaper":
                                        nConI.DisplayWallpaper = pValue == "1";
                                        break;
                                    case "disable themes":
                                        nConI.DisplayThemes = pValue == "1";
                                        break;
                                    case "allow font smoothing":
                                        nConI.EnableFontSmoothing = pValue == "1";
                                        break;
                                    case "allow desktop composition":
                                        nConI.EnableDesktopComposition = pValue == "1";
                                        break;
                                    case "redirectsmartcards":
                                        nConI.RedirectSmartCards = pValue == "1";
                                        break;
                                    case "redirectdrives":
                                        nConI.RedirectDiskDrives = pValue == "1";
                                        break;
                                    case "redirectcomports":
                                        nConI.RedirectPorts = pValue == "1";
                                        break;
                                    case "redirectprinters":
                                        nConI.RedirectPrinters = pValue == "1";
                                        break;
                                    case "audiomode":
                                        switch (Convert.ToInt32(pValue))
                                        {
                                            case 0:
                                                nConI.RedirectSound =
                                                    RDP.RDPSounds.BringToThisComputer;
                                                break;
                                            case 1:
                                                nConI.RedirectSound =
                                                    RDP.RDPSounds.LeaveAtRemoteComputer;
                                                break;
                                            case 2:
                                                nConI.RedirectSound = RDP.RDPSounds.DoNotPlay;
                                                break;
                                        }
                                        break;
                                }
                            }

                            nNode.Tag = nConI;
                            Windows.treeForm.tvConnections.SelectedNode.Nodes.Add(nNode);

                            if (Node.GetNodeType(nNode.Parent) == Node.Type.Container)
                            {
                                nConI.Parent = nNode.Parent.Tag;
                            }

                            ConnectionList.Add(nConI);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageCollector.AddMessage(MessageClass.ErrorMsg,
                                                Language.strRdpFileCouldNotBeImported + Constants.vbNewLine +
                                                Constants.vbNewLine + ex.Message);
                }
            }
Пример #7
0
            public static void CloneNode(TreeNode oldTreeNode, TreeNode parentNode = null)
            {
                try
                {
                    if (GetNodeType(oldTreeNode) == Type.Connection)
                    {
                        Connection.Info oldConnectionInfo = (Info)oldTreeNode.Tag;

                        Connection.Info             newConnectionInfo = oldConnectionInfo.Copy();
                        Connection.Info.Inheritance newInheritance    = oldConnectionInfo.Inherit.Copy();
                        newInheritance.Parent     = newConnectionInfo;
                        newConnectionInfo.Inherit = newInheritance;

                        Runtime.ConnectionList.Add(newConnectionInfo);

                        TreeNode newTreeNode = new TreeNode((string)newConnectionInfo.Name);
                        newTreeNode.Tag                = newConnectionInfo;
                        newTreeNode.ImageIndex         = System.Convert.ToInt32(Images.Enums.TreeImage.ConnectionClosed);
                        newTreeNode.SelectedImageIndex = System.Convert.ToInt32(Images.Enums.TreeImage.ConnectionClosed);

                        newConnectionInfo.TreeNode = newTreeNode;

                        if (parentNode == null)
                        {
                            oldTreeNode.Parent.Nodes.Add(newTreeNode);
                            Tree.Node.TreeView.SelectedNode = newTreeNode;
                        }
                        else
                        {
                            var parentContainerInfo = parentNode.Tag as Container.Info;
                            if (parentContainerInfo != null)
                            {
                                newConnectionInfo.Parent = parentContainerInfo;
                            }
                            parentNode.Nodes.Add(newTreeNode);
                        }
                    }
                    else if (GetNodeType(oldTreeNode) == Type.Container)
                    {
                        Container.Info  newContainerInfo  = (oldTreeNode.Tag as Container.Info).Copy();
                        Connection.Info newConnectionInfo = (oldTreeNode.Tag as Container.Info).ConnectionInfo.Copy();
                        newContainerInfo.ConnectionInfo = newConnectionInfo;

                        TreeNode newTreeNode = new TreeNode(newContainerInfo.Name);
                        newTreeNode.Tag                        = newContainerInfo;
                        newTreeNode.ImageIndex                 = System.Convert.ToInt32(Images.Enums.TreeImage.Container);
                        newTreeNode.SelectedImageIndex         = System.Convert.ToInt32(Images.Enums.TreeImage.Container);
                        newContainerInfo.ConnectionInfo.Parent = newContainerInfo;

                        Runtime.ContainerList.Add(newContainerInfo);

                        oldTreeNode.Parent.Nodes.Add(newTreeNode);

                        Tree.Node.TreeView.SelectedNode = newTreeNode;

                        foreach (TreeNode childTreeNode in oldTreeNode.Nodes)
                        {
                            CloneNode(childTreeNode, newTreeNode);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg,
                                                        string.Format(Language.strErrorCloneNodeFailed, ex.Message));
                }
            }
Пример #8
0
        void MessageReceived()
        {
            Connection.State myState = connection.myState;
            Connection.Info  info    = connection.receivedInfo;
            int nm = -1;

            if (connection.receivedNums.Count > 0)
            {
                nm = connection.receivedNums[0];
            }
            string data = connection.receivedData;

            if (info == Connection.Info.Idle)
            {
                if (myState == Connection.State.Playing || myState == Connection.State.PlayAgain)
                {
                    Invoke((MethodInvoker)(() => gameForm.OnlinePlayerQuitted()));
                }
                connection.otherPlayerState = Connection.State.Idle;
            }
            else if (info == Connection.Info.Waiting)
            {
                connection.otherPlayerState = Connection.State.Waiting;
                if (connection.myState == Connection.State.Waiting)
                {
                    progressForm.InstantClose();
                }
            }
            else if (info == Connection.Info.Disconnected)
            {
                if (myState == Connection.State.Playing || myState == Connection.State.PlayAgain)
                {
                    Invoke((MethodInvoker)(() => gameForm.OnlinePlayerQuitted()));
                }
                Invoke((MethodInvoker)(() => PlayerDisconnected()));
            }
            else if (info == Connection.Info.Playing)
            {
                connection.otherPlayerState = Connection.State.Playing;
            }
            else if (info == Connection.Info.PlayAgain)
            {
                connection.otherPlayerState = Connection.State.PlayAgain;
                if (connection.myState == Connection.State.PlayAgain)
                {
                    Invoke((MethodInvoker)(() => gameForm.NewGame()));
                }
                else
                {
                    Invoke((MethodInvoker)(() => gameForm.PlayAgainRequested()));
                }
            }
            else if (info == Connection.Info.PlayAt && myState == Connection.State.Playing)
            {
                Invoke((MethodInvoker)(() => gameForm.UpdateAll(nm, -1)));
            }
            else if (info == Connection.Info.Type)
            {
                Invoke((MethodInvoker)(() =>
                {
                    players[onlinePlayer].type = nm;
                    lblType[onlinePlayer].Text = playerType[nm];
                }));
            }
            else if (info == Connection.Info.Color)
            {
                Invoke((MethodInvoker)(() => ChangePlayerColor(onlinePlayer, Color.FromArgb(nm))));
            }
            else if (info == Connection.Info.Name)
            {
                Invoke((MethodInvoker)(() => tbxName[onlinePlayer].Text = data));
            }
            else if (info == Connection.Info.Image)
            {
                string fileName = "";
                if (nm != 0)
                {
                    fileName = connection.ReceiveFile(nm);
                }
                Invoke((MethodInvoker)(() => ChangePlayerImage(onlinePlayer, fileName)));
            }
        }
Пример #9
0
        // Start external app integrated
        public void StartIntApp(Connection.Info ConnectionInfo = null)
        {
            try
            {
                _ConnectionInfo = ConnectionInfo;

                Connection.Info nCI = new Connection.Info();

                nCI.Protocol = mRemoteNC.Protocols.IntApp;
                nCI.ExtApp = this.DisplayName;
                nCI.Name = this.DisplayName;
                nCI.Panel = "Int. Apps";
                if (_ConnectionInfo!=null)
                {
                    nCI.Hostname = _ConnectionInfo.Hostname;
                    nCI.Port = _ConnectionInfo.Port;
                    nCI.Username = _ConnectionInfo.Username;
                    nCI.Password = _ConnectionInfo.Password;
                    nCI.Domain = _ConnectionInfo.Domain;
                    nCI.Description = _ConnectionInfo.Description;
                    nCI.MacAddress = _ConnectionInfo.MacAddress;
                    nCI.UserField = _ConnectionInfo.UserField;
                    nCI.Description = _ConnectionInfo.Description;
                    nCI.PreExtApp = _ConnectionInfo.PreExtApp;
                    nCI.PostExtApp = _ConnectionInfo.PostExtApp;
                }

                Runtime.OpenConnection(nCI);
            }
            catch (Exception)
            {
            }
        }
Пример #10
0
            private Connection.Info GetConnectionInfoFromSQL()
            {
                try
                {
                    Connection.Info conI = new Connection.Info();

                    conI.PositionID = Convert.ToInt32(sqlRd["PositionID"]);
                    conI.ConstantID = sqlRd["ConstantID"].ToString();
                    conI.Name = sqlRd["Name"].ToString();
                    conI.Description = sqlRd["Description"].ToString();
                    conI.Hostname = sqlRd["Hostname"].ToString();
                    conI.Username = sqlRd["Username"].ToString();
                    conI.Password = Security.Crypt.Decrypt((string)(sqlRd["Password"]), pW);
                    conI.Domain = sqlRd["DomainName"].ToString();
                    conI.DisplayWallpaper = (bool)sqlRd["DisplayWallpaper"];
                    conI.DisplayThemes = (bool)sqlRd["DisplayThemes"];
                    conI.CacheBitmaps = (bool)sqlRd["CacheBitmaps"];
                    conI.UseConsoleSession = (bool)sqlRd["ConnectToConsole"];

                    conI.RedirectDiskDrives = (bool)sqlRd["RedirectDiskDrives"];
                    conI.RedirectPrinters = (bool)sqlRd["RedirectPrinters"];
                    conI.RedirectPorts = (bool)sqlRd["RedirectPorts"];
                    conI.RedirectSmartCards = (bool)sqlRd["RedirectSmartCards"];
                    conI.RedirectKeys = (bool)sqlRd["RedirectKeys"];
                    conI.RedirectSound =
                        (RDP.RDPSounds)Tools.Misc.StringToEnum(typeof(mRemoteNC.RDP.RDPSounds),
                                                                sqlRd["RedirectSound"].ToString());

                    conI.Protocol =
                        (Protocols)
                        Tools.Misc.StringToEnum(typeof(mRemoteNC.Protocols), sqlRd["Protocol"].ToString());
                    conI.Port = Convert.ToInt32(sqlRd["Port"]);
                    conI.PuttySession = sqlRd["PuttySession"].ToString();

                    conI.Colors =
                        (RDP.RDPColors)
                        Tools.Misc.StringToEnum(typeof(mRemoteNC.RDP.RDPColors), sqlRd["Colors"].ToString());
                    conI.Resolution =
                        (RDP.RDPResolutions)Tools.Misc.StringToEnum(typeof(mRemoteNC.RDP.RDPResolutions),
                                                                     sqlRd["Resolution"].ToString());

                    conI.Inherit = new Connection.Info.Inheritance(conI);
                    conI.Inherit.CacheBitmaps = (bool)sqlRd["InheritCacheBitmaps"];
                    conI.Inherit.Colors = (bool)sqlRd["InheritColors"];
                    conI.Inherit.Description = (bool)sqlRd["InheritDescription"];
                    conI.Inherit.DisplayThemes = (bool)sqlRd["InheritDisplayThemes"];
                    conI.Inherit.DisplayWallpaper = (bool)sqlRd["InheritDisplayWallpaper"];
                    conI.Inherit.Domain = (bool)sqlRd["InheritDomain"];
                    conI.Inherit.Icon = (bool)sqlRd["InheritIcon"];
                    conI.Inherit.Panel = (bool)sqlRd["InheritPanel"];
                    conI.Inherit.Password = (bool)sqlRd["InheritPassword"];
                    conI.Inherit.Port = (bool)sqlRd["InheritPort"];
                    conI.Inherit.Protocol = (bool)sqlRd["InheritProtocol"];
                    conI.Inherit.PuttySession = (bool)sqlRd["InheritPuttySession"];
                    conI.Inherit.RedirectDiskDrives = (bool)sqlRd["InheritRedirectDiskDrives"];
                    conI.Inherit.RedirectKeys = (bool)sqlRd["InheritRedirectKeys"];
                    conI.Inherit.RedirectPorts = (bool)sqlRd["InheritRedirectPorts"];
                    conI.Inherit.RedirectPrinters = (bool)sqlRd["InheritRedirectPrinters"];
                    conI.Inherit.RedirectSmartCards = (bool)sqlRd["InheritRedirectSmartCards"];
                    conI.Inherit.RedirectSound = (bool)sqlRd["InheritRedirectSound"];
                    conI.Inherit.Resolution = (bool)sqlRd["InheritResolution"];
                    conI.Inherit.UseConsoleSession = (bool)sqlRd["InheritUseConsoleSession"];
                    conI.Inherit.Username = (bool)sqlRd["InheritUsername"];

                    conI.Icon = sqlRd["Icon"].ToString();
                    conI.Panel = sqlRd["Panel"].ToString();

                    if (this.confVersion > 1.5) //1.6
                    {
                        conI.ICAEncryption = (ICA.EncryptionStrength)Tools.Misc.StringToEnum(
                            typeof(mRemoteNC.ICA.EncryptionStrength),
                            sqlRd["ICAEncryptionStrength"].ToString());
                        conI.Inherit.ICAEncryption = (bool)sqlRd["InheritICAEncryptionStrength"];

                        conI.PreExtApp = sqlRd["PreExtApp"].ToString();
                        conI.PostExtApp = sqlRd["PostExtApp"].ToString();
                        conI.Inherit.PreExtApp = (bool)sqlRd["InheritPreExtApp"];
                        conI.Inherit.PostExtApp = (bool)sqlRd["InheritPostExtApp"];
                    }

                    if (this.confVersion > 1.6) //1.7
                    {
                        conI.VNCCompression =
                            (VNC.Compression)Tools.Misc.StringToEnum(typeof(mRemoteNC.VNC.Compression),
                                                                      sqlRd["VNCCompression"].ToString());
                        conI.VNCEncoding =
                            (mRemoteNC.VNC.Encoding)
                            Tools.Misc.StringToEnum(typeof(mRemoteNC.VNC.Encoding),
                                                    sqlRd["VNCEncoding"].ToString());
                        conI.VNCAuthMode =
                            (VNC.AuthMode)Tools.Misc.StringToEnum(typeof(mRemoteNC.VNC.AuthMode),
                                                                   sqlRd["VNCAuthMode"].ToString());
                        conI.VNCProxyType =
                            (VNC.ProxyType)Tools.Misc.StringToEnum(typeof(mRemoteNC.VNC.ProxyType),
                                                                    sqlRd["VNCProxyType"].ToString());
                        conI.VNCProxyIP = sqlRd["VNCProxyIP"].ToString();
                        conI.VNCProxyPort = Convert.ToInt32(sqlRd["VNCProxyPort"].ToString());
                        conI.VNCProxyUsername = sqlRd["VNCProxyUsername"].ToString();
                        conI.VNCProxyPassword = Security.Crypt.Decrypt((string)(sqlRd["VNCProxyPassword"]), pW);
                        conI.VNCColors = (VNC.Colors)Tools.Misc.StringToEnum(typeof(mRemoteNC.VNC.Colors),
                                                                              sqlRd["VNCColors"].ToString());
                        conI.VNCSmartSizeMode =
                            (VNC.SmartSizeMode)Tools.Misc.StringToEnum(typeof(mRemoteNC.VNC.SmartSizeMode),
                                                                        sqlRd["VNCSmartSizeMode"].ToString());
                        conI.VNCViewOnly = (bool)sqlRd["VNCViewOnly"];

                        conI.Inherit.VNCCompression = (bool)sqlRd["InheritVNCCompression"];
                        conI.Inherit.VNCEncoding = (bool)sqlRd["InheritVNCEncoding"];
                        conI.Inherit.VNCAuthMode = (bool)sqlRd["InheritVNCAuthMode"];
                        conI.Inherit.VNCProxyType = (bool)sqlRd["InheritVNCProxyType"];
                        conI.Inherit.VNCProxyIP = (bool)sqlRd["InheritVNCProxyIP"];
                        conI.Inherit.VNCProxyPort = (bool)sqlRd["InheritVNCProxyPort"];
                        conI.Inherit.VNCProxyUsername = (bool)sqlRd["InheritVNCProxyUsername"];
                        conI.Inherit.VNCProxyPassword = (bool)sqlRd["InheritVNCProxyPassword"];
                        conI.Inherit.VNCColors = (bool)sqlRd["InheritVNCColors"];
                        conI.Inherit.VNCSmartSizeMode = (bool)sqlRd["InheritVNCSmartSizeMode"];
                        conI.Inherit.VNCViewOnly = (bool)sqlRd["InheritVNCViewOnly"];
                    }

                    if (this.confVersion > 1.7) //1.8
                    {
                        conI.RDPAuthenticationLevel = (RDP.AuthenticationLevel)
                                                      Tools.Misc.StringToEnum(
                                                          typeof(mRemoteNC.RDP.AuthenticationLevel),
                                                          sqlRd["RDPAuthenticationLevel"].ToString());

                        conI.Inherit.RDPAuthenticationLevel = (bool)sqlRd["InheritRDPAuthenticationLevel"];
                    }

                    if (this.confVersion > 1.8) //1.9
                    {
                        conI.RenderingEngine = (HTTPBase.RenderingEngine)
                                               Tools.Misc.StringToEnum(
                                                   typeof(mRemoteNC.HTTPBase.RenderingEngine),
                                                   sqlRd["RenderingEngine"].ToString());
                        conI.MacAddress = sqlRd["MacAddress"].ToString();

                        conI.Inherit.RenderingEngine = (bool)sqlRd["InheritRenderingEngine"];
                        conI.Inherit.MacAddress = (bool)sqlRd["InheritMacAddress"];
                    }

                    if (this.confVersion > 1.9) //2.0
                    {
                        conI.UserField = sqlRd["UserField"].ToString();

                        conI.Inherit.UserField = (bool)sqlRd["InheritUserField"];
                    }

                    if (this.confVersion > 2.0) //2.1
                    {
                        conI.ExtApp = sqlRd["ExtApp"].ToString();

                        conI.Inherit.ExtApp = (bool)sqlRd["InheritExtApp"];
                    }

                    if (this.confVersion >= 2.2)
                    {
                        conI.RDGatewayUsageMethod = (RDP.RDGatewayUsageMethod)
                                                    Tools.Misc.StringToEnum(typeof(RDP.RDGatewayUsageMethod),
                                                                            sqlRd["RDGatewayUsageMethod"].ToString());
                        conI.RDGatewayHostname = sqlRd["RDGatewayHostname"].ToString();
                        conI.RDGatewayUseConnectionCredentials = (RDP.RDGatewayUseConnectionCredentials)
                                                                 Tools.Misc.StringToEnum(
                                                                     typeof(RDP.RDGatewayUseConnectionCredentials),
                                                                     sqlRd["RDGatewayUseConnectionCredentials"].ToString
                                                                         ());
                        conI.RDGatewayUsername = sqlRd["RDGatewayUsername"].ToString();
                        conI.RDGatewayPassword = Security.Crypt.Decrypt((string)(sqlRd["RDGatewayPassword"]), pW);
                        conI.RDGatewayDomain = sqlRd["RDGatewayDomain"].ToString();
                        conI.Inherit.RDGatewayUsageMethod = (bool)sqlRd["InheritRDGatewayUsageMethod"];
                        conI.Inherit.RDGatewayHostname = (bool)sqlRd["InheritRDGatewayHostname"];
                        conI.Inherit.RDGatewayUsername = (bool)sqlRd["InheritRDGatewayUsername"];
                        conI.Inherit.RDGatewayPassword = (bool)sqlRd["InheritRDGatewayPassword"];
                        conI.Inherit.RDGatewayDomain = (bool)sqlRd["InheritRDGatewayDomain"];
                    }

                    if (this.confVersion >= 2.3)
                    {
                        conI.EnableFontSmoothing = (bool)sqlRd["EnableFontSmoothing"];
                        conI.EnableDesktopComposition = (bool)sqlRd["EnableDesktopComposition"];
                        conI.Inherit.EnableFontSmoothing = (bool)sqlRd["InheritEnableFontSmoothing"];
                        conI.Inherit.EnableDesktopComposition = (bool)sqlRd["InheritEnableDesktopComposition"];
                    }

                    if (confVersion >= 2.4)
                    {
                        conI.UseCredSsp = (bool)sqlRd["UseCredSsp"];
                        conI.Inherit.UseCredSsp = (bool)sqlRd["InheritUseCredSsp"];
                    }

                    if (confVersion >= 2.5)
                    {
                        conI.ConnectOnStartup = (bool)sqlRd["ConnectOnStartup"];
                    }

                    if (SQLUpdate == true)
                    {
                        conI.PleaseConnect = (bool)sqlRd["Connected"];
                    }

                    return conI;
                }
                catch (Exception ex)
                {
                    Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
                                                        Language.strGetConnectionInfoFromSqlFailed +
                                                        Constants.vbNewLine + ex.Message, true);
                }

                return null;
            }
Пример #11
0
        public IEnumerable <Connection.Info> GetConnections()
        {
            var result = new List <Connection.Info>();

            try
            {
                var allSessionsKey = Registry.CurrentUser.OpenSubKey("Software\\SimonTatham\\PuTTY\\Sessions");
                if (allSessionsKey != null)
                {
                    var allSessions = allSessionsKey.GetSubKeyNames();
                    foreach (var session in allSessions)
                    {
                        var coni = new Connection.Info {
                            PuttySession = session, Description = "PuTTY Session", Icon = "PuTTY"
                        };
                        var sessionKey = allSessionsKey.OpenSubKey(session);
                        if (sessionKey != null)
                        {
                            coni.Hostname = sessionKey.GetValue("HostName").ToString();
                            if (string.IsNullOrWhiteSpace(coni.Hostname))
                            {
                                continue;
                            }
                            coni.Username = sessionKey.GetValue("UserName").ToString();
                            var prot = sessionKey.GetValue("Protocol").ToString();
                            switch (prot)
                            {
                            case "ssh":
                                coni.Protocol = Convert.ToInt32(sessionKey.GetValue("SshProt")) == 1 ? Protocols.SSH1 : Protocols.SSH2;
                                coni.Icon     = "SSH";
                                break;

                            case "raw":
                                coni.Protocol = Protocols.RAW;
                                break;

                            case "telnet":
                                coni.Protocol = Protocols.Telnet;
                                break;

                            case "rlogin":
                                coni.Protocol = Protocols.Rlogin;
                                break;

                            case "serial":
                                coni.Protocol = Protocols.Rlogin;
                                break;

                            default:
                                coni.Protocol = Protocols.NONE;
                                break;
                            }
                            coni.Port = Convert.ToInt32(sessionKey.GetValue("PortNumber"));
                            coni.Name = session + " - Imported";
                            result.Add(coni);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }
            return(result);
        }
Пример #12
0
 internal string ToCommand(Connection.Info info)
 {
     return(Text.Replace("%Password%", info.Password).Replace("%Login%", info.Username).Replace("%AltSpace%", "% "));
 }
Пример #13
0
            private void AddNodeFromXml(XmlNode parentXmlNode, TreeNode parentTreeNode)
            {
                try
                {
                    // Loop through the XML nodes until the leaf is reached.
                    // Add the nodes to the TreeView during the looping process.
                    if (parentXmlNode.HasChildNodes)
                    {
                        foreach (XmlNode xmlNode in parentXmlNode.ChildNodes)
                        {
                            TreeNode treeNode = new TreeNode((string)(xmlNode.Attributes["Name"].Value));
                            parentTreeNode.Nodes.Add(treeNode);

                            if (Tree.Node.GetNodeTypeFromString(xmlNode.Attributes["Type"].Value) ==
                                Tree.Node.Type.Connection) //connection info
                            {
                                Connection.Info connectionInfo = GetConnectionInfoFromXml(xmlNode);
                                connectionInfo.TreeNode = treeNode;
                                connectionInfo.Parent = _previousContainer; //NEW

                                ConnectionList.Add(connectionInfo);

                                treeNode.Tag = connectionInfo;
                                treeNode.ImageIndex = System.Convert.ToInt32(Images.Enums.TreeImage.ConnectionClosed);
                                treeNode.SelectedImageIndex =
                                    System.Convert.ToInt32(Images.Enums.TreeImage.ConnectionClosed);
                            }
                            else if (Tree.Node.GetNodeTypeFromString((string)(xmlNode.Attributes["Type"].Value)) ==
                                     Tree.Node.Type.Container) //container info
                            {
                                Container.Info containerInfo = new Container.Info();
                                if (treeNode.Parent != null)
                                {
                                    if (Tree.Node.GetNodeType(treeNode.Parent) == Tree.Node.Type.Container)
                                    {
                                        containerInfo.Parent = treeNode.Parent.Tag;
                                    }
                                }
                                _previousContainer = containerInfo; //NEW
                                containerInfo.TreeNode = treeNode;

                                containerInfo.Name = xmlNode.Attributes["Name"].Value;

                                if (confVersion >= 0.8)
                                {
                                    if (xmlNode.Attributes["Expanded"].Value == "True")
                                    {
                                        containerInfo.IsExpanded = true;
                                    }
                                    else
                                    {
                                        containerInfo.IsExpanded = false;
                                    }
                                }

                                Connection.Info connectionInfo;
                                if (confVersion >= 0.9)
                                {
                                    connectionInfo = GetConnectionInfoFromXml(xmlNode);
                                }
                                else
                                {
                                    connectionInfo = new Connection.Info();
                                }

                                connectionInfo.Parent = containerInfo;
                                connectionInfo.IsContainer = true;
                                containerInfo.ConnectionInfo = connectionInfo;

                                ContainerList.Add(containerInfo);

                                treeNode.Tag = containerInfo;
                                treeNode.ImageIndex = System.Convert.ToInt32(Images.Enums.TreeImage.Container);
                                treeNode.SelectedImageIndex =
                                    System.Convert.ToInt32(Images.Enums.TreeImage.Container);
                            }

                            AddNodeFromXml(xmlNode, treeNode);
                        }
                    }
                    else
                    {
                        string nodeName = "";
                        XmlAttribute nameAttribute = parentXmlNode.Attributes["Name"];
                        if (nameAttribute != null)
                        {
                            nodeName = nameAttribute.Value.Trim();
                        }
                        if (!string.IsNullOrEmpty(nodeName))
                        {
                            parentTreeNode.Text = nodeName;
                        }
                        else
                        {
                            parentTreeNode.Text = parentXmlNode.Name;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
                                                        Language.strAddNodeFromXmlFailed + Constants.vbNewLine +
                                                        ex.Message + ex.StackTrace, true);
                    throw;
                }
            }
Пример #14
0
            public static void GoToURL(string URL)
            {
                Connection.Info cI = new Connection.Info();

                cI.Name = "";
                cI.Hostname = URL;
                cI.Protocol = URL.StartsWith("https:") ? Protocols.HTTPS : Protocols.HTTP;
                cI.SetDefaultPort();
                cI.IsQuicky = true;

                Runtime.OpenConnection(cI, Connection.Info.Force.DoNotJump);
            }
Пример #15
0
        // Start external app
        public Process Start(Connection.Info ConnectionInfo = null)
        {
            try
            {
                if (_FileName == "")
                {
                    throw (new Exception("No Filename specified!"));
                }

                if (_TryIntegrate)
                {
                    StartIntApp(ConnectionInfo);
                    return null;
                }

                _ConnectionInfo = ConnectionInfo;

                Process p = new Process();
                ProcessStartInfo pI = new ProcessStartInfo();

                pI.UseShellExecute = false;
                pI.FileName = ParseText(_FileName);
                pI.Arguments = CommandLineArguments.EscapeBackslashes(ParseText(_Arguments));

                p.StartInfo = pI;

                p.Start();

                if (_WaitForExit)
                {
                    p.WaitForExit();
                }

                return p;
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
                                                    (string)
                                                    ("Couldn\'t start external application." + Constants.vbNewLine +
                                                     ex.Message));
                return null;
            }
        }
Пример #16
0
            public static Connection.Info DefaultConnectionFromSettings()
            {
                DefaultConnection = new Connection.Info();
                DefaultConnection.IsDefault = true;

                return DefaultConnection;
            }
Пример #17
0
            private Info GetConnectionInfoFromXml(XmlNode xxNode)
            {
                Connection.Info conI = new Connection.Info();

                try
                {
                    XmlNode with_1 = xxNode;
                    if (this.confVersion > 0.1) //0.2
                    {
                        conI.Name = with_1.Attributes["Name"].Value;
                        conI.Description = with_1.Attributes["Descr"].Value;
                        conI.Hostname = with_1.Attributes["Hostname"].Value;
                        conI.Username = with_1.Attributes["Username"].Value;
                        conI.Password = Security.Crypt.Decrypt((string)(with_1.Attributes["Password"].Value), pW);
                        conI.Domain = with_1.Attributes["Domain"].Value;
                        conI.DisplayWallpaper = Convert.ToBoolean(with_1.Attributes["DisplayWallpaper"].Value);
                        conI.DisplayThemes = Convert.ToBoolean(with_1.Attributes["DisplayThemes"].Value);
                        conI.CacheBitmaps = Convert.ToBoolean(with_1.Attributes["CacheBitmaps"].Value);

                        if (this.confVersion < 1.1) //1.0 - 0.1
                        {
                            if ((Convert.ToBoolean(with_1.Attributes["Fullscreen"].Value)))
                            {
                                conI.Resolution = mRemoteNC.RDP.RDPResolutions.Fullscreen;
                            }
                            else
                            {
                                conI.Resolution = mRemoteNC.RDP.RDPResolutions.FitToWindow;
                            }
                        }
                    }

                    if (this.confVersion > 0.2) //0.3
                    {
                        if (this.confVersion < 0.7)
                        {
                            if (System.Convert.ToBoolean(with_1.Attributes["UseVNC"].Value) == true)
                            {
                                conI.Protocol = mRemoteNC.Protocols.VNC;
                                conI.Port = Convert.ToInt32(with_1.Attributes["VNCPort"].Value);
                            }
                            else
                            {
                                conI.Protocol = mRemoteNC.Protocols.RDP;
                            }
                        }
                    }
                    else
                    {
                        conI.Port = Convert.ToInt32(mRemoteNC.RDP.Defaults.Port);
                        conI.Protocol = mRemoteNC.Protocols.RDP;
                    }

                    if (this.confVersion > 0.3) //0.4
                    {
                        if (this.confVersion < 0.7)
                        {
                            if (System.Convert.ToBoolean(with_1.Attributes["UseVNC"].Value) == true)
                            {
                                conI.Port = Convert.ToInt32(with_1.Attributes["VNCPort"].Value);
                            }
                            else
                            {
                                conI.Port = Convert.ToInt32(with_1.Attributes["RDPPort"].Value);
                            }
                        }

                        conI.UseConsoleSession = Convert.ToBoolean(with_1.Attributes["ConnectToConsole"].Value);
                    }
                    else
                    {
                        if (this.confVersion < 0.7)
                        {
                            if (System.Convert.ToBoolean(with_1.Attributes["UseVNC"].Value) == true)
                            {
                                conI.Port = Convert.ToInt32(mRemoteNC.VNC.Defaults.Port);
                            }
                            else
                            {
                                conI.Port = Convert.ToInt32(mRemoteNC.RDP.Defaults.Port);
                            }
                        }
                        conI.UseConsoleSession = false;
                    }

                    if (this.confVersion > 0.4) //0.5 and 0.6
                    {
                        conI.RedirectDiskDrives = Convert.ToBoolean(with_1.Attributes["RedirectDiskDrives"].Value);
                        conI.RedirectPrinters = Convert.ToBoolean(with_1.Attributes["RedirectPrinters"].Value);
                        conI.RedirectPorts = Convert.ToBoolean(with_1.Attributes["RedirectPorts"].Value);
                        conI.RedirectSmartCards = Convert.ToBoolean(with_1.Attributes["RedirectSmartCards"].Value);
                    }
                    else
                    {
                        conI.RedirectDiskDrives = false;
                        conI.RedirectPrinters = false;
                        conI.RedirectPorts = false;
                        conI.RedirectSmartCards = false;
                    }

                    if (this.confVersion > 0.6) //0.7
                    {
                        conI.Protocol = (Protocols)Tools.Misc.StringToEnum(typeof(mRemoteNC.Protocols),
                                                                            with_1.Attributes["Protocol"].Value);
                        conI.Port = Convert.ToInt32(with_1.Attributes["Port"].Value);
                    }

                    if (this.confVersion > 0.9) //1.0
                    {
                        conI.RedirectKeys = Convert.ToBoolean(with_1.Attributes["RedirectKeys"].Value);
                    }

                    if (this.confVersion > 1.1) //1.2
                    {
                        conI.PuttySession = with_1.Attributes["PuttySession"].Value.ToString();
                    }

                    if (this.confVersion > 1.2) //1.3
                    {
                        conI.Colors =
                            (RDP.RDPColors)Tools.Misc.StringToEnum(typeof(mRemoteNC.RDP.RDPColors),
                                                                    with_1.Attributes["Colors"].Value);
                        conI.Resolution =
                            (RDP.RDPResolutions)
                            Tools.Misc.StringToEnum(typeof(mRemoteNC.RDP.RDPResolutions),
                                                    with_1.Attributes["Resolution"].Value);
                        conI.RedirectSound =
                            (RDP.RDPSounds)Tools.Misc.StringToEnum(typeof(mRemoteNC.RDP.RDPSounds),
                                                                    with_1.Attributes["RedirectSound"].Value);
                    }
                    else
                    {
                        switch (Convert.ToInt32(with_1.Attributes["Colors"].Value))
                        {
                            case 0:
                                conI.Colors = mRemoteNC.RDP.RDPColors.Colors256;
                                break;
                            case 1:
                                conI.Colors = mRemoteNC.RDP.RDPColors.Colors16Bit;
                                break;
                            case 2:
                                conI.Colors = mRemoteNC.RDP.RDPColors.Colors24Bit;
                                break;
                            case 3:
                                conI.Colors = mRemoteNC.RDP.RDPColors.Colors32Bit;
                                break;
                            case 4:
                                conI.Colors = mRemoteNC.RDP.RDPColors.Colors15Bit;
                                break;
                        }

                        conI.RedirectSound =
                            (RDP.RDPSounds)
                            Tools.Misc.StringToEnum(typeof(RDP.RDPSounds), with_1.Attributes["RedirectSound"].Value);
                    }

                    if (this.confVersion > 1.2) //1.3
                    {
                        conI.Inherit = new Connection.Info.Inheritance(conI);
                        conI.Inherit.CacheBitmaps = Convert.ToBoolean(with_1.Attributes["InheritCacheBitmaps"].Value);
                        conI.Inherit.Colors = Convert.ToBoolean(with_1.Attributes["InheritColors"].Value);
                        conI.Inherit.Description = Convert.ToBoolean(with_1.Attributes["InheritDescription"].Value);
                        conI.Inherit.DisplayThemes = Convert.ToBoolean(with_1.Attributes["InheritDisplayThemes"].Value);
                        conI.Inherit.DisplayWallpaper =
                            Convert.ToBoolean(with_1.Attributes["InheritDisplayWallpaper"].Value);
                        conI.Inherit.Domain = Convert.ToBoolean(with_1.Attributes["InheritDomain"].Value);
                        conI.Inherit.Icon = Convert.ToBoolean(with_1.Attributes["InheritIcon"].Value);
                        conI.Inherit.Panel = Convert.ToBoolean(with_1.Attributes["InheritPanel"].Value);
                        conI.Inherit.Password = Convert.ToBoolean(with_1.Attributes["InheritPassword"].Value);
                        conI.Inherit.Port = Convert.ToBoolean(with_1.Attributes["InheritPort"].Value);
                        conI.Inherit.Protocol = Convert.ToBoolean(with_1.Attributes["InheritProtocol"].Value);
                        conI.Inherit.PuttySession = Convert.ToBoolean(with_1.Attributes["InheritPuttySession"].Value);
                        conI.Inherit.RedirectDiskDrives =
                            Convert.ToBoolean(with_1.Attributes["InheritRedirectDiskDrives"].Value);
                        conI.Inherit.RedirectKeys = Convert.ToBoolean(with_1.Attributes["InheritRedirectKeys"].Value);
                        conI.Inherit.RedirectPorts = Convert.ToBoolean(with_1.Attributes["InheritRedirectPorts"].Value);
                        conI.Inherit.RedirectPrinters =
                            Convert.ToBoolean(with_1.Attributes["InheritRedirectPrinters"].Value);
                        conI.Inherit.RedirectSmartCards =
                            Convert.ToBoolean(with_1.Attributes["InheritRedirectSmartCards"].Value);
                        conI.Inherit.RedirectSound = Convert.ToBoolean(with_1.Attributes["InheritRedirectSound"].Value);
                        conI.Inherit.Resolution = Convert.ToBoolean(with_1.Attributes["InheritResolution"].Value);
                        conI.Inherit.UseConsoleSession =
                            Convert.ToBoolean(with_1.Attributes["InheritUseConsoleSession"].Value);
                        conI.Inherit.Username = Convert.ToBoolean(with_1.Attributes["InheritUsername"].Value);

                        conI.Icon = with_1.Attributes["Icon"].Value;
                        conI.Panel = with_1.Attributes["Panel"].Value;
                    }
                    else
                    {
                        conI.Inherit = new Connection.Info.Inheritance(conI,
                                                                       Convert.ToBoolean(
                                                                           with_1.Attributes["Inherit"].Value));

                        conI.Icon = with_1.Attributes["Icon"].Value.Replace(".ico", "");
                        conI.Panel = Language.strGeneral;
                    }

                    if (this.confVersion > 1.4) //1.5
                    {
                        conI.PleaseConnect = Convert.ToBoolean(with_1.Attributes["Connected"].Value);
                    }

                    if (this.confVersion > 1.5) //1.6
                    {
                        conI.ICAEncryption = (ICA.EncryptionStrength)
                                             Tools.Misc.StringToEnum(typeof(ICA.EncryptionStrength),
                                                                     with_1.Attributes["ICAEncryptionStrength"].Value);
                        conI.Inherit.ICAEncryption =
                            Convert.ToBoolean(with_1.Attributes["InheritICAEncryptionStrength"].Value);

                        conI.PreExtApp = with_1.Attributes["PreExtApp"].Value;
                        conI.PostExtApp = with_1.Attributes["PostExtApp"].Value;
                        conI.Inherit.PreExtApp = Convert.ToBoolean(with_1.Attributes["InheritPreExtApp"].Value);
                        conI.Inherit.PostExtApp = Convert.ToBoolean(with_1.Attributes["InheritPostExtApp"].Value);
                    }

                    if (this.confVersion > 1.6) //1.7
                    {
                        conI.VNCCompression = (VNC.Compression)
                                              Tools.Misc.StringToEnum(typeof(VNC.Compression),
                                                                      with_1.Attributes["VNCCompression"].Value);
                        conI.VNCEncoding = (VNC.Encoding)Tools.Misc.StringToEnum(typeof(VNC.Encoding),
                                                                                  with_1.Attributes["VNCEncoding"].Value);
                        conI.VNCAuthMode = (VNC.AuthMode)Tools.Misc.StringToEnum(typeof(VNC.AuthMode),
                                                                                  with_1.Attributes["VNCAuthMode"].Value);
                        conI.VNCProxyType = (VNC.ProxyType)Tools.Misc.StringToEnum(
                            typeof(VNC.ProxyType),
                            with_1.Attributes["VNCProxyType"].Value);
                        conI.VNCProxyIP = with_1.Attributes["VNCProxyIP"].Value;
                        conI.VNCProxyPort = Convert.ToInt32(with_1.Attributes["VNCProxyPort"].Value);
                        conI.VNCProxyUsername = with_1.Attributes["VNCProxyUsername"].Value;
                        conI.VNCProxyPassword = Security.Crypt.Decrypt(with_1.Attributes["VNCProxyPassword"].Value, pW);
                        conI.VNCColors = (VNC.Colors)Tools.Misc.StringToEnum(typeof(VNC.Colors),
                                                                              with_1.Attributes["VNCColors"].Value);
                        conI.VNCSmartSizeMode = (VNC.SmartSizeMode)
                                                Tools.Misc.StringToEnum(typeof(VNC.SmartSizeMode),
                                                                        with_1.Attributes["VNCSmartSizeMode"].Value);
                        conI.VNCViewOnly = Convert.ToBoolean(with_1.Attributes["VNCViewOnly"].Value);

                        conI.Inherit.VNCCompression = Convert.ToBoolean(with_1.Attributes["InheritVNCCompression"].Value);
                        conI.Inherit.VNCEncoding = Convert.ToBoolean(with_1.Attributes["InheritVNCEncoding"].Value);
                        conI.Inherit.VNCAuthMode = Convert.ToBoolean(with_1.Attributes["InheritVNCAuthMode"].Value);
                        conI.Inherit.VNCProxyType = Convert.ToBoolean(with_1.Attributes["InheritVNCProxyType"].Value);
                        conI.Inherit.VNCProxyIP = Convert.ToBoolean(with_1.Attributes["InheritVNCProxyIP"].Value);
                        conI.Inherit.VNCProxyPort = Convert.ToBoolean(with_1.Attributes["InheritVNCProxyPort"].Value);
                        conI.Inherit.VNCProxyUsername =
                            Convert.ToBoolean(with_1.Attributes["InheritVNCProxyUsername"].Value);
                        conI.Inherit.VNCProxyPassword =
                            Convert.ToBoolean(with_1.Attributes["InheritVNCProxyPassword"].Value);
                        conI.Inherit.VNCColors = Convert.ToBoolean(with_1.Attributes["InheritVNCColors"].Value);
                        conI.Inherit.VNCSmartSizeMode =
                            Convert.ToBoolean(with_1.Attributes["InheritVNCSmartSizeMode"].Value);
                        conI.Inherit.VNCViewOnly = Convert.ToBoolean(with_1.Attributes["InheritVNCViewOnly"].Value);
                    }

                    if (this.confVersion > 1.7) //1.8
                    {
                        conI.RDPAuthenticationLevel = (RDP.AuthenticationLevel)
                                                      Tools.Misc.StringToEnum(typeof(RDP.AuthenticationLevel),
                                                                              with_1.Attributes["RDPAuthenticationLevel"
                                                                                  ].Value);

                        conI.Inherit.RDPAuthenticationLevel =
                            Convert.ToBoolean(with_1.Attributes["InheritRDPAuthenticationLevel"].Value);
                    }

                    if (this.confVersion > 1.8) //1.9
                    {
                        conI.RenderingEngine = (HTTPBase.RenderingEngine)
                                               Tools.Misc.StringToEnum(typeof(HTTPBase.RenderingEngine),
                                                                       with_1.Attributes["RenderingEngine"].Value);
                        conI.MacAddress = with_1.Attributes["MacAddress"].Value;

                        conI.Inherit.RenderingEngine =
                            Convert.ToBoolean(with_1.Attributes["InheritRenderingEngine"].Value);
                        conI.Inherit.MacAddress = Convert.ToBoolean(with_1.Attributes["InheritMacAddress"].Value);
                    }

                    if (this.confVersion > 1.9) //2.0
                    {
                        conI.UserField = with_1.Attributes["UserField"].Value;
                        conI.Inherit.UserField = Convert.ToBoolean(with_1.Attributes["InheritUserField"].Value);
                    }

                    if (this.confVersion > 2.0) //2.1
                    {
                        conI.ExtApp = with_1.Attributes["ExtApp"].Value;
                        conI.Inherit.ExtApp = Convert.ToBoolean(with_1.Attributes["InheritExtApp"].Value);
                    }

                    if (this.confVersion > 2.1) //2.2
                    {
                        // Get settings
                        conI.RDGatewayUsageMethod = (RDP.RDGatewayUsageMethod)
                                                    Tools.Misc.StringToEnum(typeof(RDP.RDGatewayUsageMethod),
                                                                            with_1.Attributes["RDGatewayUsageMethod"].
                                                                                Value);
                        conI.RDGatewayHostname = with_1.Attributes["RDGatewayHostname"].Value;
                        conI.RDGatewayUseConnectionCredentials = (RDP.RDGatewayUseConnectionCredentials)
                                                                 Tools.Misc.StringToEnum(
                                                                     typeof(RDP.RDGatewayUseConnectionCredentials),
                                                                     with_1.Attributes[
                                                                         "RDGatewayUseConnectionCredentials"].Value);
                        conI.RDGatewayUsername = with_1.Attributes["RDGatewayUsername"].Value;
                        conI.RDGatewayPassword = Security.Crypt.Decrypt(with_1.Attributes["RDGatewayPassword"].Value, pW);
                        conI.RDGatewayDomain = with_1.Attributes["RDGatewayDomain"].Value;

                        // Get inheritance settings
                        conI.Inherit.RDGatewayUsageMethod =
                            Convert.ToBoolean(with_1.Attributes["InheritRDGatewayUsageMethod"].Value);
                        conI.Inherit.RDGatewayHostname =
                            Convert.ToBoolean(with_1.Attributes["InheritRDGatewayHostname"].Value);
                        conI.Inherit.RDGatewayUseConnectionCredentials =
                            Convert.ToBoolean(with_1.Attributes["InheritRDGatewayUseConnectionCredentials"].Value);
                        conI.Inherit.RDGatewayUsername =
                            Convert.ToBoolean(with_1.Attributes["InheritRDGatewayUsername"].Value);
                        conI.Inherit.RDGatewayPassword =
                            Convert.ToBoolean(with_1.Attributes["InheritRDGatewayPassword"].Value);
                        conI.Inherit.RDGatewayDomain =
                            Convert.ToBoolean(with_1.Attributes["InheritRDGatewayDomain"].Value);
                    }

                    if (this.confVersion > 2.2) //2.3
                    {
                        // Get settings
                        conI.EnableFontSmoothing = Convert.ToBoolean(with_1.Attributes["EnableFontSmoothing"].Value);
                        conI.EnableDesktopComposition =
                            Convert.ToBoolean(with_1.Attributes["EnableDesktopComposition"].Value);

                        // Get inheritance settings
                        conI.Inherit.EnableFontSmoothing =
                            Convert.ToBoolean(with_1.Attributes["InheritEnableFontSmoothing"].Value);
                        conI.Inherit.EnableDesktopComposition = Convert.ToBoolean(
                            with_1.Attributes["InheritEnableDesktopComposition"].Value);
                    }

                    if (confVersion >= 2.4)
                    {
                        
                        conI.UseCredSsp = Convert.ToBoolean(with_1.Attributes["UseCredSsp"].Value);
                        conI.Inherit.UseCredSsp = Convert.ToBoolean(with_1.Attributes["InheritUseCredSsp"].Value);
                    }

                    if (confVersion >= 2.5)
                    {
                        if (with_1.Attributes["ConnectOnStartup"]!=null)
                        {
                            conI.ConnectOnStartup = Convert.ToBoolean(with_1.Attributes["ConnectOnStartup"].Value);
                        }
                    }

                    //Placeholder: ConnectionOption
                }
                catch (Exception ex)
                {
                    Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
                                                        string.Format(
                                                            Language.strGetConnectionInfoFromXmlFailed, conI.Name,
                                                            this.ConnectionFileName, ex.Message), false);
                }
                return conI;
            }