From 83f1f3b1e7b17bca21df1d2bb80fcdd7bb552c2e Mon Sep 17 00:00:00 2001 From: 4sval Date: Tue, 16 Aug 2022 20:43:09 +0200 Subject: [PATCH] bunch of stuff --- CUE4Parse | 2 +- FModel/Settings/UserSettings.cs | 2 +- FModel/ViewModels/ApiEndpoints/DynamicApiEndpoint.cs | 4 ++-- FModel/ViewModels/AssetsFolderViewModel.cs | 2 +- FModel/ViewModels/ThreadWorkerViewModel.cs | 7 ++++--- FModel/Views/Resources/Controls/EndpointEditor.xaml.cs | 7 +------ 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/CUE4Parse b/CUE4Parse index 92d575d4..fe4f1d04 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit 92d575d4eac879cca8cfeed6fa8401ede1913750 +Subproject commit fe4f1d044dc2b8a3ebfaf6568ea65356a86bd83d diff --git a/FModel/Settings/UserSettings.cs b/FModel/Settings/UserSettings.cs index 618097db..e099443b 100644 --- a/FModel/Settings/UserSettings.cs +++ b/FModel/Settings/UserSettings.cs @@ -385,7 +385,7 @@ public IDictionary> OverridedOptions FGame.FortniteGame, new [] { new FEndpoint("https://fortnitecentral.gmatrixgames.ga/api/v1/aes", "$.['mainKey','dynamicKeys']"), - new FEndpoint("https://fortnitecentral.gmatrixgames.ga/api/v1/mappings", "$.[?(@.meta.compressionMethod=='Oodle')].['url','fileName']") + new FEndpoint("https://fortnitecentral.gmatrixgames.ga/api/v1/mappings", "$.[?(@.meta.compressionMethod=='Oodle')].['url','fileName']") // && @.meta.platform=='Windows' } }, {FGame.ShooterGame, new FEndpoint[]{new (), new ()}}, diff --git a/FModel/ViewModels/ApiEndpoints/DynamicApiEndpoint.cs b/FModel/ViewModels/ApiEndpoints/DynamicApiEndpoint.cs index 42808d7d..63d072f4 100644 --- a/FModel/ViewModels/ApiEndpoints/DynamicApiEndpoint.cs +++ b/FModel/ViewModels/ApiEndpoints/DynamicApiEndpoint.cs @@ -62,7 +62,7 @@ public MappingsResponse[] GetMappings(CancellationToken token, string url, strin return GetMappingsAsync(token, url, path).GetAwaiter().GetResult(); } - private async Task GetRequestBody(CancellationToken token, string url) + public async Task GetRequestBody(CancellationToken token, string url) { var request = new FRestRequest(url) { @@ -70,6 +70,6 @@ private async Task GetRequestBody(CancellationToken token, string url) }; var response = await _client.ExecuteAsync(request, token).ConfigureAwait(false); Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString); - return string.IsNullOrEmpty(response.Content) ? JToken.Parse("{}") : JToken.Parse(response.Content); + return response.IsSuccessful && !string.IsNullOrEmpty(response.Content) ? JToken.Parse(response.Content) : JToken.Parse("{}"); } } diff --git a/FModel/ViewModels/AssetsFolderViewModel.cs b/FModel/ViewModels/AssetsFolderViewModel.cs index 053c2d74..92887a61 100644 --- a/FModel/ViewModels/AssetsFolderViewModel.cs +++ b/FModel/ViewModels/AssetsFolderViewModel.cs @@ -117,7 +117,7 @@ static TreeItem FindByHeaderOrNull(IReadOnlyList list, string header) { for (var i = 0; i < list.Count; i++) { - if (list[i].Header == header) + if (list[i].Header.Equals(header, StringComparison.OrdinalIgnoreCase)) return list[i]; } diff --git a/FModel/ViewModels/ThreadWorkerViewModel.cs b/FModel/ViewModels/ThreadWorkerViewModel.cs index 4de3421c..2f8fc49f 100644 --- a/FModel/ViewModels/ThreadWorkerViewModel.cs +++ b/FModel/ViewModels/ThreadWorkerViewModel.cs @@ -121,10 +121,11 @@ private async Task ProcessQueues() FLogger.AppendText(exception.TargetSite.DeclaringType.FullName + _dot, Constants.GRAY); FLogger.AppendText(exception.TargetSite.Name, Constants.YELLOW); - var parameters = new StringBuilder(); - foreach (var parameter in exception.TargetSite.GetParameters()) + var p = exception.TargetSite.GetParameters(); + var parameters = new string[p.Length]; + for (int i = 0; i < parameters.Length; i++) { - parameters.Append(parameter.ParameterType.Name + " " + parameter.Name); + parameters[i] = p[i].ParameterType.Name + " " + p[i].Name; } FLogger.AppendText("(" + string.Join(", ", parameters) + ")", Constants.GRAY, true); } diff --git a/FModel/Views/Resources/Controls/EndpointEditor.xaml.cs b/FModel/Views/Resources/Controls/EndpointEditor.xaml.cs index 594279d1..e8559507 100644 --- a/FModel/Views/Resources/Controls/EndpointEditor.xaml.cs +++ b/FModel/Views/Resources/Controls/EndpointEditor.xaml.cs @@ -60,12 +60,7 @@ private async void OnSend(object sender, RoutedEventArgs e) { if (DataContext is not FEndpoint endpoint) return; - var response = await new RestClient().ExecuteAsync(new FRestRequest(endpoint.Url) - { - OnBeforeDeserialization = resp => { resp.ContentType = "application/json; charset=utf-8"; } - }).ConfigureAwait(false); - var body = string.IsNullOrEmpty(response.Content) ? JToken.Parse("{}") : JToken.Parse(response.Content); - + var body = await ApplicationService.ApiEndpointView.DynamicApi.GetRequestBody(default, endpoint.Url).ConfigureAwait(false); Application.Current.Dispatcher.Invoke(delegate { EndpointResponse.Document ??= new TextDocument();