protected void SendStream(PageBlobClient blob, Stream stream) { if (!overwrite && blob.Exists()) { return; } blob.UploadPages(stream, 0); }
protected void SendBytes(PageBlobClient blob, byte[] msgBytes) { if (!overwrite && blob.Exists()) { return; } using (MemoryStream ms = new MemoryStream(msgBytes)) { blob.UploadPages(ms, 0); } }
private long GetBlobLength(bool refetch = false) { if (refetch || _blobLength <= 0) { if (_pageBlobClient.Exists()) { BlobProperties props = _pageBlobClient.GetProperties(); _blobLength = props.Metadata.TryGetValue("actuallength", out string actualLength) ? long.Parse(actualLength) : props.ContentLength; } } return(_blobLength); }
protected void SendFile(PageBlobClient blob, string fileNameAndPath) { if (!File.Exists(fileNameAndPath)) { throw new CantSendFileDataWhenFileDoesNotExistException(fileNameAndPath); } if (!overwrite && blob.Exists()) { return; } using (StreamReader sr = new StreamReader(fileNameAndPath)) { blob.UploadPages(sr.BaseStream, 0); } }