Exemple #1
0
        public static RdmPacket ReadPacket(RdmBinaryReader data)
        {
            RdmPacket rdmPacket = null;

            RdmHeader header = new RdmHeader();

            header.ReadData(data);

            rdmPacket = RdmPacket.Create(header);
            if (rdmPacket != null)
            {
                rdmPacket.ReadData(data);
                return(rdmPacket);
            }
            else
            {
                rdmPacket = RdmPacket.Create(header, typeof(RdmRawPacket)) as RdmRawPacket;
                if (rdmPacket != null)
                {
                    rdmPacket.ReadData(data);
                    return(rdmPacket);
                }
            }

            throw new UnknownRdmPacketException(header);
        }
Exemple #2
0
        public static RdmRawPacket ReadPacketRaw(RdmBinaryReader data)
        {
            RdmHeader header = new RdmHeader();

            header.ReadData(data);

            RdmRawPacket rdmPacket = RdmPacket.Create(header, typeof(RdmRawPacket)) as RdmRawPacket;

            if (rdmPacket != null)
            {
                rdmPacket.ReadData(data);
            }

            return(rdmPacket);
        }
Exemple #3
0
        public static bool TryReadPacket(RdmBinaryReader data, out RdmPacket rdmPacket)
        {
            RdmHeader header = new RdmHeader();

            header.ReadData(data);

            rdmPacket = RdmPacket.Create(header);
            if (rdmPacket != null)
            {
                rdmPacket.ReadData(data);
                return(true);
            }

            return(false);
        }