mirror of
https://github.com/4sval/FModel.git
synced 2026-04-20 16:47:44 -05:00
implemented loading label
This commit is contained in:
parent
41d93177b5
commit
b57585a0c6
45
FModel/Framework/FStatus.cs
Normal file
45
FModel/Framework/FStatus.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
namespace FModel.Framework;
|
||||
|
||||
public class FStatus : ViewModel
|
||||
{
|
||||
private bool _isReady;
|
||||
public bool IsReady
|
||||
{
|
||||
get => _isReady;
|
||||
private set => SetProperty(ref _isReady, value);
|
||||
}
|
||||
|
||||
private EStatusKind _kind;
|
||||
public EStatusKind Kind
|
||||
{
|
||||
get => _kind;
|
||||
private set
|
||||
{
|
||||
SetProperty(ref _kind, value);
|
||||
IsReady = Kind != EStatusKind.Loading && Kind != EStatusKind.Stopping;
|
||||
}
|
||||
}
|
||||
|
||||
private string _label;
|
||||
public string Label
|
||||
{
|
||||
get => _label;
|
||||
private set => SetProperty(ref _label, value);
|
||||
}
|
||||
|
||||
public FStatus()
|
||||
{
|
||||
SetStatus(EStatusKind.Loading);
|
||||
}
|
||||
|
||||
public void SetStatus(EStatusKind kind, string label = "")
|
||||
{
|
||||
Kind = kind;
|
||||
UpdateStatusLabel(label);
|
||||
}
|
||||
|
||||
public void UpdateStatusLabel(string label)
|
||||
{
|
||||
Label = Kind == EStatusKind.Loading ? $"{Kind} {label}".Trim() : Kind.ToString();
|
||||
}
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="AES" Command="{Binding MenuCommand}" CommandParameter="Directory_AES" IsEnabled="{Binding IsReady}">
|
||||
<MenuItem Header="AES" Command="{Binding MenuCommand}" CommandParameter="Directory_AES" IsEnabled="{Binding Status.IsReady}">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Backup" Command="{Binding MenuCommand}" CommandParameter="Directory_Backup" IsEnabled="{Binding IsReady}">
|
||||
<MenuItem Header="Backup" Command="{Binding MenuCommand}" CommandParameter="Directory_Backup" IsEnabled="{Binding Status.IsReady}">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Archives Info" Command="{Binding MenuCommand}" CommandParameter="Directory_ArchivesInfo" IsEnabled="{Binding IsReady}">
|
||||
<MenuItem Header="Archives Info" Command="{Binding MenuCommand}" CommandParameter="Directory_ArchivesInfo" IsEnabled="{Binding Status.IsReady}">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Packages">
|
||||
<MenuItem Header="Search" IsEnabled="{Binding IsReady}" InputGestureText="Ctrl+Shift+F" Click="OnSearchViewClick">
|
||||
<MenuItem Header="Search" IsEnabled="{Binding Status.IsReady}" InputGestureText="Ctrl+Shift+F" Click="OnSearchViewClick">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Directories" ItemsSource="{Binding CustomDirectories.Directories}" IsEnabled="{Binding IsReady}">
|
||||
<MenuItem Header="Directories" ItemsSource="{Binding CustomDirectories.Directories}" IsEnabled="{Binding Status.IsReady}">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
|
|
@ -168,7 +168,7 @@
|
|||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Map Viewer" Command="{Binding MenuCommand}" CommandParameter="Views_MapViewer" IsEnabled="{Binding IsReady}">
|
||||
<MenuItem Header="Map Viewer" Command="{Binding MenuCommand}" CommandParameter="Views_MapViewer" IsEnabled="{Binding Status.IsReady}">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
|
|
@ -272,7 +272,7 @@
|
|||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Loading Mode" VerticalAlignment="Center" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="2" ItemsSource="{Binding LoadingModes.Modes}" IsEnabled="{Binding IsReady}"
|
||||
<ComboBox Grid.Row="0" Grid.Column="2" ItemsSource="{Binding LoadingModes.Modes}" IsEnabled="{Binding Status.IsReady}"
|
||||
SelectedItem="{Binding LoadingMode, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
|
@ -281,7 +281,7 @@
|
|||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<Button Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Content="Load"
|
||||
Command="{Binding LoadingModes.LoadCommand}" IsEnabled="{Binding IsReady}"
|
||||
Command="{Binding LoadingModes.LoadCommand}" IsEnabled="{Binding Status.IsReady}"
|
||||
CommandParameter="{Binding SelectedItems, ElementName=DirectoryFilesListBox}" />
|
||||
</Grid>
|
||||
<Grid DockPanel.Dock="Top">
|
||||
|
|
@ -703,27 +703,27 @@
|
|||
<Style TargetType="{x:Type StatusBar}" BasedOn="{StaticResource {x:Type StatusBar}}">
|
||||
<Style.Triggers>
|
||||
<!--don't mind me, MultiDataTrigger just sucks-->
|
||||
<DataTrigger Binding="{Binding Status}" Value="{x:Static local:EStatusKind.Ready}">
|
||||
<DataTrigger Binding="{Binding Status.Kind}" Value="{x:Static local:EStatusKind.Ready}">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static adonisUi:Brushes.AccentBrush}}" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Status}" Value="{x:Static local:EStatusKind.Completed}">
|
||||
<DataTrigger Binding="{Binding Status.Kind}" Value="{x:Static local:EStatusKind.Completed}">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static adonisUi:Brushes.AccentBrush}}" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Status}" Value="{x:Static local:EStatusKind.Loading}">
|
||||
<DataTrigger Binding="{Binding Status.Kind}" Value="{x:Static local:EStatusKind.Loading}">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static adonisUi:Brushes.AlertBrush}}" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Status}" Value="{x:Static local:EStatusKind.Stopping}">
|
||||
<DataTrigger Binding="{Binding Status.Kind}" Value="{x:Static local:EStatusKind.Stopping}">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static adonisUi:Brushes.AlertBrush}}" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Status}" Value="{x:Static local:EStatusKind.Stopped}">
|
||||
<DataTrigger Binding="{Binding Status.Kind}" Value="{x:Static local:EStatusKind.Stopped}">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static adonisUi:Brushes.ErrorBrush}}" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Status}" Value="{x:Static local:EStatusKind.Failed}">
|
||||
<DataTrigger Binding="{Binding Status.Kind}" Value="{x:Static local:EStatusKind.Failed}">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static adonisUi:Brushes.ErrorBrush}}" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</DataTrigger>
|
||||
|
|
@ -766,17 +766,17 @@
|
|||
<TextBlock>
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Text" Value="{Binding Status}" />
|
||||
<Setter Property="Text" Value="{Binding Status.Label}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Status}" Value="{x:Static local:EStatusKind.Loading}">
|
||||
<Setter Property="Text" Value="{Binding Status, StringFormat='{}{0} …'}" />
|
||||
<DataTrigger Binding="{Binding Status.Kind}" Value="{x:Static local:EStatusKind.Loading}">
|
||||
<Setter Property="Text" Value="{Binding Status.Label, StringFormat='{}{0} …'}" />
|
||||
</DataTrigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding CanBeCanceled, Source={x:Static local:Services.ApplicationService.ThreadWorkerView}}" Value="True" />
|
||||
<Condition Binding="{Binding Status}" Value="{x:Static local:EStatusKind.Loading}" />
|
||||
<Condition Binding="{Binding Status.Kind}" Value="{x:Static local:EStatusKind.Loading}" />
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Text" Value="{Binding Status, StringFormat='{}{0} … ESC to Cancel'}" />
|
||||
<Setter Property="Text" Value="{Binding Status.Label, StringFormat='{}{0} … ESC to Cancel'}" />
|
||||
</MultiDataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
|
|
|||
|
|
@ -95,10 +95,10 @@ public partial class MainWindow
|
|||
|
||||
if (_threadWorkerView.CanBeCanceled && e.Key == Key.Escape)
|
||||
{
|
||||
_applicationView.Status = EStatusKind.Stopping;
|
||||
_applicationView.Status.SetStatus(EStatusKind.Stopping);
|
||||
_threadWorkerView.Cancel();
|
||||
}
|
||||
else if (_applicationView.IsReady && e.Key == Key.F && Keyboard.Modifiers.HasFlag(ModifierKeys.Control) && Keyboard.Modifiers.HasFlag(ModifierKeys.Shift))
|
||||
else if (_applicationView.Status.IsReady && e.Key == Key.F && Keyboard.Modifiers.HasFlag(ModifierKeys.Control) && Keyboard.Modifiers.HasFlag(ModifierKeys.Shift))
|
||||
OnSearchViewClick(null, null);
|
||||
else if (e.Key == Key.Left && _applicationView.CUE4Parse.TabControl.SelectedTab.HasImage)
|
||||
_applicationView.CUE4Parse.TabControl.SelectedTab.GoPreviousImage();
|
||||
|
|
@ -230,14 +230,14 @@ public partial class MainWindow
|
|||
|
||||
private void OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (!_applicationView.IsReady || sender is not ListBox listBox) return;
|
||||
if (!_applicationView.Status.IsReady || sender is not ListBox listBox) return;
|
||||
UserSettings.Default.LoadingMode = ELoadingMode.Multiple;
|
||||
_applicationView.LoadingModes.LoadCommand.Execute(listBox.SelectedItems);
|
||||
}
|
||||
|
||||
private async void OnPreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (!_applicationView.IsReady || sender is not ListBox listBox) return;
|
||||
if (!_applicationView.Status.IsReady || sender is not ListBox listBox) return;
|
||||
|
||||
switch (e.Key)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace FModel.Settings
|
|||
return false;
|
||||
|
||||
endpoint = endpoints[(int) type];
|
||||
return endpoint.IsValid;
|
||||
return endpoint.Overwrite || endpoint.IsValid;
|
||||
}
|
||||
|
||||
private bool _showChangelog = true;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ namespace FModel.ViewModels;
|
|||
public class ApplicationViewModel : ViewModel
|
||||
{
|
||||
private EBuildKind _build;
|
||||
|
||||
public EBuildKind Build
|
||||
{
|
||||
get => _build;
|
||||
|
|
@ -33,24 +32,11 @@ public class ApplicationViewModel : ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
private bool _isReady;
|
||||
|
||||
public bool IsReady
|
||||
{
|
||||
get => _isReady;
|
||||
private set => SetProperty(ref _isReady, value);
|
||||
}
|
||||
|
||||
private EStatusKind _status;
|
||||
|
||||
public EStatusKind Status
|
||||
private FStatus _status;
|
||||
public FStatus Status
|
||||
{
|
||||
get => _status;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _status, value);
|
||||
IsReady = Status != EStatusKind.Loading && Status != EStatusKind.Stopping;
|
||||
}
|
||||
set => SetProperty(ref _status, value);
|
||||
}
|
||||
|
||||
public RightClickMenuCommand RightClickMenuCommand => _rightClickMenuCommand ??= new RightClickMenuCommand(this);
|
||||
|
|
@ -76,7 +62,7 @@ public class ApplicationViewModel : ViewModel
|
|||
|
||||
public ApplicationViewModel()
|
||||
{
|
||||
Status = EStatusKind.Loading;
|
||||
Status = new FStatus();
|
||||
#if DEBUG
|
||||
Build = EBuildKind.Debug;
|
||||
#elif RELEASE
|
||||
|
|
@ -93,7 +79,7 @@ public class ApplicationViewModel : ViewModel
|
|||
AesManager = new AesManagerViewModel(CUE4Parse);
|
||||
MapViewer = new MapViewerViewModel(CUE4Parse);
|
||||
AudioPlayer = new AudioPlayerViewModel();
|
||||
Status = EStatusKind.Ready;
|
||||
Status.SetStatus(EStatusKind.Ready);
|
||||
}
|
||||
|
||||
public void AvoidEmptyGameDirectoryAndSetEGame(bool bAlreadyLaunched)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ public class CUE4ParseViewModel : ViewModel
|
|||
RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
|
||||
private FGame _game;
|
||||
|
||||
public FGame Game
|
||||
{
|
||||
get => _game;
|
||||
|
|
@ -458,7 +457,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
cancellationToken.ThrowIfCancellationRequested();
|
||||
try
|
||||
{
|
||||
Extract(asset.FullPath, TabControl.HasNoTabs);
|
||||
Extract(cancellationToken, asset.FullPath, TabControl.HasNoTabs);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -489,7 +488,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
cancellationToken.ThrowIfCancellationRequested();
|
||||
try
|
||||
{
|
||||
Extract(asset.FullPath, TabControl.HasNoTabs, true);
|
||||
Extract(cancellationToken, asset.FullPath, TabControl.HasNoTabs, true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -506,11 +505,11 @@ public class CUE4ParseViewModel : ViewModel
|
|||
{
|
||||
Thread.Sleep(10);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
Extract(asset.FullPath, TabControl.HasNoTabs);
|
||||
Extract(cancellationToken, asset.FullPath, TabControl.HasNoTabs);
|
||||
}
|
||||
}
|
||||
|
||||
public void Extract(string fullPath, bool addNewTab = false, bool bulkSave = false)
|
||||
public void Extract(CancellationToken cancellationToken, string fullPath, bool addNewTab = false, bool bulkSave = false)
|
||||
{
|
||||
Log.Information("User DOUBLE-CLICKED to extract '{FullPath}'", fullPath);
|
||||
|
||||
|
|
@ -543,7 +542,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
|
||||
foreach (var e in exports)
|
||||
{
|
||||
if (CheckExport(e))
|
||||
if (CheckExport(cancellationToken, e))
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -704,7 +703,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
public void ExtractAndScroll(string fullPath, string objectName)
|
||||
public void ExtractAndScroll(CancellationToken cancellationToken, string fullPath, string objectName)
|
||||
{
|
||||
Log.Information("User CTRL-CLICKED to extract '{FullPath}'", fullPath);
|
||||
TabControl.AddTab(fullPath.SubstringAfterLast('/'), fullPath.SubstringBeforeLast('/'));
|
||||
|
|
@ -716,12 +715,12 @@ public class CUE4ParseViewModel : ViewModel
|
|||
|
||||
foreach (var e in exports)
|
||||
{
|
||||
if (CheckExport(e))
|
||||
if (CheckExport(cancellationToken, e))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckExport(UObject export) // return true once you wanna stop searching for exports
|
||||
private bool CheckExport(CancellationToken cancellationToken, UObject export) // return true once you wanna stop searching for exports
|
||||
{
|
||||
switch (export)
|
||||
{
|
||||
|
|
@ -758,7 +757,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
export.Owner.Name.EndsWith($"/RenderSwitch_Materials/{export.Name}", StringComparison.OrdinalIgnoreCase) ||
|
||||
export.Owner.Name.EndsWith($"/MI_BPTile/{export.Name}", StringComparison.OrdinalIgnoreCase))):
|
||||
{
|
||||
SnooperViewer.Run(export);
|
||||
SnooperViewer.Run(cancellationToken, export);
|
||||
return true;
|
||||
}
|
||||
case UMaterialInstance m when ModelIsOverwritingMaterial:
|
||||
|
|
|
|||
|
|
@ -105,8 +105,7 @@ public class LoadCommand : ViewModelCommand<LoadingModesViewModel>
|
|||
private void FilterDirectoryFilesToDisplay(CancellationToken cancellationToken, IEnumerable<FileItem> directoryFiles)
|
||||
{
|
||||
HashSet<string> filter;
|
||||
if (directoryFiles == null)
|
||||
filter = null;
|
||||
if (directoryFiles == null) filter = null;
|
||||
else
|
||||
{
|
||||
filter = new HashSet<string>();
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
|
|||
foreach (var asset in assetItems)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
contextViewModel.CUE4Parse.Extract(asset.FullPath, true);
|
||||
contextViewModel.CUE4Parse.Extract(cancellationToken, asset.FullPath, true);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -45,7 +45,7 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
|
|||
foreach (var asset in assetItems)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
contextViewModel.CUE4Parse.Extract(asset.FullPath);
|
||||
contextViewModel.CUE4Parse.Extract(cancellationToken, asset.FullPath);
|
||||
contextViewModel.CUE4Parse.TabControl.SelectedTab.SaveProperty(false);
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
|
|||
foreach (var asset in assetItems)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
contextViewModel.CUE4Parse.Extract(asset.FullPath);
|
||||
contextViewModel.CUE4Parse.Extract(cancellationToken, asset.FullPath);
|
||||
contextViewModel.CUE4Parse.TabControl.SelectedTab.SaveImage(false);
|
||||
}
|
||||
|
||||
|
|
@ -62,4 +62,4 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class ThreadWorkerViewModel : ViewModel
|
|||
|
||||
public async Task Begin(Action<CancellationToken> action)
|
||||
{
|
||||
if (!_applicationView.IsReady)
|
||||
if (!_applicationView.Status.IsReady)
|
||||
{
|
||||
SignalOperationInProgress();
|
||||
return;
|
||||
|
|
@ -79,7 +79,7 @@ public class ThreadWorkerViewModel : ViewModel
|
|||
{
|
||||
if (_jobs.Count > 0)
|
||||
{
|
||||
_applicationView.Status = EStatusKind.Loading;
|
||||
_applicationView.Status.SetStatus(EStatusKind.Loading);
|
||||
await foreach (var job in _jobs)
|
||||
{
|
||||
try
|
||||
|
|
@ -89,7 +89,7 @@ public class ThreadWorkerViewModel : ViewModel
|
|||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
_applicationView.Status = EStatusKind.Stopped;
|
||||
_applicationView.Status.SetStatus(EStatusKind.Stopped);
|
||||
CurrentCancellationTokenSource = null; // kill token
|
||||
OperationCancelled = true;
|
||||
OperationCancelled = false;
|
||||
|
|
@ -97,7 +97,7 @@ public class ThreadWorkerViewModel : ViewModel
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_applicationView.Status = EStatusKind.Failed;
|
||||
_applicationView.Status.SetStatus(EStatusKind.Failed);
|
||||
CurrentCancellationTokenSource = null; // kill token
|
||||
|
||||
Log.Error("{Exception}", e);
|
||||
|
|
@ -134,7 +134,7 @@ public class ThreadWorkerViewModel : ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
_applicationView.Status = EStatusKind.Completed;
|
||||
_applicationView.Status.SetStatus(EStatusKind.Completed);
|
||||
CurrentCancellationTokenSource = null; // kill token
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,41 +24,41 @@
|
|||
<DataTemplate x:Key="BrTemplate">
|
||||
<StackPanel VerticalAlignment="Center" Margin="25 0">
|
||||
<CheckBox Content="Points Of Interest" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.BrPois}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding Status.IsReady}" />
|
||||
<CheckBox Content="Landmarks" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.BrLandmarks}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding Status.IsReady}" />
|
||||
<!-- <CheckBox Content="Tags Location" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.BrTagsLocation}" -->
|
||||
<!-- DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" /> -->
|
||||
<!-- DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding Status.IsReady}" /> -->
|
||||
<CheckBox Content="Patrols Path" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.BrPatrolsPath}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding Status.IsReady}" />
|
||||
<CheckBox Content="Upgrade Benches" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.BrUpgradeBenches}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding Status.IsReady}" />
|
||||
<!-- <CheckBox Content="Phonebooths" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.BrPhonebooths}" -->
|
||||
<!-- DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" /> -->
|
||||
<!-- DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding Status.IsReady}" /> -->
|
||||
<CheckBox Content="Weapon-o-matic/Mending Machines" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.BrVendingMachines}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding Status.IsReady}" />
|
||||
<CheckBox Content="Bounty Boards" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.BrBountyBoards}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding Status.IsReady}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="PrTemplate">
|
||||
<StackPanel VerticalAlignment="Center" Margin="25 0">
|
||||
<CheckBox Content="Landmarks" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.PrLandmarks}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding Status.IsReady}" />
|
||||
<CheckBox Content="Cannonball" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.PrCannonball}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding Status.IsReady}" />
|
||||
<CheckBox Content="Skydive" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.PrSkydive}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding Status.IsReady}" />
|
||||
<CheckBox Content="Shooting Targets" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.PrShootingTargets}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding Status.IsReady}" />
|
||||
<CheckBox Content="Parkour" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.PrParkour}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding Status.IsReady}" />
|
||||
<CheckBox Content="Time Trials" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.PrTimeTrials}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding Status.IsReady}" />
|
||||
<CheckBox Content="Vending Machines" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.PrVendingMachines}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding Status.IsReady}" />
|
||||
<CheckBox Content="Music Blocks" Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" IsChecked="{Binding MapViewer.PrMusicBlocks}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding IsReady}" />
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.MapViewer}}}" IsEnabled="{Binding Status.IsReady}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ResourceDictionary>
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
<ContentControl ContentTemplateSelector="{StaticResource TagTemplateSelector}" Content="{Binding SelectedItem.Tag, ElementName=MapTree}" />
|
||||
</Grid>
|
||||
|
||||
<Button Grid.Row="2" Content="Save Image" Margin="5" IsEnabled="{Binding IsReady}" VerticalAlignment="Bottom" Click="OnClick" />
|
||||
<Button Grid.Row="2" Content="Save Image" Margin="5" IsEnabled="{Binding Status.IsReady}" VerticalAlignment="Bottom" Click="OnClick" />
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Column="1" HorizontalAlignment="Stretch">
|
||||
|
|
@ -118,9 +118,9 @@
|
|||
|
||||
<TextBlock Text="Minimap is loading, please wait..." HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<Image UseLayoutRounding="True" Source="{Binding MapViewer.MapImage}" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Visibility="{Binding IsReady, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
Visibility="{Binding Status.IsReady, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<Image UseLayoutRounding="True" Source="{Binding MapViewer.LayerImage}" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Visibility="{Binding IsReady, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
Visibility="{Binding Status.IsReady, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</adonisControls:AdonisWindow>
|
||||
|
|
|
|||
|
|
@ -75,8 +75,8 @@ public class GamePathVisualLineText : VisualLineText
|
|||
}
|
||||
else
|
||||
{
|
||||
await _threadWorkerView.Begin(_ =>
|
||||
_applicationView.CUE4Parse.ExtractAndScroll(fullPath, obj));
|
||||
await _threadWorkerView.Begin(cancellationToken =>
|
||||
_applicationView.CUE4Parse.ExtractAndScroll(cancellationToken, fullPath, obj));
|
||||
}
|
||||
};
|
||||
return a;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public partial class SearchView
|
|||
return;
|
||||
|
||||
WindowState = WindowState.Minimized;
|
||||
await _threadWorkerView.Begin(_ => _applicationView.CUE4Parse.Extract(assetItem.FullPath, true));
|
||||
await _threadWorkerView.Begin(cancellationToken => _applicationView.CUE4Parse.Extract(cancellationToken, assetItem.FullPath, true));
|
||||
|
||||
MainWindow.YesWeCats.Activate();
|
||||
}
|
||||
|
|
@ -80,4 +80,4 @@ public partial class SearchView
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using CUE4Parse.UE4.Assets.Exports;
|
||||
using CUE4Parse.UE4.Assets.Exports.Material;
|
||||
|
|
@ -94,7 +95,7 @@ public class Snooper
|
|||
_models = new Dictionary<FGuid, Model>();
|
||||
}
|
||||
|
||||
public void Run(UObject export)
|
||||
public void Run(CancellationToken cancellationToken, UObject export)
|
||||
{
|
||||
switch (export)
|
||||
{
|
||||
|
|
@ -133,8 +134,10 @@ public class Snooper
|
|||
case UWorld wd:
|
||||
{
|
||||
var persistentLevel = wd.PersistentLevel.Load<ULevel>();
|
||||
for (var i = 0; i < persistentLevel.Actors.Length; i++)
|
||||
var length = persistentLevel.Actors.Length;
|
||||
for (var i = 0; i < length; i++)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
if (persistentLevel.Actors[i].Load() is not { } actor || actor.ExportType == "LODActor" ||
|
||||
!actor.TryGetValue(out FPackageIndex staticMeshComponent, "StaticMeshComponent") ||
|
||||
staticMeshComponent.Load() is not { } staticMeshComp) continue;
|
||||
|
|
@ -146,6 +149,8 @@ public class Snooper
|
|||
if (staticMesh?.Load() is not UStaticMesh m)
|
||||
continue;
|
||||
|
||||
Services.ApplicationService.ApplicationView.Status.UpdateStatusLabel($"Actor {i}/{length}");
|
||||
|
||||
var guid = m.LightingGuid;
|
||||
var transform = new Transform
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user