/// <summary> /// Sets all state files to use steam sync or not, depending on what setting is selected /// </summary> internal static void UpdateAllStates() { if (SYNC_TO_STEAM) { foreach (string stateFilepath in PathHandler.GetFiles(PathHandler.DIR_BACKUPS, "*" + PathHandler.XML_FILE_PREFIX)) { if (PathHandler.GetFileName(stateFilepath) != PathHandler.FILE_MODSCONFIG_NAME) { string newFilepath = stateFilepath + GenFilePathsAPI.SavedGameExtension; if (PathHandler.FileExists(newFilepath)) { if (PathHandler.GetFileName(stateFilepath).Length != PathHandler.GetFileName(newFilepath).Length) { PathHandler.FileCopy(stateFilepath, newFilepath, true); PathHandler.FileDelete(stateFilepath); } } else { PathHandler.FileCopy(stateFilepath, newFilepath, true); } } } } else { foreach (string syncFilepath in PathHandler.GetFiles(PathHandler.DIR_BACKUPS, "*" + GenFilePathsAPI.SavedGameExtension)) { string newFilepath = syncFilepath.Replace(GenFilePathsAPI.SavedGameExtension, ""); PathHandler.FileCopy(syncFilepath, newFilepath, true); if (PathHandler.FileExists(syncFilepath)) { PathHandler.FileDelete(syncFilepath); } } } }
/// <summary> /// Check if a state is empty /// </summary> /// <param name="state"></param> /// <returns></returns> internal static bool StateIsSet(int state) { return(PathHandler.FileExists(PathHandler.GenBackupStateFile(state))); }