private static int MsgChCountCompare(messageChCounts a, messageChCounts b) { int num = 0; if (a.mid > b.mid) { return 1; } if (a.mid < b.mid) { return -1; } if (a.mid == b.mid) { if (a.subID > b.subID) { return 1; } if (a.subID < b.subID) { num = -1; } } return num; }
private static void ReadOSPMasterListIntoMsgChCounts() { uint md = 0; uint sb = 0; string nm = ""; string str2 = ""; MsgChCounts.Clear(); string str3 = ConfigurationManager.AppSettings["InstalledDirectory"]; StreamReader reader = new StreamReader(str3 + @"\scripts\OSPmasterMIDlist.csv"); string str5 = reader.ReadLine(); str5 = reader.ReadLine(); str5 = reader.ReadLine(); while (!reader.EndOfStream) { if (((str5.IndexOf("removed from OSP") <= 0) && (str5.Substring(0, 6) != ",,,,,,")) && (str5.Substring(0, 12) != ",,,,,Nothing")) { messageChCounts counts; if (str5.Substring(0, 3) == ",,,") { string[] strArray = str5.Split(new string[] { ",", " " }, StringSplitOptions.RemoveEmptyEntries); sb = Convert.ToUInt32(strArray[0], 0x10); str2 = strArray[2]; counts = new messageChCounts(md, sb, nm + " - " + str2); MsgChCounts.Add(counts); } else if (str5.IndexOf('x') > 0) { string[] strArray2 = str5.Split(new string[] { ",", " " }, StringSplitOptions.RemoveEmptyEntries); md = Convert.ToUInt32(strArray2[0], 0x10); sb = 0; if (strArray2.Length > 2) { nm = strArray2[2]; } else { nm = "Unknown"; } counts = new messageChCounts(md, sb, nm); MsgChCounts.Add(counts); } } str5 = reader.ReadLine(); Console.WriteLine(str5); } reader.Close(); }
public static void ProtocolGP2ChannelCoverageFile(string filename) { ReadOSPMasterListIntoMsgChCounts(); string str = ConfigurationManager.AppSettings["InstalledDirectory"]; StreamReader reader = new StreamReader(str + @"\Log\" + filename); try { for (string str3 = reader.ReadLine(); !reader.EndOfStream; str3 = reader.ReadLine()) { if (IsGP2DateLine(str3)) { string[] strArray = str3.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); try { uint cx = Convert.ToUInt32(strArray[6], 0x10); uint md = Convert.ToUInt32(strArray[7], 0x10); uint sb = Convert.ToUInt32(strArray[8], 0x10); int num4 = MidSubIDMsgChCountsIndexOf(md, sb); if (num4 >= 0) { int channelIDIndex = GetChannelIDIndex(cx); MsgChCounts[num4].channelIDCount[channelIDIndex]++; } else { messageChCounts item = new messageChCounts(cx, md, sb); MsgChCounts.Add(item); } } catch (Exception) { } } } CreatePrtclGP2ChannelCoverageXMLFile(); Console.WriteLine("All Done"); } catch (Exception exception) { Console.WriteLine(exception.ToString()); } }