public static Object DecodeObject(byte[] content)
{
Type type;
string length;
int pos = 0;
ParseHeader (content, ref pos, out type, out length);
byte[] objectContent = new byte[(content.Length) - pos];
Array.Copy (content, pos, objectContent, 0, objectContent.Length);
switch (type) {
case Type.Blob:
return new Blob (objectContent);
case Type.Tree:
return new Tree (objectContent);
break;
case Type.Tag:
//TOOD: return new Tag (contents);
break;
case Type.Commit:
//TODO: return new Commit (contents);
break;
}
// To ensure that all code paths returns an object
// anyway this code will never be reached
return new Blob (objectContent);
}