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

📄 systemfixedcontactgrouphelper.cs

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

    public class SystemFixedContactGroupHelper
    {
        private Imps.Client.Core.User _owner;

        public SystemFixedContactGroupHelper(Imps.Client.Core.User owner)
        {
            this._owner = owner;
        }

        public SystemFixedContactGroupCollection GetContactGroup(SystemFixContactGroupType type)
        {
            switch (type)
            {
                case SystemFixContactGroupType.Terminal:
                    return this.getTerminalContactGroup();

                case SystemFixContactGroupType.Presence:
                    return this.getPresenceContactGroup();
            }
            return null;
        }

        private SystemFixedContactGroupCollection getPresenceContactGroup()
        {
            SystemFixedContactGroupCollection groups = new SystemFixedContactGroupCollection();
            SystemFixedContactGroup item = new SystemFixedContactGroup(this._owner, 1, this.GetPresenceContactGroupName(SystemFixedContactGroup_Presence.Online), 1, delegate (Imps.Client.Core.Contact contact) {
                if (contact.RelationStatusIsAgree)
                {
                    return contact.Presence.IsOnline;
                }
                return false;
            });
            SystemFixedContactGroup group2 = new SystemFixedContactGroup(this._owner, 2, this.GetPresenceContactGroupName(SystemFixedContactGroup_Presence.SmsOnline), 2, delegate (Imps.Client.Core.Contact contact) {
                if (contact.RelationStatusIsAgree)
                {
                    return contact.Presence.IsSmsOnline;
                }
                return false;
            });
            SystemFixedContactGroup group3 = new SystemFixedContactGroup(this._owner, 3, this.GetPresenceContactGroupName(SystemFixedContactGroup_Presence.Offline), 3, delegate (Imps.Client.Core.Contact contact) {
                if (contact.RelationStatusIsAgree)
                {
                    return contact.Presence.IsOffline;
                }
                return false;
            });
            SystemFixedContactGroup group4 = new SystemFixedContactGroup(this._owner, 4, this.GetPresenceContactGroupName(SystemFixedContactGroup_Presence.Unagree), 4, delegate (Imps.Client.Core.Contact contact) {
                return !contact.RelationStatusIsAgree;
            });
            lock (this._owner.ContactList.Contacts.SyncRoot)
            {
                using (IEnumerator<Imps.Client.Core.Contact> enumerator = this._owner.ContactList.Contacts.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Imps.Client.Core.Contact contact = enumerator.get_Current();
                        item.UpdateBelong(contact);
                        group3.UpdateBelong(contact);
                        group2.UpdateBelong(contact);
                        group4.UpdateBelong(contact);
                    }
                }
            }
            item.InfoChanged += new EventHandler(groups.InnerGroupInfoChanged);
            group2.InfoChanged += new EventHandler(groups.InnerGroupInfoChanged);
            group3.InfoChanged += new EventHandler(groups.InnerGroupInfoChanged);
            group4.InfoChanged += new EventHandler(groups.InnerGroupInfoChanged);
            groups.Add(item);
            groups.Add(group2);
            groups.Add(group3);
            groups.Add(group4);
            groups.Sorted = true;
            return groups;
        }

        public string GetPresenceContactGroupName(SystemFixedContactGroup_Presence presence)
        {
            switch (presence)
            {
                case SystemFixedContactGroup_Presence.Online:
                    return StringTable.FixContactGroup.Presence_Online;

                case SystemFixedContactGroup_Presence.SmsOnline:
                    return StringTable.FixContactGroup.Presence_Sms;

                case SystemFixedContactGroup_Presence.Offline:
                    return StringTable.FixContactGroup.Presence_Offline;

                case SystemFixedContactGroup_Presence.Unagree:
                    return StringTable.FixContactGroup.Presence_Unagree;
            }
            return string.Empty;
        }

        private SystemFixedContactGroupCollection getTerminalContactGroup()
        {
            SystemFixedContactGroupCollection groups = new SystemFixedContactGroupCollection();
            SystemFixedContactGroup item = new SystemFixedContactGroup(this._owner, 1, this.GetTerminalContactGroupName(SystemFixedConactGroup_Terminal.PC), 1, delegate (Imps.Client.Core.Contact contact) {
                if (contact.RelationStatusIsAgree)
                {
                    if (contact.Presence.IsOffline || contact.Presence.IsSmsOnline)
                    {
                        return false;
                    }
                    ClientTypeCategory? nullable = new ClientTypeCategory?(ClientTypeHelper.String2ClientTypeCategory(contact.Presence.ClientType));
                    ClientTypeCategory? nullable2 = nullable;
                    if (((ClientTypeCategory) nullable2.GetValueOrDefault()) == ClientTypeCategory.PC)
                    {
                        return nullable2.get_HasValue();
                    }
                }
                return false;
            });
            SystemFixedContactGroup group2 = new SystemFixedContactGroup(this._owner, 2, this.GetTerminalContactGroupName(SystemFixedConactGroup_Terminal.Smart), 2, delegate (Imps.Client.Core.Contact contact) {
                if (contact.RelationStatusIsAgree)
                {
                    if (contact.Presence.IsOffline)
                    {
                        return false;
                    }
                    if (contact.Presence.IsSmsOnline)
                    {
                        return false;
                    }
                    ClientTypeCategory? nullable = new ClientTypeCategory?(ClientTypeHelper.String2ClientTypeCategory(contact.Presence.ClientType));
                    ClientTypeCategory? nullable2 = nullable;
                    if (((ClientTypeCategory) nullable2.GetValueOrDefault()) == ClientTypeCategory.SmartPhone)
                    {
                        return nullable2.get_HasValue();
                    }
                }
                return false;
            });
            SystemFixedContactGroup group3 = new SystemFixedContactGroup(this._owner, 4, this.GetTerminalContactGroupName(SystemFixedConactGroup_Terminal.SMS), 4, delegate (Imps.Client.Core.Contact contact) {
                if (contact.RelationStatusIsAgree && (!contact.Presence.IsOffline && !(contact is Imps.Client.Core.MobileBuddy)))
                {
                    return contact.Presence.IsSmsOnline;
                }
                return false;
            });
            SystemFixedContactGroup group4 = new SystemFixedContactGroup(this._owner, 3, this.GetTerminalContactGroupName(SystemFixedConactGroup_Terminal.WAP), 3, delegate (Imps.Client.Core.Contact contact) {
                if (contact.RelationStatusIsAgree)
                {
                    if (contact.Presence.IsOffline || contact.Presence.IsSmsOnline)
                    {
                        return false;
                    }
                    ClientTypeCategory? nullable = new ClientTypeCategory?(ClientTypeHelper.String2ClientTypeCategory(contact.Presence.ClientType));
                    ClientTypeCategory? nullable2 = nullable;
                    if (((ClientTypeCategory) nullable2.GetValueOrDefault()) == ClientTypeCategory.WAP)
                    {
                        return nullable2.get_HasValue();
                    }
                }
                return false;
            });
            SystemFixedContactGroup group5 = new SystemFixedContactGroup(this._owner, 5, this.GetTerminalContactGroupName(SystemFixedConactGroup_Terminal.Offline), 6, delegate (Imps.Client.Core.Contact contact) {
                if (!contact.RelationStatusIsAgree)
                {
                    return false;
                }
                if (contact is Imps.Client.Core.MobileBuddy)
                {
                    return false;
                }
                return contact.Presence.IsOffline;
            });
            SystemFixedContactGroup group6 = new SystemFixedContactGroup(this._owner, 6, this.GetTerminalContactGroupName(SystemFixedConactGroup_Terminal.MobileBuddy), 5, delegate (Imps.Client.Core.Contact contact) {
                if (contact.RelationStatusIsAgree)
                {
                    return contact is Imps.Client.Core.MobileBuddy;
                }
                return false;
            });
            SystemFixedContactGroup group7 = new SystemFixedContactGroup(this._owner, 7, this.GetTerminalContactGroupName(SystemFixedConactGroup_Terminal.Unagree), 7, delegate (Imps.Client.Core.Contact contact) {
                return !contact.RelationStatusIsAgree;
            });
            lock (this._owner.ContactList.Contacts.SyncRoot)
            {
                using (IEnumerator<Imps.Client.Core.Contact> enumerator = this._owner.ContactList.Contacts.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Imps.Client.Core.Contact contact = enumerator.get_Current();
                        item.UpdateBelong(contact);
                        group2.UpdateBelong(contact);
                        group4.UpdateBelong(contact);
                        group3.UpdateBelong(contact);
                        group5.UpdateBelong(contact);
                        group6.UpdateBelong(contact);
                        group7.UpdateBelong(contact);
                    }
                }
            }
            item.InfoChanged += new EventHandler(groups.InnerGroupInfoChanged);
            group2.InfoChanged += new EventHandler(groups.InnerGroupInfoChanged);
            group4.InfoChanged += new EventHandler(groups.InnerGroupInfoChanged);
            group3.InfoChanged += new EventHandler(groups.InnerGroupInfoChanged);
            group5.InfoChanged += new EventHandler(groups.InnerGroupInfoChanged);
            group6.InfoChanged += new EventHandler(groups.InnerGroupInfoChanged);
            group7.InfoChanged += new EventHandler(groups.InnerGroupInfoChanged);
            groups.Add(item);
            groups.Add(group2);
            groups.Add(group4);
            groups.Add(group3);
            groups.Add(group5);
            groups.Add(group6);
            groups.Add(group7);
            groups.Sorted = true;
            return groups;
        }

        public string GetTerminalContactGroupName(SystemFixedConactGroup_Terminal terminal)
        {
            switch (terminal)
            {
                case SystemFixedConactGroup_Terminal.PC:
                    return StringTable.FixContactGroup.Terminal_Pc;

                case SystemFixedConactGroup_Terminal.Smart:
                    return StringTable.FixContactGroup.Terminal_Smart;

                case SystemFixedConactGroup_Terminal.WAP:
                    return StringTable.FixContactGroup.Terminal_Wap;

                case SystemFixedConactGroup_Terminal.SMS:
                    return StringTable.FixContactGroup.Terminal_Sms;

                case SystemFixedConactGroup_Terminal.Offline:
                    return StringTable.FixContactGroup.Terminal_Offline;

                case SystemFixedConactGroup_Terminal.MobileBuddy:
                    return StringTable.FixContactGroup.Terminal_MobileBuddy;

                case SystemFixedConactGroup_Terminal.Unagree:
                    return StringTable.FixContactGroup.Terminal_Unagree;
            }
            return string.Empty;
        }
    }
}

⌨️ 快捷键说明

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