/// <summary> /// Saves the data into the given <paramref name="stream"/>. /// </summary> /// <param name="stream">The <see cref="Stream"/> to save the data to.</param> public void Save(Stream stream) { // Before saving all the instances, allow references to be resolved. Areas?.ForEach(x => x.SerializeReferences(this)); EnemyPaths?.ForEach(x => x.SerializeReferences(this)); GCameraPaths?.ForEach(x => x.SerializeReferences(this)); GlidePaths?.ForEach(x => x.SerializeReferences(this)); GravityPaths?.ForEach(x => x.SerializeReferences(this)); ItemPaths?.ForEach(x => x.SerializeReferences(this)); JugemPaths?.ForEach(x => x.SerializeReferences(this)); LapPaths?.ForEach(x => x.SerializeReferences(this)); PullPaths?.ForEach(x => x.SerializeReferences(this)); Objs.ForEach(x => x.SerializeReferences(this)); ReplayCameras?.ForEach(x => x.SerializeReferences(this)); // Save the serialized values. ByamlSerializer serializer = new ByamlSerializer(new ByamlSerializerSettings() { SupportPaths = true, Version = ByamlVersion.Version1 }); serializer.Serialize(stream, this); }
/// <summary> /// Saves the definitions into the the given stream. /// </summary> /// <param name="stream">The stream in which the definitions will be stored.</param> public void Save(Stream stream) { ByamlSerializer serializer = new ByamlSerializer(new ByamlSerializerSettings() { SupportPaths = true, Version = ByamlVersion.Version1 }); serializer.Serialize(stream, Definitions); }