Guest User

VerseGrab

a guest
Apr 1st, 2016
28
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections.Generic;
  2. using System.IO;
  3. using System.Linq;
  4. using System.Net.Http;
  5. using System.Runtime.Serialization;
  6. using System.Runtime.Serialization.Json;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Collections.ObjectModel;
  10. using Windows.Storage;
  11. using System;
  12.  
  13. namespace App_Code
  14. {
  15. public class QuranProxy
  16. {
  17.  
  18. public static void readQuran()
  19. {
  20. var serializer = new DataContractJsonSerializer(typeof(Verse));
  21.  
  22.  
  23. var result = App_Code.FileIOHelper.ReadFromDefaultFile("ms-appx:///Assets/en.pickthall.json");
  24.  
  25. var ms = new MemoryStream(Encoding.UTF8.GetBytes(result));
  26.  
  27. var data = (Verse)serializer.ReadObject(ms);
  28. }
  29.  
  30. }
  31.  
  32. [DataContract]
  33. public class Verse
  34. {
  35. [DataMember(Name = "id", IsRequired = true)]
  36. public int id { get; set; }
  37. [DataMember(Name = "surah", IsRequired = true)]
  38. public int surah { get; set; }
  39. [DataMember(Name = "ayah", IsRequired = true)]
  40. public int ayah { get; set; }
  41. [DataMember(Name = "verse", IsRequired = true)]
  42. public string verse { get; set; }
  43.  
  44.  
  45. }
  46. }
RAW Paste Data