public void Load() { if (System.IO.File.Exists("joystickconfig.json")) { try { string json = System.IO.File.ReadAllText("joystickconfig.json"); NJoystickConfig config = JsonConvert.DeserializeObject <NJoystickConfig>(json); this.Up = config.Up; this.Down = config.Down; this.Left = config.Left; this.Right = config.Right; this.ConfirmButton = config.ConfirmButton; this.EscButton = config.EscButton; this.CloseButton1 = config.CloseButton1; this.CloseButton2 = config.CloseButton2; this.DeviceInstaceName = config.DeviceInstaceName; } catch (Exception ex) { throw new Exception($"{nameof(Load)}: It was impossible read founded config: {ex.Message}"); } } }
public void ResetMap() { _joystickConfig = new NJoystickConfig(); }
public NJoystick(NostalgicPlay form) { _form = form; _joystickConfig = new NJoystickConfig(); _joystickConfig.Load(); }