Beispiel #1
0
        public void Serialize <T>(BinaryWriter writer, T portableObject) where T : IPortableObject
        {
            var slotDestination = new SlotDestination();
            var pofWriter       = new PofWriter(context, slotDestination);

            pofWriter.WriteObject(0, portableObject);

            var data = slotDestination[0];

            writer.Write((int)data.Length);
            writer.Write(data);
        }
Beispiel #2
0
        public void Serialize(BinaryWriter writer, object portableObject, SerializationFlags serializationFlags)
        {
            var slotDestination = new SlotDestination();
            var pofWriter       = new PofWriter(context, slotDestination);

            if (serializationFlags.HasFlag(SerializationFlags.Typeless))
            {
                pofWriter.WriteObjectTypeless(0, portableObject);
            }
            else
            {
                pofWriter.WriteObject(0, portableObject);
            }

            var data = slotDestination[0];

            writer.Write((int)data.Length);
            writer.Write(data);
        }