public IEnumerator DetectNotInstalledLevels() { isrunning=true; loading.SetActive (true); if (Application.platform == RuntimePlatform.IPhonePlayer) { if (Directory.Exists (Application.persistentDataPath + "/Inbox/")) { foreach (var file in Directory.GetFiles(Application.persistentDataPath + "/Inbox/", "*.demoidlevel")) { var toPath = Application.persistentDataPath + "/" + Path.GetFileName (file); if (File.Exists (toPath)) { File.Delete (toPath); } File.Move (file, toPath); } } if (LevelsInstalling == false) { StartCoroutine (InstallLevels ()); } } else if (Application.platform == RuntimePlatform.Android) { if (LevelsInstalling == false) { StartCoroutine (InstallLevels ()); } } while (LevelsInstalling == true) yield return null; loading.SetActive (false); isrunning=false; }
// A function that deletes a file in a zip archive. It creates a temp file where the compressed data of the old archive is copied except the one that needs to be deleted. // After that the old zip archive is deleted and the temp file gets renamed to the original zip archive. // You can delete directories too if they are empty. // // zipArchive : the full path to the zip archive // arc_filename : the name of the file that will be deleted. // // ERROR CODES : 1 = success // : -1 = failed to open zip // : -2 = failed to locate the archive to be deleted in the zip file // : -3 = error copying compressed data from original zip // : -4 = failed to create temp zip file. // public static int delete_entry(string zipArchive, string arc_filename) { string tmp = zipArchive + ".tmp"; int res = zipDeleteFile(@zipArchive, arc_filename, @tmp); if (res > 0) { File.Delete(@zipArchive); File.Move(@tmp, @zipArchive); } else { if (File.Exists(@tmp)) { File.Delete(@tmp); } } return(res); }