Exemplo n.º 1
0
 /// <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());
 }
Exemplo n.º 2
0
        /// <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);
        }