Exemple #1
0
 /// <summary>
 /// Override to serialize the object to a byte array that can be stored
 /// in the GFF's binary data.  It serializes the data according to 
 /// BioWare's GFF file specification.  Simple data items are returned
 /// in the return value, complex items are stored in the stream and 0
 /// is returned.
 /// </summary>
 /// <param name="rawData">The raw data in which to store the field's
 /// data.</param>
 /// <returns>For simple items the return value contains the item's
 /// data and the stream is uneffected.  For complex items, the
 /// return value is the offset of the written data and the items's 
 /// data is added to the end of the stream.</returns>
 UInt32 IGffFieldSerialize.Serialize(RawGffData rawData)
 {
     byte[] bytes = BitConverter.GetBytes(Value);
     return rawData.WriteComplexData(bytes, bytes.Length);
 }
Exemple #2
0
        /// <summary>
        /// Override to serialize the object to a byte array that can be stored
        /// in the GFF's binary data.  It serializes the data according to 
        /// BioWare's GFF file specification.  Simple data items are returned
        /// in the return value, complex items are stored in the stream and 0
        /// is returned.
        /// </summary>
        /// <param name="rawData">The raw data in which to store the field's
        /// data.</param>
        /// <returns>For simple items the return value contains the item's
        /// data and the stream is uneffected.  For complex items, the
        /// return value is the offset of the written data and the items's 
        /// data is added to the end of the stream.</returns>
        UInt32 IGffFieldSerialize.Serialize(RawGffData rawData)
        {
            // Write the string length first, saving the offset of the written
            // position.
            byte[] bytes = new Byte[1];
            bytes[0] = (byte) Value.Length;
            uint offset = rawData.WriteComplexData(bytes, bytes.Length);

            // Now write the string data.
            bytes = new byte[Value.Length];
            for (int i = 0; i < Value.Length; i++)
                bytes[i] = (byte) Value[i];
            rawData.WriteComplexData(bytes, bytes.Length);

            // return the offset of our data.
            return offset;
        }
Exemple #3
0
 /// <summary>
 /// Override to serialize the object to a byte array that can be stored
 /// in the GFF's binary data.  It serializes the data according to 
 /// BioWare's GFF file specification.  Simple data items are returned
 /// in the return value, complex items are stored in the stream and 0
 /// is returned.
 /// </summary>
 /// <param name="rawData">The raw data in which to store the field's
 /// data.</param>
 /// <returns>For simple items the return value contains the item's
 /// data and the stream is uneffected.  For complex items, the
 /// return value is the offset of the written data and the items's 
 /// data is added to the end of the stream.</returns>
 UInt32 IGffFieldSerialize.Serialize(RawGffData rawData)
 {
     byte[] bytes = BitConverter.GetBytes((uint) Value.Length);
     uint offset = rawData.WriteComplexData(bytes, bytes.Length);
     rawData.WriteComplexData(Value.GetBuffer(), (int) Value.Length);
     return offset;
 }
Exemple #4
0
 /// <summary>
 /// Override to serialize the object to a byte array that can be stored
 /// in the GFF's binary data.  It serializes the data according to 
 /// BioWare's GFF file specification.  Simple data items are returned
 /// in the return value, complex items are stored in the stream and 0
 /// is returned.
 /// </summary>
 /// <param name="rawData">The raw data in which to store the field's
 /// data.</param>
 /// <returns>For simple items the return value contains the item's
 /// data and the stream is uneffected.  For complex items, the
 /// return value is the offset of the written data and the items's 
 /// data is added to the end of the stream.</returns>
 UInt32 IGffFieldSerialize.Serialize(RawGffData rawData)
 {
     byte[] bytes = Value.Serialize();
     return rawData.WriteComplexData(bytes, bytes.Length);
 }