Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. using (FileStream fs = File.Open(@"C:UsersPublicDocumentscombined.json", FileMode.CreateNew))
  2. {
  3. using (StreamWriter sw = new StreamWriter(fs))
  4. {
  5. using (JsonWriter jw = new JsonTextWriter(sw))
  6. {
  7. jw.Formatting = Formatting.None;
  8.  
  9. JArray list = new JArray();
  10. JsonSerializer serializer = new JsonSerializer();
  11. jw.WriteStartArray();
  12. foreach (IListBlobItem blob in blobContainer.ListBlobs(prefix: "SharePointBlobs/"))
  13. {
  14. if (blob.GetType() == typeof(CloudBlockBlob))
  15. {
  16. var blockBlob = (CloudBlockBlob)blob;
  17. var content = blockBlob.DownloadText();
  18. var deserialized = JArray.Parse(content);
  19. //deserialized = JsonConvert.DeserializeObject(content);
  20. list.Merge(deserialized);
  21. serializer.Serialize(jw, list);
  22. }
  23. else
  24. {
  25. Console.WriteLine("Non-Block-Blob: " + blob.StorageUri);
  26. }
  27. }
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement