protected override void ReadCompressOrDecompress(FileStream fileInput, ProgressBar pb) { byte[] buffer; while (fileInput.Position < fileInput.Length && !Cancel) { int byteSize = fileInput.Length - fileInput.Position <= ByteSize ? (int)(fileInput.Length - fileInput.Position) : ByteSize; buffer = new byte[byteSize]; fileInput.Read(buffer, 0, byteSize); QueueFromReader.addDataToBuffer(buffer); pb.drawTextProgressBar((int)fileInput.Position); } }
protected override void ReadCompressOrDecompress(FileStream fileInput, ProgressBar pb) { int inkrement = 0; while (fileInput.Position < fileInput.Length && !Cancel) { byte[] lengthBuffer = new byte[8]; fileInput.Read(lengthBuffer, 0, lengthBuffer.Length); int blockLength = BitConverter.ToInt32(lengthBuffer, 4); byte[] compressedData = new byte[blockLength]; fileInput.Read(compressedData, 8, blockLength - 8); lengthBuffer.CopyTo(compressedData, 0); var compressBuffer = new DataBlockModel(inkrement, new byte[ByteSize], compressedData); QueueFromReader.AddDataToWriting(compressBuffer); inkrement++; pb.drawTextProgressBar((int)fileInput.Position); } }