| 980 | } |
| 981 | |
| 982 | bool GameList::ParsePlayedTimeLine(char* line, std::string& serial, PlayedTimeEntry& entry) |
| 983 | { |
| 984 | size_t len = std::strlen(line); |
| 985 | if (len != (PLAYED_TIME_LINE_LENGTH + 1)) // \n |
| 986 | { |
| 987 | Console.Warning("(ParsePlayedTimeLine) Malformed line: '%s'", line); |
| 988 | return false; |
| 989 | } |
| 990 | |
| 991 | const std::string_view serial_tok(StringUtil::StripWhitespace(std::string_view(line, PLAYED_TIME_SERIAL_LENGTH))); |
| 992 | const std::string_view total_played_time_tok( |
| 993 | StringUtil::StripWhitespace(std::string_view(line + PLAYED_TIME_SERIAL_LENGTH + 1, PLAYED_TIME_LAST_TIME_LENGTH))); |
| 994 | const std::string_view last_played_time_tok(StringUtil::StripWhitespace( |
| 995 | std::string_view(line + PLAYED_TIME_SERIAL_LENGTH + 1 + PLAYED_TIME_LAST_TIME_LENGTH + 1, PLAYED_TIME_TOTAL_TIME_LENGTH))); |
| 996 | |
| 997 | const std::optional<u64> total_played_time(StringUtil::FromChars<u64>(total_played_time_tok)); |
| 998 | const std::optional<u64> last_played_time(StringUtil::FromChars<u64>(last_played_time_tok)); |
| 999 | if (serial_tok.empty() || !last_played_time.has_value() || !total_played_time.has_value()) |
| 1000 | { |
| 1001 | Console.Warning("(ParsePlayedTimeLine) Malformed line: '%s'", line); |
| 1002 | return false; |
| 1003 | } |
| 1004 | |
| 1005 | serial = serial_tok; |
| 1006 | entry.last_played_time = static_cast<std::time_t>(last_played_time.value()); |
| 1007 | entry.total_played_time = static_cast<std::time_t>(total_played_time.value()); |
| 1008 | return true; |
| 1009 | } |
| 1010 | |
| 1011 | std::string GameList::MakePlayedTimeLine(const std::string& serial, const PlayedTimeEntry& entry) |
| 1012 | { |
nothing calls this directly
no test coverage detected