mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fix several missing features found during Septimus recompilation
This commit is contained in:
parent
e0702d9f17
commit
8472fa8d73
@ -79,6 +79,7 @@ namespace Wabbajack
|
||||
|
||||
[Reactive] public RelativePath[] AlwaysEnabled { get; set; } = Array.Empty<RelativePath>();
|
||||
[Reactive] public RelativePath[] NoMatchInclude { get; set; } = Array.Empty<RelativePath>();
|
||||
[Reactive] public RelativePath[] Include { get; set; } = Array.Empty<RelativePath>();
|
||||
|
||||
[Reactive] public string[] OtherProfiles { get; set; } = Array.Empty<string>();
|
||||
|
||||
@ -215,6 +216,7 @@ namespace Wabbajack
|
||||
OtherProfiles = settings.AdditionalProfiles;
|
||||
AlwaysEnabled = settings.AlwaysEnabled;
|
||||
NoMatchInclude = settings.NoMatchInclude;
|
||||
Include = settings.Include;
|
||||
}
|
||||
|
||||
|
||||
@ -314,6 +316,7 @@ namespace Wabbajack
|
||||
AlwaysEnabled = AlwaysEnabled,
|
||||
AdditionalProfiles = OtherProfiles,
|
||||
NoMatchInclude = NoMatchInclude,
|
||||
Include = Include
|
||||
};
|
||||
}
|
||||
|
||||
@ -349,6 +352,16 @@ namespace Wabbajack
|
||||
NoMatchInclude = NoMatchInclude.Where(p => p != path).ToArray();
|
||||
}
|
||||
|
||||
public void AddInclude(RelativePath path)
|
||||
{
|
||||
Include = (Include ?? Array.Empty<RelativePath>()).Append(path).Distinct().ToArray();
|
||||
}
|
||||
|
||||
public void RemoveInclude(RelativePath path)
|
||||
{
|
||||
Include = Include.Where(p => p != path).ToArray();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -158,6 +158,20 @@
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Name="AddInclude">
|
||||
<icon:Material Kind="Plus"></icon:Material>
|
||||
</Button>
|
||||
<Label>Include</Label>
|
||||
</StackPanel>
|
||||
<ListBox x:Name="Include">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<controls1:RemovableItemView ViewModel="{Binding}" ></controls1:RemovableItemView>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Name="AddOtherProfile">
|
||||
<icon:Material Kind="Plus"></icon:Material>
|
||||
|
@ -179,6 +179,14 @@ namespace Wabbajack
|
||||
|
||||
AddNoMatchInclude.Command = ReactiveCommand.CreateFromTask(async () => await AddNoMatchIncludeCommand());
|
||||
|
||||
ViewModel.WhenAnyValue(vm => vm.Include)
|
||||
.WhereNotNull()
|
||||
.Select(itms => itms.Select(itm => new RemovableItemViewModel(itm.ToString(), () => ViewModel.RemoveInclude(itm))).ToArray())
|
||||
.BindToStrict(this, view => view.Include.ItemsSource)
|
||||
.DisposeWith(disposables);
|
||||
|
||||
AddInclude.Command = ReactiveCommand.CreateFromTask(async () => await AddIncludeCommand());
|
||||
|
||||
|
||||
});
|
||||
|
||||
@ -262,7 +270,7 @@ namespace Wabbajack
|
||||
{
|
||||
var dlg = new CommonOpenFileDialog
|
||||
{
|
||||
Title = "Please select a profile folder",
|
||||
Title = "Please select a folder",
|
||||
IsFolderPicker = true,
|
||||
InitialDirectory = ViewModel!.Source.ToString(),
|
||||
AddToMostRecentlyUsedList = false,
|
||||
@ -283,5 +291,31 @@ namespace Wabbajack
|
||||
|
||||
ViewModel.AddNoMatchInclude(selectedPath.RelativeTo(ViewModel!.Source));
|
||||
}
|
||||
|
||||
public async Task AddIncludeCommand()
|
||||
{
|
||||
var dlg = new CommonOpenFileDialog
|
||||
{
|
||||
Title = "Please select a",
|
||||
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.AddInclude(selectedPath.RelativeTo(ViewModel!.Source));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public class DeconstructBSAs : ACompilationStep
|
||||
|
||||
var stack = defaultInclude ? _microstackWithInclude(source.File) : _microstack(source.File);
|
||||
|
||||
var id = Guid.NewGuid().ToString();
|
||||
var id = Guid.NewGuid().ToString().ToRelativePath();
|
||||
|
||||
|
||||
Func<Task>? _cleanup = null;
|
||||
@ -88,14 +88,14 @@ public class DeconstructBSAs : ACompilationStep
|
||||
|
||||
var matches = await sourceFiles.PMapAll(_compiler.CompilerLimiter,
|
||||
e => _mo2Compiler.RunStack(stack,
|
||||
new RawSourceFile(e, Consts.BSACreationDir.Combine((RelativePath) id, (RelativePath) e.Name))))
|
||||
new RawSourceFile(e, Consts.BSACreationDir.Combine(id, (RelativePath) e.Name))))
|
||||
.ToList();
|
||||
|
||||
|
||||
foreach (var match in matches)
|
||||
{
|
||||
if (match is IgnoredDirectly)
|
||||
throw new CompilerException($"File required for BSA {source.Path} creation doesn't exist: {match.To}");
|
||||
if (match is IgnoredDirectly ignored)
|
||||
throw new CompilerException($"File required for BSA {source.Path} creation doesn't exist: {match.To} reason {ignored.Reason}");
|
||||
|
||||
_mo2Compiler.ExtraFiles.Add(match);
|
||||
}
|
||||
|
@ -272,8 +272,6 @@ public class MO2Compiler : ACompiler
|
||||
new IncludeModIniData(this),
|
||||
new DirectMatch(this),
|
||||
new IncludeTaggedFiles(this, Settings.Include),
|
||||
// TODO: rework tagged files
|
||||
// new IncludeTaggedFolders(this, Consts.WABBAJACK_INCLUDE),
|
||||
new IgnoreExtension(this, Ext.Pyc),
|
||||
new IgnoreExtension(this, Ext.Log),
|
||||
new PatchStockGameFiles(this, _wjClient),
|
||||
|
@ -15,6 +15,18 @@ public static class ArrayExtensions
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static bool AreEqualIgnoreCase(string[] a, int startA, string[] b, int startB, int length)
|
||||
{
|
||||
if (startA + length > (a?.Length ?? 0)) return false;
|
||||
if (startB + length > (b?.Length ?? 0)) return false;
|
||||
|
||||
for (var i = 0; i < length; i++)
|
||||
if (!a[startA + i]!.Equals(b[startB + i], StringComparison.InvariantCultureIgnoreCase))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int Compare<T>(T[] a, T[] b)
|
||||
where T : IComparable<T>
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ public struct RelativePath : IPath, IEquatable<RelativePath>, IComparable<Relati
|
||||
|
||||
public bool InFolder(RelativePath parent)
|
||||
{
|
||||
return ArrayExtensions.AreEqual(parent.Parts, 0, Parts, 0, parent.Parts.Length);
|
||||
return ArrayExtensions.AreEqualIgnoreCase(parent.Parts, 0, Parts, 0, parent.Parts.Length);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
Loading…
Reference in New Issue
Block a user