Exemple #1
0
        internal static SharedFavorite ConvertFromFavorite(IPersistence persistence, FavoriteConfigurationElement Favorite)
        {
            var            favoriteSecurity = new FavoriteConfigurationSecurity(persistence, Favorite);
            SharedFavorite fav = new SharedFavorite();

            fav.Colors             = Favorite.Colors;
            fav.ConnectToConsole   = Favorite.ConnectToConsole;
            fav.DesktopShare       = Favorite.DesktopShare;
            fav.DesktopSize        = Favorite.DesktopSize;
            fav.DomainName         = favoriteSecurity.ResolveDomainName();
            fav.Name               = Favorite.Name;
            fav.Port               = Favorite.Port;
            fav.Protocol           = Favorite.Protocol;
            fav.RedirectClipboard  = Favorite.RedirectClipboard;
            fav.RedirectDevices    = Favorite.RedirectDevices;
            fav.RedirectedDrives   = Favorite.RedirectedDrives;
            fav.RedirectPorts      = Favorite.RedirectPorts;
            fav.RedirectPrinters   = Favorite.RedirectPrinters;
            fav.RedirectSmartCards = Favorite.RedirectSmartCards;
            fav.ServerName         = Favorite.ServerName;
            fav.DisableWallPaper   = Favorite.DisableWallPaper;
            fav.Sounds             = Favorite.Sounds;
            var tagsConverter = new TagsConverter();

            fav.Tags                  = tagsConverter.ResolveTags(Favorite);
            fav.ConsoleBackColor      = Favorite.ConsoleBackColor;
            fav.ConsoleCols           = Favorite.ConsoleCols;
            fav.ConsoleCursorColor    = Favorite.ConsoleCursorColor;
            fav.ConsoleFont           = Favorite.ConsoleFont;
            fav.ConsoleRows           = Favorite.ConsoleRows;
            fav.ConsoleTextColor      = Favorite.ConsoleTextColor;
            fav.VMRCAdministratorMode = Favorite.VMRCAdministratorMode;
            fav.VMRCReducedColorsMode = Favorite.VMRCReducedColorsMode;
            return(fav);
        }
        public void ShouldConvertOnlyCorrectType(Type type, bool expected)
        {
            var sut = new TagsConverter();

            var canConvertType = sut.CanConvert(type);

            Assert.Equal(expected, canConvertType);
        }
        private IEnumerable <string> SelectValidGroupNames(FavoriteConfigurationElement toImport)
        {
            var validator     = new GroupNameValidator(this.persistence);
            var tagsConverter = new TagsConverter();

            return(tagsConverter.ResolveTagsList(toImport)
                   .Where(groupName => string.IsNullOrEmpty(validator.ValidateNameValue(groupName))));
        }
        private void AssertTagsWriteRead(string tagsToAssign, string expectedTags, string assertMessage)
        {
            var favorite = this.CreateFavorite();

            favorite.Tags = tagsToAssign;
            var    converter = new TagsConverter();
            string current   = converter.ResolveTags(favorite);

            Assert.AreEqual(expectedTags, current, assertMessage);
        }
Exemple #5
0
        private void MoveFavoritesFromConfigFile()
        {
            var tagsConvertert = new TagsConverter();

            foreach (FavoriteConfigurationElement favoriteConfigElement in settings.GetFavorites())
            {
                IFavorite favorite = ModelConverterV1ToV2.ConvertToFavorite(favoriteConfigElement, this.persistence, this.connectionManager);
                ImportWithDialogs.AddFavoriteIntoGroups(this.persistence, favorite, tagsConvertert.ResolveTagsList(favoriteConfigElement));
                this.persistence.Favorites.Add(favorite);
            }
        }
        public void ShouldReturnListSplitByDelimeter(string[] expected, string inputTags, string delimeter)
        {
            var jsonReaderMock = new Mock <JsonReader>();

            jsonReaderMock.Setup(m => m.Value).Returns(inputTags);

            var sut    = new TagsConverter(delimeter);
            var result = sut.ReadJson(jsonReaderMock.Object, null, null, null) as List <string>;

            Assert.Equal(expected, result);
        }
        public void ShouldWriteCorrectValue(string[] input, string expected, string delimeter)
        {
            var jsonWriterMock = new Mock <JsonWriter>();

            jsonWriterMock.Setup(m => m.WriteValue(It.IsAny <List <string> >()));

            var sut = new TagsConverter(delimeter);

            sut.WriteJson(jsonWriterMock.Object, input, null);

            jsonWriterMock.Verify(m => m.WriteValue(expected));
        }
Exemple #8
0
        private static void ExportGeneralOptions(XmlTextWriter w, FavoriteConfigurationElement favorite)
        {
            w.WriteElementString("protocol", favorite.Protocol);
            w.WriteElementString("port", favorite.Port.ToString());
            w.WriteElementString("serverName", favorite.ServerName);
            w.WriteElementString("url", favorite.Url);
            w.WriteElementString("name", favorite.Name);
            w.WriteElementString("notes", favorite.Notes);
            var tagsConverter = new TagsConverter();

            w.WriteElementString("tags", tagsConverter.ResolveTags(favorite));
            w.WriteElementString("newWindow", favorite.NewWindow.ToString());
            w.WriteElementString("toolBarIcon", favorite.ToolBarIcon);
            w.WriteElementString("bitmapPeristence", favorite.Protocol);
        }
Exemple #9
0
        private List <FavoriteConfigurationElement> ConvertVRDConnectionCollectionToLocal(Connection[] connections, vRDConfigurationFileConnectionsFolder[] folders,
                                                                                          vRDConfigurationFileConnectionsFolderFolder[] subFolders, String connectionTag,
                                                                                          Dictionary <string, vRDConfigurationFileCredentialsFolderCredentials> credentials)
        {
            var tagsConverter = new TagsConverter();
            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 && !tagsConverter.ResolveTagsList(fav).Contains(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);
        }