public static string[] CreateTextReportPowershell(DatabaseContent tablesContentList, string path) { var sb = new StringBuilder(); sb.AppendLine(Spacer); sb.AppendLine("DataBase overview"); sb.AppendLine(Spacer); sb.AppendFormat("SchemaVersion: {0,10}{1}", tablesContentList.SchemaVersion, Environment.NewLine); sb.AppendFormat("UserVersion: {0,10}{1}", tablesContentList.UserVersion, Environment.NewLine); sb.AppendLine(Spacer); sb.AppendLine("Tables overview"); sb.AppendLine(Spacer); CreateTablesSummary(tablesContentList.TableContent, sb); //sb.AppendLine(Spacer); //sb.AppendLine("Schema"); //sb.AppendLine(Spacer); // Todo Schema sb.AppendLine(Spacer); sb.AppendLine("Content"); sb.AppendLine(Spacer); foreach (var tablesContent in tablesContentList.TableContent) { sb.AppendLine(tablesContent.GetReportPowerShell()); } sb.AppendLine("EOF"); string[] result = Regex.Split(sb.ToString(), "\r\n|\r|\n"); result = result.Select(s => path + ":" + s).ToArray(); return result; }
public static DatabaseContent GetTableContent(string source) { var result = new DatabaseContent(); List<TableContent> tablesContent; using (var connection = new SQLiteConnection(String.Format("Data Source={0};Version=3;Read Only=True;", source))) { connection.Open(); List<string> tables = GetTables(connection); tablesContent = GetTableContent(tables, connection); result.TableContent = tablesContent; result.SchemaVersion = GetSchemaVersion(connection); result.UserVersion = GetUserersion(connection); } return result; }
private static string CreateTextReportInternal(DatabaseContent tablesContentList) { var sb = new StringBuilder(); sb.AppendLine(Spacer); sb.AppendLine("DataBase overview"); sb.AppendLine(Spacer); sb.AppendFormat("SchemaVersion: {0,10}{1}", tablesContentList.SchemaVersion, Environment.NewLine); sb.AppendFormat("UserVersion: {0,10}{1}", tablesContentList.UserVersion, Environment.NewLine); sb.AppendLine(Spacer); sb.AppendLine("Tables overview"); sb.AppendLine(Spacer); CreateTablesSummary(tablesContentList.TableContent, sb); //sb.AppendLine(Spacer); //sb.AppendLine("Schema"); //sb.AppendLine(Spacer); // Todo Schema sb.AppendLine(Spacer); sb.AppendLine("Content"); sb.AppendLine(Spacer); foreach (var tablesContent in tablesContentList.TableContent) { sb.AppendLine(tablesContent.GetReport()); } sb.AppendLine("EOF"); return sb.ToString(); }
public static string[] CreateTextReport(DatabaseContent tablesContentList) { var report = CreateTextReportInternal(tablesContentList); string[] result = Regex.Split(report, "\r\n|\r|\n"); return result; }
public static void CreateTextReport(DatabaseContent tablesContentList, string target) { var sb = CreateTextReportInternal(tablesContentList); File.WriteAllText(target, sb, Encoding.UTF8); }