public IrcMessage(IrcPrefix prefix, string command, int command_id, string parameters) { Prefix = prefix; CommandName = command; CommandId = command_id; Parameters = parameters; }
public IrcMessage(string raw) { string command_proto = ""; var parts = raw.Split(' '); if (parts[0].StartsWith(":")) { Prefix = new IrcPrefix(parts[0]); command_proto = parts[1]; } else { command_proto = parts[0]; } int id = 0; if (!int.TryParse(command_proto, out id)) { CommandName = command_proto.Trim(); } else { CommandId = id; } Parameters = string.Join(command_proto, raw.Split(new string[] { command_proto }, StringSplitOptions.None).Skip(1)).Trim(); }