public void CopyTo(ClassData data)
 {
     data.Name          = Name;
     data.Icon          = Icon;
     data.ClassType     = ClassType;
     data.CSType        = CSType;
     data.IsMacrossType = IsMacrossType;
 }
        bool ShowItemWithFilter(ObservableCollection <ClassData> srcDatas, ref ObservableCollection <ClassData> tagDatas, string filterString)
        {
            tagDatas.Clear();

            bool retValue = false;

            foreach (var data in srcDatas.OfType <ClassData>())
            {
                ClassData tagData = null;
                if (string.IsNullOrEmpty(filterString))
                {
                    tagData = new ClassData();
                    data.CopyTo(tagData);
                    tagData.HightLightString = filterString;
                    tagDatas.Add(tagData);
                    retValue = true;
                }
                else if (data.Name.IndexOf(filterString, StringComparison.OrdinalIgnoreCase) > -1)
                {
                    tagData = new ClassData();
                    data.CopyTo(tagData);
                    tagData.HightLightString = filterString;
                    tagDatas.Add(tagData);
                    retValue = true;
                }

                if (data.Children.Count > 0)
                {
                    var children = new ObservableCollection <ClassData>();
                    var bFind    = ShowItemWithFilter(data.Children, ref children, filterString);
                    if (bFind)
                    {
                        if (tagData == null)
                        {
                            tagData = new ClassData();
                            data.CopyTo(tagData);
                            tagData.HightLightString = filterString;
                            tagDatas.Add(tagData);
                        }
                        tagData.Children   = children;
                        tagData.IsExpanded = true;
                        retValue           = true;
                    }
                }
            }

            return(retValue);
        }
        void CollectClassType(Type classType, List <Type> topClassTypes, Dictionary <Type, ClassData> classDataDic, ClassData childClassData, Type topClassType, Dictionary <Type, Type> checkedClasses)
        {
            if (classType == null)
            {
                return;
            }
            if (checkedClasses.ContainsKey(classType))
            {
                ClassData checkedData;
                if (classDataDic.TryGetValue(classType, out checkedData))
                {
                    checkedData.Children.Add(childClassData);
                }
                else
                {
                    if (topClassType != null && !topClassTypes.Contains(topClassType))
                    {
                        topClassTypes.Add(topClassType);
                    }
                }
                return;
            }
            ClassData classData;

            if (classDataDic.TryGetValue(classType, out classData))
            {
                if (childClassData != null)
                {
                    classData.Children.Add(childClassData);
                }
                return;
            }
            var baseType = classType.BaseType;
            var atts     = classType.GetCustomAttributes(typeof(EngineNS.Editor.Editor_MacrossClassAttribute), false);

            if (atts.Length > 0)
            {
                var att = atts[0] as EngineNS.Editor.Editor_MacrossClassAttribute;
                if (att.HasType(EngineNS.Editor.Editor_MacrossClassAttribute.enMacrossType.Inheritable))
                {
                    topClassType = classType;
                    var data = new ClassData()
                    {
                        Name      = classType.Name,
                        ClassType = classType,
                    };
                    data.CSType = att.CSType;
                    if (childClassData != null)
                    {
                        data.Children.Add(childClassData);
                    }
                    var mtAtts = classType.GetCustomAttributes(typeof(EngineNS.Macross.MacrossTypeClassAttribute), false);
                    if (mtAtts.Length > 0)
                    {
                        data.IsMacrossType = true;
                    }
                    else
                    {
                        data.IsMacrossType = false;
                    }
                    classDataDic[classType] = data;
                    if (baseType == null)
                    {
                        topClassTypes.Add(topClassType);
                        return;
                    }
                    childClassData = data;
                }
            }

            checkedClasses.Add(classType, classType);
            CollectClassType(baseType, topClassTypes, classDataDic, childClassData, topClassType, checkedClasses);
        }