diff --git a/FModel/MainWindow.xaml.cs b/FModel/MainWindow.xaml.cs
index b6c46edf..afb5ce54 100644
--- a/FModel/MainWindow.xaml.cs
+++ b/FModel/MainWindow.xaml.cs
@@ -1 +1,242 @@
-using System;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using AdonisUI.Controls;
using FModel.Extensions;
using FModel.Services;
using FModel.Settings;
using FModel.ViewModels;
using FModel.Views;
using FModel.Views.Resources.Controls;
using ICSharpCode.AvalonEdit.Editing;
namespace FModel;
///
/// Interaction logic for MainWindow.xaml
///
public partial class MainWindow
{
public static MainWindow YesWeCats;
private ThreadWorkerViewModel _threadWorkerView => ApplicationService.ThreadWorkerView;
private ApplicationViewModel _applicationView => ApplicationService.ApplicationView;
private DiscordHandler _discordHandler => DiscordService.DiscordHandler;
public MainWindow()
{
CommandBindings.Add(new CommandBinding(new RoutedCommand("AutoSaveProps", typeof(MainWindow), new InputGestureCollection { new KeyGesture(UserSettings.Default.AutoSaveProps.Key, UserSettings.Default.AutoSaveProps.Modifiers) }), OnAutoTriggerExecuted));
CommandBindings.Add(new CommandBinding(new RoutedCommand("AutoSaveTextures", typeof(MainWindow), new InputGestureCollection { new KeyGesture(UserSettings.Default.AutoSaveTextures.Key, UserSettings.Default.AutoSaveTextures.Modifiers) }), OnAutoTriggerExecuted));
CommandBindings.Add(new CommandBinding(new RoutedCommand("AutoOpenSounds", typeof(MainWindow), new InputGestureCollection { new KeyGesture(UserSettings.Default.AutoOpenSounds.Key, UserSettings.Default.AutoOpenSounds.Modifiers) }), OnAutoTriggerExecuted));
CommandBindings.Add(new CommandBinding(new RoutedCommand("ReloadMappings", typeof(MainWindow), new InputGestureCollection { new KeyGesture(Key.F12) }), OnMappingsReload));
CommandBindings.Add(new CommandBinding(ApplicationCommands.Find, (_, _) => OnOpenAvalonFinder()));
DataContext = _applicationView;
InitializeComponent();
FLogger.Logger = LogRtbName;
YesWeCats = this;
}
private void OnClosing(object sender, CancelEventArgs e)
{
_applicationView.CustomDirectories.Save();
_discordHandler.Dispose();
}
private async void OnLoaded(object sender, RoutedEventArgs e)
{
#if !DEBUG
ApplicationService.ApiEndpointView.FModelApi.CheckForUpdates(UserSettings.Default.UpdateMode);
#endif
switch (UserSettings.Default.AesReload)
{
case EAesReload.Always:
await _applicationView.CUE4Parse.RefreshAes();
break;
case EAesReload.OncePerDay when UserSettings.Default.LastAesReload != DateTime.Today:
UserSettings.Default.LastAesReload = DateTime.Today;
await _applicationView.CUE4Parse.RefreshAes();
break;
}
await _applicationView.CUE4Parse.InitInformation();
await _applicationView.CUE4Parse.Initialize();
await _applicationView.AesManager.InitAes();
await _applicationView.AesManager.UpdateProvider(true);
await _applicationView.CUE4Parse.InitBenMappings();
await _applicationView.InitVgmStream();
await _applicationView.InitOodle();
if (UserSettings.Default.DiscordRpc == EDiscordRpc.Always)
_discordHandler.Initialize(_applicationView.CUE4Parse.Game);
}
private void OnGridSplitterDoubleClick(object sender, MouseButtonEventArgs e)
{
RootGrid.ColumnDefinitions[0].Width = GridLength.Auto;
}
private void OnWindowKeyDown(object sender, KeyEventArgs e)
{
if (e.OriginalSource is TextBox || e.OriginalSource is TextArea && Keyboard.Modifiers.HasFlag(ModifierKeys.Control))
return;
if (_threadWorkerView.CanBeCanceled && e.Key == Key.Escape)
{
_applicationView.Status = EStatusKind.Stopping;
_threadWorkerView.Cancel();
}
else if (_applicationView.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();
else if (e.Key == Key.Right && _applicationView.CUE4Parse.TabControl.SelectedTab.HasImage)
_applicationView.CUE4Parse.TabControl.SelectedTab.GoNextImage();
else if (UserSettings.Default.AssetAddTab.IsTriggered(e.Key))
_applicationView.CUE4Parse.TabControl.AddTab();
else if (UserSettings.Default.AssetRemoveTab.IsTriggered(e.Key))
_applicationView.CUE4Parse.TabControl.RemoveTab();
else if (UserSettings.Default.AssetLeftTab.IsTriggered(e.Key))
_applicationView.CUE4Parse.TabControl.GoLeftTab();
else if (UserSettings.Default.AssetRightTab.IsTriggered(e.Key))
_applicationView.CUE4Parse.TabControl.GoRightTab();
else if (UserSettings.Default.DirLeftTab.IsTriggered(e.Key) && LeftTabControl.SelectedIndex > 0)
LeftTabControl.SelectedIndex--;
else if (UserSettings.Default.DirRightTab.IsTriggered(e.Key) && LeftTabControl.SelectedIndex < LeftTabControl.Items.Count - 1)
LeftTabControl.SelectedIndex++;
}
private void OnSearchViewClick(object sender, RoutedEventArgs e)
{
Helper.OpenWindow("Search View", () => new SearchView().Show());
}
private void OnTabItemChange(object sender, SelectionChangedEventArgs e)
{
if (e.OriginalSource is not TabControl tabControl)
return;
(tabControl.SelectedItem as System.Windows.Controls.TabItem)?.Focus();
}
private async void OnMappingsReload(object sender, ExecutedRoutedEventArgs e)
{
await _applicationView.CUE4Parse.InitBenMappings();
}
private void OnAutoTriggerExecuted(object sender, ExecutedRoutedEventArgs e)
{
switch ((e.Command as RoutedCommand)?.Name)
{
case "AutoSaveProps":
UserSettings.Default.IsAutoSaveProps = !UserSettings.Default.IsAutoSaveProps;
break;
case "AutoSaveTextures":
UserSettings.Default.IsAutoSaveTextures = !UserSettings.Default.IsAutoSaveTextures;
break;
case "AutoOpenSounds":
UserSettings.Default.IsAutoOpenSounds = !UserSettings.Default.IsAutoOpenSounds;
break;
}
}
private void OnOpenAvalonFinder()
{
_applicationView.CUE4Parse.TabControl.SelectedTab.HasSearchOpen = true;
AvalonEditor.YesWeSearch.Focus();
AvalonEditor.YesWeSearch.SelectAll();
}
private void OnAssetsTreeMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
if (sender is not TreeView { SelectedItem: TreeItem treeItem } || treeItem.Folders.Count > 0) return;
LeftTabControl.SelectedIndex++;
}
private async void OnAssetsListMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
if (sender is not ListBox listBox) return;
var selectedItems = listBox.SelectedItems.Cast().ToList();
await _threadWorkerView.Begin(cancellationToken => { _applicationView.CUE4Parse.ExtractSelected(cancellationToken, selectedItems); });
}
private async void OnFolderExtractClick(object sender, RoutedEventArgs e)
{
if (AssetsFolderName.SelectedItem is TreeItem folder)
{
await _threadWorkerView.Begin(cancellationToken => { _applicationView.CUE4Parse.ExtractFolder(cancellationToken, folder); });
}
}
private async void OnFolderExportClick(object sender, RoutedEventArgs e)
{
if (AssetsFolderName.SelectedItem is TreeItem folder)
{
await _threadWorkerView.Begin(cancellationToken => { _applicationView.CUE4Parse.ExportFolder(cancellationToken, folder); });
}
}
private async void OnFolderSaveClick(object sender, RoutedEventArgs e)
{
if (AssetsFolderName.SelectedItem is TreeItem folder)
{
await _threadWorkerView.Begin(cancellationToken => { _applicationView.CUE4Parse.SaveFolder(cancellationToken, folder); });
}
}
private void OnSaveDirectoryClick(object sender, RoutedEventArgs e)
{
if (AssetsFolderName.SelectedItem is not TreeItem folder) return;
_applicationView.CustomDirectories.Add(new CustomDirectory(folder.Header, folder.PathAtThisPoint));
FLogger.AppendInformation();
FLogger.AppendText($"Successfully saved '{folder.PathAtThisPoint}' as a new custom directory", Constants.WHITE, true);
}
private void OnCopyDirectoryPathClick(object sender, RoutedEventArgs e)
{
if (AssetsFolderName.SelectedItem is not TreeItem folder) return;
Clipboard.SetText(folder.PathAtThisPoint);
}
private void OnDeleteSearchClick(object sender, RoutedEventArgs e)
{
AssetsSearchName.Text = string.Empty;
AssetsListName.ScrollIntoView(AssetsListName.SelectedItem);
}
private void OnFilterTextChanged(object sender, TextChangedEventArgs e)
{
if (sender is not TextBox textBox || AssetsFolderName.SelectedItem is not TreeItem folder)
return;
var filters = textBox.Text.Trim().Split(' ');
folder.AssetsList.AssetsView.Filter = o => { return o is AssetItem assetItem && filters.All(x => assetItem.FullPath.SubstringAfterLast('/').Contains(x, StringComparison.OrdinalIgnoreCase)); };
}
private void OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
if (!_applicationView.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;
switch (e.Key)
{
case Key.Enter:
var selectedItems = listBox.SelectedItems.Cast().ToList();
await _threadWorkerView.Begin(cancellationToken => { _applicationView.CUE4Parse.ExtractSelected(cancellationToken, selectedItems); });
break;
}
}
}
\ No newline at end of file
+using System;
+using System.ComponentModel;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using AdonisUI.Controls;
+using FModel.Extensions;
+using FModel.Services;
+using FModel.Settings;
+using FModel.ViewModels;
+using FModel.Views;
+using FModel.Views.Resources.Controls;
+using ICSharpCode.AvalonEdit.Editing;
+
+namespace FModel;
+
+///
+/// Interaction logic for MainWindow.xaml
+///
+public partial class MainWindow
+{
+ public static MainWindow YesWeCats;
+ private ThreadWorkerViewModel _threadWorkerView => ApplicationService.ThreadWorkerView;
+ private ApplicationViewModel _applicationView => ApplicationService.ApplicationView;
+ private DiscordHandler _discordHandler => DiscordService.DiscordHandler;
+
+ public MainWindow()
+ {
+ CommandBindings.Add(new CommandBinding(new RoutedCommand("AutoSaveProps", typeof(MainWindow), new InputGestureCollection { new KeyGesture(UserSettings.Default.AutoSaveProps.Key, UserSettings.Default.AutoSaveProps.Modifiers) }), OnAutoTriggerExecuted));
+ CommandBindings.Add(new CommandBinding(new RoutedCommand("AutoSaveTextures", typeof(MainWindow), new InputGestureCollection { new KeyGesture(UserSettings.Default.AutoSaveTextures.Key, UserSettings.Default.AutoSaveTextures.Modifiers) }), OnAutoTriggerExecuted));
+ CommandBindings.Add(new CommandBinding(new RoutedCommand("AutoOpenSounds", typeof(MainWindow), new InputGestureCollection { new KeyGesture(UserSettings.Default.AutoOpenSounds.Key, UserSettings.Default.AutoOpenSounds.Modifiers) }), OnAutoTriggerExecuted));
+ CommandBindings.Add(new CommandBinding(new RoutedCommand("ReloadMappings", typeof(MainWindow), new InputGestureCollection { new KeyGesture(Key.F12) }), OnMappingsReload));
+ CommandBindings.Add(new CommandBinding(ApplicationCommands.Find, (_, _) => OnOpenAvalonFinder()));
+
+ DataContext = _applicationView;
+ InitializeComponent();
+
+ FLogger.Logger = LogRtbName;
+ YesWeCats = this;
+ }
+
+ private void OnClosing(object sender, CancelEventArgs e)
+ {
+ _applicationView.CustomDirectories.Save();
+ _discordHandler.Dispose();
+ }
+
+ private async void OnLoaded(object sender, RoutedEventArgs e)
+ {
+#if !DEBUG
+ ApplicationService.ApiEndpointView.FModelApi.CheckForUpdates(UserSettings.Default.UpdateMode);
+#endif
+
+ switch (UserSettings.Default.AesReload)
+ {
+ case EAesReload.Always:
+ await _applicationView.CUE4Parse.RefreshAes();
+ break;
+ case EAesReload.OncePerDay when UserSettings.Default.LastAesReload != DateTime.Today:
+ UserSettings.Default.LastAesReload = DateTime.Today;
+ await _applicationView.CUE4Parse.RefreshAes();
+ break;
+ }
+
+ await _applicationView.CUE4Parse.Initialize();
+ await _applicationView.AesManager.InitAes();
+ await _applicationView.AesManager.UpdateProvider(true);
+ await _applicationView.CUE4Parse.InitInformation();
+ await _applicationView.CUE4Parse.InitBenMappings();
+ await _applicationView.InitVgmStream();
+ await _applicationView.InitOodle();
+
+ if (UserSettings.Default.DiscordRpc == EDiscordRpc.Always)
+ _discordHandler.Initialize(_applicationView.CUE4Parse.Game);
+ }
+
+ private void OnGridSplitterDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ RootGrid.ColumnDefinitions[0].Width = GridLength.Auto;
+ }
+
+ private void OnWindowKeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.OriginalSource is TextBox || e.OriginalSource is TextArea && Keyboard.Modifiers.HasFlag(ModifierKeys.Control))
+ return;
+
+ if (_threadWorkerView.CanBeCanceled && e.Key == Key.Escape)
+ {
+ _applicationView.Status = EStatusKind.Stopping;
+ _threadWorkerView.Cancel();
+ }
+ else if (_applicationView.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();
+ else if (e.Key == Key.Right && _applicationView.CUE4Parse.TabControl.SelectedTab.HasImage)
+ _applicationView.CUE4Parse.TabControl.SelectedTab.GoNextImage();
+ else if (UserSettings.Default.AssetAddTab.IsTriggered(e.Key))
+ _applicationView.CUE4Parse.TabControl.AddTab();
+ else if (UserSettings.Default.AssetRemoveTab.IsTriggered(e.Key))
+ _applicationView.CUE4Parse.TabControl.RemoveTab();
+ else if (UserSettings.Default.AssetLeftTab.IsTriggered(e.Key))
+ _applicationView.CUE4Parse.TabControl.GoLeftTab();
+ else if (UserSettings.Default.AssetRightTab.IsTriggered(e.Key))
+ _applicationView.CUE4Parse.TabControl.GoRightTab();
+ else if (UserSettings.Default.DirLeftTab.IsTriggered(e.Key) && LeftTabControl.SelectedIndex > 0)
+ LeftTabControl.SelectedIndex--;
+ else if (UserSettings.Default.DirRightTab.IsTriggered(e.Key) && LeftTabControl.SelectedIndex < LeftTabControl.Items.Count - 1)
+ LeftTabControl.SelectedIndex++;
+ }
+
+ private void OnSearchViewClick(object sender, RoutedEventArgs e)
+ {
+ Helper.OpenWindow("Search View", () => new SearchView().Show());
+ }
+
+ private void OnTabItemChange(object sender, SelectionChangedEventArgs e)
+ {
+ if (e.OriginalSource is not TabControl tabControl)
+ return;
+
+ (tabControl.SelectedItem as System.Windows.Controls.TabItem)?.Focus();
+ }
+
+ private async void OnMappingsReload(object sender, ExecutedRoutedEventArgs e)
+ {
+ await _applicationView.CUE4Parse.InitBenMappings();
+ }
+
+ private void OnAutoTriggerExecuted(object sender, ExecutedRoutedEventArgs e)
+ {
+ switch ((e.Command as RoutedCommand)?.Name)
+ {
+ case "AutoSaveProps":
+ UserSettings.Default.IsAutoSaveProps = !UserSettings.Default.IsAutoSaveProps;
+ break;
+ case "AutoSaveTextures":
+ UserSettings.Default.IsAutoSaveTextures = !UserSettings.Default.IsAutoSaveTextures;
+ break;
+ case "AutoOpenSounds":
+ UserSettings.Default.IsAutoOpenSounds = !UserSettings.Default.IsAutoOpenSounds;
+ break;
+ }
+ }
+
+ private void OnOpenAvalonFinder()
+ {
+ _applicationView.CUE4Parse.TabControl.SelectedTab.HasSearchOpen = true;
+ AvalonEditor.YesWeSearch.Focus();
+ AvalonEditor.YesWeSearch.SelectAll();
+ }
+
+ private void OnAssetsTreeMouseDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ if (sender is not TreeView { SelectedItem: TreeItem treeItem } || treeItem.Folders.Count > 0) return;
+
+ LeftTabControl.SelectedIndex++;
+ }
+
+ private async void OnAssetsListMouseDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ if (sender is not ListBox listBox) return;
+
+ var selectedItems = listBox.SelectedItems.Cast().ToList();
+ await _threadWorkerView.Begin(cancellationToken => { _applicationView.CUE4Parse.ExtractSelected(cancellationToken, selectedItems); });
+ }
+
+ private async void OnFolderExtractClick(object sender, RoutedEventArgs e)
+ {
+ if (AssetsFolderName.SelectedItem is TreeItem folder)
+ {
+ await _threadWorkerView.Begin(cancellationToken => { _applicationView.CUE4Parse.ExtractFolder(cancellationToken, folder); });
+ }
+ }
+
+ private async void OnFolderExportClick(object sender, RoutedEventArgs e)
+ {
+ if (AssetsFolderName.SelectedItem is TreeItem folder)
+ {
+ await _threadWorkerView.Begin(cancellationToken => { _applicationView.CUE4Parse.ExportFolder(cancellationToken, folder); });
+ }
+ }
+
+ private async void OnFolderSaveClick(object sender, RoutedEventArgs e)
+ {
+ if (AssetsFolderName.SelectedItem is TreeItem folder)
+ {
+ await _threadWorkerView.Begin(cancellationToken => { _applicationView.CUE4Parse.SaveFolder(cancellationToken, folder); });
+ }
+ }
+
+ private void OnSaveDirectoryClick(object sender, RoutedEventArgs e)
+ {
+ if (AssetsFolderName.SelectedItem is not TreeItem folder) return;
+
+ _applicationView.CustomDirectories.Add(new CustomDirectory(folder.Header, folder.PathAtThisPoint));
+ FLogger.AppendInformation();
+ FLogger.AppendText($"Successfully saved '{folder.PathAtThisPoint}' as a new custom directory", Constants.WHITE, true);
+ }
+
+ private void OnCopyDirectoryPathClick(object sender, RoutedEventArgs e)
+ {
+ if (AssetsFolderName.SelectedItem is not TreeItem folder) return;
+ Clipboard.SetText(folder.PathAtThisPoint);
+ }
+
+ private void OnDeleteSearchClick(object sender, RoutedEventArgs e)
+ {
+ AssetsSearchName.Text = string.Empty;
+ AssetsListName.ScrollIntoView(AssetsListName.SelectedItem);
+ }
+
+ private void OnFilterTextChanged(object sender, TextChangedEventArgs e)
+ {
+ if (sender is not TextBox textBox || AssetsFolderName.SelectedItem is not TreeItem folder)
+ return;
+
+ var filters = textBox.Text.Trim().Split(' ');
+ folder.AssetsList.AssetsView.Filter = o => { return o is AssetItem assetItem && filters.All(x => assetItem.FullPath.SubstringAfterLast('/').Contains(x, StringComparison.OrdinalIgnoreCase)); };
+ }
+
+ private void OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ if (!_applicationView.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;
+
+ switch (e.Key)
+ {
+ case Key.Enter:
+ var selectedItems = listBox.SelectedItems.Cast().ToList();
+ await _threadWorkerView.Begin(cancellationToken => { _applicationView.CUE4Parse.ExtractSelected(cancellationToken, selectedItems); });
+ break;
+ }
+ }
+}
diff --git a/FModel/ViewModels/ApiEndpoints/BenbotApiEndpoint.cs b/FModel/ViewModels/ApiEndpoints/BenbotApiEndpoint.cs
index 5bd477ff..9c62a522 100644
--- a/FModel/ViewModels/ApiEndpoints/BenbotApiEndpoint.cs
+++ b/FModel/ViewModels/ApiEndpoints/BenbotApiEndpoint.cs
@@ -21,7 +21,7 @@ public class BenbotApiEndpoint : AbstractApiProvider
OnBeforeDeserialization = resp => { resp.ContentType = "application/json; charset=utf-8"; }
};
var response = await _client.ExecuteAsync(request, token).ConfigureAwait(false);
- Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, request.Resource);
+ Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
return response.Data;
}
@@ -37,7 +37,7 @@ public class BenbotApiEndpoint : AbstractApiProvider
OnBeforeDeserialization = resp => { resp.ContentType = "application/json; charset=utf-8"; }
};
var response = await _client.ExecuteAsync(request, token).ConfigureAwait(false);
- Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, request.Resource);
+ Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
return response.Data;
}
@@ -54,7 +54,7 @@ public class BenbotApiEndpoint : AbstractApiProvider
};
request.AddParameter("lang", language);
var response = await _client.ExecuteAsync>>(request, token).ConfigureAwait(false);
- Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, request.Resource);
+ Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
return response.Data;
}
diff --git a/FModel/ViewModels/ApiEndpoints/EpicApiEndpoint.cs b/FModel/ViewModels/ApiEndpoints/EpicApiEndpoint.cs
index 57b1e9c7..97277d6c 100644
--- a/FModel/ViewModels/ApiEndpoints/EpicApiEndpoint.cs
+++ b/FModel/ViewModels/ApiEndpoints/EpicApiEndpoint.cs
@@ -33,7 +33,7 @@ public class EpicApiEndpoint : AbstractApiProvider
var request = new RestRequest(_LAUNCHER_ASSETS);
request.AddHeader("Authorization", $"bearer {UserSettings.Default.LastAuthResponse.AccessToken}");
var response = await _client.ExecuteAsync(request, token).ConfigureAwait(false);
- Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, request.Resource);
+ Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
return new ManifestInfo(response.Content);
}
@@ -48,7 +48,7 @@ public class EpicApiEndpoint : AbstractApiProvider
request.AddHeader("Authorization", _BASIC_TOKEN);
request.AddParameter("grant_type", "client_credentials");
var response = await _client.ExecuteAsync(request, token).ConfigureAwait(false);
- Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, request.Resource);
+ Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
return response.Data;
}
diff --git a/FModel/ViewModels/ApiEndpoints/FModelApi.cs b/FModel/ViewModels/ApiEndpoints/FModelApi.cs
index aa763d32..a488b030 100644
--- a/FModel/ViewModels/ApiEndpoints/FModelApi.cs
+++ b/FModel/ViewModels/ApiEndpoints/FModelApi.cs
@@ -32,24 +32,25 @@ public class FModelApi : AbstractApiProvider
{
}
- public async Task GetNewsAsync(CancellationToken token)
+ public async Task GetNewsAsync(CancellationToken token, string game)
{
var request = new RestRequest($"https://api.fmodel.app/v1/news/{Constants.APP_VERSION}");
+ request.AddParameter("game", game);
var response = await _client.ExecuteAsync(request, token).ConfigureAwait(false);
- Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, request.Resource);
+ Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
return response.Data;
}
- public News GetNews(CancellationToken token)
+ public News GetNews(CancellationToken token, string game)
{
- return _news ??= GetNewsAsync(token).GetAwaiter().GetResult();
+ return _news ??= GetNewsAsync(token, game).GetAwaiter().GetResult();
}
public async Task GetInfosAsync(CancellationToken token, EUpdateMode updateMode)
{
var request = new RestRequest($"https://api.fmodel.app/v1/infos/{updateMode}");
var response = await _client.ExecuteAsync(request, token).ConfigureAwait(false);
- Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, request.Resource);
+ Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
return response.Data;
}
@@ -62,7 +63,7 @@ public class FModelApi : AbstractApiProvider
{
var request = new RestRequest($"https://api.fmodel.app/v1/backups/{gameName}");
var response = await _client.ExecuteAsync(request, token).ConfigureAwait(false);
- Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, request.Resource);
+ Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
return response.Data;
}
@@ -75,7 +76,7 @@ public class FModelApi : AbstractApiProvider
{
var request = new RestRequest($"https://api.fmodel.app/v1/games/{gameName}");
var response = await _client.ExecuteAsync(request, token).ConfigureAwait(false);
- Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, request.Resource);
+ Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
return response.Data;
}
@@ -88,7 +89,7 @@ public class FModelApi : AbstractApiProvider
{
var request = new RestRequest($"https://api.fmodel.app/v1/designs/{designName}");
var response = await _client.ExecuteAsync(request).ConfigureAwait(false);
- Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, request.Resource);
+ Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
return response.Data != null ? new CommunityDesign(response.Data) : null;
}
diff --git a/FModel/ViewModels/CUE4ParseViewModel.cs b/FModel/ViewModels/CUE4ParseViewModel.cs
index 7d9aa9e2..37df68eb 100644
--- a/FModel/ViewModels/CUE4ParseViewModel.cs
+++ b/FModel/ViewModels/CUE4ParseViewModel.cs
@@ -308,7 +308,7 @@ public class CUE4ParseViewModel : ViewModel
{
await _threadWorkerView.Begin(cancellationToken =>
{
- var info = _apiEndpointView.FModelApi.GetNews(cancellationToken);
+ var info = _apiEndpointView.FModelApi.GetNews(cancellationToken, Provider.GameName);
if (info == null) return;
for (var i = 0; i < info.Messages.Length; i++)
@@ -320,51 +320,50 @@ public class CUE4ParseViewModel : ViewModel
public async Task InitBenMappings()
{
- if (Game == FGame.FortniteGame)
+ if (Game != FGame.FortniteGame) return;
+
+ await _threadWorkerView.Begin(cancellationToken =>
{
- await _threadWorkerView.Begin(cancellationToken =>
+ if (UserSettings.Default.OverwriteMapping && File.Exists(UserSettings.Default.MappingFilePath))
{
- if (UserSettings.Default.OverwriteMapping && File.Exists(UserSettings.Default.MappingFilePath))
+ Provider.MappingsContainer = new FileUsmapTypeMappingsProvider(UserSettings.Default.MappingFilePath);
+ FLogger.AppendInformation();
+ FLogger.AppendText($"Mappings pulled from '{UserSettings.Default.MappingFilePath.SubstringAfterLast("\\")}'", Constants.WHITE, true);
+ }
+ else
+ {
+ var mappingsFolder = Path.Combine(UserSettings.Default.OutputDirectory, ".data");
+ var mappings = _apiEndpointView.BenbotApi.GetMappings(cancellationToken);
+ if (mappings is { Length: > 0 })
{
- Provider.MappingsContainer = new FileUsmapTypeMappingsProvider(UserSettings.Default.MappingFilePath);
- FLogger.AppendInformation();
- FLogger.AppendText($"Mappings pulled from '{UserSettings.Default.MappingFilePath.SubstringAfterLast("\\")}'", Constants.WHITE, true);
+ foreach (var mapping in mappings)
+ {
+ if (mapping.Meta.CompressionMethod != "Oodle") continue;
+
+ var mappingPath = Path.Combine(mappingsFolder, mapping.FileName);
+ if (!File.Exists(mappingPath))
+ {
+ _apiEndpointView.BenbotApi.DownloadFile(mapping.Url, mappingPath);
+ }
+
+ Provider.MappingsContainer = new FileUsmapTypeMappingsProvider(mappingPath);
+ FLogger.AppendInformation();
+ FLogger.AppendText($"Mappings pulled from '{mapping.FileName}'", Constants.WHITE, true);
+ break;
+ }
}
else
{
- var mappingsFolder = Path.Combine(UserSettings.Default.OutputDirectory, ".data");
- var mappings = _apiEndpointView.BenbotApi.GetMappings(cancellationToken);
- if (mappings is { Length: > 0 })
- {
- foreach (var mapping in mappings)
- {
- if (mapping.Meta.CompressionMethod != "Oodle") continue;
+ var latestUsmaps = new DirectoryInfo(mappingsFolder).GetFiles("*_oo.usmap");
+ if (Provider.MappingsContainer != null || latestUsmaps.Length <= 0) return;
- var mappingPath = Path.Combine(mappingsFolder, mapping.FileName);
- if (!File.Exists(mappingPath))
- {
- _apiEndpointView.BenbotApi.DownloadFile(mapping.Url, mappingPath);
- }
-
- Provider.MappingsContainer = new FileUsmapTypeMappingsProvider(mappingPath);
- FLogger.AppendInformation();
- FLogger.AppendText($"Mappings pulled from '{mapping.FileName}'", Constants.WHITE, true);
- break;
- }
- }
- else
- {
- var latestUsmaps = new DirectoryInfo(mappingsFolder).GetFiles("*_oo.usmap");
- if (Provider.MappingsContainer != null || latestUsmaps.Length <= 0) return;
-
- var latestUsmapInfo = latestUsmaps.OrderBy(f => f.LastWriteTime).Last();
- Provider.MappingsContainer = new FileUsmapTypeMappingsProvider(latestUsmapInfo.FullName);
- FLogger.AppendWarning();
- FLogger.AppendText($"Mappings pulled from '{latestUsmapInfo.Name}'", Constants.WHITE, true);
- }
+ var latestUsmapInfo = latestUsmaps.OrderBy(f => f.LastWriteTime).Last();
+ Provider.MappingsContainer = new FileUsmapTypeMappingsProvider(latestUsmapInfo.FullName);
+ FLogger.AppendWarning();
+ FLogger.AppendText($"Mappings pulled from '{latestUsmapInfo.Name}'", Constants.WHITE, true);
}
- });
- }
+ }
+ });
}
public async Task LoadLocalizedResources()