void loadDefaults() { RestrictPlatforms = true; ConfirmExit = true; ConfirmSave = true; ConfirmTest = true; DeleteTestPilots = true; RememberPlatformFolder = true; ConfirmFGDelete = true; MapOptions = MapOpts.FGTags | MapOpts.Traces; for (int i = 0; i < 6; i++) { _recentMissions[i] = ""; } Startup = StartupMode.Normal; XwingCraft = 1; XwingIff = 1; //0 = Default, 1 = Rebel TieCraft = XvtCraft = XwaCraft = 5; TieIff = XvtIff = XwaIff = 1; Verify = true; VerifyTest = true; Waypoints = 1; ColorizedDropDowns = true; ColorInteractSelected = Color.Blue; ColorInteractNonSelected = Color.Black; ColorInteractBackground = Color.RosyBrown; MapMouseWheelZoomPercentage = 10.0; WireframeEnabled = true; WireframeIconThresholdEnabled = false; WireframeIconThresholdSize = 25; WireframeMeshIconEnabled = true; WireframeMeshIconSize = 18; WireframeMeshTypeVisibility = MeshTypeHelper.GetDefaultFlags(); XwingDetectMission = true; TieDetectMission = true; XvtDetectMission = true; XwaDetectMission = true; XwingOverrideExternal = false; TieOverrideExternal = false; XvtOverrideExternal = false; XwaOverrideExternal = false; XwaOverrideScan = true; XwaFlagRemappedCraft = true; MapMiddleClickActionSelected = MapForm.MiddleClickAction.FitToSelection; MapMiddleClickActionNoneSelected = MapForm.MiddleClickAction.FitToWorld; MapSnapTo = 0; MapSnapAmount = 0.10f; MapSnapUnit = 0; }
void cmdOK_Click(object sender, EventArgs e) { if (optStartNormal.Checked) { _config.Startup = Settings.StartupMode.Normal; } else if (optStartPlat.Checked) { _config.Startup = Settings.StartupMode.LastPlatform; } else { _config.Startup = Settings.StartupMode.LastMission; } _config.RestrictPlatforms = chkRestrict.Checked; _config.ConfirmExit = chkExit.Checked; _config.ConfirmSave = chkSave.Checked; _config.XwingInstalled = chkXWInstall.Checked; _config.XwingPath = txtXW.Text; _config.TieInstalled = chkTIEInstall.Checked; _config.TiePath = txtTIE.Text; _config.XvtInstalled = chkXvTInstall.Checked; _config.XvtPath = txtXvT.Text; _config.BopInstalled = chkBoPInstall.Checked; _config.BopPath = txtBoP.Text; _config.XwaInstalled = chkXWAInstall.Checked; _config.XwaPath = txtXWA.Text; _config.Verify = chkVerify.Checked; _config.VerifyLocation = txtVerify.Text; int temp = 0; for (int i = 0; i < 22; i++) { temp += (chkWP[i].Checked ? 1 << i : 0); } _config.Waypoints = temp; _config.MapOptions = (_config.MapOptions ^ (_config.MapOptions & Settings.MapOpts.FGTags)) | (chkFG.Checked ? Settings.MapOpts.FGTags : Settings.MapOpts.None); _config.MapOptions = (_config.MapOptions ^ (_config.MapOptions & Settings.MapOpts.Traces)) | (chkTrace.Checked ? Settings.MapOpts.Traces : Settings.MapOpts.None); _config.XwingCraft = (byte)cboXWCraft.SelectedIndex; _config.XwingIff = (byte)cboXWIFF.SelectedIndex; _config.TieCraft = (byte)cboTIECraft.SelectedIndex; _config.TieIff = (byte)cboTIEIFF.SelectedIndex; _config.XvtCraft = (byte)cboXvTCraft.SelectedIndex; _config.XvtIff = (byte)cboXvTIFF.SelectedIndex; _config.XwaCraft = (byte)cboXWACraft.SelectedIndex; _config.XwaIff = (byte)cboXWAIFF.SelectedIndex; _config.ConfirmTest = chkTest.Checked; _config.DeleteTestPilots = chkDeletePilot.Checked; _config.RememberPlatformFolder = chkRememberPlatformFolder.Checked; //[JB] _config.ConfirmFGDelete = chkConfirmFGDelete.Checked; //[JB] _config.VerifyTest = chkVerifyTest.Checked; _config.InitializeUsingSuperBackdrops = chkBackdrops.Checked; #pragma warning disable IDE0059 // Unnecessary assignment of a value int sel = Color.Blue.ToArgb(); int nsel = Color.Black.ToArgb(); int background = Color.RosyBrown.ToArgb(); #pragma warning restore IDE0059 // Unnecessary assignment of a value int.TryParse(txtColorSelected.Text, System.Globalization.NumberStyles.HexNumber, null, out sel); int.TryParse(txtColorNonSelected.Text, System.Globalization.NumberStyles.HexNumber, null, out nsel); int.TryParse(txtColorBackground.Text, System.Globalization.NumberStyles.HexNumber, null, out background); sel += 0xFF << 24; //Add the alpha channel back in nsel += 0xFF << 24; background += 0xFF << 24; _config.ColorInteractSelected = Color.FromArgb(sel); _config.ColorInteractNonSelected = Color.FromArgb(nsel); _config.ColorInteractBackground = Color.FromArgb(background); _config.MapMouseWheelZoomPercentage = Convert.ToDouble(numMousewheelZoom.Value); _config.WireframeEnabled = chkWireEnabled.Checked; _config.WireframeIconThresholdEnabled = chkWireIconThreshold.Checked; _config.WireframeIconThresholdSize = Convert.ToInt32(numWireIconThreshold.Value); _config.WireframeMeshIconEnabled = chkWireMeshIcon.Checked; _config.WireframeMeshIconSize = Convert.ToInt32(numWireMeshIcon.Value); int[] selectionArray = new int[lstWireMeshTypes.Items.Count]; lstWireMeshTypes.SelectedIndices.CopyTo(selectionArray, 0); _config.WireframeMeshTypeVisibility = MeshTypeHelper.GetFlags(selectionArray); _config.XwingDetectMission = chkXwingDetectMission.Checked; _config.TieDetectMission = chkTieDetectMission.Checked; _config.XvtDetectMission = chkXvtDetectMission.Checked; _config.XwaDetectMission = chkXwaDetectMission.Checked; _config.XwingOverrideExternal = chkXwingOverrideExternal.Checked; _config.TieOverrideExternal = chkTieOverrideExternal.Checked; _config.XvtOverrideExternal = chkXvtOverrideExternal.Checked; _config.XwaOverrideExternal = chkXwaOverrideExternal.Checked; _config.XwaOverrideScan = chkXwaOverrideScan.Checked; _config.XwaFlagRemappedCraft = chkXwaFlagRemappedCraft.Checked; _config.MapMiddleClickActionSelected = (MapForm.MiddleClickAction)cboMiddleClickActionSelected.SelectedIndex; _config.MapMiddleClickActionNoneSelected = (MapForm.MiddleClickAction)cboMiddleClickAction.SelectedIndex; _closeCallback?.Invoke(0, new EventArgs()); Close(); }