public void RecordEnd() { if (currState.Get() != State.RECORDING) { return; } currState.Set(State.IDLE); hideOverlayHandle.Notify(); recKey = null; recMouse = null; if (rec.Keyframes.Count > 0) { var last = rec.Keyframes.Last; var sLast = last.Previous; Console.WriteLine(last.Value.ToString()); Console.WriteLine(sLast.Value.ToString()); if (sLast.Value.ToString().Contains("Shift") && last.Value.ToString().Contains("Escape")) { rec.Keyframes.Remove(last); rec.Keyframes.Remove(sLast); } ; } newRecordingHandle.Notify(rec); //Console.WriteLine(rec.ToString()); }
public void RecordBegin() { if (currState.Get() != State.IDLE) { return; } currState.Set(State.RECORDING); showOverlayHandle.Notify(MyColors.RED); rec = new Recording(); startT = Time.Millis(); Func <long> GetTimestamp = () => { return(Time.Millis() - startT); }; recKey = (d, k) => { KeyActions ka; switch (k) { case Key.LeftAlt: case Key.RightAlt: case Key.LeftShift: case Key.RightShift: case Key.LeftCtrl: case Key.RightCtrl: case Key.LWin: case Key.RWin: ka = d ? KeyActions.DOWN : KeyActions.UP; break; default: if (!d) { return; } ka = KeyActions.PRESS; break; } rec.AddKeyframe(ka, k, GetTimestamp()); }; //bool ld = false, rd = false, md = false; int px = -1, py = -1; //Recording.KeyFrameM prevK; bool isLastMove = false; recMouse = (a, x, y) => { //if (a == MouseAction.WM_LBUTTONDOWN) ld = true; //if (a == MouseAction.WM_RBUTTONDOWN) rd = true; //if (a == MouseAction.WM_MBUTTONDOWN) md = true; //if (a == MouseAction.WM_LBUTTONUP) ld = false; //if (a == MouseAction.WM_RBUTTONUP) rd = false; //if (a == MouseAction.WM_MBUTTONUP) md = false; if (a == MouseAction.WM_MOUSEMOVE /*&& !ld && !rd && !md*/) { px = x; py = y; isLastMove = true; return; } else { if (isLastMove) { rec.AddKeyframe(MouseAction.WM_MOUSEMOVE, px, py, GetTimestamp() - 1); } isLastMove = false; } rec.AddKeyframe(a, x, y, GetTimestamp()); }; }