/// <summary> /// Generates an instance of <see cref="CruiseServerClientBase"/> that connects via /// Windows Communications Foundation. /// </summary> /// <param name="factory">The <see cref="CruiseServerClientFactory"/> that is being extended.</param> /// <param name="address">The address of the server.</param> /// <param name="settings">The start-up settings to use.</param> /// <returns>A <see cref="CruiseServerClientBase"/> instance.</returns> public static CruiseServerClientBase GenerateWcfClient(this CruiseServerClientFactory factory, string address, ClientStartUpSettings settings) { CruiseServerClientBase client; var connection = new WcfConnection(address); client = new CruiseServerClient(connection); return client; }
/// <summary> /// Initialise a new <see cref="Server"/> with the default watcher. /// </summary> /// <param name="client">The underlying client.</param> /// <param name="settings">The start-up settings to use.</param> public Server(CruiseServerClientBase client, ClientStartUpSettings settings) { if (client == null) { throw new ArgumentNullException("client"); } InitialiseServer(client, new ManualServerWatcher(client), settings.FetchVersionOnStartUp); }
/// <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); }
/// <summary> /// Initialise a new <see cref="Server"/> with a watcher and a client. /// </summary> /// <param name="client">The underlying client.</param> /// <param name="watcher">The watcher to use.</param> /// <param name="settings">The start-up settings to use.</param> public Server(CruiseServerClientBase client, IServerWatcher watcher, ClientStartUpSettings settings) { if (client == null) { throw new ArgumentNullException("client"); } if (watcher == null) { throw new ArgumentNullException("watcher"); } InitialiseServer(client, watcher, settings.FetchVersionOnStartUp); }
/// <summary> /// Generates a set of <see cref="ClientStartUpSettings"/>. /// </summary> /// <param name="server"></param> /// <returns></returns> public static ClientStartUpSettings GenerateStartupSettings(BuildServer server) { var extSettings = server.ExtensionSettings ?? string.Empty; if (extSettings.Length < 6) { extSettings += new string(' ', 6 - extSettings.Length); } var settings = new ClientStartUpSettings { BackwardsCompatable = (extSettings.Substring(0, 3) == "OLD"), UseEncryption = (extSettings.Substring(3, 3) == "SEC") }; return(settings); }
/// <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); }
/// <summary> /// Generates an instance of <see cref="CruiseServerClientBase"/> that connects via /// Windows Communications Foundation to another server. /// </summary> /// <param name="factory">The <see cref="CruiseServerClientFactory"/> that is being extended.</param> /// <param name="address">The address of the server.</param> /// <param name="targetServer">The name of the other server.</param> /// <param name="settings">The start-up settings to use.</param> /// <returns>A <see cref="CruiseServerClientBase"/> instance.</returns> public static CruiseServerClientBase GenerateWcfClient(this CruiseServerClientFactory factory, string address, string targetServer, ClientStartUpSettings settings) { var client = GenerateWcfClient(factory, address, settings); client.TargetServer = targetServer; return(client); }
/// <summary> /// Generates an instance of <see cref="CruiseServerClientBase"/> that connects via /// Windows Communications Foundation. /// </summary> /// <param name="factory">The <see cref="CruiseServerClientFactory"/> that is being extended.</param> /// <param name="address">The address of the server.</param> /// <param name="settings">The start-up settings to use.</param> /// <returns>A <see cref="CruiseServerClientBase"/> instance.</returns> public static CruiseServerClientBase GenerateWcfClient(this CruiseServerClientFactory factory, string address, ClientStartUpSettings settings) { CruiseServerClientBase client; var connection = new WcfConnection(address); client = new CruiseServerClient(connection); return(client); }
/// <summary> /// Generates an instance of <see cref="CruiseServerClientBase"/> that connects via /// Windows Communications Foundation to another server. /// </summary> /// <param name="factory">The <see cref="CruiseServerClientFactory"/> that is being extended.</param> /// <param name="address">The address of the server.</param> /// <param name="targetServer">The name of the other server.</param> /// <param name="settings">The start-up settings to use.</param> /// <returns>A <see cref="CruiseServerClientBase"/> instance.</returns> public static CruiseServerClientBase GenerateWcfClient(this CruiseServerClientFactory factory, string address, string targetServer, ClientStartUpSettings settings) { var client = GenerateWcfClient(factory, address, settings); client.TargetServer = targetServer; return client; }