public BlockFiler(string fullFileName, double blockEntropy = 4) { this.blockEntropy = blockEntropy; BlockList = new BlockListReference(); file = new ByteFile(fullFileName); FullFileName = fullFileName; saver = new BlockSaver("D:\\Blocks", fullFileName); }
public BlockFiler(string fullFileName, Action AddProgress, double blockEntropy = 4) : this(fullFileName, blockEntropy) { if (file != null) { file.Dispose(); } file = new ByteFile(fullFileName, AddProgress); }
public void SaveBlockList(BlockList blockList, ByteFile file) { BinaryWriter writer; int start; foreach (var block in blockList.Blocks) { start = (int)(block.GetFirst % ByteFile.bufferSize); writer = new BinaryWriter(File.Create(fullDirectoryPath + "\\" + String.Format("{0:d8}", blockName))); blockName++; writer.Write(file.Buffer, start, block.CountBytesInBlock); writer.Close(); } }
public void SaveCompressBlockList(BlockList blockList, ByteFile file) { int start; foreach (var block in blockList.Blocks) { start = (int)(block.GetFirst % ByteFile.bufferSize); deflate.CompressBlock(fullDirectoryPath + "\\" + String.Format("{0:d8}", blockName), file.Buffer, start, block.CountBytesInBlock); blockName++; } }
private void SaveReferenceBlocks(BlockListReference blockList) { var file = new ByteFile(fullFileName); BinaryWriter writer; int start; foreach (var block in blockList.Blocks) { if (block.GetFirst >= ByteFile.bufferSize) { file.ReadNewPartFile(); } start = (int)(block.GetFirst % ByteFile.bufferSize); writer = new BinaryWriter(File.Create(fullDirectoryPath + "\\" + String.Format("{0:d8}", blockName))); blockName++; writer.Write(file.Buffer, start, block.CountBytesInBlock); writer.Close(); } }