public ReceivedMessage(CQApi api, long groupId, long qqId, int id, string msg, bool isRegex = false) { Type = "group"; Group = new Group(api, groupId); QQ = new QQ(api, qqId); Message = new QQMessage(api, id, msg, isRegex); }
/// <summary> /// 比较 <see cref="QQMessage"/> 中的内容和 string 是否相等 /// </summary> /// <param name="msg">相比较的 <see cref="QQMessage"/> 对象</param> /// <param name="str">相比较的字符串</param> /// <returns>如果相同返回 <code>true</code>, 不同返回 <code>false</code></returns> private static bool Equals(QQMessage msg, string str) { if (object.ReferenceEquals(msg, null) || object.ReferenceEquals(str, null)) { return(false); } return(string.Compare(msg.Text, str) == 0); }
/// <summary> /// 确定指定的对象是否等于当前对象 /// </summary> /// <param name="obj">要与当前对象进行比较的对象</param> /// <returns>如果指定的对象等于当前对象,则为 <code>true</code>,否则为 <code>false</code></returns> public override bool Equals(object obj) { QQMessage msg = obj as QQMessage; if (msg != null) { return(string.Compare(this.Text, msg.Text) == 0); } return(base.Equals(obj)); }
public ReceivedMessage(CQApi api, long qqId, int id, string msg, bool isRegex = false) { Type = "private"; QQ = new QQ(api, qqId); Message = new QQMessage(api, id, msg, isRegex); }