Example #1
0
 public int Serialize(byte[] buffer, int offset)
 {
     int oldOffset = offset;
     offset += Utils.Int32ToNetBytes((int)Length, buffer, offset);
     offset += Utils.Int32ToNetBytes((int)SeqNo, buffer, offset);
     buffer[offset++] = MessageType;
     offset += Utils.Int32ToNetBytes((int)ListIoFlow.Count, buffer, offset);
     foreach (Flow flow in ListIoFlow)
     {
         IoFlowMessageParams ioFlowParams = new IoFlowMessageParams(flow.FlowId, flow.IoFlowUpdateParams, flow.Flags);
         offset += ioFlowParams.Serialize(buffer, offset);
     }
     int byteCount = offset - oldOffset;
     return byteCount;
 }
Example #2
0
 public static IoFlowMessageParams CreateFromNetBytes(byte[] buffer, int offset)
 {
     int oldOffset = offset;
     IoFlowMessageParams msg = new IoFlowMessageParams(0,null,0);
     msg.flowId = (uint)Utils.Int32FromNetBytes(buffer, offset); offset += 4;
     int paramsLength = Utils.Int32FromNetBytes(buffer, offset); offset += 4;
     msg.parameterString = UTF8Encoding.UTF8.GetString(buffer, offset, paramsLength);
     offset += paramsLength;
     Debug.Assert(paramsLength == msg.ParameterString.Length);
     msg.flags = buffer[offset++];
     msg.netByteCount = offset - oldOffset;
     return msg;
 }