コード例 #1
0
ファイル: QuranApp.cs プロジェクト: hubaishan/quran-phone
        public static async Task Initialize()
        {
            var instance = new ScreenInfo(QuranApp.NativeProvider.ActualWidth,
                                          QuranApp.NativeProvider.ActualHeight, 
                                          QuranApp.NativeProvider.ScaleFactor);

            await FileUtils.Initialize(instance);
        }
コード例 #2
0
ファイル: FileUtils.cs プロジェクト: hubaishan/quran-phone
        public async static Task Initialize(ScreenInfo screenInfo)
        {
            if (initialized)
                return;

            initialized = true;
            ScreenInfo = screenInfo;

            // Initialize directory
            await MakeQuranDirectory(screenInfo);
            await MakeQuranDatabaseDirectory();
            await MakeQuranAudioDirectory();
            // Delete stuck files
            await DeleteStuckFiles();
            
        }
コード例 #3
0
        public QuranAudioTrack(int reciterId, QuranAyah verse, ScreenInfo qsi)
        {
            if (verse == null)
            {
                throw new ArgumentNullException(nameof(verse));
            }

            if (verse == null || verse.Surah < 1 || verse.Surah > 114)
            {
                throw new ArgumentException("Invalid Surah number.", nameof(verse));
            }

            this.ReciterId = reciterId;
            this.Surah = verse.Surah;
            this.Ayah = verse.Ayah;
            this.ScreenInfo = qsi;
        }
コード例 #4
0
ファイル: FileUtils.cs プロジェクト: sweetlearn/quran-phone
        public async static Task Initialize(ScreenInfo screenInfo)
        {
            if (initialized)
            {
                return;
            }

            initialized = true;
            ScreenInfo  = screenInfo;

            // Initialize directory
            await MakeQuranDirectory(screenInfo);
            await MakeQuranDatabaseDirectory();
            await MakeQuranAudioDirectory();

            // Delete stuck files
            await DeleteStuckFiles();
        }
コード例 #5
0
ファイル: FileUtils.cs プロジェクト: sweetlearn/quran-phone
        /// <summary>
        /// Creates Quran root directory.
        /// </summary>
        /// <returns></returns>
        public async static Task MakeQuranDirectory(ScreenInfo qsi)
        {
            if (qsi == null)
            {
                throw new ArgumentNullException(nameof(qsi));
            }

            if (BaseFolder == null)
            {
                BaseFolder = ApplicationData.Current.LocalFolder;
                var quranBaseFolder = await BaseFolder.TryGetItemAsync(QuranBase);

                if (quranBaseFolder == null)
                {
                    quranBaseFolder = await BaseFolder.CreateFolderAsync(QuranBase);
                }
                BaseFolder = quranBaseFolder as StorageFolder;
            }

            if (BaseFolder == null)
            {
                throw new InvalidOperationException("Unable to create a base folder.");
            }

            if (ImageFolder == null)
            {
                var imageFolderName = "width" + qsi.GetWidthParam();
                var quranBaseFolder = await BaseFolder.TryGetItemAsync(imageFolderName);

                if (quranBaseFolder == null)
                {
                    quranBaseFolder = await BaseFolder.CreateFolderAsync(imageFolderName);
                }
                ImageFolder = quranBaseFolder as StorageFolder;
            }

            if (ImageFolder == null)
            {
                throw new InvalidOperationException("Unable to create a base image folder.");
            }
        }
コード例 #6
0
ファイル: FileUtils.cs プロジェクト: hubaishan/quran-phone
        /// <summary>
        /// Creates Quran root directory.
        /// </summary>
        /// <returns></returns>
        public async static Task MakeQuranDirectory(ScreenInfo qsi)
        {
            if (qsi == null)
            {
                throw new ArgumentNullException(nameof(qsi));
            }

            if (BaseFolder == null)
            {
                BaseFolder = ApplicationData.Current.LocalFolder;
                var quranBaseFolder = await BaseFolder.TryGetItemAsync(QURAN_BASE);
                if (quranBaseFolder == null)
                {
                    quranBaseFolder = await BaseFolder.CreateFolderAsync(QURAN_BASE);
                }
                BaseFolder = quranBaseFolder as StorageFolder;
            }

            if (BaseFolder == null)
            {
                throw new InvalidOperationException("Unable to create a base folder.");
            }

            if (ImageFolder == null)
            {
                var imageFolderName = "width" + qsi.GetWidthParam();
                var quranBaseFolder = await BaseFolder.TryGetItemAsync(imageFolderName);
                if (quranBaseFolder == null)
                {
                    quranBaseFolder = await BaseFolder.CreateFolderAsync(imageFolderName);
                }
                ImageFolder = quranBaseFolder as StorageFolder;
            }

            if (ImageFolder == null)
            {
                throw new InvalidOperationException("Unable to create a base image folder.");
            }
        }