diff --git a/CUE4Parse b/CUE4Parse index da8536fa..d272a934 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit da8536faa0e4626af234cfd98318358ad5dc7067 +Subproject commit d272a934f9eefe7d84908fe0d3e238e08079a9e1 diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj index a2585726..e46a3e2a 100644 --- a/FModel/FModel.csproj +++ b/FModel/FModel.csproj @@ -39,6 +39,7 @@ + @@ -134,6 +135,7 @@ + diff --git a/FModel/MainWindow.xaml b/FModel/MainWindow.xaml index 600d3f2b..95c8a4f8 100644 --- a/FModel/MainWindow.xaml +++ b/FModel/MainWindow.xaml @@ -304,99 +304,143 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { VirtualPathCount = Provider.LoadVirtualPaths(cancellationToken); -#if DEBUG if (VirtualPathCount > 0) { FLogger.AppendInformation(); @@ -352,10 +351,9 @@ namespace FModel.ViewModels } else { - FLogger.AppendError(); + FLogger.AppendWarning(); FLogger.AppendText("Could not load virtual paths, plugin manifest may not exist", Constants.WHITE, true); } -#endif }); } diff --git a/FModel/ViewModels/Commands/LoadCommand.cs b/FModel/ViewModels/Commands/LoadCommand.cs index cfae5816..ed9bcb26 100644 --- a/FModel/ViewModels/Commands/LoadCommand.cs +++ b/FModel/ViewModels/Commands/LoadCommand.cs @@ -90,7 +90,7 @@ namespace FModel.ViewModels.Commands #if DEBUG loadingTime.Stop(); FLogger.AppendDebug(); - FLogger.AppendText($"{_applicationView.CUE4Parse.SearchVm.SearchResults.Count} packages and a lot of localized resources loaded in {loadingTime.Elapsed.TotalSeconds.ToString("F3", CultureInfo.InvariantCulture)} seconds", Constants.WHITE, true); + FLogger.AppendText($"{_applicationView.CUE4Parse.SearchVm.SearchResults.Count} packages, {_applicationView.CUE4Parse.LocalizedResourcesCount} localized resources, and {_applicationView.CUE4Parse.VirtualPathCount} virtual paths loaded in {loadingTime.Elapsed.TotalSeconds.ToString("F3", CultureInfo.InvariantCulture)} seconds", Constants.WHITE, true); #endif } diff --git a/FModel/ViewModels/Commands/MenuCommand.cs b/FModel/ViewModels/Commands/MenuCommand.cs index caf38ae9..019d9850 100644 --- a/FModel/ViewModels/Commands/MenuCommand.cs +++ b/FModel/ViewModels/Commands/MenuCommand.cs @@ -1,4 +1,6 @@ using System.Diagnostics; +using System.Linq; +using System.Threading; using AdonisUI.Controls; using FModel.Framework; using FModel.Services; @@ -14,7 +16,7 @@ namespace FModel.ViewModels.Commands { } - public override void Execute(ApplicationViewModel contextViewModel, object parameter) + public override async void Execute(ApplicationViewModel contextViewModel, object parameter) { switch (parameter) { @@ -61,7 +63,41 @@ namespace FModel.ViewModels.Commands case "ToolBox_Open_Output_Directory": Process.Start(new ProcessStartInfo {FileName = UserSettings.Default.OutputDirectory, UseShellExecute = true}); break; + case "ToolBox_Expand_All": + await ApplicationService.ThreadWorkerView.Begin(cancellationToken => + { + foreach (var folder in contextViewModel.CUE4Parse.AssetsFolder.Folders) + { + LoopFolders(cancellationToken, folder, true); + } + }); + break; + case "ToolBox_Collapse_All": + await ApplicationService.ThreadWorkerView.Begin(cancellationToken => + { + foreach (var folder in contextViewModel.CUE4Parse.AssetsFolder.Folders) + { + LoopFolders(cancellationToken, folder, false); + } + }); + break; + case TreeItem selectedFolder: + selectedFolder.IsSelected = false; + selectedFolder.IsSelected = true; + break; } } + + private void LoopFolders(CancellationToken cancellationToken, TreeItem parent, bool isExpanded) + { + if (parent.IsExpanded != isExpanded) + { + parent.IsExpanded = isExpanded; + Thread.Sleep(10); + } + + cancellationToken.ThrowIfCancellationRequested(); + foreach (var f in parent.Folders) LoopFolders(cancellationToken, f, isExpanded); + } } } \ No newline at end of file diff --git a/FModel/Views/Resources/Controls/Aed/BraceFoldingStrategy.cs b/FModel/Views/Resources/Controls/Aed/BraceFoldingStrategy.cs index 127090cb..68f5b10e 100644 --- a/FModel/Views/Resources/Controls/Aed/BraceFoldingStrategy.cs +++ b/FModel/Views/Resources/Controls/Aed/BraceFoldingStrategy.cs @@ -47,10 +47,18 @@ namespace FModel.Views.Resources.Controls if (_foldingManager.AllFoldings == null) return; + var dowhat = -1; + var foldunfold = false; foreach (var folding in _foldingManager.AllFoldings) { - if (folding.Tag is not CustomNewFolding realFolding) continue; - if (realFolding.Level == level) folding.IsFolded = !folding.IsFolded; + if (folding.Tag is not CustomNewFolding realFolding || realFolding.Level != level) continue; + + if (dowhat < 0) // determine if we fold or unfold based on the first one + { + dowhat = 1; + foldunfold = !folding.IsFolded; + } + folding.IsFolded = foldunfold; } } } diff --git a/FModel/Views/Resources/Controls/AvalonEditor.xaml.cs b/FModel/Views/Resources/Controls/AvalonEditor.xaml.cs index 6887e68d..7b2cd682 100644 --- a/FModel/Views/Resources/Controls/AvalonEditor.xaml.cs +++ b/FModel/Views/Resources/Controls/AvalonEditor.xaml.cs @@ -39,9 +39,15 @@ namespace FModel.Views.Resources.Controls case Key.Escape: ((TabItem) DataContext).HasSearchOpen = false; break; - case Key.Enter when ((TabItem) DataContext).HasSearchOpen: + case Key.Enter when !Keyboard.Modifiers.HasFlag(ModifierKeys.Shift) && ((TabItem) DataContext).HasSearchOpen: FindNext(); break; + case Key.Enter when Keyboard.Modifiers.HasFlag(ModifierKeys.Shift) && ((TabItem) DataContext).HasSearchOpen: + var old = ((TabItem)DataContext).SearchUp; + ((TabItem) DataContext).SearchUp = true; + FindNext(); + ((TabItem) DataContext).SearchUp = old; + break; } } diff --git a/FModel/Views/Resources/Resources.xaml b/FModel/Views/Resources/Resources.xaml index 846e683f..953617e2 100644 --- a/FModel/Views/Resources/Resources.xaml +++ b/FModel/Views/Resources/Resources.xaml @@ -60,6 +60,9 @@ M10 12c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zM6 8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12-8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm-4 8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm4-4c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-4-4c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-4-4c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z M12,17c-1.1,0-2-0.9-2-2s0.9-2,2-2s2,0.9,2,2S13.1,17,12,17z M17.95,14c-0.52,0-0.94,0.4-0.99,0.92 c-0.2,2.03-1.05,2.68-1.48,3.02C14.68,18.54,14,19,12,19s-2.68-0.46-3.48-1.06c-0.43-0.34-1.28-0.99-1.48-3.02 C6.99,14.4,6.57,14,6.05,14c-0.59,0-1.06,0.51-1,1.09c0.22,2.08,1.07,3.47,2.24,4.41c0.5,0.4,1.1,0.7,1.7,0.9L9,24h6v-3.6 c0.6-0.2,1.2-0.5,1.7-0.9c1.17-0.94,2.03-2.32,2.24-4.41C19.01,14.51,18.53,14,17.95,14z M12,0C5.92,0,1,1.9,1,4.25v3.49 C1,8.55,1.88,9,2.56,8.57C2.7,8.48,2.84,8.39,3,8.31L5,13h2l1.5-6.28C9.6,6.58,10.78,6.5,12,6.5s2.4,0.08,3.5,0.22L17,13h2l2-4.69 c0.16,0.09,0.3,0.17,0.44,0.26C22.12,9,23,8.55,23,7.74V4.25C23,1.9,18.08,0,12,0z M5.88,11.24L4.37,7.69 c0.75-0.28,1.6-0.52,2.53-0.71L5.88,11.24z M18.12,11.24L17.1,6.98c0.93,0.19,1.78,0.43,2.53,0.71L18.12,11.24z M13,9V7.82C14.16,7.4,15,6.3,15,5c0-1.65-1.35-3-3-3S9,3.35,9,5c0,1.3,0.84,2.4,2,2.82V9H9c-0.55,0-1,0.45-1,1v0 c0,0.55,0.45,1,1,1h2v8.92c-2.22-0.33-4.59-1.68-5.55-3.37l1.14-1.14c0.22-0.22,0.19-0.57-0.05-0.75L3.8,12.6 C3.47,12.35,3,12.59,3,13v2c0,3.88,4.92,7,9,7s9-3.12,9-7v-2c0-0.41-0.47-0.65-0.8-0.4l-2.74,2.05c-0.24,0.18-0.27,0.54-0.05,0.75 l1.14,1.14c-0.96,1.69-3.33,3.04-5.55,3.37V11h2c0.55,0,1-0.45,1-1v0c0-0.55-0.45-1-1-1H13z M12,4c0.55,0,1,0.45,1,1s-0.45,1-1,1 s-1-0.45-1-1S11.45,4,12,4z + M8.12 19.3c.39.39 1.02.39 1.41 0L12 16.83l2.47 2.47c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41l-3.17-3.17c-.39-.39-1.02-.39-1.41 0l-3.17 3.17c-.4.38-.4 1.02-.01 1.41zm7.76-14.6c-.39-.39-1.02-.39-1.41 0L12 7.17 9.53 4.7c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.03 0 1.42l3.17 3.17c.39.39 1.02.39 1.41 0l3.17-3.17c.4-.39.4-1.03.01-1.42z + M12 5.83l2.46 2.46c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L12.7 3.7c-.39-.39-1.02-.39-1.41 0L8.12 6.88c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L12 5.83zm0 12.34l-2.46-2.46c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41l3.17 3.18c.39.39 1.02.39 1.41 0l3.17-3.17c.39-.39.39-1.02 0-1.41-.39-.39-1.02-.39-1.41 0L12 18.17z + M11.71,17.99C8.53,17.84,6,15.22,6,12c0-3.31,2.69-6,6-6c3.22,0,5.84,2.53,5.99,5.71l-2.1-0.63C15.48,9.31,13.89,8,12,8 c-2.21,0-4,1.79-4,4c0,1.89,1.31,3.48,3.08,3.89L11.71,17.99z M22,12c0,0.3-0.01,0.6-0.04,0.9l-1.97-0.59C20,12.21,20,12.1,20,12 c0-4.42-3.58-8-8-8s-8,3.58-8,8s3.58,8,8,8c0.1,0,0.21,0,0.31-0.01l0.59,1.97C12.6,21.99,12.3,22,12,22C6.48,22,2,17.52,2,12 C2,6.48,6.48,2,12,2S22,6.48,22,12z M18.23,16.26l2.27-0.76c0.46-0.15,0.45-0.81-0.01-0.95l-7.6-2.28 c-0.38-0.11-0.74,0.24-0.62,0.62l2.28,7.6c0.14,0.47,0.8,0.48,0.95,0.01l0.76-2.27l3.91,3.91c0.2,0.2,0.51,0.2,0.71,0l1.27-1.27 c0.2-0.2,0.2-0.51,0-0.71L18.23,16.26z