/// <summary> /// Populates blobs from an existing <see cref="BlobStream"/> (eg. to preserve /// blob offsets) /// </summary> /// <param name="blobStream">The #Blob stream with the original content</param> public void Populate(BlobStream blobStream) { if (isReadOnly) { throw new ModuleWriterException("Trying to modify #Blob when it's read-only"); } if (originalData != null) { throw new InvalidOperationException("Can't call method twice"); } if (nextOffset != 1) { throw new InvalidOperationException("Add() has already been called"); } if (blobStream == null || blobStream.StreamLength == 0) { return; } var reader = blobStream.CreateReader(); originalData = reader.ToArray(); nextOffset = (uint)originalData.Length; Populate(ref reader); }