UploadText() public method

Uploads a string of text to a block blob.
public UploadText ( string content ) : void
content string The text to upload, encoded as a UTF-8 string.
return void
コード例 #1
0
ファイル: BlobLibrary.cs プロジェクト: valkiria88/Astoria
        private const string MimeTypeName = "text/plain"; // since these are assumed to

        #endregion Fields

        #region Methods

        /// <summary>
        /// ugliness of downloading and reuploading whole blob.
        /// </summary>
        /// <param name="blob"></param>
        /// <param name="toAdd"></param>
        public static void appendToBlob(CloudBlob blob, string toAdd)
        {
            string oldLogData = "";
            if (Exists(blob))
                oldLogData = blob.DownloadText();
            blob.DeleteIfExists();
            blob.UploadText(oldLogData + "\r\n" + toAdd);
        }
コード例 #2
0
ファイル: AzureLock.cs プロジェクト: rhayesbite/Examine
 private bool _handleWebException(CloudBlob blob, WebException err)
 {
     var response = (HttpWebResponse)err.Response;
     if (response.StatusCode == HttpStatusCode.NotFound)
     {
         _azureDirectory.CreateContainer();
         blob.UploadText(_lockFile);
         return true;
     }
     return false;
 }
コード例 #3
0
ファイル: AzureLock.cs プロジェクト: rhayesbite/Examine
        private bool _handleStorageClientException(CloudBlob blob, StorageClientException err)
        {
            switch (err.ErrorCode)
            {
                case StorageErrorCode.ResourceNotFound:
                    blob.UploadText(_lockFile);
                    return true;

                case StorageErrorCode.ContainerNotFound:
                    // container is missing, we should create it.
                    _azureDirectory.BlobContainer.Delete();
                    _azureDirectory.CreateContainer();
                    return true;

                default:
                    return false;
            }
        }
コード例 #4
0
 // Serialize NameValueCollection To Blob
 private static void SerializeNameValueCollectionToBlob(NameValueCollection collection, CloudBlob blob)
 {
     try
     {
         SoapFormatter ser = new SoapFormatter();
         using (MemoryStream memoryStream = new MemoryStream())
         {
             ser.Serialize(memoryStream, collection);
             byte[] b = memoryStream.GetBuffer();
             string serilizedNameValueCollection = Encoding.Default.GetString(b);
             blob.UploadText(serilizedNameValueCollection);
         }
     }
     catch (Exception ex)
     {
         Trace.TraceError("Failed to SerializeNameValueCollectionToBlob. Error: {0}", ex.Message);
     }
 }