mirror of
https://github.com/4sval/FModel.git
synced 2026-04-15 14:06:42 -05:00
33 lines
1.0 KiB
C#
33 lines
1.0 KiB
C#
using System.Collections;
|
|
using System.Linq;
|
|
using FModel.Framework;
|
|
using FModel.Services;
|
|
|
|
namespace FModel.ViewModels.Commands
|
|
{
|
|
public class ExtractNewTabCommand : ViewModelCommand<ApplicationViewModel>
|
|
{
|
|
private ThreadWorkerViewModel _threadWorkerView => ApplicationService.ThreadWorkerView;
|
|
|
|
public ExtractNewTabCommand(ApplicationViewModel contextViewModel) : base(contextViewModel)
|
|
{
|
|
}
|
|
|
|
public override async void Execute(ApplicationViewModel contextViewModel, object parameter)
|
|
{
|
|
if (parameter == null) return;
|
|
|
|
var assetItems = ((IList) parameter).Cast<AssetItem>().ToArray();
|
|
if (!assetItems.Any()) return;
|
|
|
|
await _threadWorkerView.Begin(cancellationToken =>
|
|
{
|
|
foreach (var asset in assetItems)
|
|
{
|
|
cancellationToken.ThrowIfCancellationRequested();
|
|
contextViewModel.CUE4Parse.Extract(asset.FullPath, true);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
} |