internal static DomainName Get(BackReferenceBinaryReader reader) { byte stringLength = reader.ReadByte(); if (stringLength >> 6 == 3) { //In case of pointer ushort ptr; BinaryHelper.FromBytes(new byte[] { (byte)(stringLength - (3 << 6)), reader.ReadByte() }, out ptr); return(reader.Get <DomainName>(ptr)); } else { DomainName dn = new DomainName(); reader.Register((int)reader.BaseStream.Position - 1, dn); //stringLength = reader.ReadByte(); if (stringLength != 0) { dn.Add(Encoding.UTF8.GetString(reader.ReadBytes(stringLength), 0, stringLength)); //dn.Add(Encoding.UTF8.GetString(bytes, index + 1, bytes[index])); dn.AddRange(DomainName.Get(reader)); } //else // index++; return(dn); } }
internal static Ptr Get(BackReferenceBinaryReader reader) { Ptr p = new Ptr(); //useless datalength reader.ReadBytes(2); p.DomainName = DomainName.Get(reader); //index += byteCount; return(p); }
internal static Srv Get(BackReferenceBinaryReader reader) { Srv srv = new Srv(); //Useless Datalength reader.ReadBytes(2); srv.Priority = BinaryHelper.ReadUInt16(reader); srv.Weight = BinaryHelper.ReadUInt16(reader); srv.Port = BinaryHelper.ReadUInt16(reader); srv.Target = DomainName.Get(reader); return(srv); }