Beispiel #1
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())));
        }
Beispiel #2
0
        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);
            }
        }
Beispiel #4
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);
     }
 }