public override void Reset() { base.Reset(); DPSReportLink = null; OutLocation = null; Elapsed = ""; GeneratedFiles.Clear(); OpenableFiles.Clear(); }
public void Export() { #if EXBAKE_SAVE var generatedCount = 0; var currentFuncs = new List <string>(); void ExportFuncs() { FileUtils.WriteString(Path.Combine(outputPath, $"Generated{generatedCount++}.cs"), WrapInClass(string.Join("\n", currentFuncs))); currentFuncs.Clear(); } void AddFuncs(IEnumerable <string> funcs) { currentFuncs.AddRange(funcs); if (currentFuncs.Count > FUNCS_PER_FILE) { ExportFuncs(); } } var dictSB = new StringBuilder(); dictSB.AppendLine($"\tstatic {clsName}() {{"); dictSB.AppendLine("\t_allDataMap = " + "new Dictionary<string, List<Func<object>>>() {"); foreach (var gf in GeneratedFiles) { AddFuncs(gf.funcDefs); var funcs = $"new List<Func<object>>() {{\n\t{string.Join(",\n\t", gf.funcNames)}\n}}"; dictSB.AppendLine($"\t{{ \"{gf.filename}\", {funcs.Replace("\n", "\n\t")} }},"); } ExportFuncs(); dictSB.AppendLine("\t};"); dictSB.AppendLine("}"); FileUtils.WriteString(Path.Combine(outputPath, "Top.cs"), WrapInClass(dictSB.ToString())); GeneratedFiles.Clear(); #endif }
/// <summary> /// Exports the report to a stream. /// </summary> /// <param name="report">Report to export.</param> /// <param name="stream">Stream to export to.</param> /// <remarks> /// This method does not show an export options dialog. If you want to show it, call <see cref="ShowDialog"/> /// method prior to calling this method, or use the "Export(Report report)" method instead. /// </remarks> public void Export(Report report, Stream stream) { SetReport(report); this.stream = stream; PreparePageNumbers(); GeneratedFiles.Clear(); exportTickCount = Environment.TickCount; if (pages.Count > 0) { if (!String.IsNullOrEmpty(FileName)) { GeneratedFiles.Add(FileName); } Start(); report.SetOperation(ReportOperation.Exporting); if (ShowProgress) { Config.ReportSettings.OnStartProgress(Report); } else { Report.SetAborted(false); } try { for (int i = 0; i < GetPagesCount(pages); i++) { if (ShowProgress) { Config.ReportSettings.OnProgress(Report, String.Format(Res.Get("Messages,ExportingPage"), i + 1, pages.Count), i + 1, pages.Count); } if (!Report.Aborted && i < pages.Count) { ExportPageNew(pages[i]); } else { break; } } } finally { Finish(); if (ShowProgress) { Config.ReportSettings.OnProgress(Report, String.Empty); } if (ShowProgress) { Config.ReportSettings.OnFinishProgress(Report); } report.SetOperation(ReportOperation.None); exportTickCount = Environment.TickCount - exportTickCount; ShowPerformance(exportTickCount); if (openAfter && AllowOpenAfter && stream != null) { stream.Close(); OpenFile(); } } } }
/// <summary> /// Exports the report to a stream. /// </summary> /// <param name="report">Report to export.</param> /// <param name="stream">Stream to export to.</param> /// <remarks> /// This method does not show an export options dialog. If you want to show it, call <see cref="ShowDialog"/> /// method prior to calling this method, or use the "Export(Report report)" method instead. /// </remarks> public void Export(Report report, Stream stream) { SetReport(report); FStream = stream; PreparePageNumbers(); GeneratedFiles.Clear(); FExportTickCount = Environment.TickCount; if (FPages.Count > 0) { if (!String.IsNullOrEmpty(FileName)) { GeneratedFiles.Add(FileName); } Start(); report.SetOperation(ReportOperation.Exporting); if (ShowProgress) { Config.ReportSettings.OnStartProgress(Report); } try { for (int i = 0; i < FPages.Count; i++) { if (ShowProgress) { Config.ReportSettings.OnProgress(Report, String.Format(Res.Get("Messages,ExportingPage"), i + 1, FPages.Count), i + 1, FPages.Count); } if (!Report.Aborted && i < FPages.Count) { ExportPage(FPages[i]); } } } finally { Finish(); if (ShowProgress) { Config.ReportSettings.OnProgress(Report, String.Empty); } if (ShowProgress) { Config.ReportSettings.OnFinishProgress(Report); } report.SetOperation(ReportOperation.None); FExportTickCount = Environment.TickCount - FExportTickCount; if (Report.Preview != null && Config.ReportSettings.ShowPerformance) { Report.Preview.ShowPerformance(String.Format(Res.Get("Export,Misc,Performance"), FExportTickCount)); } if (FOpenAfter && AllowOpenAfter) { stream.Close(); OpenFile(); } } } }