diff options
author | sr55 <[email protected]> | 2020-12-01 23:02:10 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2020-12-01 23:02:10 +0000 |
commit | 35f6cc74910cb95ccbb11e2e082f6144105c2ccd (patch) | |
tree | a47a8802b977f255e57d6b5a3ad520715eb29cbf /win/CS/HandBrakeWPF | |
parent | cfdf6a9be140726b01b65b212d55eae63d2f86c0 (diff) |
WinGui: Remove further JSON.Net code to remove incompatiblity with System.Text.Json
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r-- | win/CS/HandBrakeWPF/Instance/RemoteInstance.cs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/win/CS/HandBrakeWPF/Instance/RemoteInstance.cs b/win/CS/HandBrakeWPF/Instance/RemoteInstance.cs index 33b8cb847..aefed4198 100644 --- a/win/CS/HandBrakeWPF/Instance/RemoteInstance.cs +++ b/win/CS/HandBrakeWPF/Instance/RemoteInstance.cs @@ -15,6 +15,7 @@ namespace HandBrakeWPF.Instance using System.Diagnostics; using System.IO; using System.Text; + using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -22,6 +23,7 @@ namespace HandBrakeWPF.Instance using HandBrake.Interop.Interop.Interfaces; using HandBrake.Interop.Interop.Json.Encode; using HandBrake.Interop.Interop.Json.State; + using HandBrake.Interop.Json; using HandBrake.Worker.Routing.Commands; using HandBrakeWPF.Instance.Model; @@ -30,8 +32,6 @@ namespace HandBrakeWPF.Instance using HandBrakeWPF.Services.Logging.Interfaces; using HandBrakeWPF.Utilities; - using Newtonsoft.Json; - using Timer = System.Timers.Timer; public class RemoteInstance : HttpRequestBase, IEncodeInstance, IDisposable @@ -103,7 +103,7 @@ namespace HandBrakeWPF.Instance string statusJson = response.Result?.JsonResponse; - JsonState state = JsonConvert.DeserializeObject<JsonState>(statusJson); + JsonState state = JsonSerializer.Deserialize<JsonState>(statusJson, JsonSettings.Options); return state; } @@ -269,7 +269,7 @@ namespace HandBrakeWPF.Instance string statusJson = response.JsonResponse; - JsonState state = JsonConvert.DeserializeObject<JsonState>(statusJson); + JsonState state = JsonSerializer.Deserialize<JsonState>(statusJson, JsonSettings.Options); TaskState taskState = state != null ? TaskState.FromRepositoryValue(state.State) : null; @@ -328,9 +328,7 @@ namespace HandBrakeWPF.Instance initCommand.LogFile = Path.Combine(initCommand.LogDirectory, string.Format("activity_log.worker.{0}.txt", GeneralUtilities.ProcessId)); - JsonSerializerSettings settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; - - string job = JsonConvert.SerializeObject(new EncodeCommand { InitialiseCommand = initCommand, EncodeJob = jobToStart }, Formatting.None, settings); + string job = JsonSerializer.Serialize(new EncodeCommand { InitialiseCommand = initCommand, EncodeJob = jobToStart }, JsonSettings.Options); var task = Task.Run(async () => await this.MakeHttpJsonPostRequest("StartEncode", job)); task.Wait(); |