Ejemplo n.º 1
0
        private void writeResetSummaryXMLFile(string dir, ReportLayoutType rFormat)
        {
            frmResetTestReportPlots plots = new frmResetTestReportPlots();
            ZedGraphControl control = new ZedGraphControl();
            string path = dir + @"\SummaryReport.xml";
            switch (rFormat)
            {
                case ReportLayoutType.GroupBySWVersion:
                    path = dir + @"\PerSW_SummaryReport.xml";
                    break;

                case ReportLayoutType.GroupByResetType:
                    path = dir + @"\PerResetType_SummaryReport.xml";
                    break;
            }
            StreamWriter f = new StreamWriter(path);
            try
            {
                f.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                f.WriteLine("<reset>");
                int styleCt = 0;
                List<string> il = new List<string>();
                foreach (string str2 in this.reportDataHash.Keys)
                {
                    Header1DataClass class2 = (Header1DataClass) this.reportDataHash[str2];
                    f.WriteLine("\t<swVersion name=\"{0}\">", str2);
                    ArrayList list2 = new ArrayList();
                    foreach (string str3 in class2.Header2DataHash.Keys)
                    {
                        list2.Add(str3);
                    }
                    list2.Sort();
                    foreach (string str4 in list2)
                    {
                        plots.PaneTitle = str2 + "\r\n" + str4;
                        plots.CreateCharts();
                        GraphPane myPane = plots.AddPane("TTFF Resets", "Secs");
                        GraphPane pane2 = plots.AddPane("2-D Error", "Meters");
                        GraphPane pane3 = plots.AddPane("Verical Error", "Meters");
                        PerEnvReport report = (PerEnvReport) class2.Header2DataHash[str4];
                        if (this.ReportLayout == ReportLayoutType.GroupBySWVersion)
                        {
                            styleCt++;
                        }
                        else
                        {
                            styleCt = 1;
                        }
                        string item = str4 + styleCt.ToString() + ".jpg";
                        string str6 = "Style" + styleCt.ToString();
                        il.Add(item);
                        f.WriteLine("\t\t<environment name=\"{0}\" plotImage=\"{1}\"  showpicturestyle=\"{2}\">", str4, item, str6);
                        ArrayList list3 = new ArrayList();
                        foreach (string str7 in report.PerSiteData.Keys)
                        {
                            list3.Add(str7);
                        }
                        list3.Sort();
                        int num2 = 0;
                        foreach (string str8 in list3)
                        {
                            ReportElements elements = (ReportElements) report.PerSiteData[str8];
                            f.WriteLine("\t\t\t<site number=\"{0}\">", str8);
                            this.printResetSummary(f, elements.TTFFSamples.Samples, elements.NumberOfMisses, elements.NumberOfSVInFix);
                            this.printSampleData(f, elements.TTFFSamples, this._percentile, this._ttffLimit, Convert.ToDouble(this._timeoutVal), "TTFF", "sec");
                            this.printSampleData(f, elements.Position2DErrorSamples, this._percentile, this._hrErrLimit, -9999.0, "2-D Error", "m");
                            this.printSampleData(f, elements.VerticalErrorSamples, this._percentile, this._hrErrLimit, -9999.0, "Vertical Error", "m");
                            this.printSampleData(f, elements.CNOSamples, this._percentile, "", -9999.0, "CNO", "dbHz");
                            f.WriteLine("\t\t\t</site>");
                            if (rFormat == ReportLayoutType.GroupBySWVersion)
                            {
                                plots.AddCurve(myPane, elements.TTFFSamples, elements.TTFFSamples.Samples, str8);
                                plots.AddCurve(pane2, elements.Position2DErrorSamples, elements.Position2DErrorSamples.Samples, str8);
                                plots.AddCurve(pane3, elements.VerticalErrorSamples, elements.VerticalErrorSamples.Samples, str8);
                            }
                            num2++;
                        }
                        if (rFormat == ReportLayoutType.GroupBySWVersion)
                        {
                            plots.RefreshGraph();
                            plots.SaveGraphToFile(dir, item);
                            plots.PaneTitle = string.Empty;
                        }
                        f.WriteLine("\t\t</environment>");
                        myPane = null;
                        pane2 = null;
                        pane3 = null;
                    }
                    f.WriteLine("\t</swVersion>");
                }
                this.printTestSetup(f);
                if (rFormat == ReportLayoutType.GroupBySWVersion)
                {
                    this.modifyResetReportCSS(dir, styleCt);
                    this.printImageList(f, il);
                }
                f.WriteLine("</reset>");
                f.Close();
                this.reportDataHash.Clear();
                this.perRxSetupData.Clear();
                string outputFile = path.Replace(".xml", ".html");
                this.GenerateHTMLReport(path, outputFile, ConfigurationManager.AppSettings["InstalledDirectory"] + @"\scripts\resetReport.xsl");
                plots.Dispose();
                control.Dispose();
            }
            catch (Exception exception)
            {
                this.perRxSetupData.Clear();
                this.perRxSetupData.Clear();
                plots.Dispose();
                control.Dispose();
                if (f != null)
                {
                    f.Close();
                }
                MessageBox.Show(exception.Message, "Report Generate Error");
            }
        }