Exemple #1
0
        //private bool fileDownloaded, fileExtracted = false;
        private void CheckQuranFiles()
        {
            Debug.Log("Checking Files...");

            if (PlayerPrefs.GetInt("QuranDownloaded") != 114)
            {
                Downloader.SetActive(true);
                DownloadText.text = "(ﺖﻳﺎﺑﺎﺠﻴﻣ 160 ﻢﺠﺣ) ﻊﻗﻮﻤﻟﺍ ﻦﻣ نﺁﺮﻘﻟﺍ تﺎﻔﻠﻣ ﻞﻳﺰﻨﺗ ﻰﻟﺇ ﻖﻴﺒﻄﺘﻟﺍ جﺎﺘﺤﻳ";
                DownloadButton.SetActive(true);
                DownloadButton.transform.GetChild(0).GetComponent <Text>().text = "ﻖﻓﺍﻮﻣ";
                DownloadButton.GetComponent <Image>().color = Green;

                return;
            }

            if (PlayerPrefs.GetInt("QuranExtracted") != 114)
            {
                StartCoroutine(ExtractQuranFiles());
                Debug.Log("extracting Quran files...");
                return;
            }

            //Quran Loaded
            Debug.Log("Quran finished loading");
            Downloader.SetActive(false);
            //yield return new WaitForSeconds(0.01f);

            //Set a var to Ready, to avoid checking files again
            //PlayerPrefs.SetInt("Quran_Ready", 114);
            BuildSuraButtons.InitilizeUI(this, NavParent);
            InitilizePrefs();
        }
Exemple #2
0
 private void StartDownloading()
 {
     Downloader.SetActive(true);
     StartCoroutine(DownloadQuranFiles());
     isDownloading = true;
     DownloadButton.SetActive(true);
     DownloadButton.transform.GetChild(0).GetComponent <Text>().text = "ﻞﻳﺰﻨﺘﻟﺍ ءﺎﻐﻟﺍ";
     DownloadButton.GetComponent <Image>().color = Red;
     Debug.Log("Quran downloading...");
 }
Exemple #3
0
 private void StopDownloading()
 {
     StopAllCoroutines();
     isDownloading = false;
     Downloader.SetActive(true);
     DownloadText.text = "(ﺖﻳﺎﺑﺎﺠﻴﻣ 160 ﻢﺠﺣ) ﻊﻗﻮﻤﻟﺍ ﻦﻣ نﺁﺮﻘﻟﺍ تﺎﻔﻠﻣ ﻞﻳﺰﻨﺗ ﻰﻟﺇ ﻖﻴﺒﻄﺘﻟﺍ جﺎﺘﺤﻳ";
     DownloadButton.SetActive(true);
     DownloadButton.transform.GetChild(0).GetComponent <Text>().text = "ﻖﻓﺍﻮﻣ";
     DownloadButton.GetComponent <Image>().color = Green;
     Debug.Log("Quran stopped downloading...");
 }
Exemple #4
0
        System.Collections.IEnumerator ExtractQuranFiles()
        {
            Debug.Log("ExtractQuranFiles()...");
            DownloadText.text = "ةﺮﻴﺧﻷﺍ تﺎﺴﻤﻠﻟﺍ";
            DownloadButton.SetActive(false);
            yield return(new WaitForSeconds(.1f));

            //Unzip file
            string zipPath = string.Format("{0}/Quran.zip", Application.persistentDataPath);
            var    dir     = new DirectoryInfo(Application.persistentDataPath + "/Quran/");

            if (dir.Exists)
            {
                dir.Delete(true);
            }

            ZipFile.ExtractToDirectory(zipPath, Application.persistentDataPath + "/Quran/");
            //System.IO.Compression.
            PlayerPrefs.SetInt("QuranExtracted", 114);
            File.Delete(zipPath);
            CheckQuranFiles();
        }