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

📄 participantcollection.cs

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

    public class ParticipantCollection : ICollection<ConversationParticipant>, IEnumerable<ConversationParticipant>, IEnumerable
    {
        private IList _col = ArrayList.Synchronized(new ArrayList());
        private Dialog _dialog;

        internal ParticipantCollection(Dialog dialog)
        {
            this._dialog = dialog;
        }

        public void Add(ConversationParticipant item)
        {
            if (!this.Contains(item.Contact))
            {
                this._col.Add(item);
                this._dialog.RaiseAddParticipant(new ParticipantEventArgs(item));
            }
        }

        public void Clear()
        {
            lock (this._col.SyncRoot)
            {
                for (int i = this._col.Count - 1; i >= 0; i--)
                {
                    this.Remove((ConversationParticipant) this._col[i]);
                }
            }
        }

        public bool Contains(Contact contact)
        {
            lock (this._col.SyncRoot)
            {
                foreach (ConversationParticipant participant in this._col)
                {
                    if (participant.Contact == contact)
                    {
                        return true;
                    }
                }
                return false;
            }
        }

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

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

        public IEnumerator<ConversationParticipant> GetEnumerator()
        {
            <GetEnumerator>d__0 d__ = new <GetEnumerator>d__0(0);
            d__.<>4__this = this;
            return d__;
        }

        public bool Remove(Contact contact)
        {
            lock (this._col.SyncRoot)
            {
                foreach (ConversationParticipant participant in this._col)
                {
                    if (participant.Contact == contact)
                    {
                        return this.Remove(participant);
                    }
                }
                return false;
            }
        }

        public bool Remove(ConversationParticipant item)
        {
            if (this._col.Contains(item))
            {
                this._col.Remove(item);
                this._dialog.RaiseRemoveParticipant(new ParticipantEventArgs(item));
                return true;
            }
            return false;
        }

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

        private void UpdateContactState(object sender, EventArgs e)
        {
            using (IEnumerator<ConversationParticipant> enumerator = this.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ConversationParticipant participant = enumerator.get_Current();
                    if ((participant.State != ParticipantState.None) && (DateTime.Now.Subtract(participant.StateTime).TotalSeconds > 5))
                    {
                        participant.State = ParticipantState.None;
                    }
                }
            }
        }

        public int Count
        {
            get
            {
                return this._col.Count;
            }
        }

        public Dialog CurrentDialog
        {
            get
            {
                return this._dialog;
            }
            set
            {
                this._dialog = value;
            }
        }

        public bool IsReadOnly
        {
            get
            {
                return this._col.IsReadOnly;
            }
        }

        public ConversationParticipant this[int index]
        {
            get
            {
                if (this._col.Count > index)
                {
                    return (ConversationParticipant) this._col[index];
                }
                return null;
            }
        }

        public object SyncRoot
        {
            get
            {
                return this._col.SyncRoot;
            }
        }

        [CompilerGenerated]
        private sealed class <GetEnumerator>d__0 : IEnumerator<ConversationParticipant>, IEnumerator, IDisposable
        {
            private int <>1__state;
            private ConversationParticipant <>2__current;
            public ParticipantCollection <>4__this;
            public int <counter>5__1;

            [DebuggerHidden]
            public <GetEnumerator>d__0(int <>1__state)
            {
                this.<>1__state = <>1__state;
            }

            private bool MoveNext()
            {
                switch (this.<>1__state)
                {
                    case 0:
                        this.<>1__state = -1;
                        this.<counter>5__1 = 0;
                        break;

                    case 1:
                        this.<>1__state = -1;
                        break;

                    default:
                        goto Label_006C;
                }
                if (this.<counter>5__1 < this.<>4__this.Count)
                {
                    this.<>2__current = this.<>4__this[this.<counter>5__1++];
                    this.<>1__state = 1;
                    return true;
                }
            Label_006C:
                return false;
            }

            [DebuggerHidden]
            void IEnumerator.Reset()
            {
                throw new NotSupportedException();
            }

            void IDisposable.Dispose()
            {
            }

            ConversationParticipant IEnumerator<ConversationParticipant>.Current
            {
                [DebuggerHidden]
                get
                {
                    return this.<>2__current;
                }
            }

            object IEnumerator.Current
            {
                [DebuggerHidden]
                get
                {
                    return this.<>2__current;
                }
            }
        }
    }
}

⌨️ 快捷键说明

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