public DomainNamePacketHook(Byte[] bytes, ref UInt32 offset) { this.bytes = bytes; this.offset = offset; StringBuilder builder = new StringBuilder(); offset = Dns2.DomainBytesToString(builder, bytes, offset); this.packetLength = (UInt16)(offset - this.offset); this.name = builder.ToString(); }
public DomainName(Byte[] bytes, ref UInt32 offset) { UInt32 offsetOriginal = offset; StringBuilder builder = new StringBuilder(); offset = Dns2.DomainBytesToString(builder, bytes, offset); this.name = builder.ToString(); this.packet = new Byte[offset - offsetOriginal]; for (UInt32 i = 0; i < this.packet.Length; i++) { this.packet[i] = bytes[offsetOriginal + i]; } }