⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 messagekey.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace Imps.Client.CommLayer.Common
{
    using Imps.Base.Sipc;
    using Imps.Client.Base;
    using System;

    internal class MessageKey
    {
        private SipcCallIdHeader _callId;
        private SipcCSeqHeader _cSeq;
        private SipcFromHeader _from;
        private SipcMessage _Message;
        private SipcToHeader _to;

        public MessageKey(SipcMessage msg)
        {
            this.CallId = msg.CallId;
            this.CSeq = msg.CSeq;
            this.To = msg.To;
            this.From = msg.From;
            this._Message = msg;
        }

        public MessageKey(SipMessageBase msg) : this(msg.Message)
        {
        }

        private bool CheckFromHeader(SipcFromHeader from)
        {
            if (from == null)
            {
                return true;
            }
            if (this.From == null)
            {
                return false;
            }
            return (from.Value == this.From.Value);
        }

        private bool CheckToHeader(SipcToHeader to)
        {
            if (to == null)
            {
                return (this.To == null);
            }
            if (this.To != null)
            {
                return (to.Value == this.To.Value);
            }
            return false;
        }

        public override bool Equals(object obj)
        {
            MessageKey key = obj as MessageKey;
            if (key == null)
            {
                return false;
            }
            if (((this.CallId == null) || (this.CSeq == null)) || ((key.CallId == null) || (key.CSeq == null)))
            {
                return false;
            }
            if (this.CallId.CallId != key.CallId.CallId)
            {
                return false;
            }
            if (this.CSeq.Method == "C")
            {
                if (!this.CSeq.Equals(key.CSeq))
                {
                    return false;
                }
            }
            else if (this.CSeq.Method == "I")
            {
                if ((this.CSeq.Number != key.CSeq.Number) || ((key.CSeq.Method != "I") && (key.CSeq.Method != "A")))
                {
                    return false;
                }
            }
            else if (this.CSeq.Number != key.CSeq.Number)
            {
                return false;
            }
            if (!this.CheckFromHeader(key.From))
            {
                return false;
            }
            if (!this.CheckToHeader(key.To))
            {
                return false;
            }
            return true;
        }

        public override int GetHashCode()
        {
            if ((this.CallId != null) && (this.CSeq != null))
            {
                return (((int) this.CallId.CallId) & this.CSeq.Number);
            }
            return base.GetHashCode();
        }

        public override string ToString()
        {
            if (this._Message == null)
            {
                return string.Empty;
            }
            return this._Message.ToString();
        }

        public SipcCallIdHeader CallId
        {
            get
            {
                return this._callId;
            }
            private set
            {
                this._callId = value;
            }
        }

        public SipcCSeqHeader CSeq
        {
            get
            {
                return this._cSeq;
            }
            private set
            {
                this._cSeq = value;
            }
        }

        public SipcFromHeader From
        {
            get
            {
                return this._from;
            }
            private set
            {
                this._from = value;
            }
        }

        public SipcToHeader To
        {
            get
            {
                return this._to;
            }
            private set
            {
                this._to = value;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -