writeDictionaryValues() private static method

private static writeDictionaryValues ( object>.Dictionary dictionary, XmlWriter writer ) : void
dictionary object>.Dictionary
writer System.Xml.XmlWriter
return void
コード例 #1
0
ファイル: Plist.cs プロジェクト: bandy101/MK.MobileDevice
 // Token: 0x06000112 RID: 274 RVA: 0x00007244 File Offset: 0x00005444
 private static void compose(object value, XmlWriter writer)
 {
     if (value == null || value is string)
     {
         writer.WriteElementString("string", value as string);
     }
     else if (value is int || value is long)
     {
         writer.WriteElementString("integer", ((int)value).ToString(NumberFormatInfo.InvariantInfo));
     }
     else if (value is Dictionary <string, object> || value.GetType().ToString().StartsWith("System.Collections.Generic.Dictionary`2[System.String"))
     {
         Dictionary <string, object> dictionary = value as Dictionary <string, object>;
         if (dictionary == null)
         {
             dictionary = new Dictionary <string, object>();
             IDictionary dictionary2 = (IDictionary)value;
             foreach (object current in dictionary2.Keys)
             {
                 dictionary.Add(current.ToString(), dictionary2[current]);
             }
         }
         Plist.writeDictionaryValues(dictionary, writer);
     }
     else if (value is List <object> )
     {
         Plist.composeArray((List <object>)value, writer);
     }
     else if (value is byte[])
     {
         writer.WriteElementString("data", Convert.ToBase64String((byte[])value));
     }
     else if (value is float || value is double)
     {
         writer.WriteElementString("real", ((double)value).ToString(NumberFormatInfo.InvariantInfo));
     }
     else if (value is DateTime)
     {
         DateTime value2 = (DateTime)value;
         string   value3 = XmlConvert.ToString(value2, XmlDateTimeSerializationMode.Utc);
         writer.WriteElementString("date", value3);
     }
     else
     {
         if (!(value is bool))
         {
             throw new Exception(string.Format("Value type '{0}' is unhandled", value.GetType().ToString()));
         }
         writer.WriteElementString(value.ToString().ToLower(), "");
     }
 }