Esempio n. 1
0
        public static (Int32, IList <Byte[]>) EncodeCommandCall(OuterCommandCall commandCall)
        {
            var requestMessageBytes = commandCall.CallMessage?.GetPropertiesBytes();
            var requestSize         = requestMessageBytes?.Count ?? 0;
            var encodeTemp          = new Byte[4 + requestSize][];

            encodeTemp[0] = new[] { (Byte)CommandMessageSubtype.Request };
            encodeTemp[1] = new[] { commandCall.Command.Messenger };
            encodeTemp[2] = BitConverter.GetBytes(commandCall.Command.CommandId);
            encodeTemp[3] = BitConverter.GetBytes(commandCall.CallId);

            for (Int32 i = 4, k = 0; k < requestSize; i++, k++)
            {
                encodeTemp[i] = requestMessageBytes[k];
            }

            return(commandCall.Command.Node, encodeTemp.ToArray());
        }
Esempio n. 2
0
 public static CommandReply DecodeReplyFully(CommandReply partialDecodedReply, OuterCommandCall commandCall, IList <Byte[]> msg)
 {
     partialDecodedReply.Result = commandCall.Command.MessageWrapper.CreateReply(message: msg.Skip(3).ToArray());
     return(partialDecodedReply);
 }