Exemple #1
0
        public byte[] ToArray()
        {
            using (var stream = new MemoryStream(Length))
                using (var buffer = new BigEndianBinaryWriter(stream))
                {
                    buffer.Write(PREAMBLE_LENGTH);
                    buffer.Write(POSTAMBLE_LENGTH);
                    buffer.Write(PACKET_IDENTIFIER);
                    UInt16 flagsAndRootLength = (UInt16)(SACNPacket.FLAGS | (UInt16)(Length - 16));
                    buffer.Write(flagsAndRootLength);
                    buffer.Write(ROOT_VECTOR);
                    buffer.Write(UUID.ToByteArray());

                    buffer.Write(FramingLayer.ToArray());

                    return(stream.ToArray());
                }
        }
Exemple #2
0
        public byte[] ToArray()
        {
            using (var stream = new MemoryStream(Length))
                using (var buffer = new BigEndianBinaryWriter(stream))
                {
                    UInt16 flagsAndDMPLength = (UInt16)(SACNPacket.FLAGS | Length);

                    buffer.Write(flagsAndDMPLength);
                    buffer.Write(DMP_VECTOR);
                    buffer.Write(ADDRESS_TYPE_AND_DATA_TYPE);
                    buffer.Write(FIRST_PROPERTY_ADDRESS);
                    buffer.Write(ADDRESS_INCREMENT);
                    buffer.Write((Int16)(Data.Length + 1));
                    buffer.Write(ZERO_ADDRESS);
                    buffer.Write(Data);

                    return(stream.ToArray());
                }
        }
Exemple #3
0
        public byte[] ToArray()
        {
            using (var stream = new MemoryStream(Length))
                using (var buffer = new BigEndianBinaryWriter(stream))
                {
                    UInt16 flagsAndFramingLength = (UInt16)(SACNPacket.FLAGS | Length);
                    buffer.Write(flagsAndFramingLength);
                    buffer.Write(FRAMING_VECTOR);
                    buffer.Write(Encoding.UTF8.GetBytes(SourceName));
                    buffer.Write(Enumerable.Repeat((byte)0, 64 - SourceName.Length).ToArray());
                    buffer.Write(Priority);
                    buffer.Write(RESERVED);
                    buffer.Write(SequenceID);
                    buffer.Write(Options.GetByte());
                    buffer.Write(UniverseID);

                    buffer.Write(DMPLayer.ToArray());

                    return(stream.ToArray());
                }
        }