Asmex.ObjViewer.ObjViewer.ShowObjectProps C# (CSharp) Метод

ShowObjectProps() приватный Метод

private ShowObjectProps ( object o ) : void
o object
Результат void
        void ShowObjectProps(object o)
        {
            Type type = o.GetType();

            PropertyInfo[] pi = type.GetProperties();

            for(int i=0; i < pi.Length; ++i)
            {
                object ret = null;
                object[] atts;
                try
                {
                    atts = pi[i].GetCustomAttributes(typeof(ObjViewerAttribute), true);

                    ret = type.InvokeMember(pi[i].Name, BindingFlags.GetProperty, null, o, new object [] {});

                    if (atts.Length == 0)
                    {
                        AddProp(pi[i].Name, (ret==null)?"null":ret.ToString());
                    }
                    else
                    {
                        ObjViewerAttribute att = (ObjViewerAttribute)atts[0];
                        if(att.Hide == false)
                        {
                            string sName, sVal;

                            if (att.Rename)
                            {
                                sName = att.Name;
                            }
                            else
                            {
                                sName = pi[i].Name;
                            }

                            sVal = ret.ToString();

                            if (att.Hex)
                            {
                                if (ret is Int16) sVal = "0x"+((Int16)ret).ToString("X");
                                if (ret is Int32) sVal = "0x"+((Int32)ret).ToString("X8");
                                if (ret is Int64) sVal = "0x"+((Int64)ret).ToString("X");
                                if (ret is UInt16) sVal = "0x"+((UInt16)ret).ToString("X");
                                if (ret is UInt32) sVal = "0x"+((UInt32)ret).ToString("X8");
                                if (ret is UInt64) sVal = "0x"+((UInt64)ret).ToString("X");
                            }

                            AddProp(sName, sVal);
                        }
                    }
                }
                catch(Exception e)
                {
                    ret = e;
                }
            }
        }