コード例 #1
0
ファイル: ImportWithDialogs.cs プロジェクト: gbachs/Terminals
 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);
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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())));
        }
コード例 #4
0
ファイル: OrganizeGroupsForm.cs プロジェクト: zoroz/Terminals
        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();
        }
コード例 #5
0
ファイル: ImportRdpRegistry.cs プロジェクト: zoroz/Terminals
        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));
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
 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);
     }
 }