/// <summary> /// The do validate zip files. /// </summary> /// <param name="state"> /// The state. /// </param> private void DoValidateZipFiles(object state) { var downloads = DownloadsDB.GetDownloadsList().Select(x => Helpers.GenerateSaveFileName(this, x.FileName)).ToArray(); var result = downloads.Any(); var progress = downloads.Length; foreach (var file in downloads) { progress--; result = result && IsValidZipFile(file); RunOnUiThread( delegate { OnDownloadProgress(new DownloadProgressInfo(downloads.Length, downloads.Length - progress, 0, 0)); }); } RunOnUiThread( delegate { pauseButton.Click += delegate { Finish(); StartActivity(typeof(ZipTestActivity)); }; dashboardView.Visibility = ViewStates.Visible; useCellDataView.Visibility = ViewStates.Gone; if (result) { statusTextView.SetText(Resource.String.text_validation_complete); pauseButton.SetText(Android.Resource.String.Ok); } else { statusTextView.SetText(Resource.String.text_validation_failed); pauseButton.SetText(Android.Resource.String.Cancel); } }); }
/// <summary> /// Go through each of the Expansion APK files defined in the project /// and determine if the files are present and match the required size. /// </summary> /// <remarks> /// Free applications should definitely consider doing this, as this /// allows the application to be launched for the first time without /// having a network connection present. /// Paid applications that use LVL should probably do at least one LVL /// check that requires the network to be present, so this is not as /// necessary. /// </remarks> /// <returns> /// True if they are present, otherwise False; /// </returns> private bool AreExpansionFilesDelivered() { var downloads = DownloadsDB.GetDownloadsList(); return(downloads.Any() && downloads.All(x => Helpers.DoesFileExist(this, x.FileName, x.TotalBytes, false))); }