public frmGameConfig(GameSpecificInfo configInfo) { InitializeComponent(); GameSpecificInfo existingConfig = GameSpecificInfo.GetGameSpecificInfo(); GameDipswitchDefinition dipswitchDefinition = GameDipswitchDefinition.GetDipswitchDefinition(); if (existingConfig == null && dipswitchDefinition != null) { configInfo.DipSwitches = dipswitchDefinition.DefaultDipSwitches; } if (dipswitchDefinition != null) { _dipSwitches = dipswitchDefinition.DipSwitches; } else { _dipSwitches = new List <List <string> >(); for (int i = 0, len = (int)InteropEmu.GetDipSwitchCount(); i < len; i++) { _dipSwitches.Add(new List <string>(new string[] { "Dipswitch #" + i.ToString(), "Off", "On" })); } } if (_dipSwitches.Count > 8) { this.Width *= 2; } Entity = configInfo; InitializeDipSwitches(); }
private void btnReset_Click(object sender, EventArgs e) { GameDipswitchDefinition defaultConfig = GameDipswitchDefinition.GetDipswitchDefinition(); ((GameSpecificInfo)Entity).DipSwitches = defaultConfig?.DefaultDipSwitches ?? 0; UpdateUI(); UpdateDipSwitches(); }