| 189 | } |
| 190 | |
| 191 | bool ScreencapHelper::check_head_tail(std::string_view input, std::string_view head, std::string_view tail) |
| 192 | { |
| 193 | if (input.size() < head.size() || input.size() < tail.size()) { |
| 194 | LogError << "input too short" << VAR(input) << VAR(head) << VAR(tail); |
| 195 | return false; |
| 196 | } |
| 197 | |
| 198 | if (input.substr(0, head.size()) != head || input.substr(input.size() - tail.size(), tail.size()) != tail) { |
| 199 | LogError << "head or tail mismatch" << VAR(input) << VAR(head) << VAR(tail); |
| 200 | return false; |
| 201 | } |
| 202 | |
| 203 | return true; |
| 204 | } |
| 205 | |
| 206 | MAA_CTRL_UNIT_NS_END |