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

📄 channelitemcollection.cs

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

    public class ChannelItemCollection : ICollection<ChannelItem>, IEnumerable<ChannelItem>, IEnumerable
    {
        private List<ChannelItem> _items = new List<ChannelItem>();

        public void Add(ChannelItem item)
        {
            this._items.Add(item);
            this.Sort();
        }

        private static int ChannelItemComparison(ChannelItem item1, ChannelItem item2)
        {
            if (item1.Ordinal == item2.Ordinal)
            {
                return string.Compare(item1.Text, item2.Text, 1);
            }
            string[] textArray = item1.Ordinal.Split(new char[] { ',' });
            string[] textArray2 = item2.Ordinal.Split(new char[] { ',' });
            int num = 0;
            int num2 = 0;
            for (int i = 0; i < textArray.Length; i++)
            {
                int.TryParse(textArray[i], ref num);
                if (i < textArray2.Length)
                {
                    int.TryParse(textArray2[i], ref num2);
                }
                if (num > num2)
                {
                    return 1;
                }
                if (num == num2)
                {
                    num = 0;
                    num2 = 0;
                }
                else
                {
                    return -1;
                }
            }
            return 0;
        }

        public void Clear()
        {
            this._items.Clear();
        }

        public bool Contains(ChannelItem item)
        {
            return this._items.Contains(item);
        }

        public bool Contains(string channelName)
        {
            return (this.IndexOf(channelName) != null);
        }

        public void CopyTo(ChannelItem[] array, int arrayIndex)
        {
            this._items.CopyTo(array, arrayIndex);
        }

        public IEnumerator<ChannelItem> GetEnumerator()
        {
            return this._items.GetEnumerator();
        }

        public ChannelItem IndexOf(string channelName)
        {
            for (int i = 0; i < this._items.get_Count(); i++)
            {
                if (this._items.get_Item(i).Name == channelName)
                {
                    return this._items.get_Item(i);
                }
            }
            return null;
        }

        public bool Remove(ChannelItem item)
        {
            return this._items.Remove(item);
        }

        public bool Remove(string channelName)
        {
            ChannelItem index = this.IndexOf(channelName);
            if (index != null)
            {
                return this._items.Remove(index);
            }
            return false;
        }

        public void Sort()
        {
            this._items.Sort(new Comparison<ChannelItem>(null, (IntPtr) ChannelItemComparison));
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return this._items.GetEnumerator();
        }

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

        public bool IsReadOnly
        {
            get
            {
                return this._items.get_IsReadOnly();
            }
        }
    }
}

⌨️ 快捷键说明

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