public void WriteBytes(Stream stream) { byte[] encodedName = NetBiosUtils.EncodeName(Name, String.Empty); ByteWriter.WriteBytes(stream, encodedName); BigEndianWriter.WriteUInt16(stream, (ushort)Type); BigEndianWriter.WriteUInt16(stream, Class); }
public override byte[] GetBytes() { byte[] part1 = NetBiosUtils.EncodeName(CalledName, String.Empty); byte[] part2 = NetBiosUtils.EncodeName(CallingName, String.Empty); this.Trailer = new byte[part1.Length + part2.Length]; ByteWriter.WriteBytes(this.Trailer, 0, part1); ByteWriter.WriteBytes(this.Trailer, part1.Length, part2); return(base.GetBytes()); }
public void WriteBytes(Stream stream, int?nameOffset) { if (nameOffset.HasValue) { NetBiosUtils.WriteNamePointer(stream, nameOffset.Value); } else { byte[] encodedName = NetBiosUtils.EncodeName(Name, String.Empty); ByteWriter.WriteBytes(stream, encodedName); } BigEndianWriter.WriteUInt16(stream, (ushort)Type); BigEndianWriter.WriteUInt16(stream, Class); BigEndianWriter.WriteUInt32(stream, TTL); BigEndianWriter.WriteUInt16(stream, (ushort)Data.Length); ByteWriter.WriteBytes(stream, Data); }