示例#1
0
        public override void Serialize(GMDataWriter writer)
        {
            base.Serialize(writer);

            if (List != null)
            {
                if (writer.VersionInfo.FormatID <= 14)
                {
                    List.Serialize(writer);
                }
                else
                {
                    List.Serialize(writer, (GMDataWriter writer, int index, int count) =>
                    {
                        if (index == 0)
                        {
                            // Serialize bytecode before entries
                            foreach (GMCode c in List)
                            {
                                if (!writer.PointerOffsets.ContainsKey(c.BytecodeEntry))
                                {
                                    writer.WriteObjectPointer(c.BytecodeEntry);
                                    c.BytecodeEntry.Serialize(writer);
                                }
                            }
                        }
                    });
                }
            }
        }
示例#2
0
        public override void Serialize(GMDataWriter writer)
        {
            base.Serialize(writer);

            writer.Write(1);
            List.Serialize(writer);
        }
示例#3
0
        public override void Serialize(GMDataWriter writer)
        {
            base.Serialize(writer);

            List.Serialize(writer);

            // Now save the audio groups if possible
            string dir = writer.Data.Directory;

            if (dir != null && AudioData != null)
            {
                foreach (var pair in AudioData)
                {
                    string fname = $"audiogroup{pair.Key}.dat";
                    string path  = Path.Combine(dir, fname);
                    using (FileStream fs = new FileStream(path, FileMode.Create))
                    {
                        GMData data = AudioData[pair.Key];
                        using (GMDataWriter groupWriter = new GMDataWriter(data, fs, fs.Name, data.Length))
                        {
                            groupWriter.Write();
                            groupWriter.Flush();
                            foreach (GMWarning w in groupWriter.Warnings)
                            {
                                w.File = fname;
                                writer.Warnings.Add(w);
                            }
                        }
                    }
                }
            }
        }
示例#4
0
                public GMPointerList <AssetInstance> NineSlices; // apparently removed in 2.3.2

                public void Serialize(GMDataWriter writer)
                {
                    writer.WritePointer(LegacyTiles);
                    writer.WritePointer(Sprites);
                    if (writer.VersionInfo.IsNumberAtLeast(2, 3))
                    {
                        writer.WritePointer(Sequences);
                        if (!writer.VersionInfo.IsNumberAtLeast(2, 3, 2))
                        {
                            writer.WritePointer(NineSlices);
                        }
                    }

                    writer.WriteObjectPointer(LegacyTiles);
                    LegacyTiles.Serialize(writer);
                    writer.WriteObjectPointer(Sprites);
                    Sprites.Serialize(writer);
                    if (writer.VersionInfo.IsNumberAtLeast(2, 3))
                    {
                        writer.WriteObjectPointer(Sequences);
                        Sequences.Serialize(writer);
                        if (!writer.VersionInfo.IsNumberAtLeast(2, 3, 2))
                        {
                            if (NineSlices == null)
                            {
                                writer.Write(0); // Even if it's 2.3.2 but we don't detect it, this shouldn't break format... probably
                            }
                            else
                            {
                                writer.WriteObjectPointer(NineSlices);
                                NineSlices.Serialize(writer);
                            }
                        }
                    }
                }
示例#5
0
 public void Serialize(GMDataWriter writer)
 {
     writer.WritePointerString(Filename);
     writer.WritePointerString(FinalFunction);
     writer.WritePointerString(InitFunction);
     writer.Write((uint)Kind);
     Functions.Serialize(writer);
 }
示例#6
0
        public override void Serialize(GMDataWriter writer)
        {
            base.Serialize(writer);

            List.Serialize(writer, (writer, i, count) =>
            {
                writer.Pad(4);
            });
        }
示例#7
0
        public override void Serialize(GMDataWriter writer)
        {
            base.Serialize(writer);

            List.Serialize(writer, (writer, i, count) =>
            {
                // Align each entry to 4 bytes
                writer.Pad(4);
            });
        }
示例#8
0
        public override void Serialize(GMDataWriter writer)
        {
            base.Serialize(writer);

            List.Serialize(writer);
            foreach (GMTexturePage tpe in List)
            {
                tpe.TextureData.Serialize(writer);
            }

            writer.Pad(4);
        }
示例#9
0
        public override void Serialize(GMDataWriter writer)
        {
            base.Serialize(writer);

            List.Serialize(writer, (writer, i, count) =>
            {
                // Align to 8 byte offsets if necessary
                if (writer.VersionInfo.AlignBackgroundsTo8)
                {
                    writer.Pad(8);
                }
            });
        }
示例#10
0
        public override void Serialize(GMDataWriter writer)
        {
            base.Serialize(writer);

            List.Serialize(writer);

            foreach (GMExtension e in List)
            {
                if (e.ProductID != null)
                {
                    writer.Write(e.ProductID.ToByteArray());
                }
            }
        }
示例#11
0
        public override void Serialize(GMDataWriter writer)
        {
            base.Serialize(writer);

            List.Serialize(writer, (writer, i, count) =>
            {
                // Align to 4 byte offsets if necessary
                if (writer.VersionInfo.AlignStringsTo4)
                {
                    writer.Pad(4);
                }
            });

            writer.Pad(128);
        }
示例#12
0
        public override void Serialize(GMDataWriter writer)
        {
            base.Serialize(writer);

            List.Serialize(writer);

            // Whatever this is
            for (short i = 0; i < 0x80; i++)
            {
                writer.Write(i);
            }
            for (short i = 0; i < 0x80; i++)
            {
                writer.Write((short)0x3f);
            }
        }
示例#13
0
 public void Serialize(GMDataWriter writer)
 {
     writer.WritePointerString(Name);
     writer.WritePointerString(DisplayName);
     if (Size < 0)
     {
         Size = BitConverter.ToInt32(BitConverter.GetBytes(-SizeFloat));
     }
     writer.Write(Size);
     writer.WriteWideBoolean(Bold);
     writer.WriteWideBoolean(Italic);
     writer.Write(RangeStart);
     writer.Write(Charset);
     writer.Write(AntiAlias);
     writer.Write(RangeEnd);
     writer.WritePointer(TextureItem);
     writer.Write(ScaleX);
     writer.Write(ScaleY);
     if (writer.VersionInfo.FormatID >= 17)
     {
         writer.Write(AscenderOffset);
     }
     Glyphs.Serialize(writer);
 }