55using System . IO ;
66using System . Net ;
77using System . Text ;
8+ using System . Text . Json ;
89using System . Threading ;
910using System . Threading . Tasks ;
1011using nanoFramework . Tools . Debugger ;
1112using nanoFramework . Tools . FirmwareFlasher . DeploymentHelpers ;
12- using Newtonsoft . Json ;
1313
1414namespace nanoFramework . Tools . FirmwareFlasher . NetworkDeployment
1515{
@@ -30,7 +30,12 @@ public class NetworkDeploymentManager
3030 /// <param name="verbosity">The verbosity level.</param>
3131 public NetworkDeploymentManager ( string configFilePath , string originalPort , VerbosityLevel verbosity )
3232 {
33- _configuration = JsonConvert . DeserializeObject < NetworkDeploymentConfiguration > ( File . ReadAllText ( configFilePath ) ) ;
33+ var options = new JsonSerializerOptions
34+ {
35+ PropertyNameCaseInsensitive = true ,
36+ } ;
37+
38+ _configuration = JsonSerializer . Deserialize < NetworkDeploymentConfiguration > ( File . ReadAllText ( configFilePath ) , options ) ;
3439 _serialPort = string . IsNullOrEmpty ( _configuration . SerialPort ) ? originalPort : _configuration . SerialPort ;
3540 _verbosity = verbosity ;
3641 }
@@ -299,10 +304,10 @@ public async Task<ExitCodes> DeployAsync()
299304 // Read the device certificates from the file
300305 deviceCertificatesBytes = File . ReadAllBytes ( _configuration . DeviceCertificatesPath ) ;
301306 }
302-
303- CheckNullPemTermination ( deviceCertificatesBytes ) ;
307+
304308 if ( deviceCertificatesBytes != null )
305309 {
310+ CheckNullPemTermination ( deviceCertificatesBytes ) ;
306311 // deploy the client certificates
307312 OutputWriter . Write ( $ "Updating client certificates...") ;
308313 var clientCertificates = device . DebugEngine . GetAllX509DeviceCertificates ( ) ;
@@ -339,10 +344,10 @@ public async Task<ExitCodes> DeployAsync()
339344 // Read the CA certificates from the file
340345 caCertificatesBytes = File . ReadAllBytes ( _configuration . CACertificatesPath ) ;
341346 }
342-
343- CheckNullPemTermination ( caCertificatesBytes ) ;
347+
344348 if ( caCertificatesBytes != null )
345349 {
350+ CheckNullPemTermination ( caCertificatesBytes ) ;
346351 // deploy the client certificates
347352 OutputWriter . Write ( $ "Updating client certificates...") ;
348353 var caCertificates = device . DebugEngine . GetAllX509Certificates ( ) ;
0 commit comments