示例#1
0
        public IFindInFilesNode[] GetDirectories()
        {
            List <IFindInFilesNode> items = new List <IFindInFilesNode>();

            if (dataObject is IList)
            {
                foreach (object subObject in (IList)dataObject)
                {
                    items.Add(new FindInFilesNode(subObject, this));
                }
            }
            foreach (PropertyInfo pi in dataObject.GetType().GetProperties())
            {
                SearchableAttribute searchableAttribute = (SearchableAttribute)pi.GetCustomAttribute(typeof(SearchableAttribute));
                if ((searchableAttribute != null) && searchableAttribute.Searchable)
                {
                    if (typeof(IList).IsAssignableFrom(pi.PropertyType))
                    {
                        foreach (object subObject in (IList)pi.GetValue(dataObject))
                        {
                            items.Add(new FindInFilesNode(subObject, this));
                        }
                    }
                }
            }
            ;
            return(items.ToArray());
        }
示例#2
0
        public IFindInFilesItem[] GetFiles()
        {
            List <IFindInFilesItem> items = new List <IFindInFilesItem>();

            foreach (PropertyInfo pi in dataObject.GetType().GetProperties())
            {
                SearchableAttribute searchableAttribute = (SearchableAttribute)pi.GetCustomAttribute(typeof(SearchableAttribute));
                if ((searchableAttribute != null) && searchableAttribute.Searchable)
                {
                    if (!typeof(IList).IsAssignableFrom(pi.PropertyType))
                    {
                        items.Add(new FindInFilesItem(dataObject, pi.Name, this));
                    }
                }
            }
            ;
            return(items.ToArray());
        }