@@ -381,7 +381,8 @@ private object deserializeToDictionary(string jo, bool isArray=false)
381381
382382 var values = JsonConvert . DeserializeObject < Dictionary < string , object > > ( jo , defaultSettings ) ;
383383 #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 ) ;
385386 #endif
386387
387388 var values2 = new Dictionary < string , object > ( ) ;
@@ -390,21 +391,21 @@ private object deserializeToDictionary(string jo, bool isArray=false)
390391 if ( d . Value is JObject )
391392 {
392393 #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 ) ;
394395 #endif
395396 values2 . Add ( d . Key , deserializeToDictionary ( d . Value . ToString ( ) ) ) ;
396397 }
397398 else if ( d . Value is JArray )
398399 {
399400 #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 ) ;
401402 #endif
402403 values2 . Add ( d . Key , deserializeToDictionary ( d . Value . ToString ( ) , true ) ) ;
403404 }
404405 else
405406 {
406407 #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 ) ;
408409 #endif
409410 values2 . Add ( d . Key , d . Value ) ;
410411 }
@@ -416,20 +417,21 @@ private object deserializeToDictionary(string jo, bool isArray=false)
416417
417418 var values = JsonConvert . DeserializeObject < List < object > > ( jo , defaultSettings ) ;
418419 #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 ) ;
420422 #endif
421423
422424 Type whatType = typeof ( object ) ;
423425 Type currType = whatType ;
424426 int count = 0 ;
425427 foreach ( var d in values )
426428 {
427- if ( ( d is JObject ) || ( d is JArray ) ) {
429+ if ( d is JObject || d is JArray || d is null ) {
428430 break ;
429431 }
430- if ( count == 0 ) {
432+ if ( count == 0 ) {
431433 currType = d . GetType ( ) ;
432- } else if ( ! currType . Equals ( d . GetType ( ) ) ) {
434+ } else if ( currType != d . GetType ( ) ) {
433435 break ;
434436 }
435437 count ++ ;
@@ -439,7 +441,7 @@ private object deserializeToDictionary(string jo, bool isArray=false)
439441 currType = d . GetType ( ) ;
440442 }
441443 #if ( ENABLE_PUBNUB_LOGGING )
442- pnUnityBase . PNLog . WriteToLog ( string . Format ( "whatType {0}" , whatType ) , PNLoggingMethod . LevelInfo ) ;
444+ pnUnityBase . PNLog . WriteToLog ( $ "whatType { whatType } " , PNLoggingMethod . LevelInfo ) ;
443445 #endif
444446
445447 Type listType = typeof ( List < > ) . MakeGenericType ( new [ ] { whatType } ) ;
@@ -448,32 +450,32 @@ private object deserializeToDictionary(string jo, bool isArray=false)
448450 foreach ( var d in values )
449451 {
450452 #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 ) ;
452454 #endif
453455 if ( d is JObject )
454456 {
455457 #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 ) ;
457459 #endif
458460 values2 . Add ( deserializeToDictionary ( d . ToString ( ) ) ) ;
459461 }
460462 else if ( d is JArray )
461463 {
462464 #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 ) ;
464466 #endif
465467 values2 . Add ( deserializeToDictionary ( d . ToString ( ) , true ) ) ;
466468 }
467469 else
468470 {
469471 #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 ) ;
471473 #endif
472474 values2 . Add ( d ) ;
473475 }
474476 }
475477 #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 ) ;
477479 #endif
478480 return ListExtensions . ConvertToDynamicArray ( values2 , whatType , pnUnityBase ) ;
479481 }
0 commit comments