public void unloadGameContent() { //Clear the path saved in the registry RegistryTools.DeleteSetting(Constants.APPLICATION_NAME, Constants.PAK_FILE_LOCATION_REGISTRY_KEY); if (gameContentLoaded) { gameContentLoaded = false; instance = new LocalImageResolver(); } }
private void loadRecentFilesList() { // Reload items from the registry. for (int i = 0; i < Constants.MAX_RECENT_FILES; i++) { string file_name = (string)RegistryTools.GetSetting(Constants.APPLICATION_NAME, "FilePath" + i.ToString(), string.Empty); if (!string.IsNullOrWhiteSpace(file_name)) { _recentFilesInfos.Add(new FileInfo(file_name)); } } }
public async Task loadGameContentAsync(string paksFolderPath) { var pakIndex = await loadPakIndex(paksFolderPath); if (pakIndex == null) { throw new NullReferenceException($"PakIndex is null. Cannot Continue."); } var pakImageResolver = new PakImageResolver(pakIndex !, paksFolderPath); await pakImageResolver.loadPakFilesAsync(preloadBitmaps : false); instance = pakImageResolver; gameContentLoaded = true; RegistryTools.SaveSetting(Constants.APPLICATION_NAME, Constants.PAK_FILE_LOCATION_REGISTRY_KEY, paksFolderPath !); }
private void saveRecentFilesList() { // Delete the saved entries. for (int i = 0; i < Constants.MAX_RECENT_FILES; i++) { RegistryTools.DeleteSetting(Constants.APPLICATION_NAME, "FilePath" + i.ToString()); } // Save the current entries. int index = 0; foreach (FileInfo file_info in _recentFilesInfos) { RegistryTools.SaveSetting(Constants.APPLICATION_NAME, "FilePath" + index.ToString(), file_info.FullName); index++; } }
private async void loadGameContentAsync(string paksFolderPath) { showBusyIndicator(); try { await _model.loadGameContentAsync(paksFolderPath); } catch (Exception e) { MessageBox.Show($"{e.Message}\n{e.StackTrace}", R.ERROR); this.Shutdown(); return; } await preloadImages(); RegistryTools.SaveSetting(Constants.APPLICATION_NAME, Constants.PAK_FILE_LOCATION_REGISTRY_KEY, paksFolderPath); showMainWindow(); }
public string?usableGameContentIfExists() { string?registryPath = RegistryTools.GetSetting(Constants.APPLICATION_NAME, Constants.PAK_FILE_LOCATION_REGISTRY_KEY, "") as string; if (!string.IsNullOrWhiteSpace(registryPath)) { return(registryPath); } string?winstorePath = Constants.WINSTORE_PAKS_FOLDER_IF_EXISTS; if (!string.IsNullOrWhiteSpace(winstorePath) && Directory.Exists(winstorePath)) { return(winstorePath); } string launcherPath = Constants.PAKS_FOLDER_PATH; if (Directory.Exists(launcherPath)) { return(launcherPath); } return(null); }