public BoolWithMessage LoadOriginalMap() { try { DeleteMapFilesFromNYCFolder(); string fileNamePrefix = "NYC01_Persistent"; string[] fileExtensions = { ".umap", ".uexp", "_BuiltData.uasset", "_BuiltData.uexp", "_BuiltData.ubulk" }; // copy NYC01_Persistent backup files back to original game location foreach (string fileExt in fileExtensions) { string fullPath = $"{SessionPath.ToOriginalSessionMapFiles}\\{fileNamePrefix}{fileExt}"; string targetPath = $"{SessionPath.ToNYCFolder}\\{fileNamePrefix}{fileExt}"; File.Copy(fullPath, targetPath, true); } SetGameDefaultMapSetting("/Game/Tutorial/Intro/MAP_EntryPoint.MAP_EntryPoint"); return(BoolWithMessage.True($"{DefaultSessionMap.MapName} Loaded!")); } catch (Exception e) { return(BoolWithMessage.False($"Failed to load Original Session Game Map : {e.Message}")); } }
public BoolWithMessage LoadMap(MapListItem map) { if (SessionPath.IsSessionPathValid() == false) { return(BoolWithMessage.False("Cannot Load: 'Path to Session' is invalid.")); } if (SessionPath.IsSessionRunning() == false || FirstLoadedMap == null) { FirstLoadedMap = map; } if (map == DefaultSessionMap) { return(LoadOriginalMap()); } try { // delete session map file / custom maps from game DeleteMapFilesFromNYCFolder(); CopyMapFilesToNYCFolder(map); // update the ini file with the new map path string selectedMapPath = "/Game/Art/Env/NYC/" + map.MapName; SetGameDefaultMapSetting(selectedMapPath); return(BoolWithMessage.True($"{map.MapName} Loaded!")); } catch (Exception e) { return(BoolWithMessage.False($"Failed to load {map.MapName}: {e.Message}")); } }
public BoolWithMessage LoadOriginalMap() { try { DeleteMapFilesFromNYCFolder(); SetGameDefaultMapSetting("/Game/Tutorial/Intro/MAP_EntryPoint"); return(BoolWithMessage.True($"{DefaultSessionMap.MapName} Loaded!")); } catch (Exception e) { return(BoolWithMessage.False($"Failed to load Original Session Game Map : {e.Message}")); } }
public BoolWithMessage LoadMap(MapListItem map) { if (SessionPath.IsSessionPathValid() == false) { return(BoolWithMessage.False("Cannot Load: 'Path to Session' is invalid.")); } if (SessionPath.IsSessionRunning() == false || FirstLoadedMap == null) { FirstLoadedMap = map; } if (Directory.Exists(SessionPath.ToNYCFolder) == false) { Directory.CreateDirectory(SessionPath.ToNYCFolder); } if (map == DefaultSessionMap) { return(LoadOriginalMap()); } try { // delete session map file / custom maps from game DeleteMapFilesFromNYCFolder(); CopyMapFilesToNYCFolder(map); // update the ini file with the new map path // .. when the game is running the map file is renamed to NYC01_Persistent so it can load when you leave the apartment string selectedMapPath = "/Game/Art/Env/NYC/NYC01_Persistent"; if (SessionPath.IsSessionRunning() == false) { selectedMapPath = $"/Game/Art/Env/NYC/{map.MapName}"; } SetGameDefaultMapSetting(selectedMapPath); return(BoolWithMessage.True($"{map.MapName} Loaded!")); } catch (Exception e) { return(BoolWithMessage.False($"Failed to load {map.MapName}: {e.Message}")); } }
public BoolWithMessage BackupOriginalMapFiles() { if (SessionPath.IsSessionPathValid() == false) { return(BoolWithMessage.False("Cannot backup: 'Path to Session' is invalid.")); } if (IsOriginalMapFilesBackedUp()) { // the files are already backed up return(BoolWithMessage.False("Skipping backup: original files already backed up.")); } if (DoesOriginalMapFileExistInGameDirectory() == false) { // the original files are missing from the Session directory return(BoolWithMessage.False("Cannot backup: original map files for Session are missing from Session game directory.")); } try { // create folder if it doesn't exist Directory.CreateDirectory(SessionPath.ToOriginalSessionMapFiles); string fileNamePrefix = "NYC01_Persistent"; string[] fileExtensionsToCheck = { ".umap", ".uexp", "_BuiltData.uasset", "_BuiltData.uexp", "_BuiltData.ubulk" }; // copy NYC01_Persistent files to backup folder foreach (string fileExt in fileExtensionsToCheck) { string fullPathToFile = $"{SessionPath.ToNYCFolder}\\{fileNamePrefix}{fileExt}"; string destFilePath = $"{SessionPath.ToOriginalSessionMapFiles}\\{fileNamePrefix}{fileExt}"; File.Copy(fullPathToFile, destFilePath, overwrite: true); } } catch (Exception e) { string errorMsg = $"Failed to backup original map files: {e.Message}"; MessageBox.Show(errorMsg, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return(BoolWithMessage.False(errorMsg)); } DefaultSessionMap.IsEnabled = IsOriginalMapFilesBackedUp(); DefaultSessionMap.Tooltip = DefaultSessionMap.IsEnabled ? null : "The original Session game files have not been backed up to the custom Maps folder."; return(new BoolWithMessage(IsOriginalMapFilesBackedUp())); }