コード例 #1
0
        public void Test(string expected, string strAppState, string key)
        {
            var appState  = TestHelpers.CreateAppState(strAppState);
            var inputKey  = DomainUtils.CreateInputKey(key);
            var config    = TestHelpers.CreateConfig();
            var processor = new CommandKeysProcessor(inputKey, appState, config.commandKeys);
            var result    = processor.Process();
            var actual    = result != null?result.ToString() : "";

            Assert.Equal(expected, actual);
        }
コード例 #2
0
        public KeysProcessorResult ProcessKey()
        {
            //modificatorsChange
            var result = ProcessModifChange();

            if (result != null)
            {
                return(result);
            }
            if (_isUp)
            {
                return(CreateEmptyKeysEngineResult());
            }
            //stateChange
            result = ProcessStateChange();
            if (result != null)
            {
                return(result);
            }
            if (_appState.state == State.Off)
            {
                return(CreateEmptyKeysEngineResult());
            }
            //sigleStepKey
            result = new SingleStepProcessor(_inputKey, _appState, _config.mappedKeys).TryGetSingleStep();
            if (result != null)
            {
                return(result);
            }
            //doubleStepKey
            result = new DoubleStepProcessor(_inputKey, _appState, _config.mappedKeys).TryGetSingleStep();
            if (result != null)
            {
                return(result);
            }
            //commandKey
            result = new CommandKeysProcessor(_inputKey, _appState, _config.commandKeys).Process();
            if (result != null)
            {
                return(result);
            }
            //capitalKey
            return(new MappedKeysProcessor(_inputKey, _appState, _config.mappedKeys).Process());
        }