Ejemplo n.º 1
0
        public async Task <Blob> ReadBlobAsync(BlobHeader header)
        {
            var startPosition = reader.Position;

            try
            {
                Console.Write($" Offset: {startPosition.ToString("#,##0", CultureInfo.CurrentUICulture)}, Reading {header.DataSize.ToString("#,##0", CultureInfo.CurrentUICulture)}");

                var result = await blobMapper.ReadMessageAsync(reader, (long)header.DataSize);

                return(result);
            }
            catch (Exception e)
            {
                throw new InvalidOperationException("Error reading Blob.", e);
            }
        }
Ejemplo n.º 2
0
        public async Task <Blob> ReadBlobDataAsync(BlobHeader header)
        {
            if (header == null)
            {
                throw new ArgumentNullException(nameof(header));
            }
            try
            {
                var result = await blobMapper.ReadMessageAsync(reader, (long)header.DataSize);

                result.Header = header;
                return(result);
            }
            catch (Exception e)
            {
                throw new InvalidOperationException($"Error reading '{header.Type}' Blob, StartPosition: {header.StartPosition}.", e);
            }
        }