private void button3_Click(object sender, EventArgs e) { if (node != null) { root = node.list(); textBox1.Text = root.json; // for file in root.objects // populate the tree view foreach (FileObject file in root.objects) { items.Add(new TreeItem(file.name, 0)); treeView1.Nodes.Add(file.name); } //treeView1.Nodes.Clear; } }
public static FileObjectList load_json(string root_json) { FileObjectList root = new FileObjectList(); root.objects = new List<FileObject>(); root.json = root_json; JObject process_json = JObject.Parse(root_json); //IList<JToken> files = process_json["objects"].Children(); foreach (JProperty file in process_json["objects"].Children()) { string name = file.Name; string json = file.Value.ToString(); FileObject fileObject = new FileObject(); fileObject.name = name; //VersionList VersionList fileVersions = JsonConvert.DeserializeObject<VersionList>(json); fileObject.versions = fileVersions; root.objects.Add(fileObject); } return root; }