/// <summary> /// Speichert einen Planeten. /// </summary> /// <param name="universeGuid">Guid des Universums</param> /// <param name="planet">Zu speichernder Planet</param> public void SavePlanet(Guid universeGuid, IPlanet planet) { string path = Path.Combine(GetRoot(), universeGuid.ToString(), planet.Id.ToString()); Directory.CreateDirectory(path); string generatorInfo = Path.Combine(path, PlanetGeneratorInfo); using (Stream stream = File.Open(generatorInfo, FileMode.Create, FileAccess.Write)) { using (BinaryWriter bw = new BinaryWriter(stream)) { bw.Write(planet.Generator.GetType().FullName); } } string file = Path.Combine(path, PlanetFilename); using (Stream stream = File.Open(file, FileMode.Create, FileAccess.Write)) { using (GZipStream zip = new GZipStream(stream, CompressionMode.Compress)) { planet.Serialize(zip); } } }