This commit is contained in:
Asval 2026-06-14 19:02:28 +02:00
parent a6959cf891
commit ada2a9480b
10 changed files with 38 additions and 67 deletions

@ -1 +1 @@
Subproject commit a869d747f3997079f0223b6e94556a927f2fc527
Subproject commit 4318346af22e90371b1017648aff20d7defa463c

View File

@ -303,7 +303,7 @@ public class AudioPlayerViewModel : ViewModel, ISource, IDisposable
return;
}
SelectedAudioFile = _audioFiles[SelectedAudioFile.Id];
SelectedAudioFile = SelectedAudioFile.Id >= _audioFiles.Count ? _audioFiles.Last() : _audioFiles[SelectedAudioFile.Id];
if (!removedPlaying) return;
Load();

View File

@ -44,7 +44,6 @@ using CUE4Parse.UE4.Assets.Exports.StaticMesh;
using CUE4Parse.UE4.Assets.Exports.Texture;
using CUE4Parse.UE4.Assets.Exports.Verse;
using CUE4Parse.UE4.Assets.Exports.Wwise;
using CUE4Parse.UE4.Assets.Objects;
using CUE4Parse.UE4.BinaryConfig;
using CUE4Parse.UE4.CriWare;
using CUE4Parse.UE4.CriWare.Readers;
@ -62,9 +61,10 @@ using CUE4Parse.UE4.Shaders;
using CUE4Parse.UE4.Versions;
using CUE4Parse.UE4.Wwise;
using CUE4Parse.Utils;
using CUE4Parse_Conversion;
using CUE4Parse_Conversion.Exporters;
using CUE4Parse_Conversion.Sounds;
using CUE4Parse.MappingsProvider.Jmap;
using CUE4Parse.MappingsProvider.Usmap;
using EpicManifestParser;
using EpicManifestParser.UE;
using FModel.Creator;

View File

@ -43,7 +43,6 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
if (param.Length == 0) return;
var folders = param.OfType<TreeItem>().ToArray();
var searchMenu = param[0] is GameFile;
var assets = param
.Select(static item => item switch
{
@ -136,26 +135,12 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
LogExport(contextViewModel, folder.PathAtThisPoint, path, dirType, filetype, queuedBefore);
}
Action<GameFile, EBulkType, bool> fileAction = bulktype switch
Action<GameFile, EBulkType> fileAction = bulktype switch
{
EBulkType.Raw => (entry, _, _) => contextViewModel.CUE4Parse.ExportData(entry),
_ => (entry, bulk, _) => contextViewModel.CUE4Parse.Extract(cancellationToken, entry, false, bulk),
EBulkType.Raw => (entry, _) => contextViewModel.CUE4Parse.ExportData(entry),
_ => (entry, bulk) => contextViewModel.CUE4Parse.Extract(cancellationToken, entry, false, bulk),
};
if (searchMenu)
{
var update = assets.Length > 1;
foreach (var entry in assets)
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
fileAction(entry, bulktype, update);
}
if (assets.Length > 50) LogExport(contextViewModel, filetype);
return;
}
foreach (var group in assetsGroups)
{
var directory = group.Key;
@ -167,7 +152,7 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
fileAction(entry, bulk, update);
fileAction(entry, bulk);
}
if (update)
@ -217,18 +202,4 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
Interlocked.Exchange(ref contextViewModel.CUE4Parse.ExportedCount, 0);
Interlocked.Exchange(ref contextViewModel.CUE4Parse.FailedExportCount, 0);
}
private void LogExport(ApplicationViewModel contextViewModel, string fileType)
{
if (contextViewModel.CUE4Parse.ExportedCount > 0)
{
FLogger.Append(ELog.Information, () =>
{
FLogger.Text($"Successfully exported {contextViewModel.CUE4Parse.ExportedCount} {fileType}, Failed to export {contextViewModel.CUE4Parse.FailedExportCount} {fileType} in other folders.", Constants.WHITE, true);
});
}
Interlocked.Exchange(ref contextViewModel.CUE4Parse.ExportedCount, 0);
Interlocked.Exchange(ref contextViewModel.CUE4Parse.FailedExportCount, 0);
}
}

View File

@ -321,16 +321,6 @@ public class ExportSessionViewModel : ViewModel
cg.Objects.Add(og);
return og;
}
private void ResetState()
{
_cts?.Cancel();
_cts = null;
_stopwatch.Reset();
IsRunning = false;
StopUiTimer();
ClearExportHistory();
}
}
public class ClassGroupViewModel(string name) : ViewModel

View File

@ -427,7 +427,7 @@ public class TabItem : ViewModel
{
Interlocked.Increment(ref ApplicationService.ApplicationView.CUE4Parse.ExportedCount);
Log.Information("{FileName} successfully saved", fileName);
if (updateUi && ApplicationService.ApplicationView.CUE4Parse.ExportedCount < 50)
if (updateUi)
{
FLogger.Append(ELog.Information, () =>
{

View File

@ -116,7 +116,7 @@ public sealed class Timeclock : UserControl
private void OnSourceEvent(object sender, SourceEventArgs e)
{
if (Source == null) return;
if (e.Event != ESourceEventType.Loading || Source == null) return;
Label = Source.PlayedFile.FileName;
Dispatcher.BeginInvoke((Action) CalculateTime);
}

View File

@ -100,7 +100,7 @@ public sealed class Timeline : UserControl
private void OnSourceEvent(object sender, SourceEventArgs e)
{
if (Source == null) return;
if (e.Event != ESourceEventType.Loading || Source == null) return;
Dispatcher.BeginInvoke((Action) UpdateTimeline);
}
@ -347,4 +347,4 @@ public sealed class Timeline : UserControl
}
}
}
}
}

View File

@ -28,6 +28,14 @@ public enum ELog
None
}
/// <summary>
/// this whole thing needs a refactor
/// TODO: source of truth for logs should be Serilog
/// a custom sink to reroute some of these logs to the UI
/// the ui should be an ObservableCollection of things
/// the things displayed in ListBox (virtualized) should use a custom template
/// see how logs work in ExportSessionViewModel
/// </summary>
public class FLogger : ITextFormatter
{
public static CustomRichTextBox Logger;
@ -107,14 +115,12 @@ public class FLogger : ITextFormatter
try
{
Logger.Document.ContentEnd.InsertTextInRun(message);
if (newLine) Logger.Document.ContentEnd.InsertLineBreak();
Logger.Selection.Select(Logger.Document.ContentStart.GetPositionAtOffset(_previous), Logger.Document.ContentEnd);
Logger.Selection.ApplyPropertyValue(TextElement.ForegroundProperty, _brushConverter.ConvertFromString(color));
}
finally
{
Finally();
Finally(newLine);
}
}
@ -122,7 +128,7 @@ public class FLogger : ITextFormatter
{
try
{
new Hyperlink(new Run(newLine ? $"{message}{Environment.NewLine}" : message), Logger.Document.ContentEnd)
new Hyperlink(new Run(message), Logger.Document.ContentEnd)
{
NavigateUri = new Uri(url),
OverridesDefaultStyle = true,
@ -163,12 +169,21 @@ public class FLogger : ITextFormatter
}
finally
{
Finally();
Finally(newLine);
}
}
private static void Finally()
private const int MaxBlocks = 250; // in the meantime
private static void Finally(bool newLine)
{
if (newLine) Logger.Document.Blocks.Add(new Paragraph { Margin = new Thickness(0) });
while (Logger.Document.Blocks.Count > MaxBlocks)
{
Logger.Document.Blocks.Remove(Logger.Document.Blocks.FirstBlock);
}
Logger.ScrollToEnd();
_previous = Math.Abs(Logger.Document.ContentEnd.GetOffsetToPosition(Logger.Document.ContentStart)) - 2;
}

View File

@ -1067,16 +1067,11 @@
</Canvas>
</Viewbox>
</MenuItem.Icon>
<MenuItem Header="Package Path" Command="{Binding TabCommand}" CommandParameter="File_Path">
</MenuItem>
<MenuItem Header="Package Name" Command="{Binding TabCommand}" CommandParameter="File_Name">
</MenuItem>
<MenuItem Header="Directory Path" Command="{Binding TabCommand}" CommandParameter="Directory_Path">
</MenuItem>
<MenuItem Header="Package Path w/o Extension" Command="{Binding TabCommand}" CommandParameter="File_Path_No_Extension">
</MenuItem>
<MenuItem Header="Package Name w/o Extension" Command="{Binding TabCommand}" CommandParameter="File_Name_No_Extension">
</MenuItem>
<MenuItem Header="Package Path" Command="{Binding TabCommand}" CommandParameter="File_Path" />
<MenuItem Header="Package Name" Command="{Binding TabCommand}" CommandParameter="File_Name" />
<MenuItem Header="Directory Path" Command="{Binding TabCommand}" CommandParameter="Directory_Path" />
<MenuItem Header="Package Path w/o Extension" Command="{Binding TabCommand}" CommandParameter="File_Path_No_Extension" />
<MenuItem Header="Package Name w/o Extension" Command="{Binding TabCommand}" CommandParameter="File_Name_No_Extension" />
</MenuItem>
</ContextMenu>
</Setter.Value>