public void Checkout(string baseDir, Tree tree)
{
for (int i = 0; i < tree.Entries.Length; i++) {
string fullPath = baseDir + "/" + tree.Entries[i].Name;
Console.WriteLine ("Entry: #{0} {1} {2}", i, tree.Entries[i].Name, tree.Entries[i].Id.ToHexString ());
if (tree.Entries[i].IsTree ()) {
if (!Directory.Exists (fullPath))
Directory.CreateDirectory (fullPath);
Checkout (fullPath, (Tree) Get (tree.Entries[i].Id));
continue;
}
FileStream fs = new FileStream (fullPath, FileMode.Create, FileAccess.Write);
Blob blobToWrite = (Blob) Get (tree.Entries[i].Id);
fs.Write (blobToWrite.Data, 0, blobToWrite.Data.Length);
// TODO: Set FileAttributes
//File.SetAttributes ("", FileAttributes.
fs.Close ();
}
}