private void BoxRecursiveAddChilds(TreeNodeCollection treeNodes, BoxFolder folderInfo) { string folderName; if (folderInfo.ID == "0") { folderName = "root"; } else { folderName = folderInfo.Name; } TreeNode treeNode = treeNodes.Add(folderName); treeNode.Tag = folderInfo; foreach (BoxFolder folderInfo2 in folderInfo.Folders) { BoxRecursiveAddChilds(treeNode.Nodes, folderInfo2); } }
private BoxFolder ParseFolder(XElement xe) { if (xe != null && xe.Name == "folder") { BoxFolder folder = new BoxFolder(); folder.ID = xe.GetAttributeValue("id"); folder.Name = xe.GetAttributeValue("name"); XElement xeFolders = xe.Element("folders"); if (xeFolders != null) { foreach (XElement xeFolder in xeFolders.Elements()) { BoxFolder childFolder = ParseFolder(xeFolder); if (childFolder != null) { folder.Folders.Add(childFolder); } } } return folder; } return null; }