namespace ClassLibrary1
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.IO;
    using System.Reflection;
    using Telerik.Reporting;

    /// <summary>
    /// Summary description for ReportExplorer
    /// </summary>
    public static class ReportExplorer
    {
        public static List<Type> GetReports()
        {
            List<Type> list = new List<Type>();
            Assembly assembly = typeof(ReportExplorer).Assembly;
            foreach (Type type in assembly.GetTypes())
            {
                if (type.IsAbstract)
                    continue;

                if (type.IsSubclassOf(typeof(Report))
                    && TypeDescriptor.GetAttributes(type)[typeof(BrowsableAttribute)].Equals(BrowsableAttribute.Yes))
                {
                    list.Add(type);
                }
            }
            list.Sort(ReportExplorer.CompareByName);
            return list;
        }

        static int CompareByName(Type t1, Type t2)
        {
            return t1.Name.CompareTo(t2.Name);
        }
    }
    
}
