/// <summary> /// This function ingests the .nmea file of a valid CIDER data folder /// </summary> /// <param name="Data">A DataProvider object to store the ingested data in</param> /// <param name="Path">A path to the folder to the .nmea file</param> /// <param name="Read">An object implementing the IRead interface</param> /// <param name="Main">A MainWindowViewModel object to toggle the buttons from</param> public async Task ReadNmea(DataProvider Data, string Path, IRead Read, MainWindowViewModel Main) { failedParses = 0; bool first = true; logger.Debug("Starting NMEA ingestion."); await Task.Run(() => { try { string[] lines = Read.ReadLinesNmea(Path); foreach (string line in lines) { string[] vs = line.Split(','); if (vs[0] == "$GPGGA") { GGA(line, Data, first); if (Data.RouteStartTime != DateTime.Today) { first = false; } } if (vs[0] == "$GPRMC") { RMC(line, Data, first); } } } catch (Exception ex) { logger.Error(ex, "Error reading nmea file"); } }); logger.Debug("NMEA ingestion finished."); Main.ButtonState(true); }