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

📄 systemfixedcontactgroupcollection.cs

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

    public class SystemFixedContactGroupCollection : ICollection<SystemFixedContactGroup>, IEnumerable<SystemFixedContactGroup>, IEnumerable
    {
        private List<SystemFixedContactGroup> _col = new List<SystemFixedContactGroup>();
        private IComparer<SystemFixedContactGroup> _comparer;
        private bool _sorted;

        public event EventHandler<InfoChangedEventArgs> InfoChanged;

        internal SystemFixedContactGroupCollection()
        {
        }

        public void Add(SystemFixedContactGroup item)
        {
            this._col.Add(item);
            this.InnerDoSort();
        }

        public void Clear()
        {
            if (this._col.get_Count() != 0)
            {
                this._col.Clear();
            }
        }

        public bool Contains(SystemFixedContactGroup item)
        {
            return this._col.Contains(item);
        }

        public SystemFixedContactGroup FindContactGroup(int? groupId)
        {
            if (groupId.get_HasValue())
            {
                List<SystemFixedContactGroup>.Enumerator enumerator = this._col.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        SystemFixedContactGroup group = enumerator.get_Current();
                        int? nullable = groupId;
                        if ((group.Id == nullable.GetValueOrDefault()) && nullable.get_HasValue())
                        {
                            return group;
                        }
                    }
                }
                finally
                {
                    enumerator.Dispose();
                }
            }
            return null;
        }

        public IEnumerator<SystemFixedContactGroup> GetEnumerator()
        {
            return this._col.GetEnumerator();
        }

        private void InnerDoSort()
        {
            if (this._sorted && (this._comparer != null))
            {
                this._col.Sort(this._comparer);
            }
        }

        public void InnerGroupInfoChanged(object sender, EventArgs e)
        {
            InfoChangedEventArgs args = new InfoChangedEventArgs((SystemFixedContactGroup) sender);
            if (this.InfoChanged != null)
            {
                this.InfoChanged.Invoke(sender, args);
            }
        }

        public bool Remove(SystemFixedContactGroup item)
        {
            if (this.Contains(item))
            {
                return this._col.Remove(item);
            }
            return false;
        }

        void ICollection<SystemFixedContactGroup>.CopyTo(SystemFixedContactGroup[] array, int arrayIndex)
        {
            throw new NotSupportedException();
        }

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

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

        public SystemFixedContactGroup this[int? groupId]
        {
            get
            {
                if (!groupId.get_HasValue())
                {
                    return null;
                }
                return this.FindContactGroup(groupId);
            }
        }

        public IComparer<SystemFixedContactGroup> SortComparer
        {
            get
            {
                return this._comparer;
            }
            set
            {
                this._comparer = value;
                this.InnerDoSort();
            }
        }

        public bool Sorted
        {
            get
            {
                return this._sorted;
            }
            set
            {
                if (this._sorted != value)
                {
                    this._sorted = value;
                    if (this._sorted && (this._comparer == null))
                    {
                        this._comparer = new Comparer();
                    }
                    this.InnerDoSort();
                }
            }
        }

        bool ICollection<SystemFixedContactGroup>.IsReadOnly
        {
            get
            {
                return this._col.get_IsReadOnly();
            }
        }

        private class Comparer : IComparer<SystemFixedContactGroup>
        {
            public int Compare(SystemFixedContactGroup x, SystemFixedContactGroup y)
            {
                if (x == null)
                {
                    if (y != null)
                    {
                        return -1;
                    }
                    return 0;
                }
                if (y == null)
                {
                    return 1;
                }
                return x.SortIndex.CompareTo(y.SortIndex);
            }
        }
    }
}

⌨️ 快捷键说明

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