public static void AddMatcher(string id, string match_str, Osiris.MatchType type, bool owner_only = false, bool last_to_execute = false) { MessageMatcher matcher = new MessageMatcher() { ID = id, MatchString = match_str, MatchType = type, Node = Name, OwnerOnly = owner_only, ExecuteIfNoMatch = last_to_execute }; IFormatter bf = new BinaryFormatter(); MemoryStream ms = new MemoryStream(); bf.Serialize(ms, matcher); Connection.SendMessage(ms.ToArray(), "add_matcher", "irc"); ms.Close(); }
static void AddMatcher(Connection conn, Message msg) { IFormatter bf = new BinaryFormatter(); MemoryStream ms = new MemoryStream(msg.Data); MessageMatcher matcher = (MessageMatcher)bf.Deserialize(ms); if (matcher == null) { return; } if (!Matchers.Any(m => m.ID == matcher.ID && m.MatchString == matcher.MatchString && m.MatchType == matcher.MatchType && m.Node == matcher.Node)) { Matchers.Add(matcher); } ms.Close(); }