protected void CheckRegistrationInfo(IrcRegistrationInfo registrationInfo, string registrationInfoParamName)
{
// Check that given registration info is valid.
if (registrationInfo is IrcUserRegistrationInfo)
{
if (registrationInfo.NickName == null ||
((IrcUserRegistrationInfo) registrationInfo).UserName == null)
throw new ArgumentException(Resources.MessageInvalidUserRegistrationInfo,
registrationInfoParamName);
}
else if (registrationInfo is IrcServiceRegistrationInfo)
{
if (registrationInfo.NickName == null ||
((IrcServiceRegistrationInfo) registrationInfo).Description == null)
throw new ArgumentException(Resources.MessageInvalidServiceRegistrationInfo,
registrationInfoParamName);
}
else
{
throw new ArgumentException(Resources.MessageInvalidRegistrationInfoObject,
registrationInfoParamName);
}
}