protected override void OnAttached(InputRecorder inputRecorder) { Assert.IsTrue(inputRecorder.FrameDataRecorder is FrameInputData); var frameInputData = inputRecorder.FrameDataRecorder as FrameInputData; TestRecorder.RegistToFrameInputData(); frameInputData.AddChildRecorder(CreateInputData()); }
private void FinishPlaying(InputRecorder _recorder) { // swap from playing to recording string filePath = GetNewFilePath(); File.Copy(recorder.GetFilePath(), filePath); recorder.RecordAfterPlay(filePath); }
public void Restart(int _seed) { Stop(); string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); recorder = new InputRecorder(true, true, version, SaveSaveState, LoadSaveState); recorder.FinishPlaying += FinishPlaying; recorder.Record(GetNewFilePath(), _seed); playing = false; }
void Awake() { if (instance != null) { Destroy(gameObject); } instance = this; m_Recorder = GetComponent <InputRecorder>(); }
public Form1() { // Initializing UI InitializeComponent(); // Initializing the recorder this.inputRecorder = new InputRecorder(); this.inputRecorder.Pressed += InputRecorder_Pressed; this.inputRecorder.Start(); }
public MainViewModel(InputRecorder recorder) { // Catching input events this.inputRecorder = recorder; this.inputRecorder.Pressed += InputRecorder_Pressed; // Populating actions this.MyActions = new ObservableCollection <MyAction>(); this.MyActions.Add(new MyAction("First action")); this.MyActions.Add(new MyAction("Second action")); this.MyActions.Add(new MyAction("Last action")); }
private void Awake() { _inputRecorder = GetComponent <InputRecorder>(); _sampleRate = 1f / SetSampleRate; if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } _desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); _desktopFolderPath = Path.GetFullPath(Path.Combine(_desktopPath, "WestdriveLoopARData")); }
/// <summary> /// Console application entry point /// </summary> /// <param name="args">Startup arguments</param> static void Main(string[] args) { // Initializing the recorder // Only pads inputs are allowed for console applications InputRecorder inputRecorder = new InputRecorder(InputType.Pad); inputRecorder.Pressed += InputRecorder_Pressed; try { // Starting the recorde inputRecorder.Start(); // Intercepting inputs Console.WriteLine("------> Input recorder started"); Console.WriteLine("[ESC] : Exit"); Console.WriteLine("------------------------------"); bool exit = false; while (!exit) { ConsoleKeyInfo key = Console.ReadKey(true); switch (key.Key) { case ConsoleKey.Escape: exit = true; break; } } } catch (Exception ex) { // Errors happens... Console.WriteLine("-> " + ex.Message); Console.ReadKey(); } finally { // Stopping the recorder inputRecorder.Stop(); } }
protected override void OnStartup(StartupEventArgs e) { try { // Initializing the recorder // We are catching keyboard and pad events this.inputRecorder = new InputRecorder(InputType.Keyboard | InputType.Pad); this.inputRecorder.Start(); // Showing the main view MainView view = new MainView() { DataContext = new MainViewModel(this.inputRecorder) }; view.ShowDialog(); } catch (Exception ex) { // Oopss, an error occured... MessageBox.Show(ex.Message, "DemoMVVM", MessageBoxButton.OK, MessageBoxImage.Exclamation); Application.Current.Shutdown(); } }
public void Stop() { recorder?.Dispose(); recorder = null; }
private void AttachRecorderImpl(IntPtr window, InputRecorder recorder, CooperativeLevelFlags cooperativeLevelFlags) { if (this.running) { throw new InvalidOperationException("Already attached"); } this.recordedSequenceQueue = new BlockingQueue<IInputSequence>(); (this.recordingHandlerThread = new Thread(RecordingHandler) { Name = "Direct Input Recording Runner", IsBackground = true }).Start(); this.recording = true; this.recordingHandler = recorder; AttachImpl(window, cooperativeLevelFlags); }
public void AttachRecorder(IntPtr window, InputRecorder recorder) { AttachRecorderImpl(window, recorder, ForegroundFlags); }
public void AttachRecorder(InputRecorder recorder) { AttachRecorderImpl(IntPtr.Zero, recorder, BackgroundFlags); }
public void SetUp() { _recorder = new InputRecorder(); }
public NebulaClient(AbstractSender <RecordedInput> inputSender, AbstractReciver <IPacket> packetReciver, InputRecorder inputRecorder) { _inputSender = inputSender; _packetReciver = packetReciver; _inputRecorder = inputRecorder; }