bool WaypointReaderFS::ParseLine(const TCHAR* line, const unsigned linenum, Waypoints &way_points) { //$FormatGEO //ACONCAGU S 32 39 12.00 W 070 00 42.00 6962 Aconcagua //BERGNEUS N 51 03 07.02 E 007 42 22.02 488 Bergneustadt [A] //GOLDENGA N 37 49 03.00 W 122 28 42.00 227 Golden Gate Bridge //REDSQUAR N 55 45 15.00 E 037 37 12.00 123 Red Square //SYDNEYOP S 33 51 25.02 E 151 12 54.96 5 Sydney Opera //$FormatUTM //Aconcagu 19H 0405124 6386692 6962 Aconcagua //Bergneus 32U 0409312 5656398 488 Bergneustadt [A] //Golden G 10S 0545914 4185695 227 Golden Gate Bridge //Red Squa 37U 0413390 6179582 123 Red Square //Sydney O 56H 0334898 6252272 5 Sydney Opera if (line[0] == '\0') return true; if (linenum == 0 && _tcsstr(line, _T("$FormatUTM")) == line) { is_utm = true; return true; } if (line[0] == _T('$')) return true; // Determine the length of the line size_t len = _tcslen(line); // If less then 27 characters -> something is wrong -> cancel if (len < (is_utm ? 39 : 47)) return false; GeoPoint location; if ((!is_utm && !ParseLocation(line + 10, location)) || (is_utm && !ParseLocationUTM(line + 9, location))) return false; Waypoint new_waypoint(location); new_waypoint.file_num = file_num; new_waypoint.original_id = 0; if (!ParseString(line, new_waypoint.name, 8)) return false; if (!ParseAltitude(line + (is_utm ? 32 : 41), new_waypoint.elevation) && !CheckAltitude(new_waypoint)) return false; // Description (Characters 35-44) if (len > (is_utm ? 38 : 47)) ParseString(line + (is_utm ? 38 : 47), new_waypoint.comment); way_points.Append(new_waypoint); return true; }
void ParseIndexFile(const wchar_t* path, MappingFileClass &map) { IndexBTR index(map.IsXPRepository()); std::string szSearch; BuildClassSearchString(L"root\\ccm", L"CCM_RecentlyUsedApps", szSearch, true); std::vector<DWORD> *allocMap = map.GetDataAllocMap(); if (allocMap) { if (index.SearchBTRFile(path, map, szSearch)) { std::vector<std::string> *records = index.GetResults(); if (records) { std::vector<std::string>::iterator it = records->begin(); for (; it != records->end(); ++it) { LocationStruct ls; wprintf(L"Class Win32_Service : %S\n", it->c_str()); ParseLocation(ls, *it); DWORD dwPhyPage = allocMap->at(ls.LogicalID); wprintf(L"Class Win32_Service in Objects.data: Offset = %.8X size = %.8X RecordId = %.8X\n", dwPhyPage * PAGE_SIZE, ls.Size, ls.RecordID); } } } } //index.Print(); }
bool WaypointReaderCompeGPS::ParseLine(const TCHAR* line, const unsigned linenum, Waypoints &waypoints) { /* * G WGS 84 * U 1 * W IT05FC A 46.9121939503ºN 11.9605922700°E 27-MAR-62 00:00:00 566.000000 Ahornach Sand, Ahornach LP, GS und HG * w Waypoint,0,-1.0,16777215,255,0,0,7,,0.0, * W IT05FB A 46.9260440931ºN 11.9676733017°E 27-MAR-62 00:00:00 1425.000000 Ahornach Sand, Ahornach SP, GS und HG * w Waypoint,0,-1.0,16777215,255,0,0,7,,0.0, * * W ShortName 31T 318570 4657569 27-MAR-62 00:00:00 0 some Comments * W ShortName A 41.234234N 7.234424W 27-MAR-62 00:00:00 0 Comments */ // Skip projection and file encoding information if (*line == _T('G') || *line == _T('B')) return true; // Check for format: UTM or LatLon if (*line == _T('U') && _tcsstr(line, _T("U 0")) == line) { is_utm = true; return true; } // Skip non-waypoint lines if (*line != _T('W')) return true; // Skip W indicator and whitespace line++; while (*line == _T(' ')) line++; // Find next space delimiter, skip shortname const TCHAR *name = line; const TCHAR *space = _tcsstr(line, _T(" ")); if (space == NULL) return false; unsigned name_length = space - line; if (name_length == 0) return false; line = space; while (*line == _T(' ')) line++; // Parse location GeoPoint location; if ((!is_utm && !ParseLocation(line, location)) || (is_utm && !ParseLocationUTM(line, location))) return false; // Skip whitespace while (*line == _T(' ')) line++; // Skip unused date field line = _tcsstr(line, _T(" ")); if (line == NULL) return false; line++; // Skip unused time field line = _tcsstr(line, _T(" ")); if (line == NULL) return false; line++; // Create new waypoint instance Waypoint waypoint(location); waypoint.file_num = file_num; waypoint.original_id = 0; waypoint.name.assign(name, name_length); // Parse altitude if (!ParseAltitude(line, waypoint.elevation) && !CheckAltitude(waypoint)) return false; // Skip whitespace while (*line == _T(' ')) line++; // Parse waypoint name waypoint.comment.assign(line); waypoints.Append(std::move(waypoint)); return true; }