// Writes a file item void WriteItem(MemFile mf) { mf.SetDynUTF8String(fileName); mf.Set(fileTimeCreate.Ticks); mf.Set(fileTimeWrite.Ticks); mf.Set(fileLength); mf.Set(isDirectory); if (isDirectory) { mf.SetDynUTF8String(relPath); } if (files == null) { mf.Set((Int32)0); } else { mf.Set(files.Count); foreach (FileInfo fi in files) { fi.WriteItem(mf); } } if (childs == null) { mf.Set((Int32)0); } else { mf.Set(childs.Count); foreach (FileInfo fi in childs) { fi.WriteItem(mf); } } }
// Writes a file item void WriteItem(MemFile mf) { mf.SetDynUTF8String(fileName); mf.Set(fileTimeCreate.Ticks); mf.Set(fileTimeWrite.Ticks); mf.Set(fileLength); mf.Set(isDirectory); if (isDirectory) mf.SetDynUTF8String(relPath); if (files == null) mf.Set((Int32)0); else { mf.Set(files.Count); foreach (FileInfo fi in files) fi.WriteItem(mf); } if (childs == null) mf.Set((Int32)0); else { mf.Set(childs.Count); foreach (FileInfo fi in childs) fi.WriteItem(mf); } }
// Writes the file structure into a file; uses the basePath for file name public void Write(MemFile mf) { mf.Set((UInt32)0xDEADBEEF); // Magic word mf.Set((UInt32)1); // Version; WriteItem(mf); }