public virtual void CopyTo(JoinLeaveMessage dest)
        {
            base.CopyTo(dest);

            dest.Username  = Username;
            dest.EventType = EventType;
        }
Beispiel #2
0
        public static bool QuickCheck(JoinLeaveMessage message)
        {
            string content = message.Content.Trim();

            if (content.Length == 0)
            {
                return(false);
            }

            int prefix = content.IndexOf(ClanTagPrefix, sComp);

            return(prefix > 0 && content.IndexOf(ClanTagPostfix, sComp) > prefix);
        }
Beispiel #3
0
 public static bool TryParse(JoinLeaveMessage msg, out ClanMemberJoin message)
 {
     message = null;
     try
     {
         message = Parse(msg);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
 public static bool TryParse(LogMessage msg, out JoinLeaveMessage message)
 {
     message = null;
     try
     {
         message = Parse(msg);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
 public static bool TryParse(string line, out JoinLeaveMessage message)
 {
     message = null;
     try
     {
         message = Parse(line);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #6
0
        public static ClanMemberJoin Parse(JoinLeaveMessage message)
        {
            ClanMemberJoin msg = new ClanMemberJoin(message);

            string content = msg.Content.ToLower();     // only used for comparison

            if (content.Contains(ClanTagPrefix))
            {
                int start = content.IndexOf(ClanTagPrefix) + ClanTagPrefix.Length;
                int end   = content.IndexOf(ClanTagPostfix);

                msg.ClanTag = msg.Content.Substring(start, end - start);
            }
            else
            {
                throw InvalidFormatException;
            }

            return(msg);
        }
        public static JoinLeaveMessage Parse(LogMessage message)
        {
            JoinLeaveMessage msg = new JoinLeaveMessage(message);

            string content = msg.Content;

            if (content.StartsWith(EventMessagePrefix, sComp))
            {
                string[] parts = content.Split(WordSeparator);

                if (msg.Content.ToLower().Contains(JoinMessageText))
                {
                    msg.EventType = EventType.UserJoin;
                }
                else if (msg.Content.ToLower().Contains(LeaveMessageText))
                {
                    msg.EventType = EventType.UserLeft;
                }

                if (msg.EventType == EventType.UserJoin || msg.EventType == EventType.UserLeft)
                {
                    msg.Username = msg.Content.Substring(parts[0].Length + 1, parts[1].Length);;
                    msg.Content  = msg.Content.Substring(EventMessagePrefix.Length + 1);
                }
                else
                {
                    throw InvalidFormatException;
                }
            }
            else
            {
                throw InvalidFormatException;
            }

            return(msg);
        }
Beispiel #8
0
 public static new ClanMemberJoin Parse(LogMessage message)
 {
     return(Parse(JoinLeaveMessage.Parse(message)));
 }
Beispiel #9
0
 private ClanMemberJoin(JoinLeaveMessage msg) : this()
 {
     msg.CopyTo(this);
 }