static private SaveControls ( string FileOrNull ) : void | ||
FileOrNull | string | An absolute file path if we are exporting the controls, or a null reference to save to the default configuration location |
return | void |
// // SET CONTROL CUSTOM DATA // internal void SetControlKbdCustomData(Key key, Interface.KeyboardModifier keybMod) { if (isCustomisingControl) { Interface.CurrentControls[CustomControlIdx].Method = Interface.ControlMethod.Keyboard; Interface.CurrentControls[CustomControlIdx].Key = key; Interface.CurrentControls[CustomControlIdx].Modifier = keybMod; Interface.SaveControls(null); PopMenu(); isCustomisingControl = false; } }
// // SET CONTROL CUSTOM DATA // internal void SetControlKbdCustomData(Key key, Interface.KeyboardModifier keybMod) { //Check that we are customising a key, and that our key is NOT the menu back key if (isCustomisingControl && key != MenuBackKey && CustomControlIdx < Interface.CurrentControls.Length) { Interface.CurrentControls[CustomControlIdx].Method = Interface.ControlMethod.Keyboard; Interface.CurrentControls[CustomControlIdx].Key = key; Interface.CurrentControls[CustomControlIdx].Modifier = keybMod; Interface.SaveControls(null, Interface.CurrentControls); } PopMenu(); isCustomisingControl = false; }
internal void SetControlJoyCustomData(int device, Interface.JoystickComponent component, int element, int dir) { if (isCustomisingControl) { Interface.CurrentControls[CustomControlIdx].Method = Interface.ControlMethod.Joystick; Interface.CurrentControls[CustomControlIdx].Device = device; Interface.CurrentControls[CustomControlIdx].Component = component; Interface.CurrentControls[CustomControlIdx].Element = element; Interface.CurrentControls[CustomControlIdx].Direction = dir; Interface.SaveControls(null); PopMenu(); isCustomisingControl = false; } }
// export private void buttonControlsExport_Click(object sender, EventArgs e) { SaveFileDialog Dialog = new SaveFileDialog(); Dialog.OverwritePrompt = true; //Dialog.InitialDirectory = Interface.GetControlsFolder(); Dialog.Filter = Interface.GetInterfaceString("dialog_controlsfiles") + "|*.controls|" + Interface.GetInterfaceString("dialog_allfiles") + "|*"; if (Dialog.ShowDialog() == DialogResult.OK) { try { Interface.SaveControls(Dialog.FileName); } catch (Exception ex) { MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Hand); } } }
// export private void buttonControlsExport_Click(object sender, EventArgs e) { SaveFileDialog Dialog = new SaveFileDialog { OverwritePrompt = true, Filter = Translations.GetInterfaceString("dialog_controlsfiles") + @"|*.controls|" + Translations.GetInterfaceString("dialog_allfiles") + @"|*" }; if (Dialog.ShowDialog() == DialogResult.OK) { try { Interface.SaveControls(Dialog.FileName, Interface.CurrentControls); } catch (Exception ex) { MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Hand); } } }
internal void SetControlJoyCustomData(int device, Interface.JoystickComponent component, int element, int dir) { if (isCustomisingControl && CustomControlIdx < Interface.CurrentControls.Length) { if (JoystickManager.AttachedJoysticks[device] is JoystickManager.Raildriver) { Interface.CurrentControls[CustomControlIdx].Method = Interface.ControlMethod.RailDriver; } else { Interface.CurrentControls[CustomControlIdx].Method = Interface.ControlMethod.Joystick; } Interface.CurrentControls[CustomControlIdx].Device = device; Interface.CurrentControls[CustomControlIdx].Component = component; Interface.CurrentControls[CustomControlIdx].Element = element; Interface.CurrentControls[CustomControlIdx].Direction = dir; Interface.SaveControls(null, Interface.CurrentControls); PopMenu(); isCustomisingControl = false; } }