我正在玩Dropbox的Delta API,當我調用delta方法時,我得到了自上次調用以來發生更改的路徑列表。如何用路徑列表創建分層結構?
/photos
/public
/photos/sample album
/photos/sample album/boston city flow.jpg
/photos/sample album/pensive parakeet.jpg
/photos/sample album/costa rican frog.jpg
/getting started.pdf
/photos/how to use the photos folder.txt
/public/how to use the public folder.txt
/ies eai.pptx
/documents
/documents/windows phone toolkit in depth 2nd edition.pdf
/prashant
/prashant/iphone indexed list.bmml
/photos/flower.jpg
/photos/trs
/photo.jpg
/hello1
/hello1/new
我有一個很難通過操縱字符串製作分層(在下文提到的類)結構出來的,任何人都可以提出一個方法/想法,我可以實現它。
public class DeltaItem
{
private List<DeltaItem> _items;
public string Path { get; set; }
public bool IsDir { get; set; }
public List<DeltaItem> Items
{
get
{
return _items ?? (_items = new List<DeltaItem>());
}
}
}
看起來你做了很好的工作。你還需要什麼? –
用於Java的[官方Dropbox SDK](https://www.dropbox.com/developers/reference/sdk)在「examples/SearchCache」中包含一個示例,該示例顯示如何將結果從'/ delta'加載到樹中結構體。 –