コード例 #1
0
        static AyaRange GetMergedAyaRange(MemorizeDayInfo item1, MemorizeDayInfo item2)
        {
            AyaRange result = new AyaRange();

            result.startAyaInfo = AyaUtil.MinimumAyaRange(item1.rangeOfAyas.startAyaInfo, item2.rangeOfAyas.startAyaInfo);
            result.endAyaInfo   = AyaUtil.MaximumAyaRange(item1.rangeOfAyas.endAyaInfo, item2.rangeOfAyas.endAyaInfo);

            return(result);
        }
コード例 #2
0
        static List <AyaInfo> GetRangeAyaList(AyaRange ayaRange)
        {
            var result      = new List <AyaInfo>();
            var currentSura = ayaRange.startAyaInfo.suraNumber;
            var currentAya  = ayaRange.startAyaInfo.ayaNumber;

            do
            {
                result.Add(AyaInfo.Create(currentSura, currentAya));

                if (currentAya < QuranArrayHelper.suraNumAyas[currentSura - 1])
                {
                    currentAya++;
                }
                else
                {
                    currentSura++;
                    currentAya = 1;
                }
            } while (AyaUtil.AyaTotalRank(AyaInfo.Create(currentSura, currentAya)) <= AyaUtil.AyaTotalRank(ayaRange.endAyaInfo));

            return(result);
        }
コード例 #3
0
        static AyaRange GetAyaRangeFromPageIndex(int pageIndex)
        {
            AyaRange result = new AyaRange();

            result.startAyaInfo.suraNumber = pageSuraStart[pageIndex];
            result.startAyaInfo.ayaNumber  = pageAyahStart[pageIndex];
            if (pageIndex == pageSuraStart.Length - 1)
            {
                result.endAyaInfo.suraNumber = 114;
                result.endAyaInfo.ayaNumber  = suraNumAyas[113];
            }
            else
            {
                int nextPageStartSuraNumber = pageSuraStart[pageIndex + 1];
                int nextPageStartAyaNumber  = pageAyahStart[pageIndex + 1];
                if (nextPageStartSuraNumber == result.startAyaInfo.suraNumber)
                {
                    result.endAyaInfo.suraNumber = result.startAyaInfo.suraNumber;
                    result.endAyaInfo.ayaNumber  = nextPageStartAyaNumber - 1;
                }
                else
                {
                    if (nextPageStartAyaNumber == 1)
                    {
                        result.endAyaInfo.suraNumber = nextPageStartSuraNumber - 1;
                        result.endAyaInfo.ayaNumber  = suraNumAyas[(nextPageStartSuraNumber - 1) - 1];
                    }
                    else
                    {
                        result.endAyaInfo.suraNumber = nextPageStartSuraNumber;
                        result.endAyaInfo.ayaNumber  = nextPageStartAyaNumber - 1;
                    }
                }
            }
            return(result);
        }
コード例 #4
0
        public static AyaRange GetAyaRangeFromGeneralIndex(int index)
        {
            AyaRange result = GetAyaRangeFromPageIndex(index);

            return(result);
        }