void SaveCbdbFile() { if (stream == null) { return; } stream.Close(); stream = null; string dumpPath = BlockDBFile.DumpPath(mapName); string filePath = BlockDBFile.FilePath(mapName); if (File.Exists(filePath)) { File.Delete(filePath); } File.Move(dumpPath, filePath); }
void AppendCbdbFile() { string path = BlockDBFile.FilePath(mapName); if (!File.Exists(path) || stream == null) { return; } byte[] bulk = new byte[4096]; using (Stream cbdb = File.OpenRead(path)) { cbdb.Read(bulk, 0, BlockDBFile.EntrySize); // header int read = 0; while ((read = cbdb.Read(bulk, 0, 4096)) > 0) { stream.Write(bulk, 0, read); } } }