Exemple #1
0
 public override void WriteManifest(Stream stream, SerializerSession session)
 {
     if (session.ShouldWriteTypeManifest(TypeEx.RuntimeType, out ushort typeIdentifier))
     {
         stream.WriteByte(Manifest);
     }
     else
     {
         stream.Write(new[] { ObjectSerializer.ManifestIndex });
         UInt16Serializer.WriteValueImpl(stream, typeIdentifier, session);
     }
 }
        public override void WriteManifest(Stream stream, SerializerSession session)
        {
            if (session.ShouldWriteTypeManifest(Type, out var typeIdentifier))
            {
                session.TrackSerializedType(Type);

                var manifestToWrite = _manifest;

                stream.Write(manifestToWrite);
            }
            else
            {
                stream.WriteByte(ManifestIndex);
                UInt16Serializer.WriteValueImpl(stream, typeIdentifier, session);
            }
        }
Exemple #3
0
        public override void WriteManifest(Stream stream, SerializerSession session)
        {
            if (session.ShouldWriteTypeManifest(Type, out ushort typeIdentifier))
            {
                session.TrackSerializedType(Type);

                var manifestToWrite = session.Serializer.Options.VersionTolerance
                    ? _manifestWithVersionInfo
                    : _manifest;

                stream.Write(manifestToWrite);
            }
            else
            {
                stream.WriteByte(ManifestIndex);
                UInt16Serializer.WriteValueImpl(stream, typeIdentifier, session);
            }
        }