/*
 * 特别声明：本技术材料受《中华人民共和国著作权法》、《计算机软件保护条例》等法律、法规、行政
 * 规章以及有关国际条约的保护，赞同科技享有知识产权、保留一切权利并视其为技术秘密。未经本公司书
 * 面许可，任何人不得擅自（包括但不限于：以非法的方式复制、传播、展示、镜像、上载、下载）使用，
 * 不得向第三方泄露、透露、披露。否则，本公司将依法追究侵权者的法律责任。特此声明！
 *
 * Special Declaration: These technical material reserved as the technical secrets by AGREE 
 * TECHNOLOGY have been protected by the "Copyright Law" "ordinances on Protection of Computer 
 * Software" and other relevant administrative regulations and international treaties. Without 
 * the written permission of the Company, no person may use (including but not limited to the 
 * illegal copy, distribute, display, image, upload, and download) and disclose the above 
 * technical documents to any third party. Otherwise, any infringer shall afford the legal 
 * liability to the company.
 */
import {Keys} from "hotkey/Keys";
/**
 * Created by huang.dy on 2016/5/20.
 */
export class KeystrokeGenerator {
    public static generateKeyStroke(e: KeyboardEvent) {
        let stroke = "";
        let ctrlKey = e.ctrlKey;
        stroke = ctrlKey ? stroke + "CTRL+" : stroke;
        let shiftKey = e.shiftKey;
        stroke = shiftKey ? stroke + "SHIFT+" : stroke;
        let altKey = e.altKey;
        stroke = altKey ? stroke + "ALT+" : stroke;
        switch (e.keyCode) {
            case Keys.BACKSPACE:
                stroke = stroke + "BS";
                break;
            case Keys.TAB:
                stroke = stroke + "TAB";
                break;
            case Keys.CLEAR:
                stroke = stroke + "CLEAR";
                break;
            case Keys.ENTER:
                stroke = stroke + "CR";
                break;
            case Keys.CAPS_LOCK:
                stroke = stroke + "CAPS";
                break;
            case Keys.ESCAPE:
                stroke = stroke + "ESC";
                break;
            case Keys.SPACE:
                stroke = stroke + "SPACE";
                break;
            case Keys.PAGE_UP:
                stroke = stroke + "PAGE_UP";
                break;
            case Keys.PAGE_DOWN:
                stroke = stroke + "PAGE_DOWN";
                break;
            case Keys.END:
                stroke = stroke + "END";
                break;
            case Keys.HOME:
                stroke = stroke + "HOME";
                break;
            case Keys.LEFT_ARROW:
                stroke = stroke + "ARROW_LEFT";
                break;
            case Keys.UP_ARROW:
                stroke = stroke + "ARROW_UP";
                break;
            case Keys.RIGHT_ARROW:
                stroke = stroke + "ARROW_RIGHT";
                break;
            case Keys.DOWN_ARROW:
                stroke = stroke + "ARROW_DOWN";
                break;
            case Keys.INSERT:
                stroke = stroke + "INS";
                break;
            case Keys.DELETE:
                stroke = stroke + "DEL";
                break;
            case Keys.HELP:
                stroke = stroke + "HELP";
                break;
            case Keys.LEFT_WINDOW:
                stroke = stroke + "LEFT_WINDOW";
                break;
            case Keys.RIGHT_WINDOW:
                stroke = stroke + "RIGHT_WINDOW";
                break;
            case Keys.SELECT:
                stroke = stroke + "SELECT";
                break;
            case Keys.NUMPAD_0:
                stroke = stroke + "NUMPAD_0";
                break;
            case Keys.NUMPAD_1:
                stroke = stroke + "NUMPAD_1";
                break;
            case Keys.NUMPAD_2:
                stroke = stroke + "NUMPAD_2";
                break;
            case Keys.NUMPAD_3:
                stroke = stroke + "NUMPAD_3";
                break;
            case Keys.NUMPAD_4:
                stroke = stroke + "NUMPAD_4";
                break;
            case Keys.NUMPAD_5:
                stroke = stroke + "NUMPAD_5";
                break;
            case Keys.NUMPAD_6:
                stroke = stroke + "NUMPAD_6";
                break;
            case Keys.NUMPAD_7:
                stroke = stroke + "NUMPAD_7";
                break;
            case Keys.NUMPAD_8:
                stroke = stroke + "NUMPAD_8";
                break;
            case Keys.NUMPAD_9:
                stroke = stroke + "NUMPAD_9";
                break;
            case Keys.NUMPAD_MULTIPLY:
                stroke = stroke + "NUMPAD_MULTIPLY";
                break;
            case Keys.NUMPAD_PLUS:
                stroke = stroke + "NUMPAD_PLUS";
                break;
            case Keys.NUMPAD_ENTER:
                stroke = stroke + "CR";
                break;
            case Keys.NUMPAD_MINUS:
                stroke = stroke + "NUMPAD_MINUS";
                break;
            case Keys.NUMPAD_PERIOD:
                stroke = stroke + "NUMPAD_PERIOD";
                break;
            case Keys.NUMPAD_DIVIDE:
                stroke = stroke + "NUMPAD_DIVIDE";
                break;
            case Keys.F1:
                stroke = stroke + "F1";
                break;
            case Keys.F2:
                stroke = stroke + "F2";
                break;
            case Keys.F3:
                stroke = stroke + "F3";
                break;
            case Keys.F4:
                stroke = stroke + "F4";
                break;
            case Keys.F5:
                stroke = stroke + "F5";
                break;
            case Keys.F6:
                stroke = stroke + "F6";
                break;
            case Keys.F7:
                stroke = stroke + "F7";
                break;
            case Keys.F8:
                stroke = stroke + "F8";
                break;
            case Keys.F9:
                stroke = stroke + "F9";
                break;
            case Keys.F10:
                stroke = stroke + "F10";
                break;
            case Keys.F11:
                stroke = stroke + "F11";
                break;
            case Keys.F12:
                stroke = stroke + "F12";
                break;
            case Keys.F13:
                stroke = stroke + "F13";
                break;
            case Keys.F14:
                stroke = stroke + "F14";
                break;
            case Keys.F15:
                stroke = stroke + "F15";
                break;
            case Keys.NUM_LOCK:
                stroke = stroke + "NUM_LOCK";
                break;
            case Keys.SCROLL_LOCK:
                stroke = stroke + "SCROLL_LOCK";
                break;
            case Keys.UP_DPAD:
                stroke = stroke + "UP_DPAD";
                break;
            case Keys.DOWN_DPAD:
                stroke = stroke + "DOWN_DPAD";
                break;
            case Keys.LEFT_DPAD:
                stroke = stroke + "LEFT_DPAD";
                break;
            case Keys.RIGHT_DPAD:
                stroke = stroke + "RIGHT_DPAD";
                break;
            case Keys.NUM_0:
                stroke = stroke + "0";
                break;
            case Keys.NUM_1:
                stroke = stroke + "1";
                break;
            case Keys.NUM_2:
                stroke = stroke + "2";
                break;
            case Keys.NUM_3:
                stroke = stroke + "3";
                break;
            case Keys.NUM_4:
                stroke = stroke + "4";
                break;
            case Keys.NUM_5:
                stroke = stroke + "5";
                break;
            case Keys.NUM_6:
                stroke = stroke + "6";
                break;
            case Keys.NUM_7:
                stroke = stroke + "7";
                break;
            case Keys.NUM_8:
                stroke = stroke + "8";
                break;
            case Keys.NUM_9:
                stroke = stroke + "9";
                break;
            case Keys.CHAR_A:
                stroke = stroke + "A";
                break;
            case Keys.CHAR_B:
                stroke = stroke + "B";
                break;
            case Keys.CHAR_C:
                stroke = stroke + "C";
                break;
            case Keys.CHAR_D:
                stroke = stroke + "D";
                break;
            case Keys.CHAR_E:
                stroke = stroke + "E";
                break;
            case Keys.CHAR_F:
                stroke = stroke + "F";
                break;
            case Keys.CHAR_G:
                stroke = stroke + "G";
                break;
            case Keys.CHAR_H:
                stroke = stroke + "H";
                break;
            case Keys.CHAR_I:
                stroke = stroke + "I";
                break;
            case Keys.CHAR_J:
                stroke = stroke + "J";
                break;
            case Keys.CHAR_K:
                stroke = stroke + "K";
                break;
            case Keys.CHAR_L:
                stroke = stroke + "L";
                break;
            case Keys.CHAR_M:
                stroke = stroke + "M";
                break;
            case Keys.CHAR_N:
                stroke = stroke + "N";
                break;
            case Keys.CHAR_O:
                stroke = stroke + "O";
                break;
            case Keys.CHAR_P:
                stroke = stroke + "P";
                break;
            case Keys.CHAR_Q:
                stroke = stroke + "Q";
                break;
            case Keys.CHAR_R:
                stroke = stroke + "R";
                break;
            case Keys.CHAR_S:
                stroke = stroke + "S";
                break;
            case Keys.CHAR_T:
                stroke = stroke + "T";
                break;
            case Keys.CHAR_U:
                stroke = stroke + "U";
                break;
            case Keys.CHAR_V:
                stroke = stroke + "V";
                break;
            case Keys.CHAR_W:
                stroke = stroke + "W";
                break;
            case Keys.CHAR_X:
                stroke = stroke + "X";
                break;
            case Keys.CHAR_Y:
                stroke = stroke + "Y";
                break;
            case Keys.CHAR_Z:
                stroke = stroke + "Z";
                break;
            case Keys.SLASH :
                stroke = stroke + "/";
                break;
            default:
        }
        return stroke;
    }
}
