| 1524 | DuckyScriptEngine::DuckyScriptEngine() : scriptLoaded(false) {} |
| 1525 | |
| 1526 | DuckyScriptEngine::HIDKeycode DuckyScriptEngine::charToKeycode(char c) { |
| 1527 | if (c >= 'a' && c <= 'z') return {0, (uint8_t)(0x04 + (c - 'a'))}; |
| 1528 | if (c >= 'A' && c <= 'Z') return {0x02, (uint8_t)(0x04 + (c - 'A'))}; |
| 1529 | if (c >= '0' && c <= '9') { |
| 1530 | if (c == '0') return {0, 0x27}; |
| 1531 | return {0, (uint8_t)(0x1E + (c - '1'))}; |
| 1532 | } |
| 1533 | |
| 1534 | switch (c) { |
| 1535 | case ' ': return {0, 0x2C}; |
| 1536 | case '\n': return {0, 0x28}; |
| 1537 | case '\t': return {0, 0x2B}; |
| 1538 | case '!': return {0x02, 0x1E}; |
| 1539 | case '@': return {0x02, 0x1F}; |
| 1540 | case '#': return {0x02, 0x20}; |
| 1541 | case '$': return {0x02, 0x21}; |
| 1542 | case '%': return {0x02, 0x22}; |
| 1543 | case '^': return {0x02, 0x23}; |
| 1544 | case '&': return {0x02, 0x24}; |
| 1545 | case '*': return {0x02, 0x25}; |
| 1546 | case '(': return {0x02, 0x26}; |
| 1547 | case ')': return {0x02, 0x27}; |
| 1548 | case '-': return {0, 0x2D}; |
| 1549 | case '_': return {0x02, 0x2D}; |
| 1550 | case '=': return {0, 0x2E}; |
| 1551 | case '+': return {0x02, 0x2E}; |
| 1552 | case '[': return {0, 0x2F}; |
| 1553 | case '{': return {0x02, 0x2F}; |
| 1554 | case ']': return {0, 0x30}; |
| 1555 | case '}': return {0x02, 0x30}; |
| 1556 | case '\\': return {0, 0x31}; |
| 1557 | case '|': return {0x02, 0x31}; |
| 1558 | case ';': return {0, 0x33}; |
| 1559 | case ':': return {0x02, 0x33}; |
| 1560 | case '\'': return {0, 0x34}; |
| 1561 | case '"': return {0x02, 0x34}; |
| 1562 | case '`': return {0, 0x35}; |
| 1563 | case '~': return {0x02, 0x35}; |
| 1564 | case ',': return {0, 0x36}; |
| 1565 | case '<': return {0x02, 0x36}; |
| 1566 | case '.': return {0, 0x37}; |
| 1567 | case '>': return {0x02, 0x37}; |
| 1568 | case '/': return {0, 0x38}; |
| 1569 | case '?': return {0x02, 0x38}; |
| 1570 | default: return {0, 0x2C}; |
| 1571 | } |
| 1572 | } |
| 1573 | |
| 1574 | bool DuckyScriptEngine::parseLine(String line) { |
| 1575 | line.trim(); |
no outgoing calls
no test coverage detected