1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- /* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
- using System;
- using System.Collections;
- namespace QuranCalc
- {
- public class AyahIncrementer
- {
- public static bool Finished = false;
- private ArrayList list = new ArrayList(0);
- private string[] array {
- get {
- try
- {
- return Array.ConvertAll<object, string> (list.ToArray (), a => (string)a);
- }
- catch(Exception e) {
- Traceback.Write ("At string[] array (class AyahIncrementer):");
- throw e;
- }
- }
- }
- public static int[] AyahCounts = new int[] { 7, 286, 200, 176, 120, 165, 206, 75, 129, 109, 123, 111, 43, 52, 99, 128, 111, 110, 98, 135, 112, 78, 118, 64, 77, 227, 93, 88, 69, 60, 34, 30, 73, 54, 45, 83, 182, 88, 75, 85, 54, 53, 89, 59, 37, 35, 38, 29, 18, 45, 60, 49, 62, 55, 78, 96, 29, 22, 24, 13, 14, 11, 11, 18, 12, 12, 30, 52, 52, 44, 28, 28, 20, 56, 40, 31, 50, 40, 46, 42, 29, 19, 36, 25, 22, 17, 19, 26, 30, 20, 15, 21, 11, 8, 8, 19, 5, 8, 8, 11, 11, 8, 3, 9, 5, 4, 7, 3, 6, 3, 5, 4, 5, 6 };
- public AyahIncrementer ()
- {
- try
- {
- for (int i = 0; i < 114; i++) {
- for (int j = 1; j <= AyahCounts[i]; j++) {
- list.Add (MainClass.SurahNames[i] + " " + j);
- }
- }
- }
- catch(Exception e) {
- Traceback.Write ("At AyahIncrementer() (class AyahIncrementer):");
- throw e;
- }
- }
- private int AyahNumber = 0;
- public void Increment(int value)
- {
- try
- {
- if(AyahNumber + value > 6235)
- Finished = true;
- AyahNumber = (AyahNumber + value) % 6236;
- return;
- }
- catch(Exception e) {
- Traceback.Write ("At void Increment(int) (class AyahIncrementer):");
- throw e;
- }
- }
- public string LastAyah {
- get {
- try
- {
- return array [AyahNumber - 1];
- }
- catch(Exception e) {
- Traceback.Write ("At string LastAyah (class AyahIncrementer)");
- throw e;
- }
- }
- }
- public string NextAyah {
- get {
- try
- {
- return array [AyahNumber];
- }
- catch(Exception e) {
- Traceback.Write ("At string NextAyah (class AyahIncrementer)");
- throw e;
- }
- }
- }
- }
- }
|