hschumann2/TempleOS-Source-Code
0847
1 2/*You probably don't need this. It makes a directory3tree into a flat contiguous memory chunk, suitable for4serial communication and rebuilds it into a tree on the5other end.6*/7 8U0 SerializeTree()9{10 CDirEntry *tmpde=FilesFind("/Demo/*.DD*",FUF_RECURSE);11 I64 size;12 U8 *ptr;13 CArcCompress *arc;14 15 LineRep1(tmpde); //We have CDirEntry.fullname16 LineRep2(DocPut,tmpde);17 "$GREEN$***************$FG$\n";18 ptr=DirTreeSerialize(tmpde,&size);19 DirTreeDel(tmpde);20 D(ptr,size);21 "$GREEN$***************:%7d$FG$\n",size;22 arc=CompressBuf(ptr,size);23 Free(ptr);24 D(arc,arc->compressed_size);25 "$GREEN$***************:%7d$FG$\n",size;26 ptr=ExpandBuf(arc);27 size=arc->expanded_size;28 Free(arc);29 D(ptr,size);30 "$GREEN$***************:%7d$FG$\n",size;31 tmpde=DirTreeUnserialize(ptr);32 LineRep2(DocPut,tmpde); //We don't have CDirEntry.fullname33 DirTreeDel(tmpde);34}35 36SerializeTree;37 