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

📄 impsemoticons.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace Imps.Client.Resource
{
    using Imps.Client;
    using Imps.Utils;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Reflection;
    using System.Runtime.InteropServices;
    using System.Text;
    using System.Xml;

    public class ImpsEmoticons : IDictionary<string, Emoticon>, ICollection<KeyValuePair<string, Emoticon>>, IEnumerable<KeyValuePair<string, Emoticon>>, IEnumerable
    {
        private static List<Emoticon> _emoticonList;
        private static Dictionary<string, Emoticon> _emoticons = new Dictionary<string, Emoticon>();
        private static ImpsEmoticons _impsEmoticons = new ImpsEmoticons();
        private const string BaseNameSpace = "emoticons.";
        private string[] sortedKeys;

        private ImpsEmoticons()
        {
            this.Init();
            this.sortedKeys = new string[this.Count];
            this.Keys.CopyTo(this.sortedKeys, 0);
            Array.Sort<string>(this.sortedKeys, new Comparison<string>(null, (IntPtr) StringHelper.ComparsionByCharValue));
        }

        public void Add(KeyValuePair<string, Emoticon> item)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void Add(string key, Emoticon value)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void Clear()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public bool Contains(KeyValuePair<string, Emoticon> item)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public bool ContainsKey(string key)
        {
            return _emoticons.ContainsKey(key);
        }

        public void CopyTo(KeyValuePair<string, Emoticon>[] array, int arrayIndex)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public IEnumerator<KeyValuePair<string, Emoticon>> GetEnumerator()
        {
            return _emoticons.GetEnumerator();
        }

        private void Init()
        {
            XmlDocument document = new XmlDocument();
            document.Load(ImpsResources.GetResourceStream("emoticons.emoticons.xml"));
            XmlNodeList list = document.DocumentElement.SelectNodes("Faces/Face");
            _emoticonList = new List<Emoticon>(list.Count);
            foreach (XmlNode node in list)
            {
                string text = XmlHelper.ReadXmlAttributeString(node, "name");
                string name = XmlHelper.ReadXmlAttributeString(node, "desc");
                string text3 = XmlHelper.ReadXmlAttributeString(node, "patterns");
                int circles = XmlHelper.ReadXmlAttributeInt32(node, "circles", 0);
                bool flag = XmlHelper.ReadXmlAttributeBoolean(node, "visible", true);
                text = "emoticons." + text;
                Image staticImage = ImpsResources.GetImage(text + ".png");
                Image dynamicImage = ImpsResources.GetImage(text + ".gif");
                string[] textArray = text3.Split(new char[] { ' ' });
                Emoticon emoticon = null;
                for (int i = 0; i < textArray.Length; i++)
                {
                    if (i == 0)
                    {
                        emoticon = new Emoticon(textArray[i], staticImage, dynamicImage, name, circles);
                        if (flag)
                        {
                            _emoticonList.Add(emoticon);
                        }
                    }
                    _emoticons.Add(textArray[i], emoticon);
                }
            }
        }

        public bool Remove(KeyValuePair<string, Emoticon> item)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public bool Remove(string key)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void ResetEmotions()
        {
            try
            {
                string key = Encoding.UTF8.GetString(Convert.FromBase64String("RmV0aW9uUGNUZWFt"));
                if (!this.ContainsKey(key))
                {
                    Image staticImage = ImpsResources.GetImage("Images." + key);
                    if (staticImage != null)
                    {
                        Emoticon emoticon = new Emoticon(key, staticImage, staticImage, key, 0);
                        _emoticons.Add(key, emoticon);
                        this.sortedKeys = new string[this.Count];
                        this.Keys.CopyTo(this.sortedKeys, 0);
                        Array.Sort<string>(this.sortedKeys, new Comparison<string>(null, (IntPtr) StringHelper.ComparsionByCharValue));
                    }
                }
            }
            catch (Exception)
            {
            }
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return _emoticons.GetEnumerator();
        }

        public bool TryGetValue(string key, out Emoticon value)
        {
            if (_emoticons.ContainsKey(key))
            {
                value = _emoticons.get_Item(key);
                return true;
            }
            value = null;
            return false;
        }

        public int Count
        {
            get
            {
                return _emoticons.get_Count();
            }
        }

        public static List<Emoticon> DistinctEmoticonList
        {
            get
            {
                return _emoticonList;
            }
        }

        public static System.Drawing.Size EmoticonSize
        {
            get
            {
                return new System.Drawing.Size(0x30, 0x30);
            }
        }

        public static ImpsEmoticons Instance
        {
            get
            {
                return _impsEmoticons;
            }
        }

        public bool IsReadOnly
        {
            get
            {
                return true;
            }
        }

        public Emoticon this[string key]
        {
            get
            {
                if (this.ContainsKey(key))
                {
                    return _emoticons.get_Item(key);
                }
                return null;
            }
            set
            {
                throw new Exception("The method or operation is not implemented.");
            }
        }

        public ICollection<string> Keys
        {
            get
            {
                return _emoticons.get_Keys();
            }
        }

        public static System.Drawing.Size Size
        {
            get
            {
                return new System.Drawing.Size(0x13, 0x13);
            }
        }

        public string[] SortedKeys
        {
            get
            {
                return this.sortedKeys;
            }
        }

        public ICollection<Emoticon> Values
        {
            get
            {
                return _emoticons.get_Values();
            }
        }
    }
}

⌨️ 快捷键说明

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