mirror of
https://github.com/4sval/FModel.git
synced 2026-06-22 07:50:10 -05:00
fixes
This commit is contained in:
parent
a6959cf891
commit
ada2a9480b
|
|
@ -1 +1 @@
|
|||
Subproject commit a869d747f3997079f0223b6e94556a927f2fc527
|
||||
Subproject commit 4318346af22e90371b1017648aff20d7defa463c
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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, () =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user