///// <summary>是否响应</summary> //public Boolean Response { get { return Header.Response; } set { Header.Response = value; } } //DNSQuery Question //{ // get // { // if (Questions == null || Questions.Length < 1) Questions = new DNSQuery[] { new DNSQuery() }; // return Questions[0]; // } //} ///// <summary>名称</summary> //public virtual String Name { get { return Question.Name; } set { Question.Name = value; } } ///// <summary>查询类型</summary> //public virtual DNSQueryType Type { get { return Question.Type; } set { Question.Type = value; } } ///// <summary>协议组</summary> //public virtual DNSQueryClass Class { get { return Question.Class; } set { Question.Class = value; } } /// <summary>获取响应</summary> /// <param name="create"></param> /// <returns></returns> internal protected DNSRecord GetAnswer(Boolean create = false) { var qs = Questions; if (qs == null || qs.Length == 0) { return(null); } var type = qs.First().Type; if (Answers == null || Answers.Length < 1) { if (!create) { return(null); } Answers = new DNSRecord[] { CreateRecord(type) }; } foreach (var item in Answers) { if (item.Type == type) { return(item); } } return(Answers[0]); }
/// <summary>克隆</summary> /// <param name="dr"></param> /// <returns></returns> public DNSRecord CloneFrom(DNSRecord dr) { Name = dr.Name; Type = dr.Type; Class = dr.Class; TTL = dr.TTL; _Length = dr._Length; return(this); }
/// <summary>克隆</summary> /// <param name="dr"></param> /// <returns></returns> public DNSRecord CloneFrom(DNSRecord dr) { Name = dr.Name; Type = dr.Type; Class = dr.Class; TTL = dr.TTL; _Length = dr._Length; return this; }