コード例 #1
0
        public PositiveNameQueryResponse(byte[] buffer, int offset)
        {
            Header   = new NameServicePacketHeader(buffer, ref offset);
            Resource = new ResourceRecord(buffer, ref offset);
            int position = 0;

            while (position < Resource.Data.Length)
            {
                NameFlags nameFlags = (NameFlags)BigEndianReader.ReadUInt16(Resource.Data, ref position);
                byte[]    address   = ByteReader.ReadBytes(Resource.Data, ref position, 4);
                Addresses.Add(address, nameFlags);
            }
        }
コード例 #2
0
        public NodeStatusResponse(byte[] buffer, int offset)
        {
            Header   = new NameServicePacketHeader(buffer, ref offset);
            Resource = new ResourceRecord(buffer, ref offset);

            int  position      = 0;
            byte numberOfNames = ByteReader.ReadByte(Resource.Data, ref position);

            for (int index = 0; index < numberOfNames; index++)
            {
                string    name      = ByteReader.ReadAnsiString(Resource.Data, ref position, 16);
                NameFlags nameFlags = (NameFlags)BigEndianReader.ReadUInt16(Resource.Data, ref position);
                Names.Add(name, nameFlags);
            }
            Statistics = new NodeStatistics(Resource.Data, ref position);
        }