2using System.Collections.Generic;
15 public override bool Valid =>
Address !=
null && Port.HasValue &&
Port != 0 && UseSsl.HasValue && (PasswordType.HasValue ^
Password ==
null);
25 public ushort?
Port {
get;
set; }
60 if (connectionString ==
null)
61 throw new ArgumentNullException(nameof(connectionString));
62 var splits = connectionString.Split(
';');
66 if (splits.Length < 2)
69 if (UInt16.TryParse(splits[1], out var port))
72 if (splits.Length < 3)
77 if (splits.Length < 4)
80 if (Int32.TryParse(splits[3], out var intSsl))
81 UseSsl = Convert.ToBoolean(intSsl);
83 if (splits.Length < 5)
98 if (splits.Length < 6)
101 var rest =
new List<string>(splits);
102 rest.RemoveRange(0, 5);
109 var sb =
new StringBuilder();
118 sb.Append(Convert.ToInt32(
UseSsl.Value));
128 return sb.ToString();
Helper for building ChatBotSettings.ConnectionStrings.
ChatConnectionStringBuilder for ChatProvider.Irc.
ushort? Port
The port the server runs on.
string? Password
The optional password to use.
IrcPasswordType? PasswordType
The optional IrcPasswordType to use.
IrcConnectionStringBuilder(string connectionString)
Initializes a new instance of the IrcConnectionStringBuilder class.
string? Address
The IP address or URL of the IRC server.
bool? UseSsl
If the connection should be made using SSL.
IrcConnectionStringBuilder()
Initializes a new instance of the IrcConnectionStringBuilder class.
override string ToString()
string? Nickname
The nickname for the bot to use.
IrcPasswordType
Represents the type of a password for a ChatProvider.Irc.