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 (connectionTag != null && connectionTag != String.Empty && !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(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(ConvertVRDConnectionCollectionToLocal(folder.Connection, null, null, tag, credentials));
         }
     }
     return coll;
 }
 private void ImportConnection(Connection Connection, List<string> FolderNames, Dictionary<string, vRDConfigurationFileCredentialsFolderCredentials> Credentials)
 {
 }
Exemple #3
0
        private FavoriteConfigurationElement ConvertVRDConnectionToLocal(Dictionary <string, vRDConfigurationFileCredentialsFolderCredentials> credentials, vRdImport.Connection con)
        {
            FavoriteConfigurationElement fav = new FavoriteConfigurationElement();
            var security = new FavoriteConfigurationSecurity(this.persistence, fav);

            fav.ServerName = con.ServerName;

            int p = 3389;

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

            if (credentials.ContainsKey(con.Credentials))
            {
                fav.Credential    = credentials[con.Credentials].Name;
                fav.UserName      = credentials[con.Credentials].UserName;
                fav.DomainName    = credentials[con.Credentials].Domain;
                security.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);
        }