Console.WriteLine("{0} UTC {1}", DateTime.UtcNow, ex.Message);
}
}
}
/// <summary>
/// Writes the supplied value to the log file
/// </summary>
/// <param name="logData">String to be written to the log file</param>
public static void WriteToLog(string logData)
{
TextWriter tw = new StreamWriter("log.csv", true);
tw.WriteLine(logData);
tw.Close();
}
}
public static class CloudBlockBlobExtension
{
/// <summary>
/// Uploads a file from the file system to a blob. Parallel implementation of
/// UploadFile().
/// </summary>
/// <param name="blob">Blob object that is extended by this method</param>
/// <param name="fileName">The file to be uploaded.</param>
/// <param name="options">A Microsoft.WindowsAzure.StorageClient.BlobRequestOptions object indicating any addtional options to be specified on the request</param>
/// <param name="maxBlockSize">The maximum size of an individual block transferred</param>
public static void ParallelUploadFile(this CloudBlockBlob blob, string fileName, BlobRequestOptions options, int maxBlockSize)
{
var file = new FileInfo(fileName);
long fileSize = file.Length;
// let's figure out how big the file is here
long leftToRead = fileSize;
int startPosition = 0;
// have 1 block for every maxBlockSize bytes plus 1 for the remainder