private static void WriteMetadataInternal(BinaryWriter bw, SignatureMetadata metadata) { bw.Write(FastRsyncBinaryFormat.SignatureHeader); bw.Write(FastRsyncBinaryFormat.Version); var metadataStr = JsonConvert.SerializeObject(metadata, JsonSerializationSettings.JsonSettings); bw.Write(metadataStr); }
public Signature(SignatureMetadata metadata, RsyncFormatType type) { HashAlgorithm = SupportedAlgorithms.Hashing.Create(metadata.ChunkHashAlgorithm); RollingChecksumAlgorithm = SupportedAlgorithms.Checksum.Create(metadata.RollingChecksumAlgorithm); Chunks = new List <ChunkSignature>(); Metadata = metadata; Type = type; }
public async Task WriteMetadataAsync(SignatureMetadata metadata) { var ms = new MemoryStream(256); var msbw = new BinaryWriter(ms); WriteMetadataInternal(msbw, metadata); ms.Seek(0, SeekOrigin.Begin); await ms.CopyToAsync(_signatureStream).ConfigureAwait(false); }
public void WriteMetadata(SignatureMetadata metadata) { WriteMetadataInternal(signaturebw, metadata); }