示例#1
0
        public void DownloadTldsAsSamples()
        {
            var lines        = File.ReadAllLines(@"..\..\Data\tlds.txt");
            var serverLookup = new IanaServerLookup();

            serverLookup.TcpReaderFactory = new TcpReaderFactory();

            foreach (var line in lines)
            {
                if (string.IsNullOrEmpty(line))
                {
                    continue;
                }
                if (line.StartsWith("#"))
                {
                    continue;
                }

                var fileName = @"..\..\..\Whois.Tests\Samples\Tlds\" + line.ToLower() + ".txt";

                if (File.Exists(fileName))
                {
                    continue;
                }

                var tld = serverLookup.Lookup(line.ToLower()) as WhoisServerRecord;

                File.WriteAllText(fileName, tld.RawResponse);
                Console.WriteLine("{0}: {1:####,##0} byte(s)", line.ToLower(), tld.RawResponse.Length);

                Thread.Sleep(60000);
            }
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WhoisLookup"/> class with the given <see cref="WhoisOptions"/>.
 /// </summary>
 public WhoisLookup(WhoisOptions options)
 {
     Options      = options;
     whoisParser  = new WhoisParser();
     TcpReader    = new TcpReader();
     ServerLookup = new IanaServerLookup(TcpReader);
 }
示例#3
0
 public void SetUp()
 {
     lookup = new IanaServerLookup {
         TcpReaderFactory = new TcpReaderFactory()
     };
 }
示例#4
0
 public void SetUp()
 {
     lookup = new IanaServerLookup();
 }
示例#5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WhoisServerVisitor"/> class.
        /// </summary>
        /// <param name="encoding">The encoding used to read and write strings.</param>
        public WhoisServerVisitor(Encoding encoding)
        {
            WhoisServerLookup = new IanaServerLookup();

            Encoding = encoding;
        }