本文整理汇总了C#中Microsoft.WindowsAzure.StorageClient.CloudBlob.UploadText方法的典型用法代码示例。如果您正苦于以下问题:C# CloudBlob.UploadText方法的具体用法?C# CloudBlob.UploadText怎么用?C# CloudBlob.UploadText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.StorageClient.CloudBlob
的用法示例。
在下文中一共展示了CloudBlob.UploadText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: appendToBlob
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: _handleWebException
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: _handleStorageClientException
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: SerializeNameValueCollectionToBlob
// 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);
}
}