private void ExportSimulationDataPDF() { SQL.ConnectionString = @"data source=WR-7-BASE-74\SQLEXPRESS;initial catalog=DoktoratSymulacja;Integrated Security=SSPI"; //SQL.ConnectionString = @"data source=WR-7-BASE-74\SQLEXPRESS;initial catalog=Doktorat;Integrated Security=SSPI;"; MapItem[] mapList = SQL.DataProviderExport.GetExportMapList(); string sTempInputDir = string.Format("{0}\\TempInput", Environment.CurrentDirectory); string sOutputDir = string.Format("{0}\\Output", Environment.CurrentDirectory); foreach (var map in mapList) { ConfigItem[] itemConfigList = SQL.DataProviderExport.GetExportConfigList(map); DataSet ds; List <string> pdfsFile = new List <string>(); List <string> dunnTest = new List <string>(); List <string> kwTest = new List <string>(); List <string> LatexImageDescriptions = new List <string>(); StringBuilder sLatexFile = new StringBuilder(); double[] prawodpodobienstwMinimalnea = new double[] { 0, 3.8415, 5.9915, 7.8147, 9.4877, 11.0705, 12.5916 }; double alfa = 0.05; string sCombineNamePDF = "Simulation " + map.MapName + ".pdf"; string sCombineNameTex = "Simulation " + map.MapName + ".tex"; sCombineNamePDF = sCombineNamePDF.Replace(" ", "_"); //usuniecie spacje w nazwie pliku wynikowym pdf sCombineNameTex = sCombineNameTex.Replace(" ", "_"); //usuniecie spcaji w nazwie poliku wynikowego tex if (Directory.Exists(sTempInputDir)) { Directory.Delete(sTempInputDir, true); Directory.CreateDirectory(sTempInputDir); } else { Directory.CreateDirectory(sTempInputDir); } if (!Directory.Exists(sOutputDir)) { Directory.CreateDirectory(sOutputDir); } for (int i = 0; i < itemConfigList.Length; i++) { string sOutputPdfFile = string.Format("{0}\\{1}.pdf", sTempInputDir, i.ToString()); string sChartTitel = string.Format("{0}", itemConfigList[i].Name); // ""; //Gdy zajedzie potrzeba to nadamy w tym mijscy nazwy wykresu string sLatexImageDescriptions = string.Format("Eksperymenty symulacyjne: Mapa {0} Konfiguracja: {1}", map.MapName, itemConfigList[i].Name); ds = SQL.DataProviderExport.GetExportResult(itemConfigList[i].ConfigID); ds = removeUnnecessaryData(ds, map.ID_Map); RExporter r = new RExporter(); RExporterResult chartAndTestResult = r.GetChartPDFTest(ds, sChartTitel, map.ID_Map); RExporterResultItem[] testResult = chartAndTestResult.GetDunnTestResult(); SQL.DataProviderExport.InsertDunnStatistic(map, itemConfigList[i], testResult); File.Move(chartAndTestResult.ChartPath, sOutputPdfFile); pdfsFile.Add(sOutputPdfFile); int df = chartAndTestResult.GetKwTestDF(); double kw = chartAndTestResult.GetKwchiSquared(); string outLatex = formatLatexFile(sChartTitel, string.Format("06_experimental_results/simulation/img/{0}", sCombineNamePDF), i, alfa, prawodpodobienstwMinimalnea[df], df, kw, map.MapName); sLatexFile.Append(outLatex); } concatAndAddContent(pdfsFile, string.Format("{0}\\{1}", sOutputDir, sCombineNamePDF)); File.AppendAllText(string.Format("{0}\\{1}", sOutputDir, sCombineNameTex), sLatexFile.ToString()); } }