Exemplo n.º 1
0
        private static FavoriteConfigurationElement ConvertVRDConnectionToLocal(
            Dictionary<string, vRDConfigurationFileCredentialsFolderCredentials> credentials, Connection con)
        {
            FavoriteConfigurationElement fav = new FavoriteConfigurationElement {ServerName = con.ServerName};

            int p = 3389;
            int.TryParse(con.Port, out p);
            fav.Port = p;

            if (credentials.ContainsKey(con.Credentials))
            {
                fav.XmlCredentialSetName = credentials[con.Credentials].Name;
                fav.UserName = credentials[con.Credentials].UserName;
                fav.DomainName = credentials[con.Credentials].Domain;
                fav.Password = credentials[con.Credentials].Password;
            }

            switch (con.ColorDepth)
            {
                case "8":
                    fav.Colors = Colors.Bits8;
                    break;
                case "16":
                    fav.Colors = Colors.Bit16;
                    break;
                case "24":
                    fav.Colors = Colors.Bits24;
                    break;
                case "32":
                    fav.Colors = Colors.Bits32;
                    break;
                default:
                    fav.Colors = Colors.Bit16;
                    break;
            }
            
            fav.DesktopSize = DesktopSize.AutoScale;
            if (con.SeparateWindow == "true") fav.DesktopSize = DesktopSize.FullScreen;

            fav.ConnectToConsole = false;
            if (con.Console == "true") fav.ConnectToConsole = true;

            fav.DisableWallPaper = false;
            if (con.BitmapCaching == "false") fav.DisableWallPaper = true;

            fav.RedirectSmartCards = false;
            if (con.SmartCard == "true") fav.RedirectSmartCards = true;

            fav.RedirectPorts = false;
            //if (pValue == "1") fav.RedirectPorts = true;

            fav.RedirectPrinters = false;
            if (con.Printer == "true") fav.RedirectPrinters = true;

            fav.Sounds = ImportRDP.ConvertToSounds(con.Audio);
            fav.Name = con.Name;

            return fav;
        }
Exemplo n.º 2
0
 private void ImportConnection(Connection Connection, List<string> FolderNames,
                               Dictionary<string, vRDConfigurationFileCredentialsFolderCredentials> Credentials)
 {
 }
Exemplo n.º 3
0
        private List<FavoriteConfigurationElement> ConvertVRDConnectionCollectionToLocal(Connection[] connections,
                                                                                         vRDConfigurationFileConnectionsFolder
                                                                                             [] folders,
                                                                                         vRDConfigurationFileConnectionsFolderFolder
                                                                                             [] subFolders,
                                                                                         String connectionTag,
                                                                                         Dictionary
                                                                                             <string,
                                                                                             vRDConfigurationFileCredentialsFolderCredentials
                                                                                             > credentials)
        {
            List<FavoriteConfigurationElement> coll = new List<FavoriteConfigurationElement>();
            //covert vrd connection
            if (connections != null && connections.Length > 0)
            {
                foreach (Connection con in connections)
                {
                    FavoriteConfigurationElement fav = ConvertVRDConnectionToLocal(credentials, con);

                    if (!string.IsNullOrEmpty(connectionTag) && !fav.TagList.Contains(connectionTag))
                    {
                        fav.TagList.Add(connectionTag);
                        fav.Tags = connectionTag;
                    }

                    coll.Add(fav);
                }
            }

            //get connection object from root folder
            if (folders != null && folders.Length > 0)
            {
                foreach (vRDConfigurationFileConnectionsFolder folder in folders)
                {
                    coll.AddRange(this.ConvertVRDConnectionCollectionToLocal(folder.Connection, null, folder.Folder,
                                                                             folder.Name, credentials));
                }
            }

            //get connection object from sub folder
            if (subFolders != null && subFolders.Length > 0)
            {
                foreach (vRDConfigurationFileConnectionsFolderFolder folder in subFolders)
                {
                    string tag = connectionTag + folder.Name;
                    coll.AddRange(this.ConvertVRDConnectionCollectionToLocal(folder.Connection, null, null, tag,
                                                                             credentials));
                }
            }

            return coll;
        }