Setup CSV Fleet import and EF Fleet Entity, fix a few bugs

This commit is contained in:
2024-10-01 22:21:50 +02:00
parent 3f04de398a
commit e6c2f969b4
7 changed files with 192 additions and 31 deletions

View File

@ -89,6 +89,13 @@ public class Game
/// <returns>Fully qualified file path.</returns>
public string PlanetFileForRace (Race r) => Path.Combine(GamePath, $"{BaseName}.p{r.PlayerFileId}");
/// <summary>
/// Get the name of a planet file for a given race.
/// </summary>
/// <param name="r">The race to load.</param>
/// <returns>Fully qualified file path.</returns>
public string FleetFileForRace (Race r) => Path.Combine(GamePath, $"{BaseName}.f{r.PlayerFileId}");
/// <summary>
/// Save this record in the database. Uses the service locator to access the
/// database unless you specify an instance. This is needed during initial
@ -176,8 +183,12 @@ public class Game
db.Add(r);
db.SaveChanges();
var loader = new CSV.PlanetLoader();
loader.ImportForRace(Services.Game.Player);
var planetLoader = new CSV.PlanetLoader();
planetLoader.ImportForRace(Services.Game.Player);
var fleetLoader = new CSV.FleetLoader();
fleetLoader.ImportForRace(Services.Game.Player);
}
}