From 4c790af232175bb4288f5654f7d82f6fe44cce4c Mon Sep 17 00:00:00 2001 From: Asval Date: Sun, 16 Feb 2025 00:20:28 +0100 Subject: [PATCH] fixed use of obsolete methods --- FModel/ViewModels/ApiEndpoints/AbstractApiProvider.cs | 6 ++++++ FModel/ViewModels/ApiEndpoints/DynamicApiEndpoint.cs | 2 +- .../ViewModels/ApiEndpoints/FortniteCentralApiEndpoint.cs | 2 +- FModel/Views/Snooper/Models/SkeletalModel.cs | 4 ++-- FModel/Views/Snooper/Models/StaticModel.cs | 4 ++-- FModel/Views/Snooper/Models/UModel.cs | 4 ++-- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/FModel/ViewModels/ApiEndpoints/AbstractApiProvider.cs b/FModel/ViewModels/ApiEndpoints/AbstractApiProvider.cs index ea0f4c04..400cafe7 100644 --- a/FModel/ViewModels/ApiEndpoints/AbstractApiProvider.cs +++ b/FModel/ViewModels/ApiEndpoints/AbstractApiProvider.cs @@ -1,13 +1,19 @@ using RestSharp; +using RestSharp.Interceptors; namespace FModel.ViewModels.ApiEndpoints; public abstract class AbstractApiProvider { protected readonly RestClient _client; + protected readonly Interceptor _interceptor; protected AbstractApiProvider(RestClient client) { _client = client; + _interceptor = new CompatibilityInterceptor + { + OnBeforeDeserialization = resp => { resp.ContentType = "application/json; charset=utf-8"; } + }; } } diff --git a/FModel/ViewModels/ApiEndpoints/DynamicApiEndpoint.cs b/FModel/ViewModels/ApiEndpoints/DynamicApiEndpoint.cs index 4b151c15..3e2fa9fb 100644 --- a/FModel/ViewModels/ApiEndpoints/DynamicApiEndpoint.cs +++ b/FModel/ViewModels/ApiEndpoints/DynamicApiEndpoint.cs @@ -66,7 +66,7 @@ public class DynamicApiEndpoint : AbstractApiProvider { var request = new FRestRequest(url) { - OnBeforeDeserialization = resp => { resp.ContentType = "application/json; charset=utf-8"; } + Interceptors = [_interceptor] }; 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); diff --git a/FModel/ViewModels/ApiEndpoints/FortniteCentralApiEndpoint.cs b/FModel/ViewModels/ApiEndpoints/FortniteCentralApiEndpoint.cs index af7fe1e8..82af932f 100644 --- a/FModel/ViewModels/ApiEndpoints/FortniteCentralApiEndpoint.cs +++ b/FModel/ViewModels/ApiEndpoints/FortniteCentralApiEndpoint.cs @@ -15,7 +15,7 @@ public class FortniteCentralApiEndpoint : AbstractApiProvider { var request = new FRestRequest("https://fortnitecentral.genxgames.gg/api/v1/hotfixes") { - OnBeforeDeserialization = resp => { resp.ContentType = "application/json; charset=utf-8"; } + Interceptors = [_interceptor] }; request.AddParameter("lang", language); var response = await _client.ExecuteAsync>>(request, token).ConfigureAwait(false); diff --git a/FModel/Views/Snooper/Models/SkeletalModel.cs b/FModel/Views/Snooper/Models/SkeletalModel.cs index 7d40778c..17592492 100644 --- a/FModel/Views/Snooper/Models/SkeletalModel.cs +++ b/FModel/Views/Snooper/Models/SkeletalModel.cs @@ -153,7 +153,7 @@ public class SkeletalModel : UModel GL.Disable(EnableCap.DepthTest); GL.Disable(EnableCap.CullFace); - GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); + GL.PolygonMode(TriangleFace.FrontAndBack, PolygonMode.Line); foreach (var collision in Collisions) { var boneMatrix = Matrix4x4.Identity; @@ -162,7 +162,7 @@ public class SkeletalModel : UModel collision.Render(shader, boneMatrix); } - GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); + GL.PolygonMode(TriangleFace.FrontAndBack, PolygonMode.Fill); GL.Enable(EnableCap.CullFace); GL.Enable(EnableCap.DepthTest); } diff --git a/FModel/Views/Snooper/Models/StaticModel.cs b/FModel/Views/Snooper/Models/StaticModel.cs index 0d669a83..e0464f42 100644 --- a/FModel/Views/Snooper/Models/StaticModel.cs +++ b/FModel/Views/Snooper/Models/StaticModel.cs @@ -148,12 +148,12 @@ public class StaticModel : UModel base.RenderCollision(shader); GL.Disable(EnableCap.CullFace); - GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); + GL.PolygonMode(TriangleFace.FrontAndBack, PolygonMode.Line); foreach (var collision in Collisions) { collision.Render(shader, Matrix4x4.Identity); } - GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); + GL.PolygonMode(TriangleFace.FrontAndBack, PolygonMode.Fill); GL.Enable(EnableCap.CullFace); } } diff --git a/FModel/Views/Snooper/Models/UModel.cs b/FModel/Views/Snooper/Models/UModel.cs index 4f398e19..62b95084 100644 --- a/FModel/Views/Snooper/Models/UModel.cs +++ b/FModel/Views/Snooper/Models/UModel.cs @@ -255,7 +255,7 @@ public abstract class UModel : IRenderableModel } Vao.Bind(); - GL.PolygonMode(MaterialFace.FrontAndBack, ShowWireframe ? PolygonMode.Line : PolygonMode.Fill); + GL.PolygonMode(TriangleFace.FrontAndBack, ShowWireframe ? PolygonMode.Line : PolygonMode.Fill); foreach (var section in Sections) { if (!section.Show) continue; @@ -275,7 +275,7 @@ public abstract class UModel : IRenderableModel GL.DrawElementsInstanced(PrimitiveType.Triangles, section.FacesCount, DrawElementsType.UnsignedInt, section.FirstFaceIndexPtr, TransformsCount); } - GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); + GL.PolygonMode(TriangleFace.FrontAndBack, PolygonMode.Fill); Vao.Unbind(); if (IsSelected)