예제 #1
0
 public void SaveFile(Stream stream, string fileName)
 {
     if (!Authenticate()) throw new InvalidOperationException("Unable to authenticate");
     CreateContainer();
     var fileObject = new CF_Object(_connection, _container, new CF_Client(), fileName);
     fileObject.Write(stream);
     stream.Close();
 }
예제 #2
0
		public void StoreDocument(byte[] document, Guid documentId)
		{
			SetConnection();
			var obj = new CF_Object(_conn, _container, _client, documentId.ToString());

			using (MemoryStream ms = new MemoryStream(document))
			{
				obj.Write(ms);
			}
		}
        /// <summary>
        /// Uploads the specified content item to the remote blob storage.
        /// </summary>
        /// <param name="content">Descriptor of the item on the remote blob storage.</param>
        /// <param name="source">The source item's content stream.</param>
        /// <param name="bufferSize">Size of the upload buffer.</param>
        /// <returns>The length of the uploaded stream.</returns>
        public override long Upload(IBlobContent content, Stream source, int bufferSize)
        {
            var filename = this.GetBlobName(content);
            var obj = new CF_Object(this.Connection, this.ContainerBucket, this.Client, filename);

            obj.Write(source);

            return obj.ContentLength;
        }