using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.PMR; using Tango.PMR.Common; namespace Tango.Transport.Encoders { /// /// Represents a protobuf Transport Encoder. /// /// public class ProtoEncoder : ITransportEncoder { /// /// Decodes the specified data. /// /// The data. /// public ITangoMessage Decode(byte[] data) { return MessageFactory.ParseTangoMessageAgnostic(data); } /// /// Decodes only the container part of the message. /// /// The data. /// public MessageContainer DecodeContainer(byte[] data) { return MessageFactory.ParseContainer(data); } /// /// Encodes the specified tango message. /// /// The tango message. /// public byte[] Encode(ITangoMessage tangoMessage) { return tangoMessage.ToBytes(); } /// /// Returns a that represents this instance. /// /// /// A that represents this instance. /// public override string ToString() { return "Protobuf Encoder"; } } }