Esempio n. 1
0
        public static void Load()
        {
            Reset();

            // Load Machine Aliases
            AliasConfiguration machineConfiguration = LoadMachineAliasConfiguration();

            foreach (ServerAlias alias in machineConfiguration.Aliases.Values)
            {
                _aliases.Add(alias);
            }

            // Load User Aliases
            AliasConfiguration userConfiguration = LoadUserAliasConfiguration();

            foreach (ServerAlias alias in userConfiguration.Aliases.Values)
            {
                ServerAlias machineAlias = _aliases[alias.Name];
                if (machineAlias != null)
                {
                    _overriddenAliases.Add(machineAlias);
                    _aliases.Remove(alias.Name);
                }

                _aliases.Add(alias);
            }

            _defaultAliasName = userConfiguration.DefaultAliasName;
        }
Esempio n. 2
0
 private void InternalSetAlias(ServerAlias alias)
 {
     _alias = alias;
     if (_alias != null)
     {
         SessionInfo = (SessionInfo)_alias.SessionInfo.Clone();
     }
 }
Esempio n. 3
0
        public void AddServer(ServerAlias alias, string login, string password)
        {
            if (ServerHash.ContainsKey(alias.Name))
            {
                throw new ClientException(ClientException.Codes.DuplicateAlias, alias.Name);
            }

            ServerInfo serverInfo = new ServerInfo(alias, login, password);

            ServerList.Add(serverInfo);
            ServerHash.Add(serverInfo.Alias.Name, serverInfo);
        }
Esempio n. 4
0
 public ServerInfo(ServerAlias alias, string login, string password)
 {
     Alias    = alias;
     Login    = login;
     Password = password;
 }
Esempio n. 5
0
        public ServerConnection(ServerAlias serverAlias, bool autoStart)
        {
            if (serverAlias == null)
            {
                throw new ClientException(ClientException.Codes.ServerAliasRequired);
            }

            _serverAlias = serverAlias;
            InProcessAlias  inProcessAlias  = _serverAlias as InProcessAlias;
            ConnectionAlias connectionAlias = _serverAlias as ConnectionAlias;

            try
            {
                if (inProcessAlias != null)
                {
                                        #if !SILVERLIGHT
                    if (inProcessAlias.IsEmbedded)
                    {
                        ServerConfiguration configuration = InstanceManager.GetInstance(inProcessAlias.InstanceName);
                        _hostedServer = new Server.Server();
                        configuration.ApplyTo(_hostedServer);
                        if (autoStart)
                        {
                            _hostedServer.Start();
                        }
                    }
                    else
                    {
                        _serviceHost = new DataphorServiceHost();
                        _serviceHost.InstanceName = inProcessAlias.InstanceName;
                        if (autoStart)
                        {
                            _serviceHost.Start();
                        }
                    }
                                        #else
                    throw new NotSupportedException("In-process aliases are not supported in Silverlight");
                                        #endif
                }
                else
                {
                    _clientServer =
                        String.IsNullOrEmpty(connectionAlias.ClientConfigurationName)
                                                        ?
                        new ClientServer
                        (
                            connectionAlias.HostName,
                            connectionAlias.InstanceName,
                            connectionAlias.OverridePortNumber,
                            connectionAlias.SecurityMode,
                            connectionAlias.OverrideListenerPortNumber,
                            connectionAlias.ListenerSecurityMode
                        )
                                                        :
                        new ClientServer
                        (
                            connectionAlias.HostName,
                            connectionAlias.ClientConfigurationName
                        );

                    _localServer = new LocalServer(_clientServer, connectionAlias.ClientSideLoggingEnabled, TerminalServiceUtility.ClientName);
                }
            }
            catch
            {
                CleanUp();
                throw;
            }
        }
Esempio n. 6
0
 public ServerConnection(ServerAlias serverAlias) : this(serverAlias, true)
 {
 }