//File Handling. Methods for getting files from the game and parsing them. /// <summary> /// Gets a parsed file from the game and caches it. If it exists in the cache already then that is returned. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="path"></param> /// <returns></returns> public object GetParsedFile <T>(string path, bool fromCpk, bool raiseEx = true) where T : new() { if (fromCpk) { return(Install_NEW.GetParsedFileFromGame(path, FileIO, fromCpk, raiseEx)); } var cachedFile = fileManager.GetParsedFile <T>(path); if (cachedFile != null) { //File is already cached. Return that instance. return(cachedFile); } else { //File is not cached. So parse it, add it and then return it. var file = Install_NEW.GetParsedFileFromGame(path, FileIO, fromCpk, raiseEx); if (file != null) { fileManager.AddParsedFile(path, file); } return(file); } }
private async Task StartInstall() { //todo: for release build, make installer.Start call async //non-async call is for easy debuging try { //Reload tracker. GeneralInfo.LoadTracker(); //Uninstall previous version (if already installed) if (isInstalled) { Uninstall uninstall = new Uninstall(this, FileIO, fileManager); await Task.Run(uninstall.Start); //Do not uninstall jungle files. In the event of an error there would be no way to restore them. } //Install logic var installer = new Install_NEW(InstallerInfo, zipManager, this, FileIO, fileManager); //installer.Start(); await Task.Run(new Action(installer.Start)); ShutdownApp(); } catch (Exception ex) { SaveErrorLog(ex.ToString()); MessageBox.Show(string.Format("A critical exception occured that cannot be recovered from. The installer will now close.\n\nException:{0}", ex.ToString()), "Critical Exception", MessageBoxButton.OK, MessageBoxImage.Error); ShutdownApp(); } }
public byte[] GetBytes() { if (FileType == CachedFileType.Parsed) { return(Install_NEW.GetBytesFromParsedFile(Path, Data)); } else { throw new Exception("CachedFile.GetBytes(): Invalid FileType = \n\nUse WriteSteam() for FileType.Stream." + FileType); } }
public MusicInstaller(Install_NEW _install, string musicPackagePath) { install = _install; musicPackage = ACB_File.Load(install.zipManager.GetFileFromArchive(GeneralInfo.GetPathInZipDataDir(musicPackagePath)), null, false, true); bgmAcb = (ACB_File)install.GetParsedFile <ACB_File>(BGM_PATH, false); if (musicPackage.MusicPackageType == MusicPackageType.NewOption) { oblFile = (OBL_File)install.GetParsedFile <OBL_File>(OBL_PATH, false); for (int i = 0; i < GeneralInfo.LanguageSuffix.Length; i++) { msgFiles.Add((MSG_File)install.GetParsedFile <MSG_File>($"{OPTION_MSG_PATH}{GeneralInfo.LanguageSuffix[i]}", false)); } } Install(); }
public MsgComponentInstall(Install_NEW _install) { install = _install; }
public IdBindingManager(Install_NEW install) { this.install = install; }