/// <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.OrdinalIgnoreCase) || actualAddress.Equals("127.0.0.1", StringComparison.OrdinalIgnoreCase)) { 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 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); }