コード例 #1
0
 public static void AddDomainDnsRecord(DnsRecordInfo domainDnsRecord)
 {
     SqlHelper.ExecuteNonQuery(
         ConnectionString,
         CommandType.StoredProcedure,
         "AddDomainDnsRecord",
         new SqlParameter("@DomainId", domainDnsRecord.DomainId),
         new SqlParameter("@RecordType", domainDnsRecord.RecordType),
         new SqlParameter("@DnsServer", domainDnsRecord.DnsServer),
         new SqlParameter("@Value", domainDnsRecord.Value),
         new SqlParameter("@Date", domainDnsRecord.Date)
     );
 }
コード例 #2
0
        private IEnumerable<DnsRecordInfo> ParseNsLookupResult(string raw, string dnsServer, DnsRecordType recordType)
        {
            var records = new List<DnsRecordInfo>();

            var recordTypePattern = string.Empty;

            switch (recordType)
            {
                case DnsRecordType.NS:
                    {
                        recordTypePattern = NsRecordPattern;
                        break;
                    }
                case DnsRecordType.MX:
                    {
                        recordTypePattern = MxRecordPattern;
                        break;
                    }
            }

            var regex = new Regex(recordTypePattern, RegexOptions.IgnoreCase);

            foreach (Match match in regex.Matches(raw))
            {
                if (match.Groups.Count != 2)
                {
                    continue;
                }

                var dnsRecord = new DnsRecordInfo
                {
                    Value = match.Groups[1].Value != null ? match.Groups[1].Value.Replace("\r\n", "").Replace("\r", "").Replace("\n", "").ToLowerInvariant().Trim() : null,
                    RecordType = recordType,
                    DnsServer = dnsServer
                };

                records.Add(dnsRecord);
            }

            return records;
        }
コード例 #3
0
        private void RemoveRecord(DnsRecordInfo dnsRecord)
        {
            DataProvider.DeleteDomainDnsRecord(dnsRecord.Id);

            Thread.Sleep(100);
        }
コード例 #4
0
        private void AddRecord(DnsRecordInfo dnsRecord)
        {
            DataProvider.AddDomainDnsRecord(dnsRecord);

            Thread.Sleep(100);
        }
コード例 #5
0
 private void FillRecordData(DnsRecordInfo record, DomainInfo domain, string dnsServer)
 {
     record.DomainId = domain.DomainId;
     record.Date = DateTime.Now;
     record.DnsServer = dnsServer;
 }