public void downloadAndUpdateWwiseBanks() { GameDownloader downloadHelper = this; using (downloadHelper.wc) { string bankArchiveUrl = //"http://142.93.93.56/svn/timeloop/ReleaseWwiseBank.zip"; //"https://drive.google.com/uc?export=download&id=1OLk-C_iaI0ItswTyI_0yfc0ioo8BaqqE"; "https://drive.google.com/uc?export=download&id=14q1oOoVBWz2YZ-OPROvktOdTBIVdHTB1"; string downloadNameSuffix = XuFileUtil.GetDateSuffixForFileName(); downloadHelper.downloadedZipPath = Application.temporaryCachePath + "/" + downloadNameSuffix + "Audio.zip"; Debug.Log(downloadHelper.downloadedZipPath); downloadHelper.finished = false; downloadHelper.downloadPercentage = 0; downloadHelper.wc.DownloadProgressChanged += downloadHelper.wc_DownloadProgressChanged; downloadHelper.wc.DownloadFileCompleted += downloadHelper.Wc_DownloadDataCompleted; System.Uri uri = new System.Uri(bankArchiveUrl); Debug.Log(uri); downloadHelper.wc.DownloadFileAsync(uri, downloadHelper.downloadedZipPath); } }
void autoFindAndAssignAppropriateExe() { string chosenPath = null; XuFileUtil.ProcessAllFilesRecursive(this._gameFolder.FullName, (path) => { if (chosenPath == null) { FileInfo fi = new FileInfo(path); bool seeminglyAppropriateExe = fi.Extension == ".exe" && fi.Name != "UnityCrashHandler64.exe" && !fi.Name.StartsWith("."); //mac drives generate a bunch of duplicate files that start with '.' if (seeminglyAppropriateExe) { chosenPath = XuFileUtil.ComputeRelativePath(fi.FullName, _gameFolder.FullName); } } }); if (chosenPath != null) { this.exePath = chosenPath; } }
public void OpenSelectedFolderInWindowsExplorer() { if (Screen.fullScreen) { Screen.fullScreen = false; } XuFileUtil.OpenPathInExplorer(currentSelectedGame.rootFolder.FullName); }
void onClick() { if (string.IsNullOrEmpty(startDirectory) || !Directory.Exists(startDirectory)) { if (_baseDirectory == BaseDirectoryType.GamesDirectory) { startDirectory = SwitcherSettings.Data.GamesFolder; } else if (_baseDirectory == BaseDirectoryType.JoyToKey) { startDirectory = SwitcherSettings.Data.JoyToKeyFolder; } else if (_baseDirectory == BaseDirectoryType.Other) { startDirectory = StartingDirectoryIfNoHistory(); } } if (!Directory.Exists(startDirectory)) { startDirectory = StartingDirectoryIfNoHistory(); } string result = null; if (_dialogTarget == DialogSelectionType.SingleFile) { result = FileBrowser.OpenSingleFile(windowTitle, startDirectory, extensions); } else if (_dialogTarget == DialogSelectionType.SingleFolder) { result = FileBrowser.OpenSingleFolder(windowTitle, startDirectory); } if (!string.IsNullOrEmpty(result)) { startDirectory = Path.GetDirectoryName(result); string finalVal = result; if (_setFileNameInsteadOfFullPath) { finalVal = Path.GetFileName(result);//exclude the path } if (detectIfExeRelative) { if (XuFileUtil.IsSubdirectory(finalVal, XuFileUtil.RunningAppDirectory)) { finalVal = XuFileUtil.ComputeRelativePath(finalVal, XuFileUtil.RunningAppDirectory); finalVal = Path.Combine(".", finalVal); } } _targetField.text = finalVal; OnValidPathChosen.Invoke(finalVal); } }
public void flushChangesToDisk() { string newJson = JsonUtility.ToJson(this, true); WriteJSON(newJson); XuFileUtil.WriteText(this.description, descriptionFilePath); XuFileUtil.WriteText(this.howToPlay, instructionsFilePath); XuFileUtil.WriteText(this.notes, notesFilePath); //GameLaunchSettings gls = this.launchSettings; //string glsLaunchSettingsJson = JsonUtility.ToJson(gls, true); //XuFileUtil.WriteText(glsLaunchSettingsJson, launchSettingsFilePath); }
public string GetInfoJSON() { bool prettify = true; string rawJson = !File.Exists(jsonFilePath) ? null : File.ReadAllText(jsonFilePath); if (string.IsNullOrEmpty(rawJson)) { rawJson = JsonUtility.ToJson(this, prettify); XuFileUtil.WriteText(rawJson, jsonFilePath); } return(rawJson); }
string findOrCreateDoubleExtensionTextFile(string extension, string defaultVal) { string ret = null; //--- Look for a file ending in .instructions.text ---------------- string[] filesWithInstructionExtension = Directory.GetFiles(_gameFolder.FullName, "*" + extension); if (filesWithInstructionExtension.Length > 0) { ret = filesWithInstructionExtension[0]; } else //--- Create it, if it doesn't exist --------------- { string newPath = Path.Combine(_gameFolder.FullName, _gameFolder.Name + extension); XuFileUtil.WriteText(defaultVal, newPath); ret = newPath; } return(ret); }
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); }
public void WriteJSON(string newJson) { XuFileUtil.WriteText(newJson, this.jsonFilePath); }
public string GetNotesText() { return(XuFileUtil.ReadText(this.notesFilePath)); }
public string GetInstructionText() { return(XuFileUtil.ReadText(this.instructionsFilePath)); }
public string GetDescriptionText() { return(XuFileUtil.ReadText(this.descriptionFilePath)); }