Skip to content

Commit

Permalink
bunch of stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
4sval committed Aug 16, 2022
1 parent 77903ba commit 83f1f3b
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CUE4Parse
2 changes: 1 addition & 1 deletion FModel/Settings/UserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public IDictionary<FGame, Dictionary<string, bool>> 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 ()}},
Expand Down
4 changes: 2 additions & 2 deletions FModel/ViewModels/ApiEndpoints/DynamicApiEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ public MappingsResponse[] GetMappings(CancellationToken token, string url, strin
return GetMappingsAsync(token, url, path).GetAwaiter().GetResult();
}

private async Task<JToken> GetRequestBody(CancellationToken token, string url)
public async Task<JToken> GetRequestBody(CancellationToken token, string url)
{
var request = new FRestRequest(url)
{
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, 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("{}");
}
}
2 changes: 1 addition & 1 deletion FModel/ViewModels/AssetsFolderViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static TreeItem FindByHeaderOrNull(IReadOnlyList<TreeItem> 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];
}
Expand Down
7 changes: 4 additions & 3 deletions FModel/ViewModels/ThreadWorkerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
7 changes: 1 addition & 6 deletions FModel/Views/Resources/Controls/EndpointEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 83f1f3b

Please sign in to comment.