public static string GetSaveDirectory() { if (String.IsNullOrEmpty(GameSettings.Current.SaveLocation)) { return(DwarfGame.GetGameDirectory() + Path.DirectorySeparatorChar + "Saves"); } else { return(GameSettings.Current.SaveLocation + Path.DirectorySeparatorChar + "Saves"); } }
public static string GetWorldDirectory() { if (String.IsNullOrEmpty(GameSettings.Default.SaveLocation)) { return(DwarfGame.GetGameDirectory() + Path.DirectorySeparatorChar + "Worlds"); } else { return(GameSettings.Default.SaveLocation + Path.DirectorySeparatorChar + "Worlds"); } }
public static string GetLatestSaveFile() { DirectoryInfo saveDirectory = Directory.CreateDirectory(DwarfGame.GetGameDirectory() + Path.DirectorySeparatorChar + "Saves"); DirectoryInfo newest = null; foreach (var dir in saveDirectory.EnumerateDirectories()) { if (newest == null || newest.CreationTime < dir.CreationTime) { newest = dir; } } return(newest == null ? null : newest.FullName); }