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

📄 reg2result.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace Imps.Client.Core
{
    using System;
    using System.Xml;

    public sealed class Reg2Result
    {
        private string _contactVer;
        private bool _isSetPresenceOK;
        private string _permissionVer;
        private string _personalInfoVer;
        public static readonly string INVALID_VALUE = string.Empty;

        public Reg2Result()
        {
            this.Clear();
        }

        private void CheckPresenceResult(XmlDocument xmlDoc)
        {
            this.ClearPresenceResult();
            XmlNode node = xmlDoc.DocumentElement.SelectSingleNode("presence");
            if (node != null)
            {
                int num;
                string attributeValue = GetAttributeValue(node, "result");
                if (INVALID_VALUE == attributeValue)
                {
                    this._isSetPresenceOK = false;
                }
                if (int.TryParse(attributeValue, ref num))
                {
                    this._isSetPresenceOK = (num >= 200) && (num < 300);
                }
                else
                {
                    this._isSetPresenceOK = false;
                }
            }
        }

        public void Clear()
        {
            this.ClearUserInfoResult();
            this.ClearPresenceResult();
        }

        private void ClearPresenceResult()
        {
            this._isSetPresenceOK = false;
        }

        private void ClearUserInfoResult()
        {
            this._personalInfoVer = INVALID_VALUE;
            this._permissionVer = INVALID_VALUE;
            this._contactVer = INVALID_VALUE;
        }

        private static string GetAttributeValue(XmlNode node, string attrName)
        {
            XmlNode node2 = node.Attributes[attrName];
            if ((node2 != null) && !string.IsNullOrEmpty(node2.Value))
            {
                return node2.Value;
            }
            return INVALID_VALUE;
        }

        private void GetVersions(XmlDocument xmlDoc)
        {
            this.ClearUserInfoResult();
            XmlNode node = xmlDoc.DocumentElement.SelectSingleNode("user-info");
            if (node != null)
            {
                this._personalInfoVer = GetAttributeValue(node, "personal-info-version");
                this._permissionVer = GetAttributeValue(node, "permission-version");
                this._contactVer = GetAttributeValue(node, "contact-version");
            }
        }

        public void LoadFromXml(XmlDocument xmlDoc)
        {
            this.GetVersions(xmlDoc);
            this.CheckPresenceResult(xmlDoc);
        }

        public override string ToString()
        {
            return string.Format("Personal info version:{0}, Contact version:{1}, Premission version:{2}, Set presence {3}.", new object[] { this._personalInfoVer, this._contactVer, this._permissionVer, this._isSetPresenceOK ? "OK" : "failed" });
        }

        public string ContactVer
        {
            get
            {
                return this._contactVer;
            }
        }

        public bool IsSetPresenceOK
        {
            get
            {
                return this._isSetPresenceOK;
            }
        }

        public string PermissionVer
        {
            get
            {
                return this._permissionVer;
            }
        }

        public string PersonalInfoVer
        {
            get
            {
                return this._personalInfoVer;
            }
        }
    }
}

⌨️ 快捷键说明

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