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

📄 buddytree_comparer.cs

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

    public class buddytree_comparer : IComparer<tree_widget.item_type>
    {
        private buddytree_widget.SORTSTYLE m_sortStyle;

        public int Compare(tree_widget.item_type x, tree_widget.item_type y)
        {
            if ((x == null) || (y == null))
            {
                throw new ArgumentNullException("x or y");
            }
            return this.compare_func(x.context, y.context);
        }

        private int compare_func(object node1, object node2)
        {
            if ((node1 != null) && (node2 != null))
            {
                if ((node1 is ContactGroup) && (node2 is ContactGroup))
                {
                    ContactGroupBase base2 = node1 as ContactGroupBase;
                    ContactGroupBase base3 = node2 as ContactGroupBase;
                    if ((base2 == null) || (base3 == null))
                    {
                        return 0;
                    }
                    if (base2.Id == -1)
                    {
                        return 1;
                    }
                    if (base3.Id == -1)
                    {
                        return -1;
                    }
                    return string.Compare(base2.Name, base3.Name);
                }
                if ((node1 is SystemFixedContactGroup) && (node2 is SystemFixedContactGroup))
                {
                    if (buddytree_widget.SORTSTYLE.SORT_BY_STATE == this.m_sortStyle)
                    {
                        SystemFixedContactGroup group = node1 as SystemFixedContactGroup;
                        SystemFixedContactGroup group2 = node2 as SystemFixedContactGroup;
                        if ((group != null) && (group2 != null))
                        {
                            return group.SortIndex.CompareTo(group2.SortIndex);
                        }
                        return 0;
                    }
                    if (buddytree_widget.SORTSTYLE.SORT_BY_DEVICE == this.m_sortStyle)
                    {
                        SystemFixedContactGroup group3 = node1 as SystemFixedContactGroup;
                        SystemFixedContactGroup group4 = node2 as SystemFixedContactGroup;
                        if ((group3 != null) && (group4 != null))
                        {
                            return group3.SortIndex.CompareTo(group4.SortIndex);
                        }
                        return 0;
                    }
                }
                else
                {
                    if ((node1 is ContactGroup) || ((node1 is SystemFixedContactGroup) && (node2 is Contact)))
                    {
                        return 1;
                    }
                    if ((node2 is ContactGroup) || ((node2 is SystemFixedContactGroup) && (node1 is Contact)))
                    {
                        return -1;
                    }
                    if ((node1 is Contact) && (node2 is Contact))
                    {
                        Contact contact = node1 as Contact;
                        Contact other = node2 as Contact;
                        if ((contact != null) && (other != null))
                        {
                            return contact.CompareTo(other);
                        }
                        return 0;
                    }
                }
            }
            return 0;
        }

        public buddytree_widget.SORTSTYLE sort_style
        {
            get
            {
                return this.m_sortStyle;
            }
            set
            {
                this.m_sortStyle = value;
            }
        }
    }
}

⌨️ 快捷键说明

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