/// <summary> /// Speichert das Universum. /// </summary> /// <param name="universe">Das zu speichernde Universum</param> public void SaveUniverse(IUniverse universe) { string path = Path.Combine(GetRoot(), universe.Id.ToString()); Directory.CreateDirectory(path); string file = Path.Combine(path, UniverseFilename); using (Stream stream = File.Open(file, FileMode.Create, FileAccess.Write)) using (GZipStream zip = new GZipStream(stream, CompressionMode.Compress)) using (var writer = new BinaryWriter(zip)) { universe.Serialize(writer, null); } }
/// <summary> /// Speichert das Universum. /// </summary> /// <param name="universe">Das zu speichernde Universum</param> public void SaveUniverse(IUniverse universe) { string path = Path.Combine(GetRoot(), universe.Id.ToString()); Directory.CreateDirectory(path); string file = Path.Combine(path, UniverseFilename); using (Stream stream = File.Open(file, FileMode.Create, FileAccess.Write)) { using (GZipStream zip = new GZipStream(stream, CompressionMode.Compress)) { universe.Serialize(zip); } } }