Ejemplo n.º 1
0
        internal BindResult <Motion> Process(string input, bool enter = false)
        {
            var res = _capture.GetMotionAndCount(KeyInputUtil.CharToKeyInput(input[0]));

            foreach (var cur in input.Skip(1))
            {
                Assert.True(res.IsNeedMoreInput);
                var needMore = res.AsNeedMoreInput();
                res = needMore.Item.BindFunction.Invoke(KeyInputUtil.CharToKeyInput(cur));
            }

            if (enter)
            {
                var needMore = res.AsNeedMoreInput();
                res = needMore.Item.BindFunction.Invoke(KeyInputUtil.EnterKey);
            }

            return(res.Convert(x => x.Item1));
        }
Ejemplo n.º 2
0
        internal BindResult <Motion> Process(string input, bool enter = false)
        {
            var keyInputSet = KeyNotationUtil.StringToKeyInputSet(input);
            var res         = _capture.GetMotionAndCount(keyInputSet.FirstKeyInput.Value);

            foreach (var keyInput in keyInputSet.Rest.KeyInputs)
            {
                Assert.True(res.IsNeedMoreInput);
                var needMore = res.AsNeedMoreInput();
                res = needMore.BindData.BindFunction.Invoke(keyInput);
            }

            if (enter)
            {
                var needMore = res.AsNeedMoreInput();
                res = needMore.BindData.BindFunction.Invoke(KeyInputUtil.EnterKey);
            }

            return(res.Convert(x => x.Item1));
        }
Ejemplo n.º 3
0
 public static BindResult <Tuple <Motion, FSharpOption <int> > > GetMotionAndCount(this IMotionCapture capture, char c)
 {
     return(capture.GetMotionAndCount(KeyInputUtil.CharToKeyInput(c)));
 }