示例#1
0
        /// <summary>
        /// Factory for DnsResourceRecord objects
        /// </summary>
        /// <param name="recordType"></param>
        /// <returns></returns>
        public static DnsResourceRecord CreateRecordObject(DnsStandard.RecordType recordType)
        {
            DnsResourceRecord record;

            switch (recordType)
            {
            default:
                record = new RawRecord();
                break;

            case DnsStandard.RecordType.ANAME:
                record = new AddressRecord();
                break;

            case DnsStandard.RecordType.NS:
                record = new NSRecord();
                break;

            case DnsStandard.RecordType.CNAME:
                record = new CNameRecord();
                break;

            case DnsStandard.RecordType.SOA:
                record = new SOARecord();
                break;

            case DnsStandard.RecordType.TXT:
                record = new TextRecord();
                break;

            case DnsStandard.RecordType.MX:
                record = new MXRecord();
                break;

            case DnsStandard.RecordType.PTR:
                record = new PtrRecord();
                break;

            case DnsStandard.RecordType.CERT:
                record = new CertRecord();
                break;

            case DnsStandard.RecordType.SRV:
                record = new SRVRecord();
                break;
            }

            return(record);
        }
示例#2
0
        /// <summary>
        /// Factory for DnsResourceRecord objects
        /// </summary>
        /// <param name="recordType"></param>
        /// <returns></returns>
        public static DnsResourceRecord CreateRecordObject(DnsStandard.RecordType recordType)
        {
            DnsResourceRecord record;
            switch (recordType)
            {
                default:
                    record = new RawRecord();
                    break;

                case DnsStandard.RecordType.ANAME:
                    record = new AddressRecord();
                    break;

                case DnsStandard.RecordType.NS:
                    record = new NSRecord();
                    break;

                case DnsStandard.RecordType.CNAME:
                    record = new CNameRecord();
                    break;

                case DnsStandard.RecordType.SOA:
                    record = new SOARecord();
                    break;

                case DnsStandard.RecordType.TXT:
                    record = new TextRecord();
                    break;

                case DnsStandard.RecordType.MX:
                    record = new MXRecord();
                    break;
                
                case DnsStandard.RecordType.PTR:
                    record = new PtrRecord();
                    break;
                    
                case DnsStandard.RecordType.CERT:
                    record = new CertRecord();
                    break;
                
                case DnsStandard.RecordType.SRV:
                    record = new SRVRecord();
                    break;
            }
            
            return record;
        }
示例#3
0
 /// <summary>
 /// Prints a CNAME RR
 /// </summary>
 /// <param name="cname">The RR to print</param>
 public void Print(CNameRecord cname)
 {
     this.Print("CName", cname.CName);
 }