public void Summary_TIA916(string dir) { Hashtable hashtable = new Hashtable(); int index = 8; int num2 = index + 1; int num3 = num2 + 3; int num4 = num3 + 3; int num5 = num4 + 5; int num6 = 12; int num7 = (num6 + num5) + 1; double sample = 0.0; string path = dir + @"\summary_TIA916.xml"; StreamWriter f = new StreamWriter(path); try { FileInfo[] files = new DirectoryInfo(dir).GetFiles("*.csv"); if (files.Length != 0) { foreach (FileInfo info2 in files) { Header1DataClass class2; PerEnvReport report; ReportElements elements; StreamReader reader = info2.OpenText(); string name = info2.Name; string pattern = @"_(com|COM|tcp|TCP|i2c|I2C)\d+_(?<testName>\w+)_(?<margin>\d+p\d?)"; Regex regex = new Regex(pattern, RegexOptions.Compiled); bool flag = regex.IsMatch(name); string key = "Unknown"; string str5 = "Unknown"; if (flag) { key = regex.Match(name).Result("${margin}").Replace('p', '.'); str5 = regex.Match(name).Result("${testName}"); } string str6 = string.Empty; string input = reader.ReadLine(); if (input != null) { pattern = @"SW Version\s*=\s*(?<swVer>.*)"; Regex regex2 = new Regex(pattern, RegexOptions.Compiled); if (regex2.IsMatch(input)) { str6 = regex2.Match(input).Result("${swVer}"); } else { str6 = "SW Version= Not detected"; } } else { str6 = "SW Version= Not detected"; } if (hashtable.Contains(str6)) { class2 = (Header1DataClass) hashtable[str6]; } else { Header1DataClass class3 = new Header1DataClass(); hashtable.Add(str6, class3); class2 = (Header1DataClass) hashtable[str6]; } if (class2.Header2DataHash.Contains(str5)) { report = (PerEnvReport) class2.Header2DataHash[str5]; } else { PerEnvReport report2 = new PerEnvReport(); class2.Header2DataHash.Add(str5, report2); report = (PerEnvReport) class2.Header2DataHash[str5]; } if (report.PerSiteData.Contains(key)) { elements = (ReportElements) report.PerSiteData[key]; } else { ReportElements elements2 = new ReportElements(); report.PerSiteData.Add(key, elements2); elements = (ReportElements) report.PerSiteData[key]; } this.setTIA916_2DErrorLimit(str5); input = reader.ReadLine(); string str8 = "N/A"; Hashtable hashtable2 = new Hashtable(); int num9 = 0; if (input != null) { string[] strArray = input.Split(new char[] { '=' }); if (strArray.Length > 1) { str8 = strArray[1] + "_" + str5; if (this.perRxSetupData.ContainsKey(str8)) { goto Label_0356; } hashtable2.Add("Test", str5); if (strArray.Length > 1) { hashtable2.Add(strArray[0], strArray[1]); } while ((input = reader.ReadLine()) != null) { if (input == "End Summary") { break; } if (input != string.Empty) { strArray = input.Split(new char[] { '=' }); if (strArray.Length > 1) { hashtable2.Add(strArray[0], strArray[1]); } num9++; } } this.perRxSetupData.Add(str8, hashtable2); } } goto Label_0362; Label_0334: if (input == "End Summary") { goto Label_0362; } if (!(input == string.Empty)) { num9++; } Label_0356: if ((input = reader.ReadLine()) != null) { goto Label_0334; } Label_0362: input = reader.ReadLine(); for (input = reader.ReadLine(); input != null; input = reader.ReadLine()) { string[] strArray2 = input.Split(new char[] { ',' }); double num10 = -9999.0; if (strArray2.Length >= 5) { double num11 = Convert.ToDouble(strArray2[this._ttffReportType]); double num12 = Convert.ToDouble(strArray2[index]); double num13 = Convert.ToDouble(this._limitVal); double num14 = 0.0; string[] strArray3 = this._hrErrLimit.Split(new char[] { ',' }); int num15 = -1; try { num15 = Convert.ToInt32(strArray2[num7]); } catch { } if (str5.Contains("TEST5")) { num13 = 240.0; } if (strArray3.Length > 0) { num14 = Convert.ToDouble(strArray3[strArray3.Length - 1]); } else { num14 = Convert.ToDouble(strArray3[0]); } if (num11 <= 0.0) { elements.NumberOfTTFFMisses++; } else if (num11 == Convert.ToDouble(this._timeoutVal)) { elements.NumberOfTTFFMisses++; } else if (num11 > num13) { elements.NumberOfTTFFOutOfLimits++; } if (num12 <= 0.0) { elements.NumberOf2DMisses++; } if (num12 > num14) { elements.NumberOf2DOutOfLimits++; } if (num11 <= 0.0) { elements.NumberOfMisses++; } else if (num11 > num13) { elements.NumberOfMisses++; } else if (num12 <= 0.0) { elements.NumberOfMisses++; } else if (num12 > num14) { elements.NumberOfMisses++; } double num16 = Convert.ToDouble(strArray2[num3]); if (num16 != -9999.0) { num10 = Math.Abs((double) (num16 - Convert.ToDouble(strArray2[num4]))); } if ((num15 >= 0) && (num15 <= 3)) { elements.NumberOfSVInFix++; } elements.TTFFSamples.InsertSample(num11); elements.Position2DErrorSamples.InsertSample(num12); elements.VerticalErrorSamples.InsertSample(num10); report.PerEnvSamples.TTFFSamples.InsertSample(num11); report.PerEnvSamples.Position2DErrorSamples.InsertSample(num12); report.PerEnvSamples.VerticalErrorSamples.InsertSample(num10); class2.ReportDataSamples.TTFFSamples.InsertSample(num11); class2.ReportDataSamples.Position2DErrorSamples.InsertSample(num12); class2.ReportDataSamples.VerticalErrorSamples.InsertSample(num10); for (int i = 0; i < num6; i++) { sample = Convert.ToDouble(strArray2[num5 + i]); if (sample != 0.0) { elements.CNOSamples.InsertSample(sample); report.PerEnvSamples.CNOSamples.InsertSample(sample); class2.ReportDataSamples.CNOSamples.InsertSample(sample); } } } } reader.Close(); } f.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); f.WriteLine("<TIA916>"); string limitStr = this._ttffLimit; foreach (string str10 in hashtable.Keys) { Header1DataClass class4 = (Header1DataClass) hashtable[str10]; f.WriteLine("\t<swVersion name=\"{0}\">", str10); int item = 0; foreach (string str11 in class4.Header2DataHash.Keys) { this.setTIA916_2DErrorLimit(str11); if (str11.Contains("TEST1")) { item = 0; } else if (str11.Contains("TEST2")) { item = 1; } else if (str11.Contains("TEST3")) { item = 2; } else if (str11.Contains("TEST4")) { item = 3; } else if (str11.Contains("TEST5")) { item = 4; limitStr = "240"; } PerEnvReport report3 = (PerEnvReport) class4.Header2DataHash[str11]; f.WriteLine("\t\t<environment name=\"{0}\">", str11); ArrayList list = new ArrayList(); foreach (string str12 in report3.PerSiteData.Keys) { list.Add(str12); } list.Sort(); foreach (string str13 in list) { ReportElements elements3 = (ReportElements) report3.PerSiteData[str13]; f.WriteLine("\t\t\t<site number=\"{0}\">", str13); List<int> data = new List<int>(); data.Add(item); data.Add(elements3.NumberOfSVInFix); data.Add(elements3.NumberOfMisses); data.Add(elements3.NumberOfTTFFMisses); data.Add(elements3.NumberOfTTFFOutOfLimits); data.Add(elements3.NumberOf2DMisses); data.Add(elements3.NumberOf2DOutOfLimits); this.printTIA916Summary(f, elements3.Position2DErrorSamples, elements3.TTFFSamples, data); this.printSampleData(f, elements3.TTFFSamples, this._percentile, limitStr, Convert.ToDouble(this._timeoutVal), "TTFF", "sec"); this.printSampleData(f, elements3.Position2DErrorSamples, this._percentile, this._hrErrLimit, -9999.0, "2-D Error", "m"); this.printSampleData(f, elements3.VerticalErrorSamples, this._percentile, "", -9999.0, "Vertical Error", "m"); this.printSampleData(f, elements3.CNOSamples, this._percentile, "", -9999.0, "CNO", "dbHz"); f.WriteLine("\t\t\t</site>"); } f.WriteLine("\t\t</environment>"); } f.WriteLine("\t</swVersion>"); } this.printTestSetup(f); f.WriteLine("</TIA916>"); f.Close(); hashtable.Clear(); this.perRxSetupData.Clear(); string outputFile = dir + @"\summary_TIA916.html"; this.GenerateHTMLReport(path, outputFile, ConfigurationManager.AppSettings["InstalledDirectory"] + @"\scripts\TIA916\TIA916Report.xsl"); } } catch (Exception exception) { this.perRxSetupData.Clear(); hashtable.Clear(); f.Close(); MessageBox.Show(exception.Message, "ERROR"); } }
public void Summary_Reset_V2(string dir) { int index = 8; int num2 = index + 1; int num3 = num2 + 3; int num4 = num3 + 3; int num5 = num4 + 5; int num6 = 12; int num7 = (num6 + num5) + 1; double sample = 0.0; StreamReader reader = null; try { FileInfo[] files = new DirectoryInfo(dir).GetFiles("*.csv"); if (files.Length != 0) { foreach (FileInfo info2 in files) { string str8; reader = info2.OpenText(); string name = info2.Name; string pattern = @"_(com|COM|tcp|TCP|i2c|I2C)\d+_(reset)*(?<testName>\w+)_(?<cno>-?\d+\.*\d?)"; Regex regex = new Regex(pattern, RegexOptions.Compiled); bool flag = regex.IsMatch(name); string key = "Unknown"; string str4 = "Unknown"; if (flag) { key = regex.Match(name).Result("${cno}"); str4 = regex.Match(name).Result("${testName}"); } string str5 = string.Empty; string input = reader.ReadLine(); if (input != null) { pattern = @"SW Version\s*=\s*(?<swVer>.*)"; Regex regex2 = new Regex(pattern, RegexOptions.Compiled); if (regex2.IsMatch(input)) { str5 = regex2.Match(input).Result("${swVer}"); } else { str5 = "SW Version: Not detected"; } } else { str5 = "SW Version: Not detected"; } input = reader.ReadLine(); string str7 = "N/A"; Hashtable hashtable = new Hashtable(); int num9 = 0; if (input != null) { string[] strArray = input.Split(new char[] { '=' }); if (strArray.Length > 1) { str7 = strArray[1]; if (this.perRxSetupData.ContainsKey(str7)) { goto Label_0217; } if (strArray.Length > 1) { hashtable.Add(strArray[0], strArray[1]); } while ((input = reader.ReadLine()) != null) { if (input == "End Summary") { break; } if (input != string.Empty) { strArray = input.Split(new char[] { '=' }); if (strArray.Length > 1) { hashtable.Add(strArray[0], strArray[1]); } num9++; } } this.perRxSetupData.Add(str7, hashtable); } } goto Label_0223; Label_0209: if (input == "End Summary") { goto Label_0223; } Label_0217: if ((input = reader.ReadLine()) != null) { goto Label_0209; } Label_0223: str8 = string.Empty; Header1DataClass class2 = null; PerEnvReport report = null; switch (this.ReportLayout) { case ReportLayoutType.GroupBySWVersion: str8 = key; if (!this.reportDataHash.Contains(str5)) { Header1DataClass class3 = new Header1DataClass(); this.reportDataHash.Add(str5, class3); } class2 = (Header1DataClass) this.reportDataHash[str5]; if (!class2.Header2DataHash.Contains(str4)) { PerEnvReport report2 = new PerEnvReport(); class2.Header2DataHash.Add(str4, report2); } report = (PerEnvReport) class2.Header2DataHash[str4]; if (!report.PerSiteData.Contains(key)) { ReportElements elements = new ReportElements(); report.PerSiteData.Add(key, elements); } class2.Header2DataHash[str4] = report; this.reportDataHash[str5] = class2; break; case ReportLayoutType.GroupByResetType: str8 = str7; if (!this.reportDataHash.Contains(str4)) { Header1DataClass class4 = new Header1DataClass(); this.reportDataHash.Add(str4, class4); } class2 = (Header1DataClass) this.reportDataHash[str4]; if (!class2.Header2DataHash.Contains(key)) { PerEnvReport report3 = new PerEnvReport(); class2.Header2DataHash.Add(key, report3); } report = (PerEnvReport) class2.Header2DataHash[key]; if (!report.PerSiteData.Contains(str7)) { ReportElements elements2 = new ReportElements(); report.PerSiteData.Add(str7, elements2); } class2.Header2DataHash[key] = report; this.reportDataHash[str4] = class2; break; default: str8 = string.Empty; break; } if (str8 != string.Empty) { ReportElements elements3 = (ReportElements) report.PerSiteData[str8]; input = reader.ReadLine(); for (input = reader.ReadLine(); input != null; input = reader.ReadLine()) { string[] strArray2 = input.Split(new char[] { ',' }); double num10 = -9999.0; if (strArray2.Length >= 5) { double num11 = Convert.ToDouble(strArray2[this._ttffReportType]); double num12 = Convert.ToDouble(strArray2[index]); double num13 = Convert.ToDouble(this._limitVal); string[] strArray3 = this._hrErrLimit.Split(new char[] { ',' }); int num14 = -1; try { num14 = Convert.ToInt32(strArray2[num7]); } catch { } if (strArray3.Length > 0) { Convert.ToDouble(strArray3[strArray3.Length - 1]); } else { Convert.ToDouble(strArray3[0]); } if (num11 <= 0.0) { elements3.NumberOfMisses++; } else if (num11 >= num13) { elements3.NumberOfMisses++; } double num15 = Convert.ToDouble(strArray2[num3]); if (num15 != -9999.0) { num10 = Math.Abs((double) (num15 - Convert.ToDouble(strArray2[num4]))); } if ((num14 >= 0) && (num14 <= 3)) { elements3.NumberOfSVInFix++; } try { elements3.TTFFSamples.InsertSample(num11); elements3.Position2DErrorSamples.InsertSample(num12); elements3.VerticalErrorSamples.InsertSample(num10); for (int i = 0; i < num6; i++) { sample = Convert.ToDouble(strArray2[num5 + i]); if (sample != 0.0) { elements3.CNOSamples.InsertSample(sample); } } } catch (FormatException exception) { exception.ToString(); } } } reader.Close(); } } this.writeResetSummaryXMLFile(dir, this.ReportLayout); } } catch (Exception exception2) { if (reader != null) { reader.Close(); } this.perRxSetupData.Clear(); this.reportDataHash.Clear(); MessageBox.Show(exception2.Message, "ERROR"); } }
public void E911_Summary(string dir) { Hashtable hashtable = new Hashtable(); int index = 8; int num2 = index + 1; int num3 = num2 + 3; int num4 = num3 + 3; int num5 = num4 + 5; int num6 = 12; double sample = 0.0; string path = dir + @"\summary_e911.xml"; StreamWriter f = new StreamWriter(path); try { if (!Directory.Exists(dir)) { MessageBox.Show(string.Format("Directory Not Found!\n\n{0}", dir), "Report Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { FileInfo[] files = new DirectoryInfo(dir).GetFiles("*.csv"); if (files.Length != 0) { foreach (FileInfo info2 in files) { Header1DataClass class2; PerEnvReport report; ReportElements elements; StreamReader reader = info2.OpenText(); string name = info2.Name; string pattern = @"_Idx\d+_(?<site>\w+_Site\d+)(?<subName>\D*)_"; Regex regex = new Regex(pattern, RegexOptions.Compiled); bool flag = regex.IsMatch(name); string key = "Unknown"; string str5 = "Unknown"; if (flag) { key = regex.Match(name).Result("${site}"); str5 = regex.Match(name).Result("${subName}"); } string str6 = string.Empty; string str7 = string.Empty; switch (key) { case "Seattle_Site101": case "Seattle_Site107": case "Dallas_Site115": case "Dallas_Site116": str7 = "Indoor"; break; case "Seattle_Site11": case "Seattle_Site19": case "Seattle_Site23": case "Dallas_Site106": case "Dallas_Site105": case "Dallas_Site107": case "Dallas_Site108": str7 = "Urban"; break; case "Seattle_Site4": case "Seattle_Site29": case "Dallas_Site109": case "Dallas_Site110": case "Dallas_Site112": str7 = "Suburban"; break; case "Seattle_Site17": case "Seattle_Site20": case "Seattle_Site25": case "Dallas_Site101": case "Dallas_Site102": case "Dallas_Site103": case "Dallas_Site104": str7 = "Dense Urban"; break; case "Seattle_Site3": case "Seattle_Site103": case "Seattle_Site105": case "Dallas_Site111": case "Dallas_Site113": case "Dallas_Site114": str7 = "Rural"; break; default: str7 = str5; key = str5; break; } string input = reader.ReadLine(); if (input != null) { pattern = @"SW Version\s*=\s*(?<swVer>.*)"; Regex regex2 = new Regex(pattern, RegexOptions.Compiled); if (regex2.IsMatch(input)) { str6 = regex2.Match(input).Result("${swVer}"); } else { str6 = "SW Version: Not detected"; } } else { str6 = "SW Version: Not detected"; } if (hashtable.Contains(str6)) { class2 = (Header1DataClass) hashtable[str6]; } else { Header1DataClass class3 = new Header1DataClass(); hashtable.Add(str6, class3); class2 = (Header1DataClass) hashtable[str6]; } if (class2.Header2DataHash.Contains(str7)) { report = (PerEnvReport) class2.Header2DataHash[str7]; } else { PerEnvReport report2 = new PerEnvReport(); class2.Header2DataHash.Add(str7, report2); report = (PerEnvReport) class2.Header2DataHash[str7]; } if (report.PerSiteData.Contains(key)) { elements = (ReportElements) report.PerSiteData[key]; } else { ReportElements elements2 = new ReportElements(); report.PerSiteData.Add(key, elements2); elements = (ReportElements) report.PerSiteData[key]; } input = reader.ReadLine(); string str9 = "N/A"; Hashtable hashtable2 = new Hashtable(); int num8 = 0; if (input != null) { string[] strArray = input.Split(new char[] { '=' }); if (strArray.Length > 1) { str9 = strArray[1]; if (this.perRxSetupData.ContainsKey(str9)) { goto Label_0595; } if (strArray.Length > 1) { hashtable2.Add(strArray[0], strArray[1]); } while ((input = reader.ReadLine()) != null) { if (input == "End Summary") { break; } strArray = input.Split(new char[] { '=' }); if (strArray.Length > 1) { hashtable2.Add(strArray[0], strArray[1]); } num8++; } this.perRxSetupData.Add(str9, hashtable2); } } goto Label_0746; Label_0579: if (input == "End Summary") { input = reader.ReadLine(); goto Label_0746; } Label_0595: if ((input = reader.ReadLine()) != null) { goto Label_0579; } Label_0746: while (input != null) { if (input.Contains("Time,")) { input = reader.ReadLine(); input = reader.ReadLine(); } else { string[] strArray2 = input.Split(new char[] { ',' }); double num9 = -9999.0; if (strArray2.Length >= 5) { double num10 = Convert.ToDouble(strArray2[this._ttffReportType]); double num11 = Convert.ToDouble(strArray2[index]); double num12 = Convert.ToDouble(strArray2[num3]); if (num12 != -9999.0) { num9 = Math.Abs((double) (num12 - Convert.ToDouble(strArray2[num4]))); } elements.TTFFSamples.InsertSample(num10); elements.Position2DErrorSamples.InsertSample(num11); elements.VerticalErrorSamples.InsertSample(num9); report.PerEnvSamples.TTFFSamples.InsertSample(num10); report.PerEnvSamples.Position2DErrorSamples.InsertSample(num11); report.PerEnvSamples.VerticalErrorSamples.InsertSample(num9); class2.ReportDataSamples.TTFFSamples.InsertSample(num10); class2.ReportDataSamples.Position2DErrorSamples.InsertSample(num11); class2.ReportDataSamples.VerticalErrorSamples.InsertSample(num9); for (int i = 0; i < num6; i++) { sample = Convert.ToDouble(strArray2[num5 + i]); if (sample != 0.0) { elements.CNOSamples.InsertSample(sample); report.PerEnvSamples.CNOSamples.InsertSample(sample); class2.ReportDataSamples.CNOSamples.InsertSample(sample); } } } input = reader.ReadLine(); } } reader.Close(); } f.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); f.WriteLine("<e911>"); foreach (string str10 in hashtable.Keys) { Header1DataClass class4 = (Header1DataClass) hashtable[str10]; f.WriteLine("\t<swVersion name=\"{0}\">", str10); foreach (string str11 in class4.Header2DataHash.Keys) { PerEnvReport report3 = (PerEnvReport) class4.Header2DataHash[str11]; f.WriteLine("\t\t<environment name=\"{0}\">", str11); foreach (string str12 in report3.PerSiteData.Keys) { ReportElements elements3 = (ReportElements) report3.PerSiteData[str12]; f.WriteLine("\t\t\t<site number=\"{0}\">", str12); this.printE911Summary(f, elements3.TTFFSamples); this.printSampleData(f, elements3.TTFFSamples, this._percentile, this._ttffLimit, Convert.ToDouble(this._timeoutVal), "TTFF", "sec"); this.printSampleData(f, elements3.Position2DErrorSamples, this._percentile, this._hrErrLimit, -9999.0, "2-D Error", "m"); this.printSampleData(f, elements3.VerticalErrorSamples, this._percentile, this._hrErrLimit, -9999.0, "Vertical Error", "m"); this.printSampleData(f, elements3.CNOSamples, this._percentile, "", 0.0, "CNO", "dbHz"); f.WriteLine("\t\t\t</site>"); } f.WriteLine("\t\t\t<average>"); this.printE911Summary(f, report3.PerEnvSamples.TTFFSamples); this.printSampleData(f, report3.PerEnvSamples.TTFFSamples, this._percentile, this._ttffLimit, Convert.ToDouble(this._timeoutVal), "TTFF", "sec"); this.printSampleData(f, report3.PerEnvSamples.Position2DErrorSamples, this._percentile, this._hrErrLimit, -9999.0, "2-D Error", "m"); this.printSampleData(f, report3.PerEnvSamples.VerticalErrorSamples, this._percentile, this._hrErrLimit, -9999.0, "Vertical Error", "m"); this.printSampleData(f, report3.PerEnvSamples.CNOSamples, this._percentile, "", 0.0, "CNO", "dbHz"); f.WriteLine("\t\t\t</average>"); f.WriteLine("\t\t</environment>"); } f.WriteLine("\t\t<summary>"); this.printE911Summary(f, class4.ReportDataSamples.TTFFSamples); this.printSampleData(f, class4.ReportDataSamples.TTFFSamples, this._percentile, this._ttffLimit, Convert.ToDouble(this._timeoutVal), "TTFF", "sec"); this.printSampleData(f, class4.ReportDataSamples.Position2DErrorSamples, this._percentile, this._hrErrLimit, -9999.0, "2-D Error", "m"); this.printSampleData(f, class4.ReportDataSamples.VerticalErrorSamples, this._percentile, this._hrErrLimit, -9999.0, "Vertical Error", "m"); this.printSampleData(f, class4.ReportDataSamples.CNOSamples, this._percentile, "", 0.0, "CNO", "dbHz"); f.WriteLine("\t\t</summary>"); f.WriteLine("\t</swVersion>"); } this.printTestSetup(f); f.WriteLine("</e911>"); f.Close(); hashtable.Clear(); this.perRxSetupData.Clear(); string outputFile = dir + @"\summary_e911.html"; this.GenerateHTMLReport(path, outputFile, ConfigurationManager.AppSettings["InstalledDirectory"] + @"\scripts\e911Report.xsl"); } } } catch (Exception exception) { this.perRxSetupData.Clear(); hashtable.Clear(); f.Close(); MessageBox.Show(exception.Message, "ERROR"); } }
public void Summary_Reset(string dir) { frmResetTestReportPlots plots = new frmResetTestReportPlots(); new ZedGraphControl(); Hashtable hashtable = new Hashtable(); int index = 8; int num2 = index + 1; int num3 = num2 + 3; int num4 = num3 + 3; int num5 = num4 + 5; int num6 = 12; int num7 = (num6 + num5) + 1; double sample = 0.0; string path = dir + @"\summary_reset.xml"; StreamWriter f = new StreamWriter(path); try { FileInfo[] files = new DirectoryInfo(dir).GetFiles("*.csv"); if (files.Length != 0) { foreach (FileInfo info2 in files) { Header1DataClass class2; PerEnvReport report; ReportElements elements; StreamReader reader = info2.OpenText(); string name = info2.Name; string pattern = @"_(com|COM|tcp|TCP|i2c|I2C)\d+_(reset)*(?<testName>\w+)_(?<cno>-?\d+\.*\d?)"; Regex regex = new Regex(pattern, RegexOptions.Compiled); bool flag = regex.IsMatch(name); string key = "Unknown"; string str5 = "Unknown"; if (flag) { key = regex.Match(name).Result("${cno}"); str5 = regex.Match(name).Result("${testName}"); } string str6 = string.Empty; string input = reader.ReadLine(); if (input != null) { pattern = @"SW Version=\s*(?<swVer>.*)"; Regex regex2 = new Regex(pattern, RegexOptions.Compiled); if (regex2.IsMatch(input)) { str6 = regex2.Match(input).Result("${swVer}"); } else { str6 = "SW Version= Not detected"; } } else { str6 = "SW Version= Not detected"; } if (hashtable.Contains(str6)) { class2 = (Header1DataClass) hashtable[str6]; } else { Header1DataClass class3 = new Header1DataClass(); hashtable.Add(str6, class3); class2 = (Header1DataClass) hashtable[str6]; } if (class2.Header2DataHash.Contains(str5)) { report = (PerEnvReport) class2.Header2DataHash[str5]; } else { PerEnvReport report2 = new PerEnvReport(); class2.Header2DataHash.Add(str5, report2); report = (PerEnvReport) class2.Header2DataHash[str5]; } if (report.PerSiteData.Contains(key)) { elements = (ReportElements) report.PerSiteData[key]; } else { ReportElements elements2 = new ReportElements(); report.PerSiteData.Add(key, elements2); elements = (ReportElements) report.PerSiteData[key]; } input = reader.ReadLine(); string str8 = "N/A"; Hashtable hashtable2 = new Hashtable(); int num9 = 0; if (input != null) { string[] strArray = input.Split(new char[] { '=' }); if (strArray.Length > 1) { str8 = strArray[1]; if (this.perRxSetupData.ContainsKey(str8)) { goto Label_0323; } if (strArray.Length > 1) { hashtable2.Add(strArray[0], strArray[1]); } while ((input = reader.ReadLine()) != null) { if (input == "End Summary") { break; } if (input != string.Empty) { strArray = input.Split(new char[] { '=' }); if (strArray.Length > 1) { hashtable2.Add(strArray[0], strArray[1]); } num9++; } } this.perRxSetupData.Add(str8, hashtable2); } } goto Label_032F; Label_0315: if (input == "End Summary") { goto Label_032F; } Label_0323: if ((input = reader.ReadLine()) != null) { goto Label_0315; } Label_032F: elements.RxName = str8; input = reader.ReadLine(); for (input = reader.ReadLine(); input != null; input = reader.ReadLine()) { string[] strArray2 = input.Split(new char[] { ',' }); double num10 = -9999.0; if (strArray2.Length >= 5) { double num11 = Convert.ToDouble(strArray2[this._ttffReportType]); double num12 = Convert.ToDouble(strArray2[index]); double num13 = Convert.ToDouble(this._limitVal); string[] strArray3 = this._hrErrLimit.Split(new char[] { ',' }); int num14 = -1; try { num14 = Convert.ToInt32(strArray2[num7]); } catch { } if (strArray3.Length > 0) { Convert.ToDouble(strArray3[strArray3.Length - 1]); } else { Convert.ToDouble(strArray3[0]); } if (num11 <= 0.0) { elements.NumberOfMisses++; } else if (num11 >= num13) { elements.NumberOfMisses++; } double num15 = Convert.ToDouble(strArray2[num3]); if (num15 != -9999.0) { num10 = Math.Abs((double) (num15 - Convert.ToDouble(strArray2[num4]))); } if ((num14 >= 0) && (num14 <= 3)) { elements.NumberOfSVInFix++; } try { elements.TTFFSamples.InsertSample(num11); elements.Position2DErrorSamples.InsertSample(num12); elements.VerticalErrorSamples.InsertSample(num10); report.PerEnvSamples.TTFFSamples.InsertSample(num11); report.PerEnvSamples.Position2DErrorSamples.InsertSample(num12); report.PerEnvSamples.VerticalErrorSamples.InsertSample(num10); class2.ReportDataSamples.TTFFSamples.InsertSample(num11); class2.ReportDataSamples.Position2DErrorSamples.InsertSample(num12); class2.ReportDataSamples.VerticalErrorSamples.InsertSample(num10); for (int i = 0; i < num6; i++) { sample = Convert.ToDouble(strArray2[num5 + i]); if (sample != 0.0) { elements.CNOSamples.InsertSample(sample); report.PerEnvSamples.CNOSamples.InsertSample(sample); class2.ReportDataSamples.CNOSamples.InsertSample(sample); } } } catch (FormatException exception) { exception.ToString(); } } } reader.Close(); } f.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); f.WriteLine("<reset>"); int styleCt = 0; List<string> il = new List<string>(); foreach (string str9 in hashtable.Keys) { Header1DataClass class4 = (Header1DataClass) hashtable[str9]; f.WriteLine("\t<swVersion name=\"{0}\">", str9); foreach (string str10 in class4.Header2DataHash.Keys) { plots.PaneTitle = str9 + "\r\n" + str10; 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 report3 = (PerEnvReport) class4.Header2DataHash[str10]; styleCt++; string item = str10 + styleCt.ToString() + ".jpg"; string str12 = "Style" + styleCt.ToString(); il.Add(item); f.WriteLine("\t\t<environment name=\"{0}\" plotImage=\"{1}\" showpicturestyle=\"{2}\">", str10, item, str12); ArrayList list2 = new ArrayList(); foreach (string str13 in report3.PerSiteData.Keys) { list2.Add(str13); } list2.Sort(); int num18 = 0; foreach (string str14 in list2) { ReportElements elements3 = (ReportElements) report3.PerSiteData[str14]; f.WriteLine("\t\t\t<site number=\"{0}\">", str14); this.printResetSummary(f, elements3.TTFFSamples.Samples, elements3.NumberOfMisses, elements3.NumberOfSVInFix); this.printSampleData(f, elements3.TTFFSamples, this._percentile, this._ttffLimit, Convert.ToDouble(this._timeoutVal), "TTFF", "sec"); plots.AddCurve(myPane, elements3.TTFFSamples, elements3.TTFFSamples.Samples, str14); this.printSampleData(f, elements3.Position2DErrorSamples, this._percentile, this._hrErrLimit, -9999.0, "2-D Error", "m"); plots.AddCurve(pane2, elements3.Position2DErrorSamples, elements3.Position2DErrorSamples.Samples, str14); this.printSampleData(f, elements3.VerticalErrorSamples, this._percentile, this._hrErrLimit, -9999.0, "Vertical Error", "m"); plots.AddCurve(pane3, elements3.VerticalErrorSamples, elements3.VerticalErrorSamples.Samples, str14); this.printSampleData(f, elements3.CNOSamples, this._percentile, "", -9999.0, "CNO", "dbHz"); f.WriteLine("\t\t\t</site>"); num18++; } plots.RefreshGraph(); plots.SaveGraphToFile(dir, item); plots.PaneTitle = string.Empty; f.WriteLine("\t\t</environment>"); } f.WriteLine("\t</swVersion>"); } this.modifyResetReportCSS(dir, styleCt); this.printTestSetup(f); this.printImageList(f, il); f.WriteLine("</reset>"); f.Close(); hashtable.Clear(); this.perRxSetupData.Clear(); string outputFile = dir + @"\summary_reset.html"; this.GenerateHTMLReport(path, outputFile, ConfigurationManager.AppSettings["InstalledDirectory"] + @"\scripts\resetReport.xsl"); } } catch (Exception exception2) { this.perRxSetupData.Clear(); hashtable.Clear(); f.Close(); MessageBox.Show(exception2.Message, "ERROR"); } }
public void CW_Summary(string dir) { Hashtable hashtable = new Hashtable(); string path = dir + @"\summary_cw.xml"; StreamWriter f = new StreamWriter(path); try { if (!Directory.Exists(dir)) { MessageBox.Show(string.Format("Directory Not Found!\n\n{0}", dir), "Report Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { FileInfo[] files = new DirectoryInfo(dir).GetFiles("*.csv"); if (files.Length != 0) { foreach (FileInfo info2 in files) { Header1DataClass class2; PerEnvReport report; PerPowerReport report2; string str10; int num2; List<string> list; Invalid_Data data = new Invalid_Data(); StreamReader reader = info2.OpenText(); string name = info2.Name; string pattern = @"_P(?<state>\d)_(?<power>-?\d+.\d?)_(?<msgID>msg\d+)"; Regex regex = new Regex(pattern, RegexOptions.Compiled); bool flag = regex.IsMatch(name); string str4 = "Unknown"; string str5 = "Unknown"; string str6 = "Unknown"; string key = "Unknown"; if (flag) { str4 = regex.Match(name).Result("${state}"); str5 = regex.Match(name).Result("${msgID}"); str6 = regex.Match(name).Result("${power}"); } string str8 = string.Empty; string str9 = string.Empty; if (str4 == "0") { str9 = "RF OFF -- CW(" + str6 + ")"; } else { str9 = "RF ON -- CW(" + str6 + ")"; } string str26 = str5; if (str26 != null) { if (!(str26 == "msg2")) { if (str26 == "msg28") { goto Label_0185; } if (str26 == "msg41") { goto Label_018E; } } else { key = "Nav"; } } goto Label_0195; Label_0185: key = "Track"; goto Label_0195; Label_018E: key = "Nav"; Label_0195: str10 = reader.ReadLine(); if (str10 != null) { pattern = "SW Version:(?<swVer>.*)"; Regex regex2 = new Regex(pattern, RegexOptions.Compiled); if (regex2.IsMatch(str10)) { str8 = regex2.Match(str10).Result("${swVer}"); } else { str8 = "SW Version: Not detected"; } } else { str8 = "SW Version: Not detected"; } if (hashtable.Contains(str8)) { class2 = (Header1DataClass) hashtable[str8]; } else { Header1DataClass class3 = new Header1DataClass(); hashtable.Add(str8, class3); class2 = (Header1DataClass) hashtable[str8]; } if (class2.Header2DataHash.Contains(key)) { report = (PerEnvReport) class2.Header2DataHash[key]; } else { PerEnvReport report3 = new PerEnvReport(); class2.Header2DataHash.Add(key, report3); report = (PerEnvReport) class2.Header2DataHash[key]; } if (report.PerSiteData.Contains(str9)) { report2 = (PerPowerReport) report.PerSiteData[str9]; } else { PerPowerReport report4 = new PerPowerReport(); report.PerSiteData.Add(str9, report4); report2 = (PerPowerReport) report.PerSiteData[str9]; } str10 = reader.ReadLine(); int num = 0; string str11 = "N/A"; Hashtable hashtable2 = new Hashtable(); if (str10 != null) { string[] strArray = str10.Split(new char[] { '=' }); num2 = 5; if (strArray.Length > 1) { str11 = strArray[1]; if (this.perRxSetupData.ContainsKey(str11)) { goto Label_039C; } if (strArray.Length > 1) { hashtable2.Add(strArray[0], strArray[1]); } while (((str10 = reader.ReadLine()) != null) && (num < num2)) { strArray = str10.Split(new char[] { '=' }); if (strArray.Length > 1) { hashtable2.Add(strArray[0], strArray[1]); } num++; } this.perRxSetupData.Add(str11, hashtable2); } } goto Label_03AE; Label_0396: num++; Label_039C: if (((str10 = reader.ReadLine()) != null) && (num < num2)) { goto Label_0396; } Label_03AE: list = new List<string>(); if (this.perRxSetupData.ContainsKey(str11)) { Hashtable hashtable3 = (Hashtable) this.perRxSetupData[str11]; string str12 = "SV List"; if (hashtable3.ContainsKey(str12)) { foreach (string str13 in ((string) hashtable3[str12]).Split(new char[] { ',' })) { if (!list.Contains(str13)) { list.Add(str13); } } } } Invalid_Data data2 = new Invalid_Data(); while (str10 != null) { string str14; string str15; int num5; string[] strArray3 = str10.Split(new char[] { ',' }); if (strArray3.Length >= 5) { str14 = strArray3[2]; str15 = strArray3[3]; str26 = strArray3[4]; if (str26 != null) { if (!(str26 == "2")) { if (str26 == "28") { goto Label_0659; } if (str26 == "41") { goto Label_079C; } } else { string str17 = strArray3[0x10]; if (report2.PerFreqData.Contains("Total")) { data = (Invalid_Data) report2.PerFreqData["Total"]; } else { Invalid_Data data3 = new Invalid_Data(); report2.PerFreqData.Add("Total", data3); data = (Invalid_Data) report2.PerFreqData["Total"]; } data.EpochCount++; if (strArray3.Length >= 20) { if (Convert.ToInt16(str17) > 4) { if (report2.PerFreqData.Contains(str14)) { data2 = (Invalid_Data) report2.PerFreqData[str14]; } else { Invalid_Data data4 = new Invalid_Data(); report2.PerFreqData.Add(str14, data4); data2 = (Invalid_Data) report2.PerFreqData[str14]; } data2.InvalidSVsCount++; data.InvalidSVsCount++; } else { int num3 = 0; int num4 = 12; for (num3 = 0; num3 < num4; num3++) { if (strArray3[num3 + 0x11] != "0") { string str18 = strArray3[num3 + 0x11]; if (!list.Contains(str18)) { data2.InvalidSVsCount++; data.InvalidSVsCount++; } } } } if (report2.PerFreqData.Contains(str14)) { data2 = (Invalid_Data) report2.PerFreqData[str14]; data2.EpochCount++; } } } } } goto Label_08A8; Label_0659: num5 = Convert.ToInt16(strArray3[13]); string item = strArray3[7]; if (report2.PerFreqData.Contains("Total")) { data = (Invalid_Data) report2.PerFreqData["Total"]; } else { Invalid_Data data5 = new Invalid_Data(); report2.PerFreqData.Add("Total", data5); data = (Invalid_Data) report2.PerFreqData["Total"]; } if ((num5 & 1) != 0) { int num6 = 0; int num7 = 0; for (num7 = 0; num7 < 10; num7++) { num6 += Convert.ToInt16(strArray3[num7 + 14]); } double num1 = ((double) num6) / 10.0; if ((str15 == "0") || !list.Contains(item)) { if (report2.PerFreqData.Contains(str14)) { data2 = (Invalid_Data) report2.PerFreqData[str14]; } else { Invalid_Data data6 = new Invalid_Data(); report2.PerFreqData.Add(str14, data6); data2 = (Invalid_Data) report2.PerFreqData[str14]; } data2.InvalidSVsCount++; data.InvalidSVsCount++; } } goto Label_08A8; Label_079C: if (report2.PerFreqData.Contains("Total")) { data = (Invalid_Data) report2.PerFreqData["Total"]; } else { Invalid_Data data7 = new Invalid_Data(); report2.PerFreqData.Add("Total", data7); data = (Invalid_Data) report2.PerFreqData["Total"]; } data.EpochCount++; if (report2.PerFreqData.Contains(str14)) { data2 = (Invalid_Data) report2.PerFreqData[str14]; } else { Invalid_Data data8 = new Invalid_Data(); report2.PerFreqData.Add(str14, data8); data2 = (Invalid_Data) report2.PerFreqData[str14]; } if ((str15 == "1") && (Convert.ToDouble(strArray3[strArray3.Length - 1]) > Convert.ToDouble(this._hrErrLimit))) { data2.HrErrCount++; data.HrErrCount++; } Label_08A8: str10 = reader.ReadLine(); } reader.Close(); } f.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); f.WriteLine("<cw>"); foreach (string str20 in hashtable.Keys) { f.WriteLine("\t<swVersion name=\"{0}\">", str20); Header1DataClass class4 = (Header1DataClass) hashtable[str20]; int num9 = 0; int num10 = 0; foreach (string str21 in class4.Header2DataHash.Keys) { f.WriteLine("\t\t<msg name=\"{0}\">", str21); PerEnvReport report5 = (PerEnvReport) class4.Header2DataHash[str21]; foreach (string str22 in report5.PerSiteData.Keys) { f.WriteLine("\t\t\t<environment name=\"{0}\">", str22); PerPowerReport report6 = (PerPowerReport) report5.PerSiteData[str22]; foreach (string str23 in report6.PerFreqData.Keys) { Invalid_Data data9 = (Invalid_Data) report6.PerFreqData[str23]; if (str21 == "Nav") { num9 = data9.EpochCount / 2; } if (((data9.InvalidSVsCount != 0) || (data9.HrErrCount != 0)) && !(str23 == "Total")) { f.WriteLine("\t\t\t\t<freq value=\"{0}\">", str23); f.WriteLine("\t\t\t\t\t<field name=\"# Invalid SV\" value=\"{0}\" criteria=\"{1}\" direction=\"<\" units=\"\"/>", data9.InvalidSVsCount, this._invalidSV); f.WriteLine("\t\t\t\t\t<field name=\"# Hr Error >{0} m\" value=\"{1}\" criteria=\"{2}\" direction=\"<\" units=\"\"/>", this._hrErrLimit, data9.HrErrCount, this._limitVal); f.WriteLine("\t\t\t\t\t<field name=\"# Epoch\" value=\"{0}\" criteria=\"\" direction=\"\" units=\"\"/>", num9); f.WriteLine("\t\t\t\t</freq>"); } } string str24 = "Total"; Invalid_Data data10 = (Invalid_Data) report6.PerFreqData[str24]; f.WriteLine("\t\t\t\t<freq value=\"{0}\">", str24); if (data10 != null) { if (str21 == "Nav") { num10 = data10.EpochCount / 2; } f.WriteLine("\t\t\t\t\t<field name=\"# Invalid SV\" value=\"{0}\" criteria=\"{1}\" direction=\"<\" units=\"\"/>", data10.InvalidSVsCount, this._invalidSV); f.WriteLine("\t\t\t\t\t<field name=\"# Hr Error >{0} m\" value=\"{1}\" criteria=\"{2}\" direction=\"<\" units=\"\"/>", this._hrErrLimit, data10.HrErrCount, this._limitVal); f.WriteLine("\t\t\t\t\t<field name=\"# Epoch\" value=\"{0}\" criteria=\"\" direction=\"\" units=\"\"/>", num10); f.WriteLine("\t\t\t\t</freq>"); } else { f.WriteLine("\t\t\t\t\t<field name=\"# Invalid SV\" value=\"0\" criteria=\"{0}\" direction=\"<\" units=\"\"/>", this._invalidSV); f.WriteLine("\t\t\t\t\t<field name=\"# Hr Error >{0} m\" value=\"0\" criteria=\"{1}\" direction=\"<\" units=\"\"/>", this._hrErrLimit, this._limitVal); f.WriteLine("\t\t\t\t\t<field name=\"# Epoch\" value=\"{0}\" criteria=\"\" direction=\"\" units=\"\"/>", num10); f.WriteLine("\t\t\t\t</freq>"); } f.WriteLine("\t\t\t</environment>"); } f.WriteLine("\t\t</msg>"); } f.WriteLine("\t</swVersion>"); } this.printTestSetup(f); f.WriteLine("</cw>"); f.Close(); hashtable.Clear(); this.perRxSetupData.Clear(); string outputFile = dir + @"\summary_cw.html"; this.GenerateHTMLReport(path, outputFile, ConfigurationManager.AppSettings["InstalledDirectory"] + @"\scripts\cwReport.xsl"); } } } catch (Exception exception) { this.perRxSetupData.Clear(); hashtable.Clear(); f.Close(); MessageBox.Show(exception.Message, "Error"); } }