This commit is contained in:
Asval
2026-06-15 18:03:55 +02:00
parent 2cb6ef63c8
commit 3fc249448a
5 changed files with 28 additions and 32 deletions

View File

@@ -118,7 +118,7 @@ public partial class App
var filePath = Path.Combine(UserSettings.Default.OutputDirectory, "Logs", $"FModel-Log-{DateTime.Now:yyyy-MM-dd}.log");
#endif
const string template1 = "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] {Enriched}: {Message:lj}{NewLine}{Exception}";
const string template2 = "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{ClassName}] {ObjectName}: {Message:lj}{NewLine}{Exception}";
const string template2 = "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{ClassName}] {ObjectPath}: {Message:lj}{NewLine}{Exception}";
Log.Logger = new LoggerConfiguration()
#if DEBUG
.Enrich.With<SourceEnricher>()

View File

@@ -10,6 +10,7 @@ using System.Windows;
using System.Windows.Threading;
using CUE4Parse_Conversion;
using CUE4Parse_Conversion.Options;
using CUE4Parse.Utils;
using FModel.Extensions;
using FModel.Framework;
using FModel.Settings;
@@ -288,11 +289,11 @@ public class ExportSessionViewModel : ViewModel
while (_pendingLogs.TryDequeue(out var log))
{
var className = log.GetContext("ClassName");
var objectName = log.GetContext("ObjectName");
var objectPath = log.GetContext("ObjectPath");
var filePath = log.GetContext("FilePath");
var cg = FindOrCreateClass(className);
var og = FindOrCreateObject(cg, objectName);
var og = FindOrCreateObject(cg, objectPath);
if (log.Level >= LogEventLevel.Error)
{
og.ErrorCount++;
@@ -313,11 +314,11 @@ public class ExportSessionViewModel : ViewModel
return cg;
}
private static ObjectGroupViewModel FindOrCreateObject(ClassGroupViewModel cg, string name)
private static ObjectGroupViewModel FindOrCreateObject(ClassGroupViewModel cg, string path)
{
var og = cg.Objects.FirstOrDefault(o => o.Name == name);
var og = cg.Objects.FirstOrDefault(o => o.Path == path);
if (og != null) return og;
og = new ObjectGroupViewModel(name);
og = new ObjectGroupViewModel(path);
cg.Objects.Add(og);
return og;
}
@@ -346,9 +347,10 @@ public class ClassGroupViewModel(string name) : ViewModel
public override bool HasErrors => ErrorCount > 0;
}
public class ObjectGroupViewModel(string name) : ViewModel
public class ObjectGroupViewModel(string path) : ViewModel
{
public string Name { get; } = name;
public string Path { get; } = path;
public string Name { get; } = path.SubstringAfterLast('.');
public ObservableCollection<LogEntryViewModel> Entries { get; } = [];
public bool IsExpanded

View File

@@ -200,7 +200,8 @@
</Viewbox>
<TextBlock Grid.Column="1" Text="{Binding Name}" VerticalAlignment="Center"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" />
Foreground="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}"
ToolTip="{Binding Path}" />
<Button Grid.Column="3" ToolTip="Open in Explorer" Click="OnOpenInExplorerClick"
Tag="{Binding FirstFilePath}"
@@ -277,21 +278,8 @@
Foreground="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" />
<TextBlock Grid.Row="1" Grid.Column="1" FontSize="10" HorizontalAlignment="Right">
<Run Text="ETA " Foreground="{DynamicResource {x:Static adonisUi:Brushes.DisabledForegroundBrush}}" />
<Run Foreground="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}">
<Run.Style>
<Style TargetType="Run">
<Setter Property="Text" Value="{Binding EtaTime, Mode=OneWay, Converter={x:Static converters:TimeSpanConverter.Instance}, FallbackValue=--:--}" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsFinished}" Value="True">
<Setter Property="Text" Value="Done" />
</DataTrigger>
<DataTrigger Binding="{Binding IsCanceled}" Value="True">
<Setter Property="Text" Value="--:--" />
</DataTrigger>
</Style.Triggers>
</Style>
</Run.Style>
</Run>
<Run Foreground="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}"
Text="{Binding EtaTime, Mode=OneWay, Converter={x:Static converters:TimeSpanConverter.Instance}, FallbackValue=--:--}" />
</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"
FontSize="10" HorizontalAlignment="Right"
@@ -305,6 +293,10 @@
<Setter Property="Text" Value="Export canceled" />
<Setter Property="Foreground" Value="#EF5350" />
</DataTrigger>
<DataTrigger Binding="{Binding IsFinished}" Value="True">
<Setter Property="Text" Value="Export finished" />
<Setter Property="Foreground" Value="#66BB6A" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>

View File

@@ -9,6 +9,7 @@ using System.Threading;
using System.Threading.Tasks;
using CUE4Parse_Conversion;
using CUE4Parse_Conversion.Options;
using CUE4Parse.Utils;
using FModel.Extensions;
using FModel.Views.Snooper.Models;
using ImGuiNET;
@@ -570,11 +571,11 @@ public sealed class ExportModal
while (_pendingLogs.TryDequeue(out var log))
{
var className = log.GetContext("ClassName");
var objectName = log.GetContext("ObjectName");
var objectPath = log.GetContext("ObjectPath");
var filePath = log.GetContext("FilePath");
var cg = FindOrCreateClass(className);
var og = FindOrCreateObject(cg, objectName);
var og = FindOrCreateObject(cg, objectPath);
var entry = new LogEntry(log, filePath);
if (entry.Icon == IconXMark)
{
@@ -595,12 +596,12 @@ public sealed class ExportModal
return n;
}
private static ObjectGroup FindOrCreateObject(ClassGroup cg, string name)
private static ObjectGroup FindOrCreateObject(ClassGroup cg, string path)
{
foreach (var og in cg.Objects)
if (og.Name == name) return og;
if (og.Path == path) return og;
var n = new ObjectGroup(name);
var n = new ObjectGroup(path);
cg.Objects.Add(n);
return n;
}
@@ -626,9 +627,10 @@ public sealed class ExportModal
public Exception? Exception { get; } = log.Exception;
}
private sealed class ObjectGroup(string name)
private sealed class ObjectGroup(string path)
{
public string Name { get; } = name;
public string Path { get; } = path;
public string Name { get; } = path.SubstringAfterLast('.');
public List<LogEntry> Entries { get; } = [];
public int ErrorCount { get; set; }
}