refactor: Migrated from Newtonsoft.Json to System.Text.Json, missing one test passing

This commit is contained in:
Denny09310
2025-11-09 12:05:07 +01:00
parent fc69598b09
commit 71ced8db56
80 changed files with 720 additions and 878 deletions

View File

@@ -1,4 +1,5 @@
using System.Threading;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
namespace ElectronNET.API
@@ -75,10 +76,10 @@ namespace ElectronNET.API
var taskCompletionSource = new TaskCompletionSource<bool>();
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
{
BridgeConnector.Socket.On("appCommandLineHasSwitchCompleted", (result) =>
BridgeConnector.Socket.On<JsonElement>("appCommandLineHasSwitchCompleted", (result) =>
{
BridgeConnector.Socket.Off("appCommandLineHasSwitchCompleted");
taskCompletionSource.SetResult((bool)result);
taskCompletionSource.SetResult(result.GetBoolean());
});
BridgeConnector.Socket.Emit("appCommandLineHasSwitch", switchName);
@@ -103,10 +104,10 @@ namespace ElectronNET.API
var taskCompletionSource = new TaskCompletionSource<string>();
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
{
BridgeConnector.Socket.On("appCommandLineGetSwitchValueCompleted", (result) =>
BridgeConnector.Socket.On<JsonElement>("appCommandLineGetSwitchValueCompleted", (result) =>
{
BridgeConnector.Socket.Off("appCommandLineGetSwitchValueCompleted");
taskCompletionSource.SetResult((string)result);
taskCompletionSource.SetResult(result.GetString());
});
BridgeConnector.Socket.Emit("appCommandLineGetSwitchValue", switchName);