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)); }
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)); }
public static BindResult <Tuple <Motion, FSharpOption <int> > > GetMotionAndCount(this IMotionCapture capture, char c) { return(capture.GetMotionAndCount(KeyInputUtil.CharToKeyInput(c))); }