bunch of stuff

This commit is contained in:
4sval 2022-08-16 20:43:09 +02:00
parent 77903bad20
commit 83f1f3b1e7
6 changed files with 10 additions and 14 deletions

@ -1 +1 @@
Subproject commit 92d575d4eac879cca8cfeed6fa8401ede1913750
Subproject commit fe4f1d044dc2b8a3ebfaf6568ea65356a86bd83d

View File

@ -385,7 +385,7 @@ namespace FModel.Settings
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 ()}},

View File

@ -62,7 +62,7 @@ public class DynamicApiEndpoint : AbstractApiProvider
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)
{
@ -70,6 +70,6 @@ public class DynamicApiEndpoint : AbstractApiProvider
};
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("{}");
}
}

View File

@ -117,7 +117,7 @@ public class AssetsFolderViewModel
{
for (var i = 0; i < list.Count; i++)
{
if (list[i].Header == header)
if (list[i].Header.Equals(header, StringComparison.OrdinalIgnoreCase))
return list[i];
}

View File

@ -121,10 +121,11 @@ public class ThreadWorkerViewModel : ViewModel
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);
}

View File

@ -60,12 +60,7 @@ public partial class EndpointEditor
{
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();