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(); }
private static void WriteMethods(Type nt1, html ht, string mt) { MethodInfo[] metodos = nt1.GetMethods(); //if (metodos.Length > 0) Heading2("Methods:"); { ht.BeginList(); foreach (MethodInfo p in metodos) { if (p.Name != mt) { continue; } tw.Write("<li> {0}", p.Name); if (p.IsStatic) { tw.Write(" S"); } WriteParametros(p.GetParameters()); tw.WriteLine("</li>"); } ht.EndList(); } }
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(); }
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(); }
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(); } }
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(); }
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); } }