From d0a4e277657309f40ab6f10627426a63e8e99acb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Mon, 4 Apr 2016 02:52:32 +0200 Subject: [PATCH] Remove the now redundant KeyActionfactory. --- .../config-items/KeyActionFactory.ts | 51 ------------------- 1 file changed, 51 deletions(-) delete mode 100644 config-serializer/config-items/KeyActionFactory.ts diff --git a/config-serializer/config-items/KeyActionFactory.ts b/config-serializer/config-items/KeyActionFactory.ts deleted file mode 100644 index 0f261843..00000000 --- a/config-serializer/config-items/KeyActionFactory.ts +++ /dev/null @@ -1,51 +0,0 @@ -class KeyActionFactory implements SubclassFactory { - - fromJsObject(jsObject: any): KeyAction { - switch (jsObject.keyActionType) { - case KeyActionType.NoneAction: - return new NoneAction().fromJsObject(jsObject); - case KeyActionType.KeystrokeAction: - return new KeystrokeAction().fromJsObject(jsObject); - case KeyActionType.KeystrokeWithModifiersAction: - return new KeystrokeWithModifiersAction().fromJsObject(jsObject); - case KeyActionType.DualRoleKeystrokeAction: - return new DualRoleKeystrokeAction().fromJsObject(jsObject); - case KeyActionType.SwitchLayerAction: - return new SwitchLayerAction().fromJsObject(jsObject); - case KeyActionType.SwitchKeymapAction: - return new SwitchKeymapAction().fromJsObject(jsObject); - case KeyActionType.MouseAction: - return new MouseAction().fromJsObject(jsObject); - case KeyActionType.PlayMacroAction: - return new PlayMacroAction().fromJsObject(jsObject); - default: - throw `Invalid KeyAction.keyActionType: "${jsObject.actionType}"`; - } - } - - fromBinary(buffer: UhkBuffer): KeyAction { - let keyActionFirstByte = buffer.readUInt8(); - buffer.backtrack(); - - switch (keyActionFirstByte) { - case KeyActionId.NoneAction: - return new NoneAction().fromBinary(buffer); - case KeyActionId.KeystrokeAction: - return new KeystrokeAction().fromBinary(buffer); - case KeyActionId.KeystrokeWithModifiersAction: - return new KeystrokeWithModifiersAction().fromBinary(buffer); - case KeyActionId.DualRoleKeystrokeAction: - return new DualRoleKeystrokeAction().fromBinary(buffer); - case KeyActionId.SwitchLayerAction: - return new SwitchLayerAction().fromBinary(buffer); - case KeyActionId.SwitchKeymapAction: - return new SwitchKeymapAction().fromBinary(buffer); - case KeyActionId.MouseAction: - return new MouseAction().fromBinary(buffer); - case KeyActionId.PlayMacroAction: - return new PlayMacroAction().fromBinary(buffer); - default: - throw `Invalid KeyAction first byte: ${keyActionFirstByte}`; - } - } -}