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

📄 personalgroupmember.cs

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

    public class PersonalGroupMember : Contact, IComparable<PersonalGroupMember>
    {
        private PersonalGroupMemberInfo _memberInfo;
        private Contact _ownerContact;
        private PersonalGroup _ownerGroup;

        public PersonalGroupMember(User owner, string uri, PersonalGroup ownerGroup) : base(owner, uri, false)
        {
            this._ownerGroup = ownerGroup;
            this._memberInfo = new PersonalGroupMemberInfo(this);
        }

        public int CompareTo(PersonalGroupMember other)
        {
            if (other == null)
            {
                return 1;
            }
            if (this.GroupMemeberInfo.Owner.Presence.RealValue != other.GroupMemeberInfo.Owner.Presence.RealValue)
            {
                return -(this.GroupMemeberInfo.Owner.Presence.RealValue - other.GroupMemeberInfo.Owner.Presence.RealValue);
            }
            if (this.GroupMemeberInfo.GroupUserIdentity.Value == other.GroupMemeberInfo.GroupUserIdentity.Value)
            {
                return string.Compare(this.DisplayName, other.DisplayName);
            }
            return (this.GroupMemeberInfo.GroupUserIdentity.Value - other.GroupMemeberInfo.GroupUserIdentity.Value);
        }

        private void ContactList_ContactsChanged(object sender, ContactsChangedEventArgs e)
        {
            List<ContactChangedEventArgs>.Enumerator enumerator = e.ContactChangedEventArgsCollection.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    ContactChangedEventArgs args = enumerator.get_Current();
                    if (args.Contact.Uri.Raw == base.Uri.Raw)
                    {
                        if (args.ContactEventType == ContactEventType.BlockChanged)
                        {
                            base.InnerOnContactIsBlockChanged(new BlockEventArgs(args.Contact.IsBlocked));
                        }
                        else
                        {
                            if (args.ContactEventType == ContactEventType.Added)
                            {
                                this._ownerContact = args.Contact;
                                continue;
                            }
                            if (args.ContactEventType == ContactEventType.Deleted)
                            {
                                this._ownerContact = null;
                            }
                        }
                    }
                }
            }
            finally
            {
                enumerator.Dispose();
            }
        }

        public override void Dispose()
        {
            try
            {
                base.Dispose();
                if (this._ownerContact != null)
                {
                    this._ownerContact.PersonalInfo.PropertiesChanged -= new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.PersonalInfo_PropertiesChanged);
                }
                this.GroupMemeberInfo.Dispose();
            }
            catch (Exception)
            {
            }
        }

        private void PersonalInfo_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
        {
            if (e.ContainsProperty("DisplayName"))
            {
                this.GroupMemeberInfo.ComputeGroupNickName();
                base.Owner.PersonalGroupManager.RaiseMemberInfoChanged(this);
            }
        }

        internal override void WriteContactSetInfoXml(XmlTextWriter writer)
        {
        }

        public override bool CanSaveAndUseMyPortrait
        {
            get
            {
                return false;
            }
        }

        internal override bool CanSubscribedPresence
        {
            get
            {
                return false;
            }
        }

        public override string DisplayName
        {
            get
            {
                if (string.IsNullOrEmpty(this.GroupMemeberInfo.GroupNickName.Value))
                {
                    return base.Uri.Sid.ToString();
                }
                return (string) this.GroupMemeberInfo.GroupNickName;
            }
            internal set
            {
                this.GroupMemeberInfo.GroupNickName.Value = value;
            }
        }

        public override bool EnableEditUserSetProfile
        {
            get
            {
                return (base.Uri.Raw == base.Owner.Uri.Raw);
            }
        }

        public override bool EnableIM
        {
            get
            {
                return (base.Presence.MainPresence == MainPresence.Online);
            }
        }

        public override bool EnableInvite
        {
            get
            {
                if (this.OwnerContact != null)
                {
                    return this.OwnerContact.EnableInvite;
                }
                return (base.Presence.MainPresence == MainPresence.Online);
            }
        }

        public override bool EnableIvr
        {
            get
            {
                if (this.OwnerContact != null)
                {
                    return this.OwnerContact.EnableIvr;
                }
                return false;
            }
        }

        public override bool EnableMultiIM
        {
            get
            {
                if (this.OwnerContact != null)
                {
                    return this.OwnerContact.EnableMultiIM;
                }
                return false;
            }
        }

        public override bool EnableSendFile
        {
            get
            {
                if (this.OwnerContact != null)
                {
                    return this.OwnerContact.EnableSendFile;
                }
                return false;
            }
        }

        public override bool EnableSMS
        {
            get
            {
                if (this.OwnerContact != null)
                {
                    return this.OwnerContact.EnableSMS;
                }
                return false;
            }
        }

        public PersonalGroupMemberInfo GroupMemeberInfo
        {
            get
            {
                return this._memberInfo;
            }
        }

        public Contact OwnerContact
        {
            get
            {
                if (this._ownerContact == null)
                {
                    this._ownerContact = base.Owner.ContactList.FindContact(base.Uri.Raw, false);
                    if ((this._ownerContact is ChatFriend) || (this._ownerContact is Stranger))
                    {
                        return null;
                    }
                    if (this._ownerContact != null)
                    {
                        this._ownerContact.PersonalInfo.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.PersonalInfo_PropertiesChanged);
                    }
                }
                return this._ownerContact;
            }
        }

        public PersonalGroup OwnerGroup
        {
            get
            {
                return this._ownerGroup;
            }
        }

        public override rich_string RichDisplayName
        {
            get
            {
                if (string.IsNullOrEmpty(this.GroupMemeberInfo.RichGroupNickName.plane_text))
                {
                    this.GroupMemeberInfo.RichGroupNickName.plane_text = this.DisplayName;
                }
                return this.GroupMemeberInfo.RichGroupNickName;
            }
        }

        public override ContactType Type
        {
            get
            {
                return ContactType.PersonalGroupMember;
            }
        }
    }
}

⌨️ 快捷键说明

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