Mover código a sus namespaces correspondientes
This commit is contained in:
49
ServerExplorer/Code/DocGen.cs
Normal file
49
ServerExplorer/Code/DocGen.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using ServerExplorer.Code;
|
||||
|
||||
namespace ServerExplorer.Code
|
||||
{
|
||||
public class DocGen
|
||||
{
|
||||
public static void GenerarDocumentacion(DatabaseDesc database)
|
||||
{
|
||||
// Abrir el documento que contendra la documentacion
|
||||
string fixedDatabaseName = database.Nombre.Replace(' ', '_');
|
||||
StreamWriter escritor = new StreamWriter(fixedDatabaseName + ".documentacion.html");
|
||||
|
||||
// Poner cabecera de la documentacion
|
||||
escritor.WriteLine("<!DOCTYPE html>");
|
||||
escritor.WriteLine("<html><head><title>" + database.Nombre + "</title></head>");
|
||||
escritor.WriteLine("<body>");
|
||||
|
||||
// Iterar cada tabla
|
||||
foreach (TablaDesc t in database.Tablas)
|
||||
{
|
||||
// Cabecera de la info de tabla
|
||||
escritor.WriteLine("<h2>" + t.Esquema + "." + t.Nombre + "</h2>");
|
||||
|
||||
// Iterar las columnas
|
||||
escritor.WriteLine("<table>");
|
||||
escritor.WriteLine("<thead><tr><th>Nombre</th><th>Tipo</th><th>Tamaño</th><th>Primaria</th></tr></thead>");
|
||||
escritor.WriteLine("<tbody>");
|
||||
foreach (ColumnaDesc c in t.Columnas)
|
||||
{
|
||||
escritor.WriteLine("<tr><td>" +
|
||||
c.Nombre + "</td><td>" +
|
||||
c.Tipo + "</td><td>" +
|
||||
c.Tamanho + "</td><td>" +
|
||||
c.Primaria + "</td></tr>");
|
||||
}
|
||||
escritor.WriteLine("</tbody></table>");
|
||||
}
|
||||
|
||||
// Poner pie y cerrar fichero
|
||||
escritor.WriteLine("</body></html>");
|
||||
escritor.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user