Exemplo n.º 1
0
        /// <summary>
        /// Initialise a new <see cref="Server"/> with the default watcher.
        /// </summary>
        /// <param name="address">The address of the server.</param>
        /// <param name="settings">The start-up settings to use.</param>
        public Server(string address, ClientStartUpSettings settings)
        {
            if (string.IsNullOrEmpty(address))
            {
                throw new ArgumentNullException("address");
            }
            var factory = new CruiseServerClientFactory();
            var client  = factory.GenerateClient(address, settings);

            InitialiseServer(client, new ManualServerWatcher(client), settings.FetchVersionOnStartUp);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initialise a new <see cref="Server"/> with the default watcher.
        /// </summary>
        /// <param name="address">The address of the server.</param>
        public Server(string address)
        {
            if (string.IsNullOrEmpty(address))
            {
                throw new ArgumentNullException("address");
            }
            var factory = new CruiseServerClientFactory();
            var client  = factory.GenerateClient(address);

            InitialiseServer(client, new ManualServerWatcher(client), true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Generates a client connection.
        /// </summary>
        /// <param name="address">The address.</param>
        /// <param name="common">The common parameters.</param>
        /// <returns>
        /// The client connection.
        /// </returns>
        public static CruiseServerClientBase GenerateClient(string address, CommonCmdlet common)
        {
            // Build up the address
            var actualAddress = address;

            if (!actualAddress.Contains("//"))
            {
                // Address does not contain the protocol
                if (actualAddress.Equals("localhost", StringComparison.InvariantCultureIgnoreCase) ||
                    actualAddress.Equals("127.0.0.1", StringComparison.InvariantCultureIgnoreCase))
                {
                    actualAddress = "tcp://" + actualAddress;
                    if (!actualAddress.Contains(":"))
                    {
                        // Add the default port
                        actualAddress += ":21234";
                    }
                }
                else
                {
                    actualAddress = "http://" + actualAddress;
                }
            }

            // Generate the client
            var clientFactory = new CruiseServerClientFactory();
            var settings      = new ClientStartUpSettings
            {
                UseEncryption       = common.Encrypted,
                BackwardsCompatable = common.BackwardsCompatable
            };
            var client = clientFactory.GenerateClient(actualAddress, settings);

            client.TargetServer = common.Target;
            return(client);
        }