Skip to content

Commit

Permalink
.NET 6
Browse files Browse the repository at this point in the history
  • Loading branch information
KyeOnDiscord committed May 14, 2023
1 parent 347bde1 commit 3049614
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Auth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal static Modal.AuthRoot GetAuth(AuthClient authClient, string AuthCode)
});
var response = http.PostAsync("https://account-public-service-prod.ol.epicgames.com/account/api/oauth/token", content).GetAwaiter().GetResult();
string resp = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
return JsonSerializer.Deserialize(resp, SourceGenerationContext.Default.AuthRoot);
return JsonSerializer.Deserialize<Modal.AuthRoot>(resp);
}
}

Expand Down
16 changes: 2 additions & 14 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
using System.Diagnostics;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Security.Cryptography;
using System.Text;
using System.Net.Http.Headers;

namespace FortniteChecker;

//https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/source-generation
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(CosmeticsDB.CosmeticsDBRoot))]
[JsonSerializable(typeof(Auth.Modal.AuthRoot))]
[JsonSerializable(typeof(QueryProfile.Modal.QueryProfileRoot))]
internal partial class SourceGenerationContext : JsonSerializerContext
{
}

internal class Program
{
//Compile with native with dotnet publish -r win-x64 -c Release
static void Main()
{
Console.Title = "Pro Swapper Fortnite Account Checker";
Console.Title = "Kye's Fortnite Account Checker";
Console.ForegroundColor = ConsoleColor.DarkBlue;
Console.WriteLine("Pro Swapper Fortnite Account Checker");
Console.WriteLine("Kye's Fortnite Account Checker");
Console.WriteLine("=====================================");
Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Gray;
Expand Down
2 changes: 1 addition & 1 deletion QueryProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal static Modal.QueryProfileRoot Get(Auth.Modal.AuthRoot auth, Profile pro
File.WriteAllText($"{auth.account_id}_{profile}.json", resp);
#endif

return JsonSerializer.Deserialize(resp, SourceGenerationContext.Default.QueryProfileRoot);
return JsonSerializer.Deserialize<Modal.QueryProfileRoot>(resp);
}
}

Expand Down

0 comments on commit 3049614

Please sign in to comment.