/// <summary> /// Pack the field values for this Generic type /// into the MessageData. /// </summary> /// <param name="MessageData">The packed data from this Generic type</param> public override void pack(out byte[] MessageData) { for (int i = 0; i < Fields.Count; i++) { byte[] msgData; Fields[i].pack(out msgData); DDMLValue.item((uint)i + 1).setData(msgData, msgData.Length); } MessageData = new byte[memorySize()]; DDMLValue.getData(ref MessageData); }
/// <summary> /// Upack the message data into this Generic type. /// </summary> /// <param name="MessageData">Incoming message data</param> public override void unpack(byte[] MessageData) { //##It would be nice to improve this code a little - NH //populate DDMLValue from MessageData DDMLValue.setData(MessageData, MessageData.Length, 0); for (uint i = 1; i <= DDMLValue.count(); i++) //for each member { byte[] b = new byte[DDMLValue.item(i).sizeBytes()]; DDMLValue.getData(ref b); Fields[(int)i - 1].unpack(b); //unpack each field } }