Example #1
0
        public void Serialize(AtmoWriter writer) {
            writer.Write(References.Count);
            foreach (var reference in References) {
                writer.Write(reference);
            }

            foreach (var mapItem in Content) {
                writer.Write(mapItem);
            }
        }
Example #2
0
        public void Serialize(AtmoWriter writer) {
            writer.Write(ResourceName);
            if (Rulebook != null) {
                writer.Write(Rulebook);
                return;
            }

            writer.Write(Position);
            writer.Write(Rotation);
            writer.Write(Scale);

            writer.Write((byte)Properties.Count);
            foreach (var kvp in Properties) {
                writer.Write(writer.Solver?.Reference(kvp.Key));
                writer.Write(kvp.Value);
            }
        }
 public static void Serialize(Stream stream, Map map, Encoding encoding = null) {
     var writer = new AtmoWriter(stream, encoding);
     writer.Write(new MapHeader {
         Format = FormatIdentifier,
         Version = map.Version.ToString(),
         Compressed = map.Compressed,
     });
     if (map.Compressed) {
         stream = new DeflaterOutputStream(stream, new Deflater(Deflater.BEST_COMPRESSION));
     }
     writer = new AtmoWriter(stream, encoding) {
         Solver = new ReferenceSolver()
     };
     writer.Write(writer.Solver);
     writer.Write(new MapItem {
         ResourceName = "Rulebook",
         Rulebook = map.Rulebook
     });
     writer.Write((IEnumerable<MapItem>) map.Items);
     
     if (map.Compressed) {
         ((DeflaterOutputStream) stream).Finish();
     }
 }
Example #4
0
 public void Serialize(AtmoWriter writer) {
     writer.Write(X);
     writer.Write(Y);
     writer.Write(Z);
 }
Example #5
0
 public void Serialize(AtmoWriter writer) {
     writer.Write((byte) Rules.Count);
     foreach (var kvp in Rules) {
         writer.Write(string.Concat(kvp.Key, PropertySeparator, kvp.Value));
     }
 }
Example #6
0
 public void Serialize(AtmoWriter writer) {
     writer.Write(Format);
     writer.Write(Version);
     writer.Write(Compressed);
 }
 public void Serialize(AtmoWriter writer) {
     writer.Write(_references, writer.Write);
 }