Example #1
0
        /// <summary>
        /// Write the request message to a stream.
        /// </summary>
        /// <param name="requestMessage">The message to serialize.</param>
        /// <param name="stream">The stream to write to.</param>
        /// <param name="writer">A <see cref="GraphBinaryWriter"/> that can be used to write nested values.</param>
        /// <returns>A task that represents the asynchronous write operation.</returns>
        public async Task WriteValueAsync(RequestMessage requestMessage, MemoryStream stream, GraphBinaryWriter writer)
        {
            await stream.WriteByteAsync(GraphBinaryWriter.VersionByte).ConfigureAwait(false);

            await writer.WriteValueAsync(requestMessage.RequestId, stream, false).ConfigureAwait(false);

            await writer.WriteValueAsync(requestMessage.Operation, stream, false).ConfigureAwait(false);

            await writer.WriteValueAsync(requestMessage.Processor, stream, false).ConfigureAwait(false);

            await writer.WriteValueAsync(requestMessage.Arguments, stream, false).ConfigureAwait(false);
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GraphBinaryMessageSerializer" /> class.
 /// </summary>
 /// <param name="registry">The <see cref="TypeSerializerRegistry"/> to use for serialization.</param>
 public GraphBinaryMessageSerializer(TypeSerializerRegistry registry = null)
 {
     _reader = new GraphBinaryReader(registry);
     _writer = new GraphBinaryWriter(registry);
 }
Example #3
0
 public GraphBinaryMessageSerializer(GraphBinaryReader reader, GraphBinaryWriter writer)
 {
     _reader = reader;
     _writer = writer;
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GraphBinaryMessageSerializer" /> class.
 /// </summary>
 /// <param name="reader">The <see cref="GraphBinaryReader"/> used to deserialize from GraphBinary.</param>
 /// <param name="writer">The <see cref="GraphBinaryWriter"/> used to serialize to GraphBinary.</param>
 public GraphBinaryMessageSerializer(GraphBinaryReader reader = null, GraphBinaryWriter writer = null)
 {
     _reader = reader ?? new GraphBinaryReader();
     _writer = writer ?? new GraphBinaryWriter();
 }