| 423 | } |
| 424 | |
| 425 | void DebugCommands::Search(StringView searchText, Array<StringView>& matches, bool startsWith) |
| 426 | { |
| 427 | if (searchText.IsEmpty()) |
| 428 | return; |
| 429 | PROFILE_MEM(EngineDebug); |
| 430 | // TODO: fix missing string handle on 1st command execution (command gets invalid after InitCommands due to dotnet GC or dotnet interop handles flush) |
| 431 | String searchTextCopy = searchText; |
| 432 | searchText = searchTextCopy; |
| 433 | |
| 434 | EnsureInited(); |
| 435 | ScopeLock lock(Locker); |
| 436 | |
| 437 | if (startsWith) |
| 438 | { |
| 439 | for (auto& command : Commands) |
| 440 | { |
| 441 | if (command.Name.StartsWith(searchText, StringSearchCase::IgnoreCase)) |
| 442 | { |
| 443 | matches.Add(command.Name); |
| 444 | } |
| 445 | } |
| 446 | } |
| 447 | else |
| 448 | { |
| 449 | for (auto& command : Commands) |
| 450 | { |
| 451 | if (command.Name.Contains(searchText.Get(), StringSearchCase::IgnoreCase)) |
| 452 | { |
| 453 | matches.Add(command.Name); |
| 454 | } |
| 455 | } |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | void DebugCommands::InitAsync() |
| 460 | { |
nothing calls this directly
no test coverage detected