Merge pull request #70 from tr4wzified/betterlabel

Fix validation bugs, corrected error in README.md & MessageBox
This commit is contained in:
Timothy Baldridge 2019-10-05 12:28:14 -06:00 committed by GitHub
commit 3e4adb1f97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 8 deletions

View File

@ -174,7 +174,7 @@ Look at the [`RECIPES.md`] file, we keep a knowledgebase of how to deal with giv
**How do I contribute to Wabbajack?**
Look at the [`CONTRIBUTION.md`](https://github.com/halgari/wabbajack/blob/master/CONTRIBUTING.md) file for detailed guidelines.
Look at the [`CONTRIBUTING.md`](https://github.com/halgari/wabbajack/blob/master/CONTRIBUTING.md) file for detailed guidelines.
**Why does each modlist install another copy of Mod Organizer 2?**

View File

@ -30,10 +30,10 @@ namespace Wabbajack
private bool _ignoreMissingFiles;
private string _location;
private string _locationLabel;
private string _mo2Folder;
private string _mode;
private ModList _modList;
private string _modListName;
@ -64,9 +64,9 @@ namespace Wabbajack
if (Assembly.GetEntryAssembly().Location.ToLower().Contains("\\downloads\\"))
{
MessageBox.Show(
"This app seems to be running inside a folder called `Downloads`, such folders are often highly monitored by antivirus software and they can often " +
"conflict with the operations Wabbajack needs to perform. Please move this executable outside of your `Downloads` folder and then restart the app.",
"Cannot run inside `Downloads`",
"This app seems to be running inside a folder called 'Downloads', such folders are often highly monitored by antivirus software and they can often " +
"conflict with the operations Wabbajack needs to perform. Please move this executable outside of your 'Downloads' folder and then restart the app.",
"Cannot run inside 'Downloads'",
MessageBoxButton.OK,
MessageBoxImage.Error);
Environment.Exit(1);
@ -132,6 +132,16 @@ namespace Wabbajack
OnPropertyChanged("Location");
}
}
public string LocationLabel
{
get => _locationLabel;
set
{
_locationLabel = value;
OnPropertyChanged("LocationLabel");
}
}
public string DownloadLocation
@ -320,12 +330,20 @@ namespace Wabbajack
{
validationMessage = null;
}
else if (Location != null && Directory.Exists(Location) && File.Exists(Path.Combine(Location, "modlist.txt")))
else if (Mode == "Building" && Location != null && Directory.Exists(Location) && File.Exists(Path.Combine(Location, "modlist.txt")))
{
Location = Path.Combine(Location, "modlist.txt");
validationMessage = null;
ConfigureForBuild();
}
else if (Mode == "Installing" && Location != null && Directory.Exists(Location) && !Directory.EnumerateFileSystemEntries(Location).Any())
{
validationMessage = null;
}
else if (Mode == "Installing" && Location != null && Directory.Exists(Location) && Directory.EnumerateFileSystemEntries(Location).Any())
{
validationMessage = "You have selected a non-empty directory. Installing the modlist here might result in a broken install!";
}
else
{
validationMessage = "Invalid Mod Organizer profile directory";

View File

@ -64,7 +64,7 @@
<RowDefinition MinHeight="10" />
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="MO2 Profile:" Grid.Column="0" />
<Label Grid.Row="0" Content="{Binding LocationLabel}" Grid.Column="0" />
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Location, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" IsEnabled="{Binding UIReady}"/>
<Button Grid.Row="0" Content="Select" MinWidth="80" Grid.Column="2" Command="{Binding ChangePath}" IsEnabled="{Binding UIReady}"/>
<Label Grid.Row="2" Content="Download Location:" Grid.Column="0" />

View File

@ -42,7 +42,7 @@ namespace Wabbajack
Utils.SetStatusFn((msg, progress) => WorkQueue.Report(msg, progress));
UIUtils.Dispatcher = Dispatcher;
_state._nexusSiteURL = "https://github.com/halgari/wabbajack";
_state._nexusSiteURL = "https://github.com/wabbajack-tools/wabbajack";
new Thread(() =>
{
@ -50,10 +50,12 @@ namespace Wabbajack
{
Utils.Log("Compiler ready to execute");
context.Location = Path.GetDirectoryName(source);
context.LocationLabel = "MO2 Profile:";
}
else if (mode == RunMode.Install)
{
context.UIReady = false;
context.LocationLabel = "Installation Location:";
var modlist = Installer.LoadFromFile(source);
if (modlist == null)
{