mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Add NoMatchInclude support to the UI
This commit is contained in:
parent
0a2abfa1be
commit
06674a22f8
@ -87,6 +87,7 @@ namespace Wabbajack
|
||||
[Reactive] public bool IsMO2Compilation { get; set; }
|
||||
|
||||
[Reactive] public RelativePath[] AlwaysEnabled { get; set; } = Array.Empty<RelativePath>();
|
||||
[Reactive] public RelativePath[] NoMatchInclude { get; set; } = Array.Empty<RelativePath>();
|
||||
|
||||
[Reactive] public string[] OtherProfiles { get; set; } = Array.Empty<string>();
|
||||
|
||||
@ -181,6 +182,7 @@ namespace Wabbajack
|
||||
SelectedProfile = settings.Profile;
|
||||
OtherProfiles = settings.OtherProfiles;
|
||||
AlwaysEnabled = settings.AlwaysEnabled;
|
||||
NoMatchInclude = settings.NoMatchInclude;
|
||||
}
|
||||
|
||||
|
||||
@ -204,6 +206,7 @@ namespace Wabbajack
|
||||
Profile = SelectedProfile,
|
||||
OtherProfiles = OtherProfiles,
|
||||
AlwaysEnabled = AlwaysEnabled,
|
||||
NoMatchInclude = NoMatchInclude,
|
||||
UseGamePaths = true
|
||||
};
|
||||
|
||||
@ -264,8 +267,9 @@ namespace Wabbajack
|
||||
Profile = SelectedProfile,
|
||||
UseGamePaths = true,
|
||||
OutputFile = OutputLocation.TargetPath.Combine(SelectedProfile).WithExtension(Ext.Wabbajack),
|
||||
AlwaysEnabled = AlwaysEnabled.ToArray(),
|
||||
OtherProfiles = OtherProfiles.ToArray()
|
||||
AlwaysEnabled = AlwaysEnabled,
|
||||
OtherProfiles = OtherProfiles,
|
||||
NoMatchInclude = NoMatchInclude,
|
||||
};
|
||||
}
|
||||
|
||||
@ -291,6 +295,16 @@ namespace Wabbajack
|
||||
AlwaysEnabled = AlwaysEnabled.Where(p => p != path).ToArray();
|
||||
}
|
||||
|
||||
public void AddNoMatchInclude(RelativePath path)
|
||||
{
|
||||
NoMatchInclude = (NoMatchInclude ?? Array.Empty<RelativePath>()).Append(path).Distinct().ToArray();
|
||||
}
|
||||
|
||||
public void RemoveNoMatchInclude(RelativePath path)
|
||||
{
|
||||
NoMatchInclude = NoMatchInclude.Where(p => p != path).ToArray();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -144,6 +144,19 @@
|
||||
ToolTip="If this box has a value the modlist will be published to this MachineUrl after compilation" />
|
||||
<TextBox x:Name="MachineUrl" Style="{StaticResource ValueStyle}" />
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Name="AddNoMatchInclude">
|
||||
<icon:Material Kind="Plus"></icon:Material>
|
||||
</Button>
|
||||
<Label>No Match Include</Label>
|
||||
</StackPanel>
|
||||
<ListBox x:Name="NoMatchInclude">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<controls1:RemovableItemView ViewModel="{Binding}" ></controls1:RemovableItemView>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Name="AddOtherProfile">
|
||||
|
@ -113,6 +113,7 @@ namespace Wabbajack
|
||||
|
||||
AddAlwaysEnabled.Command = ReactiveCommand.CreateFromTask(async () => await AddAlwaysEnabledCommand());
|
||||
|
||||
|
||||
ViewModel.WhenAnyValue(vm => vm.OtherProfiles)
|
||||
.WhereNotNull()
|
||||
.Select(itms => itms.Select(itm => new RemovableItemViewModel(itm.ToString(), () => ViewModel.RemoveProfile(itm))).ToArray())
|
||||
@ -121,6 +122,14 @@ namespace Wabbajack
|
||||
|
||||
AddOtherProfile.Command = ReactiveCommand.CreateFromTask(async () => await AddOtherProfileCommand());
|
||||
|
||||
ViewModel.WhenAnyValue(vm => vm.NoMatchInclude)
|
||||
.WhereNotNull()
|
||||
.Select(itms => itms.Select(itm => new RemovableItemViewModel(itm.ToString(), () => ViewModel.RemoveNoMatchInclude(itm))).ToArray())
|
||||
.BindToStrict(this, view => view.NoMatchInclude.ItemsSource)
|
||||
.DisposeWith(disposables);
|
||||
|
||||
AddNoMatchInclude.Command = ReactiveCommand.CreateFromTask(async () => await AddNoMatchIncludeCommand());
|
||||
|
||||
|
||||
});
|
||||
|
||||
@ -199,5 +208,31 @@ namespace Wabbajack
|
||||
|
||||
ViewModel.AddOtherProfile(selectedPath.FileName.ToString());
|
||||
}
|
||||
|
||||
public async Task AddNoMatchIncludeCommand()
|
||||
{
|
||||
var dlg = new CommonOpenFileDialog
|
||||
{
|
||||
Title = "Please select a profile folder",
|
||||
IsFolderPicker = true,
|
||||
InitialDirectory = ViewModel!.Source.ToString(),
|
||||
AddToMostRecentlyUsedList = false,
|
||||
AllowNonFileSystemItems = false,
|
||||
DefaultDirectory = ViewModel!.Source.ToString(),
|
||||
EnsureFileExists = true,
|
||||
EnsurePathExists = true,
|
||||
EnsureReadOnly = false,
|
||||
EnsureValidNames = true,
|
||||
Multiselect = false,
|
||||
ShowPlacesList = true,
|
||||
};
|
||||
|
||||
if (dlg.ShowDialog() != CommonFileDialogResult.Ok) return;
|
||||
var selectedPath = dlg.FileNames.First().ToAbsolutePath();
|
||||
|
||||
if (!selectedPath.InFolder(ViewModel.Source)) return;
|
||||
|
||||
ViewModel.AddNoMatchInclude(selectedPath.RelativeTo(ViewModel!.Source));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@ -53,6 +54,13 @@ public class CompilerSettingsInferencer
|
||||
if (cs.Downloads == default)
|
||||
cs.Downloads = cs.Source.Combine("downloads");
|
||||
|
||||
cs.NoMatchInclude = Array.Empty<RelativePath>();
|
||||
foreach (var file in mo2Folder.EnumerateFiles())
|
||||
{
|
||||
if (file.FileName == Consts.WABBAJACK_NOMATCH_INCLUDE_FILES)
|
||||
cs.NoMatchInclude = cs.NoMatchInclude.Add(file.Parent.RelativeTo(mo2Folder));
|
||||
}
|
||||
|
||||
_logger.LogInformation("Finding Always Enabled mods");
|
||||
cs.AlwaysEnabled = Array.Empty<RelativePath>();
|
||||
// Find Always Enabled mods
|
||||
|
@ -26,7 +26,7 @@ public class Consts
|
||||
public static string WABBAJACK_ALWAYS_DISABLE = "WABBAJACK_ALWAYS_DISABLE";
|
||||
public static string WABBAJACK_NOMATCH_INCLUDE = "WABBAJACK_NOMATCH_INCLUDE";
|
||||
public static string WABBAJACK_IGNORE = "WABBAJACK_IGNORE";
|
||||
public static string WABBAJACK_NOMATCH_INCLUDE_FILES = "WABBAJACK_NOMATCH_INCLUDE_FILES.txt";
|
||||
public static RelativePath WABBAJACK_NOMATCH_INCLUDE_FILES = "WABBAJACK_NOMATCH_INCLUDE_FILES.txt".ToRelativePath();
|
||||
public static string WABBAJACK_IGNORE_FILES = "WABBAJACK_IGNORE_FILES.txt";
|
||||
public static string WABBAJACK_INCLUDE_SAVES = "WABBAJACK_INCLUDE_SAVES";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user