public int serialize( int offset, byte[] data, EscherSerializationListener listener ){listener.beforeRecordSerialize( offset, getRecordId(), this );if (remainingData == null) {remainingData = new byte[0];}LittleEndian.putShort( data, offset, getOptions() );LittleEndian.putShort( data, offset + 2, getRecordId() );int remainingBytes = remainingData.length + (shortRecord ? 8 : 18);LittleEndian.putInt( data, offset + 4, remainingBytes );LittleEndian.putShort( data, offset + 8, field_1_flag );LittleEndian.putShort( data, offset + 10, field_2_col1 );LittleEndian.putShort( data, offset + 12, field_3_dx1 );LittleEndian.putShort( data, offset + 14, field_4_row1 );if(!shortRecord) {LittleEndian.putShort( data, offset + 16, field_5_dy1 );LittleEndian.putShort( data, offset + 18, field_6_col2 );LittleEndian.putShort( data, offset + 20, field_7_dx2 );LittleEndian.putShort( data, offset + 22, field_8_row2 );LittleEndian.putShort( data, offset + 24, field_9_dy2 );}System.arraycopy( remainingData, 0, data, offset + (shortRecord ? 16 : 26), remainingData.length );int pos = offset + 8 + (shortRecord ? 8 : 18) + remainingData.length;listener.afterRecordSerialize( pos, getRecordId(), pos - offset, this );return pos - offset;}
public override int Serialize(int offset, byte[] data, EscherSerializationListener listener){listener.BeforeRecordSerialize(offset, RecordId, this);if (remainingData == null) remainingData = new byte[0];LittleEndian.PutShort(data, offset, Options);LittleEndian.PutShort(data, offset + 2, RecordId);int remainingBytes = remainingData.Length + (shortRecord ? 8 : 18);LittleEndian.PutInt(data, offset + 4, remainingBytes);LittleEndian.PutShort(data, offset + 8, field_1_flag);LittleEndian.PutShort(data, offset + 10, field_2_col1);LittleEndian.PutShort(data, offset + 12, field_3_dx1);LittleEndian.PutShort(data, offset + 14, field_4_row1);if (!shortRecord){LittleEndian.PutShort(data, offset + 16, field_5_dy1);LittleEndian.PutShort(data, offset + 18, field_6_col2);LittleEndian.PutShort(data, offset + 20, field_7_dx2);LittleEndian.PutShort(data, offset + 22, field_8_row2);LittleEndian.PutShort(data, offset + 24, field_9_dy2);}Array.Copy(remainingData, 0, data, offset + (shortRecord ? 16 : 26), remainingData.Length);int pos = offset + 8 + (shortRecord ? 8 : 18) + remainingData.Length;listener.AfterRecordSerialize(pos, RecordId, pos - offset, this);return pos - offset;}