コード例 #1
0
        private static void WriteCampos(Type nt1, string campo, html ht)
        {
            FieldInfo[] campos = nt1.GetFields();

            if (campos.Length == 0)
            {
                return;
            }


            ht.BeginList();
            foreach (FieldInfo fi in campos)
            {
                if (fi.Name != campo)
                {
                    continue;
                }
                ht.Heading2("Informacao sobre o campo: " + fi.Name);
                ht.BeginElementList();

                tw.Write(" tipo: {0}", fi.FieldType.Name);
                ht.EndElementList();
            }
            ht.EndList();
        }
コード例 #2
0
        public static void WriteConstrutores(Type nt1, html ht)
        {
            ConstructorInfo[] construtores = nt1.GetConstructors();

            if (construtores.Length > 0)
            {
                ht.Heading2("Construtores:");
                ht.BeginList();
                foreach (ConstructorInfo p in construtores)
                {
                    tw.Write("<li> {0}", p.Name);
                    WriteParametros(p.GetParameters());
                    tw.WriteLine("</li>");
                }

                ht.EndList();
            }
        }
コード例 #3
0
        private static void WritePropriedades(Type nt1, string propriedade, html ht)
        {
            PropertyInfo[] prop = nt1.GetProperties();
            if (prop.Length == 0)
            {
                return;
            }

            ht.Heading2("Propriedades:");
            ht.BeginList();
            foreach (PropertyInfo pi in prop)
            {
                if (pi.Name != propriedade)
                {
                    continue;
                }
                ht.BeginElementList();
                tw.Write(" {0}, tipo: {1}, tem set: {2}, tem get: {03}", pi.Name, pi.PropertyType.Name, pi.CanWrite ? 'S' : 'N', pi.CanRead ? 'S' : 'N');
                ht.EndElementList();
            }
            ht.EndList();
        }
コード例 #4
0
        public static void WriteEventos(Type nt1, string evento, html ht)
        {
            EventInfo[] eventos = nt1.GetEvents();

            if (eventos.Length == 0)
            {
                return;
            }

            ht.Heading2("Eventos:");
            tw.WriteLine("<ul>");
            foreach (EventInfo ev in eventos)
            {
                if (ev.Name != evento)
                {
                    continue;
                }

                tw.Write("<li>");
                tw.Write(" {0}, tipo: {1}", ev.Name, ev.EventHandlerType.Name);
                tw.WriteLine("</li>");
            }
            tw.WriteLine("</ul>");
        }
コード例 #5
0
        static public void Browse(string assemb, TextWriter tw1)
        {
            tw = tw1;
            //tw.WriteLine("<html><head><title>Erro</title></head>");
            //tw.WriteLine("<body>");
            //tw.WriteLine("Tipo de nome nao encontrado");
            //tw.WriteLine("</body>");
            //tw.WriteLine("</html>");


            try
            {
                Assembly ass = Assembly.LoadFrom(@"C:\Windows\Microsoft.NET\Framework\v4.0.30319\" + assemb);

                html ht = new html(tw, assemb);

                Type[] ass_types = ass.GetExportedTypes();

                ht.Heading1(assemb);
                //ht.Heading1("<a href = assemb >assemb</a>" );

                string local = ass.Location;
                ht.Paragraph(local);

                ht.Heading2("Tipos:");

                ht.BeginList();
                //SortedDictionary<string, SortedDictionary<string, Type>> dic;
                dic = new SortedDictionary <string, SortedDictionary <string, Type> >();
                //SortedDictionary<string, Type> dic1;
                foreach (Type tp in ass_types)
                {
                    string s = tp.Namespace;
                    if (s == null)
                    {
                        s = "";
                    }

                    if (!dic.TryGetValue(s, out dic1))
                    {
                        dic.Add(s, dic1 = new SortedDictionary <string, Type>());
                    }

                    dic1.Add(tp.FullName, tp);
                    //ht.BeginElementList();
                    //ht.link(tp.FullName);
                    //ht.EndElementList();
                }

                foreach (var ns in dic.Keys)
                {
                    if (ns != "")
                    {
                        ht.BeginElementList();
                        //ht.Paragraph(ns);
                        ht.LinkNs(assemb, ns);
                        ht.EndElementList();
                        ht.BeginList();
                        dic1 = dic[ns];               // obter do dic1 o que estiver para a respectiva chave do dic
                        foreach (var nt in dic1.Keys) // obtem as chaves de dic1
                        {
                            ht.BeginElementList();
                            //ht.link(dic1[nt].FullName);
                            ht.LinkTipo(nt);
                            ht.EndElementList();
                        }
                        ht.EndList();
                    }
                }


                ht.EndList();
                ht.Close();
            }
            catch (Exception e)
            {
                html ht = new html(tw, "Erro", e.Message);
            }
        }