private void UpdatePathing(object sender, EventArgs e) { string correctedGamePath = AMLUtils.FixGamePath(gamePathBox.Text); string correctedLocalPath = AMLUtils.FixBasePath(localPathBox.Text); if (string.IsNullOrEmpty(correctedGamePath) || !AMLUtils.IsValidPath(correctedGamePath)) { gamePathBox.Text = BaseForm.ModManager.GamePath; this.ShowBasicButton("The specified game path is invalid!", "OK", null, null); return; } if (string.IsNullOrEmpty(correctedLocalPath) || !AMLUtils.IsValidPath(correctedLocalPath)) { localPathBox.Text = BaseForm.ModManager.BasePath; this.ShowBasicButton("The specified local path is invalid!", "OK", null, null); return; } BaseForm.ModManager.ValidPlatformTypesToPaths[PlatformType.Custom] = correctedGamePath; BaseForm.ModManager.CustomBasePath = correctedLocalPath; BaseForm.ModManager.RefreshAllPlatformsList(); BaseForm.SwitchPlatform(PlatformType.Custom); this.UpdateLabels(); }
private void RunOKButton() { PerformPathSubstitutions(); if (AllowBrowse && !AMLUtils.IsValidPath(gamePathBox.Text)) { ShowWarning("This is not a valid path!"); return; } if (gamePathBox.Text != null && gamePathBox.Text.Length > 0) { var doneText = gamePathBox.Text; if (AllowBrowse && doneText[doneText.Length - 1] == Path.DirectorySeparatorChar) { doneText = doneText.Substring(0, doneText.Length - 1); } switch (VerifyMode) { case VerifyPathMode.Base: doneText = AMLUtils.FixBasePath(doneText); if (string.IsNullOrEmpty(doneText)) { ShowWarning("This is not the correct path!"); OutputText = null; return; } break; case VerifyPathMode.Game: doneText = AMLUtils.FixGamePath(doneText); if (doneText == null) { ShowWarning("This is not the correct path!"); OutputText = null; return; } break; } OutputText = doneText; this.DialogResult = DialogResult.OK; this.Close(); } }