pak double click + fixed export

This commit is contained in:
Valentin 2021-05-23 12:13:39 +02:00
parent df27d650a8
commit dd1457b580
5 changed files with 16 additions and 12 deletions

View File

@ -27,7 +27,7 @@ namespace FModel.Framework
protected ViewModelCommand(TContextViewModel contextViewModel)
{
ContextViewModel = contextViewModel /*?? throw new ArgumentNullException(nameof(contextViewModel))*/;
ContextViewModel = contextViewModel ?? throw new ArgumentNullException(nameof(contextViewModel));
}
public sealed override void Execute(object parameter)

View File

@ -278,7 +278,7 @@
</Grid.RowDefinitions>
<Separator Grid.Row="0" Style="{StaticResource CustomSeparator}" Tag="GAME DIRECTORY" />
<ListBox Grid.Row="1" x:Name="DirectoryFilesListBox" Style="{StaticResource DirectoryFilesListBox}" />
<ListBox Grid.Row="1" x:Name="DirectoryFilesListBox" Style="{StaticResource DirectoryFilesListBox}" MouseDoubleClick="OnMouseDoubleClick" />
<Separator Grid.Row="2" Style="{StaticResource CustomSeparator}" Tag="INFORMATION" />
<StackPanel Grid.Row="3" Orientation="Vertical" Margin="0 0 0 5">
<Grid HorizontalAlignment="Stretch">

View File

@ -233,5 +233,12 @@ namespace FModel
return o is AssetItem assetItem && filters.All(x => assetItem.FullPath.SubstringAfterLast('/').Contains(x, StringComparison.OrdinalIgnoreCase));
};
}
private void OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
if (sender is not ListBox listBox) return;
UserSettings.Default.LoadingMode = ELoadingMode.Multiple;
_applicationView.LoadingModes.LoadCommand.Execute(listBox.SelectedItems);
}
}
}

View File

@ -617,17 +617,14 @@ namespace FModel.ViewModels
if (Provider.TrySavePackage(fullPath, out var assets))
{
foreach (var (key, value) in assets)
foreach (var kvp in assets)
{
directory = Path.Combine(directory, UserSettings.Default.KeepDirectoryStructure == EEnabledDisabled.Enabled
? key : key.SubstringAfterLast('/')).Replace('\\', '/');
Directory.CreateDirectory(directory.SubstringBeforeLast('/'));
File.WriteAllBytes(directory, value);
var path = Path.Combine(directory, UserSettings.Default.KeepDirectoryStructure == EEnabledDisabled.Enabled
? kvp.Key : kvp.Key.SubstringAfterLast('/')).Replace('\\', '/');
Directory.CreateDirectory(path.SubstringBeforeLast('/'));
File.WriteAllBytes(path, kvp.Value);
}
}
if (File.Exists(directory))
{
Log.Information("{FileName} successfully exported", fileName);
FLogger.AppendInformation();
FLogger.AppendText($"Successfully exported '{fileName}'", Constants.WHITE, true);

View File

@ -36,7 +36,7 @@ namespace FModel.Views
WindowState = WindowState.Minimized;
MainWindow.YesWeCats.AssetsListName.ItemsSource = null;
var folder = new GoToCommand(null).JumpTo(assetItem.FullPath.SubstringBeforeLast('/'));
var folder = _applicationView.CustomDirectories.GoToCommand.JumpTo(assetItem.FullPath.SubstringBeforeLast('/'));
if (folder == null) return;
do { await Task.Delay(100); } while (MainWindow.YesWeCats.AssetsListName.Items.Count < folder.AssetsList.Assets.Count);