private void InitializeHeader() { this.bufferStream = new MemoryStream(); var writer = new BinaryWriter(this.bufferStream); SignatureHelpers.WriteHeader(writer, this.settings); writer.Flush(); this.bufferStream.Seek(0, SeekOrigin.Begin); }
private void InitializeHeader() { bufferStream = new MemoryStream(); BinaryWriter binaryWriter = new BinaryWriter(bufferStream); SignatureHelpers.WriteHeader(binaryWriter, settings); binaryWriter.Flush(); bufferStream.Seek(0L, SeekOrigin.Begin); }
private static BlockSignature FindBlockSignatureByStrongSum(List <BlockSignature> matchCandidates, byte[] currentStrongSum) { for (int i = 0; i < matchCandidates.Count; i++) { if (SignatureHelpers.UnsafeEquals(matchCandidates[i].StrongSum, currentStrongSum)) { return(matchCandidates[i]); } } return(null); }
public DeltaStream(Stream signatureStream, Stream inputStream) { SignatureFile signatures = SignatureHelpers.ParseSignatureFile(signatureStream); IEnumerable <OutputCommand> enumerable = DeltaCalculator.ComputeCommands(new BinaryReader(inputStream), signatures); commandsToOutput = enumerable.GetEnumerator(); currentCommandStream = new MemoryStream(); BinaryWriter binaryWriter = new BinaryWriter(currentCommandStream); StreamHelpers.WriteBigEndian(binaryWriter, 1920139830uL); binaryWriter.Flush(); currentCommandStream.Seek(0L, SeekOrigin.Begin); }
public DeltaStream(Stream signatureStream, Stream inputStream) { var signature = SignatureHelpers.ParseSignatureFile(signatureStream); var inputReader = new BinaryReader(inputStream); var commands = DeltaCalculator.ComputeCommands(inputReader, signature); this.commandsToOutput = commands.GetEnumerator(); this.currentCommandStream = new MemoryStream(); var writer = new BinaryWriter(this.currentCommandStream); StreamHelpers.WriteBigEndian(writer, (uint)MagicNumber.Delta); writer.Flush(); this.currentCommandStream.Seek(0, SeekOrigin.Begin); }
private void FillBuffer() { bufferStream = new MemoryStream(); BinaryWriter binaryWriter = new BinaryWriter(bufferStream); for (int i = 0; i < 100; i++) { byte[] array = inputReader.ReadBytes(settings.BlockLength); if (array.Length != 0) { SignatureHelpers.WriteBlock(binaryWriter, array, settings); } } binaryWriter.Flush(); bufferStream.Seek(0L, SeekOrigin.Begin); }
private void FillBuffer() { this.bufferStream = new MemoryStream(); var writer = new BinaryWriter(this.bufferStream); for (int i = 0; i < BlocksToBuffer; i++) { var block = this.inputReader.ReadBytes(this.settings.BlockLength); if (block.Length != 0) { SignatureHelpers.WriteBlock(writer, block, this.settings); } } writer.Flush(); this.bufferStream.Seek(0, SeekOrigin.Begin); }