public int updateSettings(SPSettings appSettings, string game, SPGame gameSettings, out string errMsg) { bool upGame = false; bool upApp = false; for (int i = 0; i < this.listGames.Count; i++) { if (this.listGames[i].game.Trim() == game.Trim()) { this.listGames[i] = gameSettings; upGame = true; break; } } if (appSettings != null) { this.settings = appSettings; upApp = true; } if (upApp == true && upGame == true) { errMsg = ""; return(Errors.SUCCESS); } if (!upGame) { errMsg = "Invalid game name <" + game + ">"; return(Errors.ERR_INVALID_GAME_NAME_3); } errMsg = "Invalid settings"; return(Errors.ERR_ARGUMENT_NULL); }
/// <summary> /// Update the paths values /// </summary> /// <param name="settings"></param> public void update(SPSettings settings, SPGame gameSettings) { // game name. This is not a folder, it is a label from settings file this._game = gameSettings.game; // update game installation and backup settings this.execUpdate1(settings.steamPath, settings.appDataPath, settings.documentsPath, gameSettings.gameFolder, gameSettings.docsSubPath, gameSettings.docsFolder, gameSettings.appDataFolder, gameSettings.backupFolder, gameSettings.isDocumentsPathOptional(), gameSettings.isAppDataPathOptional()); // update nmm and vortex settings this.execUpdate2(settings.nmmPath2, gameSettings.nmmGameFolder, settings.vortexPath2, gameSettings.vortexGameFolder); // update exes from settings file this.execUpdate3(settings.vortexExe, settings.nmmExe, settings.tesvEditExe, gameSettings.gameExe); // update game log stuff this.execUpdate4(gameSettings.gameLogPath, gameSettings.gameLogExt, gameSettings.gameLogsAreSet()); }
public bool updateSettings(SPSettings appSettings) { if (appSettings != null) { this.settings = appSettings; return(true); } return(false); }
/// <summary> /// Get PathsHelper object /// </summary> /// <param name="gameName"></param> /// <returns></returns> public static PathsHelper getPathsHelper(string gameName) { SPConfig config = SPConfig.loadConfig(); SPGame gameSettings = SettingsFactory.getGameSettings(gameName); SPSettings settings = SettingsFactory.getSettings(); PathsHelper paths = new PathsHelper(settings, gameSettings); return(paths); }
public PathsHelper(SPSettings settings, SPGame gameSettings) { this.update(settings, gameSettings); }
/// <summary> /// Check settings. If it fails, the application settings are not valid of corrupted, and the application MUST be /// re-configurad to work properly and safaty. /// </summary> /// <param name="gameName"></param> /// <returns></returns> public static int checkConfig(string gameName) { // game name if (!SettingsFactory.gameExist(gameName)) { return(Errors.ERR_INVALID_GAME_NAME_1); } // load settings SPSettings settings = SettingsFactory.getSettings(); SPGame gameSettings = SettingsFactory.getGameSettings(gameName); // game name if (gameSettings.game == null || gameSettings.game.Trim().Equals("")) { return(Errors.ERR_INVALID_GAME_NAME_2); } // steam path else if (settings.steamPath == null || settings.steamPath.Trim().Equals("") || !Directory.Exists(settings.steamPath)) { return(Errors.ERR_STEAM_DIRRECTORY_MISSING_1); } // documents else if (!gameSettings.isDocumentsPathOptional()) { if (settings.documentsPath == null || settings.documentsPath.Trim().Equals("") || !Directory.Exists(settings.documentsPath)) { return(Errors.ERR_DOCUMENTS_DIRRECTORY_MISSING_1); } } // app data else if (!gameSettings.isAppDataPathOptional()) { if (settings.appDataPath == null || settings.appDataPath.Trim().Equals("") || !Directory.Exists(settings.appDataPath)) { return(Errors.ERR_APPDATA_DIRRECTORY_MISSING_2); } } // game folder else if (gameSettings.gameFolder == null || gameSettings.gameFolder.Trim().Equals("")) { return(Errors.ERR_INVALID_GAME_FOLDER); } // game exe else if (gameSettings.gameExe == null || gameSettings.gameExe.Trim().Equals("")) { return(Errors.ERR_INVALID_GAME_EXE); } // backup folder name else if (gameSettings.backupFolder == null || gameSettings.backupFolder.Trim().Equals("")) { return(Errors.ERR_INVALID_BACKUP_FOLDER); } // arquivo de configuração está ok no formato. // agora entradas redundantes ou invalidas devem ser eliminadas se existirem. return(Errors.SUCCESS); }
/// <summary> /// returns date format from settings /// </summary> /// <returns></returns> public static string dateFormat() { SPSettings settings = SettingsFactory.getSettings(); return(settings.dateFormat); }