private void SetControlMode(ControlMode controlMode) { m_ControlMode = controlMode; if (m_ControlMode == ControlMode.Macro) { // Setup callback to interceptor Interceptor.Callback = new InterceptionDelegate(m_MacroPlayer.OnReceiveData); recordButton.Enabled = true; clearButton.Enabled = true; scriptButton.Enabled = false; } else if (m_ControlMode == ControlMode.Script) { // Stop macro player if (m_MacroPlayer.IsRecording) { m_MacroPlayer.Record(); } m_MacroPlayer.Stop(); // Setup callback to interceptor Interceptor.Callback = new InterceptionDelegate(m_ScriptHost.OnReceiveData); recordButton.Enabled = false; clearButton.Enabled = false; scriptButton.Enabled = true; currentTickToolStripStatusLabel.Text = CURRENT_TICK_DEFAULT_TEXT; } }
private void ExecuteRemapAction(MappingAction action, DualShockState state) { if (state == null) { state = new DualShockState(); } // Try to set property using Reflection bool didSetProperty = false; try { RemapperUtility.SetValue(state, action.Property, action.Value); didSetProperty = true; } catch (Exception ex) { Debug.WriteLine(ex.StackTrace); } if (didSetProperty) { MacroPlayer.Stop(); UsingMacroPlayer = false; state.Battery = 255; state.IsCharging = true; CurrentState = state; } }
private void ExecuteMacroAction(MacroAction action) { //// TODO: Load sequence from cache ////List<DualShockState> sequence = new List<DualShockState>(); UsingMacroPlayer = true; MacroPlayer.Stop(); MacroPlayer.LoadFile(action.Path); MacroPlayer.Play(); }
private void SetControlMode(ControlMode controlMode) { m_ControlMode = controlMode; Console.WriteLine("SetControlMode:" + controlMode); if (m_ControlMode == ControlMode.Macro) { // Stop script and remove if (m_ScriptHost != null && m_ScriptHost.IsRunning) { m_ScriptHost.Stop(); m_ScriptHost = null; } // Setup callback to interceptor Interceptor.Callback = new InterceptionDelegate(m_MacroPlayer.OnReceiveData); recordButton.Enabled = true; recordToolStripMenuItem.Enabled = true; loopCheckBox.Enabled = true; loopCheckBox.Checked = m_MacroPlayer.Loop; loopToolStripMenuItem.Enabled = true; recordOnTouchToolStripMenuItem.Enabled = true; scriptButton.Enabled = false; saveToolStripMenuItem.Enabled = true; saveAsToolStripMenuItem.Enabled = true; clearMacroToolStripMenuItem.Enabled = true; trimMacroToolStripMenuItem.Enabled = true; } else if (m_ControlMode == ControlMode.Script) { // Stop macro player if (m_MacroPlayer.IsRecording) { m_MacroPlayer.Record(); } m_MacroPlayer.Stop(); // Setup callback to interceptor Interceptor.Callback = new InterceptionDelegate(m_ScriptHost.OnReceiveData); recordButton.Enabled = false; recordToolStripMenuItem.Enabled = false; loopCheckBox.Enabled = false; loopCheckBox.Checked = false; loopToolStripMenuItem.Enabled = false; recordOnTouchToolStripMenuItem.Enabled = false; scriptButton.Enabled = true; saveToolStripMenuItem.Enabled = false; saveAsToolStripMenuItem.Enabled = false; clearMacroToolStripMenuItem.Enabled = false; trimMacroToolStripMenuItem.Enabled = false; currentTickToolStripStatusLabel.Text = CURRENT_TICK_DEFAULT_TEXT; } else if (m_ControlMode == ControlMode.Remapper) { // Stop macro player if (m_MacroPlayer.IsRecording) { m_MacroPlayer.Record(); } m_MacroPlayer.Stop(); // Stop script if (m_ScriptHost != null && m_ScriptHost.IsRunning) { m_ScriptHost.Stop(); } // Setup callback to interceptor Interceptor.Callback = new InterceptionDelegate(m_Remapper.OnReceiveData); } else if (m_ControlMode == ControlMode.StatusChecker) { // Stop macro player if (m_MacroPlayer.IsRecording) { m_MacroPlayer.Record(); } m_MacroPlayer.Stop(); // Stop script if (m_ScriptHost != null && m_ScriptHost.IsRunning) { m_ScriptHost.Stop(); } // Setup callback to interceptor Interceptor.Callback = new InterceptionDelegate(m_StatusChecker.OnReceiveData); } }