Beispiel #1
0
 private static void RestoreCollection(LinkCollection collection, JsonData tree)
 {
     if (tree == null || tree.IsNull)
     {
         return;
     }
     if (!tree.IsArray)
     {
         throw new ArgumentException("Array JsonData expected. Received: " + tree.GetJsonType());
     }
     foreach (JsonData jsonData in ((IEnumerable)tree))
     {
         Link link = new Link();
         link.Id   = (string)jsonData["id"];
         link.From = (string)jsonData["from"];
         link.To   = (string)jsonData["to"];
         link.Type = LinkTypeParser.Parse((string)jsonData["type"]);
         link.Tags.RestoreFromJson(jsonData["tags"]);
         collection.Add(link);
     }
 }
Beispiel #2
0
 internal void RestoreFromJson(JsonData tree)
 {
     base.Clear();
     LinkCollection.RestoreCollection(this, tree);
 }