/// <summary> /// Initializes a new instance of the <see cref="ServerConfiguration" /> class. /// </summary> /// <param name="host"> /// The IP address. /// </param> /// <param name="port"> /// The port. /// </param> private ServerConfiguration(string host, int port) { Should.NotBeNull(host, nameof(host)); Should.BeTrue(IPAddress.TryParse(host, out _), nameof(host)); Should.BePositive(port, nameof(port)); this.Logger = new ConsoleLogger(); this.Host = host; this.Port = port; }
/// <summary> /// Validates an IP address and its port. /// </summary> /// <param name="host"> /// The IP address to validate. /// </param> /// <param name="port"> /// The port to validate. /// </param> internal static void Validate(string host, int port) { Should.NotBeNull(host, nameof(host)); Should.BeTrue(IPAddress.TryParse(host, out _), nameof(host)); Should.BePositive(port, nameof(port)); }
/// <summary> /// Validates <see cref="GridionServerConfiguration" /> instance. /// </summary> /// <param name="configuration"> /// The configuration to validate. /// </param> internal static void Validate(GridionServerConfiguration configuration) { Should.NotBeNull(configuration, nameof(configuration)); Should.BeTrue(IPAddress.TryParse(configuration.Host, out _), nameof(configuration.Host)); Should.BePositive(configuration.Port, nameof(configuration.Port)); }
/// <summary> /// Validates the server configuration. /// </summary> internal void Validate() { Should.BeTrue(IPAddress.TryParse(this.Host, out _), nameof(this.Host)); Should.BePositive(this.Port, nameof(this.Port)); }