private void button_FixPCurrentLocation_Click(object sender, EventArgs e) { try { int count = this.comm.dataGui.Positions.PositionList.Count; if (this.comm.dataGui.Positions.PositionList.Count > 0) { PositionInfo.PositionStruct struct2 = (PositionInfo.PositionStruct) this.comm.dataGui.Positions.PositionList[count - 1]; if (((byte)(struct2.NavType & 7)) == 0) { MessageBox.Show("Position not fixed yet -- Not set", "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { this.frmSetRefLocationRefLatitudeTxtBox.Text = struct2.Latitude.ToString(); this.frmSetRefLocationRefLongitudeTxtBox.Text = struct2.Longitude.ToString(); this.frmSetRefLocationRefAltitudeTxtBox.Text = struct2.Altitude.ToString(); } } } catch { MessageBox.Show("Error updating location with current fix position", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } }
private void getMsg41DataFromHash(Hashtable msgH) { ushort navValid = 0xffff; PositionInfo.PositionStruct struct2 = new PositionInfo.PositionStruct(); if (msgH.ContainsKey("Nav Valid")) { struct2.NavValid = Convert.ToUInt16((string)msgH["Nav Valid"]); navValid = struct2.NavValid; } if (msgH.ContainsKey("TOW")) { struct2.TOW = Convert.ToDouble((string)msgH["TOW"]); if (navValid == 0) { this.dataPlot.InsertTow_nvplot(struct2.TOW / 1000.0); } } if (msgH.ContainsKey("Latitude")) { struct2.Latitude = Convert.ToDouble((string)msgH["Latitude"]) / 10000000.0; if (navValid == 0) { this.dataPlot.InsertLat(struct2.Latitude); } } if (msgH.ContainsKey("Longitude")) { struct2.Longitude = Convert.ToDouble((string)msgH["Longitude"]) / 10000000.0; if (navValid == 0) { this.dataPlot.InsertLon(struct2.Longitude); } } if (msgH.ContainsKey("Altitude from Ellipsoid")) { struct2.Altitude = Convert.ToDouble((string)msgH["Altitude from Ellipsoid"]) / 100.0; if (navValid == 0) { this.dataPlot.InsertAlt(struct2.Altitude); this.dataPlot.UpdateIdx_nvplot(); } } }
public ArrayList ReadIMUFile(string filePath, double startTow, double endTow) { ArrayList list = new ArrayList(); try { StreamReader reader = new FileInfo(filePath).OpenText(); double num = 0.0; int num2 = 0; int num3 = 0; bool flag = false; string str = string.Empty; string input = reader.ReadLine(); while (input != null) { if (!flag && input.Contains("SW Version")) { string pattern = "SW Version*(?<swVer>.*)"; Regex regex = new Regex(pattern, RegexOptions.Compiled); if (regex.IsMatch(input)) { str = regex.Match(input).Result("${swVer}"); flag = true; } } string[] strArray = input.Split(new char[] { ',' }); if (strArray.Length <= 20) { goto Label_0302; } if (strArray[0] == "28") { num3 = Convert.ToInt16(strArray[0x13]); if (num2 < num3) { num2 = num3; num = (uint)Convert.ToDouble(strArray[4]); } } if (!(strArray[0] == "41") || (Convert.ToInt16(strArray[2]) <= 0)) { goto Label_0302; } PositionInfo.PositionStruct struct2 = new PositionInfo.PositionStruct(); struct2.NavType = Convert.ToUInt16(strArray[2]); int num4 = 8; struct2.TOW = (uint)(Convert.ToDouble(strArray[num4 / 2]) / 1000.0); if (startTow > 0.0) { if (struct2.TOW >= startTow) { if ((endTow > 0.0) && (struct2.TOW > endTow)) { return(list); } goto Label_0190; } input = reader.ReadLine(); continue; } if ((endTow > 0.0) && (struct2.TOW > endTow)) { return(list); } Label_0190: struct2.RxTime_Hour = Convert.ToInt32(strArray[num4++]); struct2.RxTime_Minute = Convert.ToInt32(strArray[num4++]); struct2.RxTime_second = (ushort)(Convert.ToDouble(strArray[num4++]) / 1000.0); struct2.SatellitesUsed = Convert.ToUInt32(strArray[num4++]); struct2.Latitude = Convert.ToDouble(strArray[num4++]) / 10000000.0; struct2.Longitude = Convert.ToDouble(strArray[num4++]) / 10000000.0; struct2.Altitude = Convert.ToDouble(strArray[num4++]) / 100.0; struct2.Speed = Convert.ToDouble(strArray[num4 + 2]) / 100.0; struct2.Heading = Convert.ToDouble(strArray[num4 + 3]) / 100.0; struct2.NumSVInFix = Convert.ToUInt16(strArray[num4 + 0x12]); struct2.HDOP = Convert.ToDouble(strArray[num4 + 0x13]) / 5.0; if (struct2.TOW == num) { struct2.MaxCN0 = num2; } else { struct2.MaxCN0 = 0.0; } num2 = 0; num3 = 0; struct2.SW_Version = str; list.Add(struct2); Label_0302: input = reader.ReadLine(); } } catch (Exception exception) { throw exception; } return(list); }