@@ -381,7 +381,8 @@ private object deserializeToDictionary(string jo, bool isArray=false)
381
381
382
382
var values = JsonConvert . DeserializeObject < Dictionary < string , object > > ( jo , defaultSettings ) ;
383
383
#if ( ENABLE_PUBNUB_LOGGING )
384
- pnUnityBase . PNLog . WriteToLog ( string . Format ( "JsonConvert.SerializeObject(values) {0}" , JsonConvert . SerializeObject ( values , defaultSettings ) ) , PNLoggingMethod . LevelInfo ) ;
384
+ pnUnityBase . PNLog . WriteToLog (
385
+ $ "JsonConvert.SerializeObject(values) { JsonConvert . SerializeObject ( values , defaultSettings ) } ", PNLoggingMethod . LevelInfo ) ;
385
386
#endif
386
387
387
388
var values2 = new Dictionary < string , object > ( ) ;
@@ -390,21 +391,21 @@ private object deserializeToDictionary(string jo, bool isArray=false)
390
391
if ( d . Value is JObject )
391
392
{
392
393
#if ( ENABLE_PUBNUB_LOGGING )
393
- pnUnityBase . PNLog . WriteToLog ( string . Format ( "1: d.Key {0 }, d.Value {1}" , d . Key , d . Value ) , PNLoggingMethod . LevelInfo ) ;
394
+ pnUnityBase . PNLog . WriteToLog ( $ "1: d.Key { d . Key } , d.Value { d . Value } " , PNLoggingMethod . LevelInfo ) ;
394
395
#endif
395
396
values2 . Add ( d . Key , deserializeToDictionary ( d . Value . ToString ( ) ) ) ;
396
397
}
397
398
else if ( d . Value is JArray )
398
399
{
399
400
#if ( ENABLE_PUBNUB_LOGGING )
400
- pnUnityBase . PNLog . WriteToLog ( string . Format ( "2: d.Key {0 }, d.Value {1}" , d . Key , d . Value ) , PNLoggingMethod . LevelInfo ) ;
401
+ pnUnityBase . PNLog . WriteToLog ( $ "2: d.Key { d . Key } , d.Value { d . Value } " , PNLoggingMethod . LevelInfo ) ;
401
402
#endif
402
403
values2 . Add ( d . Key , deserializeToDictionary ( d . Value . ToString ( ) , true ) ) ;
403
404
}
404
405
else
405
406
{
406
407
#if ( ENABLE_PUBNUB_LOGGING )
407
- pnUnityBase . PNLog . WriteToLog ( string . Format ( "3: d.Key {0 }, d.Value {1}" , d . Key , d . Value ) , PNLoggingMethod . LevelInfo ) ;
408
+ pnUnityBase . PNLog . WriteToLog ( $ "3: d.Key { d . Key } , d.Value { d . Value } " , PNLoggingMethod . LevelInfo ) ;
408
409
#endif
409
410
values2 . Add ( d . Key , d . Value ) ;
410
411
}
@@ -416,20 +417,21 @@ private object deserializeToDictionary(string jo, bool isArray=false)
416
417
417
418
var values = JsonConvert . DeserializeObject < List < object > > ( jo , defaultSettings ) ;
418
419
#if ( ENABLE_PUBNUB_LOGGING )
419
- pnUnityBase . PNLog . WriteToLog ( string . Format ( "2: JsonConvert.SerializeObject(values) {0}" , JsonConvert . SerializeObject ( values , defaultSettings ) ) , PNLoggingMethod . LevelInfo ) ;
420
+ pnUnityBase . PNLog . WriteToLog (
421
+ $ "2: JsonConvert.SerializeObject(values) { JsonConvert . SerializeObject ( values , defaultSettings ) } ", PNLoggingMethod . LevelInfo ) ;
420
422
#endif
421
423
422
424
Type whatType = typeof ( object ) ;
423
425
Type currType = whatType ;
424
426
int count = 0 ;
425
427
foreach ( var d in values )
426
428
{
427
- if ( ( d is JObject ) || ( d is JArray ) ) {
429
+ if ( d is JObject || d is JArray || d is null ) {
428
430
break ;
429
431
}
430
- if ( count == 0 ) {
432
+ if ( count == 0 ) {
431
433
currType = d . GetType ( ) ;
432
- } else if ( ! currType . Equals ( d . GetType ( ) ) ) {
434
+ } else if ( currType != d . GetType ( ) ) {
433
435
break ;
434
436
}
435
437
count ++ ;
@@ -439,7 +441,7 @@ private object deserializeToDictionary(string jo, bool isArray=false)
439
441
currType = d . GetType ( ) ;
440
442
}
441
443
#if ( ENABLE_PUBNUB_LOGGING )
442
- pnUnityBase . PNLog . WriteToLog ( string . Format ( "whatType {0}" , whatType ) , PNLoggingMethod . LevelInfo ) ;
444
+ pnUnityBase . PNLog . WriteToLog ( $ "whatType { whatType } " , PNLoggingMethod . LevelInfo ) ;
443
445
#endif
444
446
445
447
Type listType = typeof ( List < > ) . MakeGenericType ( new [ ] { whatType } ) ;
@@ -448,32 +450,32 @@ private object deserializeToDictionary(string jo, bool isArray=false)
448
450
foreach ( var d in values )
449
451
{
450
452
#if ( ENABLE_PUBNUB_LOGGING )
451
- pnUnityBase . PNLog . WriteToLog ( string . Format ( "d.GetType() {0}" , d . GetType ( ) ) , PNLoggingMethod . LevelInfo ) ;
453
+ pnUnityBase . PNLog . WriteToLog ( $ "d.GetType() { d ? . GetType ( ) } " , PNLoggingMethod . LevelInfo ) ;
452
454
#endif
453
455
if ( d is JObject )
454
456
{
455
457
#if ( ENABLE_PUBNUB_LOGGING )
456
- pnUnityBase . PNLog . WriteToLog ( string . Format ( "1: d {0}" , d ) , PNLoggingMethod . LevelInfo ) ;
458
+ pnUnityBase . PNLog . WriteToLog ( $ "1: d { d } " , PNLoggingMethod . LevelInfo ) ;
457
459
#endif
458
460
values2 . Add ( deserializeToDictionary ( d . ToString ( ) ) ) ;
459
461
}
460
462
else if ( d is JArray )
461
463
{
462
464
#if ( ENABLE_PUBNUB_LOGGING )
463
- pnUnityBase . PNLog . WriteToLog ( string . Format ( "2: d {0}" , d ) , PNLoggingMethod . LevelInfo ) ;
465
+ pnUnityBase . PNLog . WriteToLog ( $ "2: d { d } " , PNLoggingMethod . LevelInfo ) ;
464
466
#endif
465
467
values2 . Add ( deserializeToDictionary ( d . ToString ( ) , true ) ) ;
466
468
}
467
469
else
468
470
{
469
471
#if ( ENABLE_PUBNUB_LOGGING )
470
- pnUnityBase . PNLog . WriteToLog ( string . Format ( "3: d {0}" , d ) , PNLoggingMethod . LevelInfo ) ;
472
+ pnUnityBase . PNLog . WriteToLog ( $ "3: d { d } " , PNLoggingMethod . LevelInfo ) ;
471
473
#endif
472
474
values2 . Add ( d ) ;
473
475
}
474
476
}
475
477
#if ( ENABLE_PUBNUB_LOGGING )
476
- pnUnityBase . PNLog . WriteToLog ( string . Format ( "values2.GetType() {0}" , values2 . GetType ( ) ) , PNLoggingMethod . LevelInfo ) ;
478
+ pnUnityBase . PNLog . WriteToLog ( $ "values2.GetType() { values2 . GetType ( ) } " , PNLoggingMethod . LevelInfo ) ;
477
479
#endif
478
480
return ListExtensions . ConvertToDynamicArray ( values2 , whatType , pnUnityBase ) ;
479
481
}
0 commit comments