예제 #1
0
 /// <summary>
 /// Instantiates a new <see cref="Message"/> with the given information.
 /// </summary>
 /// <param name="id">The unique id for this message.</param>
 /// <param name="clientId">The id of the <see cref="IClient"/> which sent the <see cref="IMessage"/>.</param>
 /// <param name="targetId">The id of the <see cref="IClient"/> which should receive the <see cref="IMessage"/>.</param>
 /// <param name="typeInfo">Type information about the <see cref="Payload"/>.</param>
 /// <param name="payload">The data being transported.</param>
 public Message(string id,
                string clientId,
                string targetId,
                IPayloadTypeInfo typeInfo,
                byte[] payload) : this(id, "", clientId, targetId, typeInfo, payload)
 {
 }
예제 #2
0
 /// <summary>
 /// Instantiates a new <see cref="Message"/> with the given information.
 /// </summary>
 /// <param name="id">The unique id for this message.</param>
 /// <param name="serverIds">The list of servers this message has been processed by.</param>
 /// <param name="clientId">The id of the <see cref="IClient"/> which sent the <see cref="IMessage"/>.</param>
 /// <param name="targetId">The id of the <see cref="IClient"/> which should receive the <see cref="IMessage"/>.</param>
 /// <param name="typeInfo">Type information about the <see cref="Payload"/>.</param>
 /// <param name="payload">The data being transported.</param>
 public Message(string id,
                string serverIds,
                string clientId,
                string targetId,
                IPayloadTypeInfo typeInfo,
                byte[] payload)
     : this()
 {
     if (string.IsNullOrWhiteSpace(id))
     {
         throw new ArgumentNullException(nameof(id));
     }
     Id        = id;
     ServerIds = serverIds;
     ClientId  = clientId;
     TargetId  = targetId;
     TypeInfo  = typeInfo ?? throw new ArgumentNullException(nameof(typeInfo));
     Payload   = payload;
 }
 /// <summary>
 /// Instantiates a new <see cref="TransportEnvelopeHeader"/>.
 /// </summary>
 /// <param name="id">The unique id.</param>
 /// <param name="serverIds">The list of servers that have processed this <see cref="IMessage"/>.</param>
 /// <param name="clientId">The id of the <see cref="IClient"/> which sent the <see cref="IMessage"/> this <see cref="TransportEnvelope"/> is part of.</param>
 /// <param name="targetId">The id of the <see cref="IClient"/> which should receive the <see cref="TransportEnvelope"/>.</param>
 /// <param name="payloadTypeInfo">Type information about the payload.</param>
 /// <param name="chunkIndex">The index for this <see cref="TransportEnvelope"/>. (One-based indexing)</param>
 /// <param name="chunkTotal">The total number of <see cref="TransportEnvelope"/>s in this <see cref="IMessage"/>. (One-based indexing)</param>
 public TransportEnvelopeHeader(string id,
                                string serverIds,
                                string clientId,
                                string targetId,
                                IPayloadTypeInfo payloadTypeInfo,
                                int chunkIndex,
                                int chunkTotal)
     : this()
 {
     if (string.IsNullOrWhiteSpace(id))
     {
         throw new ArgumentNullException("id");
     }
     if (string.IsNullOrWhiteSpace(clientId))
     {
         throw new ArgumentNullException("clientId");
     }
     if (chunkIndex < 1)
     {
         throw new ArgumentOutOfRangeException("chunkIndex", "chunkIndex must be greater than or equal to one. [1 >= chunkIndex <= chunkTotal]");
     }
     if (chunkIndex > chunkTotal)
     {
         throw new ArgumentOutOfRangeException("chunkIndex", "chunkIndex must be less than or equal to chunkTotal. [1 >= chunkIndex <= chunkTotal]");
     }
     if (chunkTotal < 1)
     {
         throw new ArgumentOutOfRangeException("chunkTotal", "chunkTotal must be greater than or equal to one. [1 >= chunkTotal <= int.MaxValue]");
     }
     Id              = id;
     ServerIds       = serverIds;
     ClientId        = clientId;
     TargetId        = targetId;
     PayloadTypeInfo = payloadTypeInfo ?? throw new ArgumentNullException(nameof(payloadTypeInfo));
     ChunkIndex      = chunkIndex;
     ChunkTotal      = chunkTotal;
 }
 /// <summary>
 /// Determines if the <see cref="IPayloadTypeInfo"/> information matches the type in the payload.
 /// </summary>
 /// <param name="typeInfo">The <see cref="IPayloadTypeInfo"/> to test for.</param>
 /// <returns><b>True</b> if the payload type matches the <paramref name="typeInfo"/>; otherwise, <b>false</b>.</returns>
 public bool IsEnvelopeType(IPayloadTypeInfo typeInfo) => IsEnvelopeType(typeInfo.TypeName);
예제 #5
0
 /// <summary>
 /// Instantiates a new <see cref="Message"/> with the given information.
 /// </summary>
 /// <param name="clientId">The id of the <see cref="IClient"/> which sent the <see cref="IMessage"/>.</param>
 /// <param name="typeInfo">Type information about the <see cref="Payload"/>.</param>
 /// <param name="payload">The data being transported.</param>
 public Message(string clientId,
                IPayloadTypeInfo typeInfo,
                byte[] payload) : this(Guid.NewGuid().ToString("N"), "", clientId, "", typeInfo, payload)
 {
 }