コード例 #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
        private static void WriteMethods(Type nt1, html ht)
        {
            MethodInfo[] metodos = nt1.GetMethods();
            if (metodos.Length > 0)
            {
                Heading2("Methods:");
            }
            {
                ht.BeginList();
                foreach (MethodInfo p in metodos)
                {
                    tw.Write("<li> {0}", p.Name);
                    if (p.IsStatic)
                    {
                        tw.Write(" S");
                    }


                    WriteParametros(p.GetParameters());

                    tw.WriteLine("</li>");
                }

                ht.EndList();
            }
        }
        static public void Browse(string assemb, string nspace, TextWriter tw1)
        {
            tw = tw1;

            html ht = new html(tw, assemb);

            foreach (var ns in BrowseAssembly.dic.Keys)
            {
                if (ns == nspace)
                {
                    ht.Heading1("Informacao para o seguinte namespace:");

                    ht.BeginElementList();
                    ht.Paragraph(ns);
                    ht.EndElementList();
                    ht.BeginList();
                    BrowseAssembly.dic1 = BrowseAssembly.dic[ns];    // obter do dic1 o que estiver para a respectiva chave do dic
                    foreach (var nt in BrowseAssembly.dic1.Keys)     // obtem as chaves de dic1
                    {
                        ht.BeginElementList();

                        ht.LinkTipo(nt);
                        ht.EndElementList();
                    }
                    ht.EndList();
                }
            }

            ht.EndList();
            ht.Close();
        }
コード例 #4
0
        public static void Browse(TextWriter tw)

        {
            //tw.WriteLine("<html><head><title>{0}</title></head>", nome);
            //tw.WriteLine("<body>");

            html ht = new html(tw, "Início");


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



            tw.WriteLine("</body>");
            tw.WriteLine("</html>");
        }
コード例 #5
0
        static public void Browse(string ns, string nt, TextWriter tw1)
        {
            tw = tw1;
            string nome_completo = ns + "." + nt;
            Type   nt1           = Type.GetType(nome_completo);



            if (nt1 == null)
            {
                tw.WriteLine("<html><head><title>Erro</title></head>");
                tw.WriteLine("<body>");
                tw.WriteLine("Tipo de nome nao encontrado");
                tw.WriteLine("</body>");
                tw.WriteLine("</html>");
                return;
            }

            string nome = nt1.FullName;

            //tw.WriteLine("<html><head><title>{0}</title></head>", nome);
            //tw.WriteLine("<body>");

            html ht = new html(tw, nome);


            Heading1("Tipo: " + nt1.FullName);
            //tw.WriteLine("<h1> Tipo: {0}</h1>", nt1.FullName);



            WriteAssembly(nt1, ht);


            WriteCampos(nt1, ht);
            WriteMethods(nt1, ht);
            WriteConstrutores(nt1, ht);

            WritePropriedades(nt1, ht);
            WriteEventos(nt1);



            tw.WriteLine("</body>");
            tw.WriteLine("</html>");
        }
コード例 #6
0
        private static void WriteAssembly(Type nt1, html ht)
        {
            string nome_completo_assembly = nt1.Assembly.FullName;
            string nome_assembly          = nt1.Assembly.GetName().Name;
            string local_assembly         = nt1.Assembly.Location;



            Heading2("Informacao Assembly:");
            ht.BeginList();

            ht.BeginElementList();
            tw.Write("<a href ={0}as/{1}.dll> {2} </a>,", Program.PREFIXO, nome_assembly, nome_assembly);
            tw.Write("nome_completo: {0}, localizacao: {1}", nome_completo_assembly, local_assembly);
            ht.EndElementList();

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

            Heading2("Propriedades:");
            ht.BeginList();
            foreach (PropertyInfo pi in prop)
            {
                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();
        }
コード例 #8
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();
            }
        }
コード例 #9
0
        private static void WriteCampos(Type nt1, html ht)
        {
            FieldInfo[] campos = nt1.GetFields();

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

            Heading2("Campos:");
            ht.BeginList();
            foreach (FieldInfo fi in campos)
            {
                ht.BeginElementList();
                tw.Write(" {0}, tipo: {1}", fi.Name, fi.FieldType.Name);
                ht.EndElementList();
            }
            ht.EndList();
        }
コード例 #10
0
        static public void Browse(string ns, string nt, string mt, TextWriter tw1)
        {
            tw = tw1;
            string nome_completo = ns + "." + nt;
            Type   nt1           = Type.GetType(nome_completo);



            if (nt1 == null)
            {
                tw.WriteLine("<html><head><title>Erro</title></head>");
                tw.WriteLine("<body>");
                tw.WriteLine("Tipo de nome nao encontrado");
                tw.WriteLine("</body>");
                tw.WriteLine("</html>");
                return;
            }

            string nome = nt1.FullName;

            //tw.WriteLine("<html><head><title>{0}</title></head>", nome);
            //tw.WriteLine("<body>");

            html ht = new html(tw, nome);


            ht.Heading1("Tipo: " + nt1.FullName);



            WriteMethods(nt1, ht, mt);



            tw.WriteLine("</body>");
            tw.WriteLine("</html>");
        }
コード例 #11
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>");
        }
コード例 #12
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);
            }
        }