Example #1
0
        public ResourceRecord Visit(TxtResourceRecord record, DnsZoneParseContext context)
        {
            var sb = new StringBuilder();

            while (!context.IsEof)
            {
                var token = context.Tokens.Peek();
                if (token.Type == TokenType.NewLine)
                {
                    break;
                }
                if (token.Type == TokenType.QuotedString || token.Type == TokenType.Literal)
                {
                    sb.Append(token.StringValue);
                    context.Tokens.Dequeue();
                }
                else
                {
                    throw new NotSupportedException($"unexpected token {token.Type}");
                }
            }
            record.Content = sb.ToString();
            return(record);
        }
Example #2
0
 public ResourceRecord Visit(TxtResourceRecord record, DnsZoneFormatterContext context)
 {
     context.WriteString(record.Content);
     return(record);
 }