CSI.Utils.MInfo C# (CSharp) Method

MInfo() public static method

public static MInfo ( object ctype, string mname ) : void
ctype object
mname string
return void
        public static void MInfo(object ctype, string mname)
        {
            Type t;
            if (ctype == null)
            {
                if (lastClass != null)
                    ctype = lastClass;
                else
                    return;
            }
            if (ctype is String)
            {
                string cname = (string)ctype;
                if (cname.Length < 7 || cname.Substring(0, 7) != "System.")
                    cname = "System." + cname;
                t = GetType(cname);
                if (t == null) throw (new Exception("is not a type"));
            }
            else
                if (!(ctype is Type))
                    t = ctype.GetType();
                else
                    t = (Type)ctype;
            lastClass = t;
            try
            {
                string lastName = "";
                int k = 0;
                foreach (MethodInfo mi in t.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy))
                {
                    if (mname == null)
                    {
                        if (mi.Name != lastName && mi.Name.IndexOf('_') == -1)
                        {
                            lastName = mi.Name;
                            Write(lastName);
                            if (++k == 5)
                            {
                                Print();
                                k = 0;
                            }
                            else
                                Write(" ");
                        }
                    }
                    else
                    {
                        if (mi.Name == mname)
                        {
                            string proto = mi.ToString();
                            proto = proto.Replace("System.", "");
                            if (mi.IsStatic)
                                proto = "static " + proto;
                            if (mi.IsVirtual)
                                proto = "virtual " + proto;
                            Print(proto);
                        }
                    }
                }
                if (k > 0)
                    Print();
            }
            catch (Exception e)
            {
                Print("Error: " + ctype, e.Message);
            }
        }