| 99 | } |
| 100 | |
| 101 | static bool TryClassifyAsS6(IStream* stream, ClassifiedFileInfo* result) |
| 102 | { |
| 103 | bool success = false; |
| 104 | uint64_t originalPosition = stream->GetPosition(); |
| 105 | try |
| 106 | { |
| 107 | auto chunkReader = SawyerChunkReader(stream); |
| 108 | auto s6Header = chunkReader.ReadChunkAs<RCT2::S6Header>(); |
| 109 | if (s6Header.Type == S6_TYPE_SAVEDGAME) |
| 110 | { |
| 111 | result->Type = FileType::savedGame; |
| 112 | } |
| 113 | else if (s6Header.Type == S6_TYPE_SCENARIO) |
| 114 | { |
| 115 | result->Type = FileType::scenario; |
| 116 | } |
| 117 | result->Version = s6Header.Version; |
| 118 | success = true; |
| 119 | } |
| 120 | catch (const std::exception& e) |
| 121 | { |
| 122 | // Exceptions are likely to occur if file is not S6 format |
| 123 | LOG_VERBOSE(e.what()); |
| 124 | } |
| 125 | stream->SetPosition(originalPosition); |
| 126 | return success; |
| 127 | } |
| 128 | |
| 129 | static bool TryClassifyAsS4(IStream* stream, ClassifiedFileInfo* result) |
| 130 | { |
no test coverage detected