using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace FindOverloadsAndStatics
{
    class Program
    {

        static void CheckOverloads(Type tp)
        {
            Dictionary<String, List<MethodInfo>> dic = new Dictionary<String, List<MethodInfo>>();

            foreach (MethodInfo mt in tp.GetMethods())
            {
                if ((mt.DeclaringType == tp)&&(mt.IsPublic))
                {
                    if (dic.ContainsKey(mt.Name))
                    {
                        List<MethodInfo> lmi = dic[mt.Name];
                        lmi.Add(mt);
                    }
                    else
                    {
                        List<MethodInfo> lmi = new List<MethodInfo>();
                        lmi.Add(mt);
                        dic.Add(mt.Name, lmi);
                    }
                }
            }

                foreach (List<MethodInfo> lmi in dic.Values)
                {
                    if (lmi.Count > 1)
                    {
                        foreach (MethodInfo mt in lmi)
                        {
                            Console.WriteLine("{0}.{1}", tp.Name, mt.Name);
                        }
                    }
                }
        }
        static void CheckStatics(Type tp)
        {
            foreach (MethodInfo mt in tp.GetMethods())
            {
                if ((mt.IsStatic)&&(mt.IsPublic))
                {
                    Console.WriteLine("{0}.{1}", tp.Name, mt.Name);
                }
            }
        }

        static void Main(string[] args)
        {
            foreach (string strarg in args)
            {
                Console.WriteLine();
                Console.WriteLine("************ {0} ************", strarg);
                Console.WriteLine();

                try
                {
                    Assembly asm = Assembly.LoadFrom(strarg);

                    Console.WriteLine("************* OVERLOADS *************");
                    foreach (Type tp in asm.GetTypes())
                    {
                        if ((tp.IsPublic) && ((tp.IsClass) || (tp.IsInterface)))
                        {
                            CheckOverloads(tp);
                        }
                    }
                    Console.WriteLine("************* STATICS *************");
                    foreach (Type tp in asm.GetTypes())
                    {
                        if ((tp.IsPublic) && ((tp.IsClass) || (tp.IsInterface)))
                        {
                            CheckStatics(tp);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
    }
}