| 143 | } |
| 144 | |
| 145 | bool ParseKeyName(KeyNameCode const* valid, size_t validCount, wchar_t* name, wchar_t const* errorMessage, UINT* outKeyCode) |
| 146 | { |
| 147 | for (size_t i = 0; i < validCount; ++i) { |
| 148 | if (_wcsicmp(name, valid[i].mName) == 0) { |
| 149 | *outKeyCode = valid[i].mCode; |
| 150 | return true; |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | PrintError(L"error: %s: %s\n", errorMessage, name); |
| 155 | |
| 156 | int width = (int) (0.8 * GetConsoleWidth()); |
| 157 | int col = PrintError(L" valid options:"); |
| 158 | for (size_t i = 0; i < validCount; ++i) { |
| 159 | col += PrintError(L" %s", valid[i].mName); |
| 160 | if (col > width) { |
| 161 | col = PrintError(L"\n ") - 1; |
| 162 | } |
| 163 | } |
| 164 | PrintError(L"\n"); |
| 165 | |
| 166 | return false; |
| 167 | } |
| 168 | |
| 169 | bool AssignHotkey(wchar_t* key, CommandLineArgs* args) |
| 170 | { |
no test coverage detected