Exemplo n.º 1
0
 public ChapterBase(QuranInfo info, ChapterLite chapter, DatabaseFactory dbFactory)
 {
     this.chapter = chapter;
     this.quranInfo = info;
     this.dbFactory = dbFactory;
     isValid = (chapter != null && chapter.Id > 0 && !string.IsNullOrEmpty(chapter.Name) && chapter.TotalAyahs > 0);
 }
Exemplo n.º 2
0
        public static IQuran ProcessXml(string xmlFile)
        {
            IQuran iQuran = null;

            XDocument doc = XDocument.Load(xmlFile);
            var quran = doc.XPathSelectElement("//Quran");

            if (quran != null)
            {
                QuranInfo quranInfo = new QuranInfo();
                quranInfo.Language = Convert.ToInt32(quran.Attribute("language").Value);
                quranInfo.ScriptId = (byte)(quran.Attribute("script").Value.Equals("Usmani") ? 1 : 2);
                quranInfo.Translator = Convert.ToInt32(quran.Attribute("translator").Value);

                Debug.WriteLine(string.Format("Processing Quran data: Language: {0} Script: {1} Translator: {2}.", quranInfo.Language, quran.Attribute("script").Value, quranInfo.Translator));

                var chapters = from elem1 in quran.Descendants("Chapter")
                               where elem1 != null
                               select elem1;

                if (quranInfo.Language == 1)
                {
                    iQuran = new QuranData(quranInfo);
                }
                else
                {
                    iQuran = new LSQuranData(quranInfo);
                }

                iQuran.ProcessChapters(chapters.ToList());
            }

            return iQuran;
        }
Exemplo n.º 3
0
 public ChapterData(QuranInfo info, ChapterLite chapter, DatabaseFactory dbFactory)
     : base(info, chapter, dbFactory)
 {
     verses = new List<Verse>();
     rukus = new List<int>();
     sajdas = new List<int>();
 }
Exemplo n.º 4
0
 public LSChapterData(QuranInfo info, ChapterLite chapter, DatabaseFactory dbFactory)
     : base(info, chapter, dbFactory)
 {
     verses = new List<LSVerse>();
     lsChapter = new LSChapter();
     lsChapter.Id = chapter.Id;
     lsChapter.TransId = info.Translator;
     LoadDBVerses();
 }
Exemplo n.º 5
0
 public QuranBase(QuranInfo info)
 {
     quranInfo = info;
     chapterDict = new Dictionary<byte, IChapter>();
     UpdateChaptersFromDB();
 }
Exemplo n.º 6
0
 public QuranData(QuranInfo info)
     : base(info)
 {
 }