private static async Task <Stream> CreateLayerAsync(DeveloperDisk developerDisk, CancellationToken cancellationToken) { MemoryStream stream = new MemoryStream(); var writer = new TarWriter(stream); var versionBytes = Encoding.UTF8.GetBytes(developerDisk.Version.ToDictionary().ToXmlPropertyList()); var fileMode = LinuxFileMode.S_IFREG | LinuxFileMode.S_IRUSR | LinuxFileMode.S_IRGRP | LinuxFileMode.S_IROTH; await writer.AddFileAsync("SystemVersion.plist", fileMode, developerDisk.CreationTime, new MemoryStream(versionBytes), cancellationToken).ConfigureAwait(false); await writer.AddFileAsync("DeveloperDiskImage.dmg", fileMode, developerDisk.CreationTime, developerDisk.Image, cancellationToken).ConfigureAwait(false); await writer.AddFileAsync("DeveloperDiskImage.dmg.signature", fileMode, developerDisk.CreationTime, new MemoryStream(developerDisk.Signature), cancellationToken).ConfigureAwait(false); await writer.WriteTrailerAsync(cancellationToken).ConfigureAwait(false); stream.Seek(0, SeekOrigin.Begin); return(stream); }