internal static void AddFavoriteIntoGroups(IPersistence persistence, IFavorite toPerisist, IEnumerable <string> validGroupNames) { foreach (var groupName in validGroupNames) { var group = FavoritesFactory.GetOrAddNewGroup(persistence, groupName); group.AddFavorite(toPerisist); } }
private void MoveFavoriteAliasesGroup(GroupConfigurationElement configGroup) { IGroup group = FavoritesFactory.GetOrAddNewGroup(this.persistence, configGroup.Name); List <string> favoriteNames = configGroup.FavoriteAliases.GetFavoriteNames(); List <IFavorite> groupFavorites = favoriteNames.Select(favoriteName => persistence.Favorites[favoriteName]) .Where(favorite => favorite != null).ToList(); group.AddFavorites(groupFavorites); }
private static FavoriteConfigurationElement ImportRdpKey(RegistryKey favoriteKey, string favoriteName) { string userKey = favoriteKey.GetValue("UsernameHint").ToString(); int slashIndex = userKey.LastIndexOf('\\'); string domainName = userKey.Substring(0, slashIndex); string userName = userKey.Substring(slashIndex + 1, userKey.Length - slashIndex - 1); return(FavoritesFactory.CreateNewFavorite(favoriteName, favoriteName, typeof(RDPConnection).GetProtocolName(), domainName, userName, ConnectionManager.GetPort(typeof(RDPConnection).GetProtocolName()))); }
private void TsbAddGroup_Click(object sender, EventArgs e) { string newGroupName = NewGroupForm.AskFroGroupName(this.persistence); if (string.IsNullOrEmpty(newGroupName)) { return; } FavoritesFactory.GetOrAddNewGroup(this.persistence, newGroupName); this.LoadGroups(); }
private static FavoriteConfigurationElement ImportRdpKey(ConnectionManager connectionManager, RegistryKey favoriteKey, string favoriteName) { string userKey = favoriteKey.GetValue("UsernameHint", string.Empty).ToString(); string domainName = string.Empty; string userName = string.Empty; int slashIndex = userKey.LastIndexOf('\\'); if (slashIndex > 0) { domainName = userKey.Substring(0, slashIndex); userName = userKey.Substring(slashIndex + 1, userKey.Length - slashIndex - 1); } return(FavoritesFactory.CreateNewFavorite(connectionManager, favoriteName, favoriteName, KnownConnectionConstants.RDPPort, domainName, userName)); }
private void AddFavorite(IPEndPoint endPoint) { try { string protocol = this.connectionManager.GetPortName(endPoint.Port); string serverName = endPoint.Address.ToString(); string connectionName = String.Format("{0}_{1}", serverName, protocol); FavoriteConfigurationElement newFavorite = FavoritesFactory.CreateNewFavorite(this.connectionManager, connectionName, serverName, endPoint.Port); AddFavoriteToDiscovered(newFavorite); } catch (Exception e) { Logging.Error("Add Favorite Error", e); } }
private void AddFavorite(IPEndPoint endPoint) { try { string serverName = endPoint.Address.ToString(); string connectionName = serverName; FavoriteConfigurationElement newFavorite = FavoritesFactory.CreateNewFavorite(connectionName, serverName, typeof(RDPConnection) .GetProtocolName(), ConnectionManager.GetPort( typeof(RDPConnection) .GetProtocolName())); this.AddFavoriteToDiscovered(newFavorite); } catch (Exception e) { Log.Error("Add Favorite Error", e); } }