Ejemplo n.º 1
0
 public override void Write(CPlugEntRecordData n, GameBoxWriter w)
 {
     w.Write(Version);
     w.Write(UncompressedSize);
     w.Write(CompressedSize);
     w.WriteBytes(data);
 }
Ejemplo n.º 2
0
    /// <exception cref="IOException">An I/O error occurs.</exception>
    /// <exception cref="ObjectDisposedException">The stream is closed.</exception>
    /// <exception cref="MissingLzoException"></exception>
    public void Write(GameBoxWriter w, IDRemap remap = default)
    {
        GBX.Remap = remap;

        if (GBX.Header.CompressionOfBody == GameBoxCompression.Uncompressed)
        {
            GBX.Node.Write(w);
            return;
        }

        using var msBody   = new MemoryStream();
        using var gbxwBody = new GameBoxWriter(msBody, body: this);

        GBX.Node.Write(gbxwBody, remap);

        var buffer = msBody.ToArray();

        var output = Lzo.Compress(buffer);

        w.Write((int)msBody.Length); // Uncompressed
        w.Write(output.Length);      // Compressed
        w.WriteBytes(output);        // Compressed body data
    }
Ejemplo n.º 3
0
 public override void Write(T n, GameBoxWriter w)
 {
     w.WriteBytes(Data);
 }
Ejemplo n.º 4
0
 public void Write(GameBoxWriter w)
 {
     w.WriteBytes(Data);
 }