Beispiel #1
0
 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);
 }
Beispiel #2
0
 public BlockFiler(string fullFileName, Action AddProgress, double blockEntropy = 4)
     : this(fullFileName, blockEntropy)
 {
     if (file != null)
     {
         file.Dispose();
     }
     file = new ByteFile(fullFileName, AddProgress);
 }
Beispiel #3
0
        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();
            }
        }
Beispiel #4
0
        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++;
            }
        }
Beispiel #5
0
        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();
            }
        }