Exemplo n.º 1
0
        public override void SetRecords(DnsResourceRecordType type, IReadOnlyList <DnsResourceRecord> records)
        {
            switch (type)
            {
            case DnsResourceRecordType.SOA:
                if ((records.Count != 1) || !records[0].Name.Equals(_name, StringComparison.OrdinalIgnoreCase))
                {
                    throw new InvalidOperationException("Invalid SOA record.");
                }

                DnsResourceRecord existingSoaRR = _entries[DnsResourceRecordType.SOA][0];

                existingSoaRR.SetGlueRecords(records.GetGlueRecords());
                existingSoaRR.SetComments(records[0].GetComments());
                break;

            default:
                throw new InvalidOperationException("Cannot set records in stub zone.");
            }
        }