void OnGUI() { AlexUtil.DrawCenteredText(Vector2.zero, "Downloaded: " + downloadPercentage + "%", 18, Color.magenta, null); if (GUI.Button(new Rect(Screen.height - 45, 10, 70, 45), "Cancel")) { wc.CancelAsync(); XuFileUtil.DeleteFileOrDirectory(downloadedZipPath); } if (finished) { if (GUI.Button(new Rect(Screen.height - 45, 85, 70, 45), "Load Into Project")) { LoadDownloadedBank(); } } }
void LoadDownloadedBank() { //string gameFolderName = "tada_no_rei_v2"; string unzipDestination = SwitcherSettings.Data.GamesFolder;// System.IO.Path.Combine(SwitcherSettings.GamesFolder, gameFolderName);//Application.streamingAssetsPath; string originalFilePath = Application.streamingAssetsPath + "/Audio"; bool saveExistingTemporarily = System.IO.Directory.Exists(originalFilePath); string saveVersionOfBank = originalFilePath + "_safe_" + XuFileUtil.GetDateSuffixForFileName(); if (saveExistingTemporarily) { XuFileUtil.MoveFileOrDirectory(originalFilePath, saveVersionOfBank); } //[!!!] Warning will overwrite an existing file with no warning! ZipUtil.Unzip(downloadedZipPath, unzipDestination); XuFileUtil.DeleteFileOrDirectory(downloadedZipPath); }