/// <summary> /// Gets the JSON data from the blob. The blobs are pre-created as key value pairs using Ops tasks. /// </summary> /// <param name="blobName"></param> /// <param name="xValues"></param> /// <param name="yValues"></param> public static void AppendDatatoBlob(CloudStorageAccount account, string blobName, Tuple <string, string> tuple, int bufferCount, string containerName = "dashboard") { List <Tuple <string, string> > dict = new List <Tuple <string, string> >(); try { if (ReportHelpers.IffBlobExists(account, blobName, containerName)) { string json = Load(account, blobName, containerName); if (!string.IsNullOrEmpty(json)) { JArray array = JArray.Parse(json); foreach (JObject item in array) { dict.Add(new Tuple <string, string>(item["key"].ToString(), item["value"].ToString())); } } } }catch (StorageException e) { Console.WriteLine(string.Format("Exception thrown while trying to load blob {0}. Exception : {1}", blobName, e.Message)); } dict.Add(tuple); if (dict.Count > bufferCount) { dict.RemoveRange(0, dict.Count - bufferCount); } JArray reportObject = ReportHelpers.GetJson(dict); ReportHelpers.CreateBlob(account, blobName, containerName, "application/json", ReportHelpers.ToStream(reportObject)); }