Skip to content

Commit

Permalink
Added a way to pick where mods should be stored.
Browse files Browse the repository at this point in the history
  • Loading branch information
FelisDiligens committed Mar 8, 2023
1 parent c14161b commit 6a60d66
Show file tree
Hide file tree
Showing 12 changed files with 278 additions and 127 deletions.
112 changes: 81 additions & 31 deletions Fo76ini/Forms/FormMain/Views/UserControlProfiles.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions Fo76ini/Forms/FormMain/Views/UserControlProfiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ private void UpdateEditingScreen()
this.radioButtonLaunchViaExecutable.Checked = game.PreferredLaunchOption == LaunchOption.RunExec;

this.textBoxGamePath.Text = game.GamePath;
this.textBoxModsPath.Text = game.ModsPath;
this.textBoxExecutable.Text = game.ExecutableName;
this.textBoxIniPrefix.Text = game.IniPrefix;
this.textBoxIniPath.Text = game.IniParentPath;
Expand Down Expand Up @@ -342,6 +343,50 @@ private void linkLabelAutoDetect_LinkClicked(object sender, LinkLabelLinkClicked
#endregion


/* Mods location */
#region Mods location
private void textBoxModsPath_TextChanged(object sender, EventArgs e)
{
if (UpdatingUI)
return;

ProfileManager.SelectedGame.ModsPath = Utils.SanitizePath(this.textBoxModsPath.Text);
this.textBoxModsPath.ForeColor = (this.textBoxModsPath.Text == "" || ProfileManager.SelectedGame.ValidateModsPath()) ? Color.Black : Color.Maroon;
}

private void buttonPickModsPath_Click(object sender, EventArgs e)
{
if (UpdatingUI)
return;

CommonOpenFileDialog dialog = new CommonOpenFileDialog();
dialog.IsFolderPicker = true;
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
{
string path = dialog.FileName;
if (GameInstance.ValidateModsPath(path))
{
this.textBoxModsPath.Text = path;
ProfileManager.SelectedGame.ModsPath = path;
UpdateEditingScreen();
}
else
MsgBox.ShowID("modsGamePathInvalid");
}
this.Focus();
}

private void linkLabelResetModsPath_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
if (UpdatingUI)
return;

this.textBoxModsPath.Text = "";
ProfileManager.SelectedGame.ModsPath = "";
}
#endregion


/* Launch options */
#region Launch options

Expand Down
Loading

0 comments on commit 6a60d66

Please sign in to comment.