internal static WorldResource LoadSession(string savePath) { if (Directory.Exists(savePath)) { var userPath = Path.GetDirectoryName(savePath); var saveResource = new WorldResource { Savename = Path.GetFileName(savePath), UserName = Path.GetFileName(userPath), Savepath = savePath, DataPath = UserDataPath.FindFromSavePath(savePath) }; saveResource.LoadCheckpoint(); return(saveResource); } return(null); }
internal static bool LoadSession(string savePath, out WorldResource saveResource, out string errorInformation) { if (Directory.Exists(savePath)) { var userPath = Path.GetDirectoryName(savePath); saveResource = new WorldResource { Savename = Path.GetFileName(savePath), UserName = Path.GetFileName(userPath), Savepath = savePath, DataPath = UserDataPath.FindFromSavePath(savePath) }; return(saveResource.LoadCheckpoint(out errorInformation)); } saveResource = null; errorInformation = Res.ErrorDirectoryNotFound; return(false); }
internal static WorldResource FindSaveSession(string baseSavePath, string findSession) { if (Directory.Exists(baseSavePath)) { var userPaths = Directory.GetDirectories(baseSavePath); foreach (var userPath in userPaths) { var lastLoadedFile = Path.Combine(userPath, SpaceEngineersConsts.LoadLoadedFilename); // Ignore any other base Save paths without the LastLoaded file. if (File.Exists(lastLoadedFile)) { var savePaths = Directory.GetDirectories(userPath); // Still check every potential game world path. foreach (var savePath in savePaths) { var saveResource = new WorldResource { Savename = Path.GetFileName(savePath), UserName = Path.GetFileName(userPath), Savepath = savePath, DataPath = UserDataPath.FindFromSavePath(savePath) }; saveResource.LoadCheckpoint(); if (saveResource.Savename.ToUpper() == findSession || saveResource.SessionName.ToUpper() == findSession) { return(saveResource); } } } } } return(null); }
internal static bool FindSaveSession(string baseSavePath, string findSession, out WorldResource saveResource, out string errorInformation) { if (Directory.Exists(baseSavePath)) { var userPaths = Directory.GetDirectories(baseSavePath); foreach (var userPath in userPaths) { // Ignore any other base Save paths without the LastLoaded file. if (Directory.Exists(userPath)) { var savePaths = Directory.GetDirectories(userPath); // Still check every potential game world path. foreach (var savePath in savePaths) { saveResource = new WorldResource { Savename = Path.GetFileName(savePath), UserName = Path.GetFileName(userPath), Savepath = savePath, DataPath = UserDataPath.FindFromSavePath(savePath) }; saveResource.LoadWorldInfo(); if (saveResource.IsValid && (saveResource.Savename.ToUpper() == findSession || saveResource.SessionName.ToUpper() == findSession)) { return(saveResource.LoadCheckpoint(out errorInformation)); } } } } } saveResource = null; errorInformation = Res.ErrorGameNotFound; return(false); }
internal static WorldResource LoadSession(string savePath) { if (Directory.Exists(savePath)) { var userPath = Path.GetDirectoryName(savePath); var saveResource = new WorldResource { Savename = Path.GetFileName(savePath), UserName = Path.GetFileName(userPath), Savepath = savePath, DataPath = UserDataPath.FindFromSavePath(savePath) }; saveResource.LoadCheckpoint(); return saveResource; } return null; }
internal static WorldResource FindSaveSession(string baseSavePath, string findSession) { if (Directory.Exists(baseSavePath)) { var userPaths = Directory.GetDirectories(baseSavePath); foreach (var userPath in userPaths) { var lastLoadedFile = Path.Combine(userPath, SpaceEngineersConsts.LoadLoadedFilename); // Ignore any other base Save paths without the LastLoaded file. if (File.Exists(lastLoadedFile)) { var savePaths = Directory.GetDirectories(userPath); // Still check every potential game world path. foreach (var savePath in savePaths) { var saveResource = new WorldResource { Savename = Path.GetFileName(savePath), UserName = Path.GetFileName(userPath), Savepath = savePath, DataPath = UserDataPath.FindFromSavePath(savePath) }; saveResource.LoadCheckpoint(); if (saveResource.Savename.ToUpper() == findSession || saveResource.SessionName.ToUpper() == findSession) { return saveResource; } } } } } return null; }