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

📄 scoreinfo.cs

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

    public class ScoreInfo : UserItemBase
    {
        private bool _hasLoadLocalStroage;
        internal int? _levelScore;
        internal DateTime _saveDate;
        internal int? _scoreLevel;
        internal int? _scoreVale;
        private const string AN_Score = "score";
        private const string errorMessage = "后台获取积分错误";

        public event EventHandler NewScoreDataArrive;

        public ScoreInfo(User owner) : base(owner)
        {
        }

        private bool cacheValidate()
        {
            return this._saveDate.Date.Equals(DateTime.Today);
        }

        public void Clear()
        {
            this._scoreVale = null;
            this._scoreLevel = null;
            this._levelScore = null;
        }

        internal void loadScoreFromLocalStorage()
        {
            PersistentDelegate load = null;
            try
            {
                if (load == null)
                {
                    load = delegate (XmlNode node) {
                        base.Owner.PersonalInfo.LoadPersonalXmlNode(node);
                        if (this.cacheValidate())
                        {
                            this._hasLoadLocalStroage = true;
                        }
                    };
                }
                base.Owner.PersistentManager.LoadUserInfo(load);
            }
            catch (Exception exception)
            {
                LogHelper.LogException(exception);
            }
        }

        internal void SaveScoreCache(string scoreXML)
        {
            if (!string.IsNullOrEmpty(scoreXML))
            {
                XmlDocument document = new XmlDocument();
                document.LoadXml(scoreXML);
                XmlNode node = document.SelectSingleNode("results").SelectSingleNode("score");
                this._scoreVale = XmlHelper.ReadXmlAttributeInt32(node, "value");
                this._scoreLevel = XmlHelper.ReadXmlAttributeInt32(node, "level");
                this._levelScore = XmlHelper.ReadXmlAttributeInt32(node, "level-score");
                if (this.NewScoreDataArrive != null)
                {
                    FuncDispatcher.InvokeEventHandlerInUiThread(this, this.NewScoreDataArrive, EventArgs.Empty);
                }
                this._saveDate = DateTime.Now;
                base.Owner.PersistentManager.SaveUserInfo(delegate (XmlNode node) {
                    base.Owner.PersonalInfo.SaveToXmlNode(node);
                });
            }
        }

        public DateTime CacheSaveDate
        {
            get
            {
                return this._saveDate;
            }
        }

        internal bool IsLocalCacheHit
        {
            get
            {
                this.loadScoreFromLocalStorage();
                return this._hasLoadLocalStroage;
            }
        }

        public int LevelScore
        {
            get
            {
                int? nullable = this._levelScore;
                if (!nullable.get_HasValue())
                {
                    return 0;
                }
                return nullable.GetValueOrDefault();
            }
        }

        public int ScoreLevel
        {
            get
            {
                int? nullable = this._scoreLevel;
                if (!nullable.get_HasValue())
                {
                    return 0;
                }
                return nullable.GetValueOrDefault();
            }
        }

        public int ScoreValue
        {
            get
            {
                int? nullable = this._scoreVale;
                if (!nullable.get_HasValue())
                {
                    return 0;
                }
                return nullable.GetValueOrDefault();
            }
        }
    }
}

⌨️ 快捷键说明

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