Exemplo n.º 1
0
        private SOAType GetSoaFromText(string zoneFileText)
        {
            var soa   = new SOAType();
            var match = Regex.Match(zoneFileText, SOA_PATTERN, RegexOptions.Multiline);

            if (match.Success)
            {
                soa.PrimaryServer    = ReadGroupValue(match.Groups, 1);
                soa.ResponsibleParty = ReadGroupValue(match.Groups, 2);
                soa.SerialNumber     = Convert.ToUInt32(ReadGroupValueLong(match.Groups, 3));
                soa.RefreshInterval  = Convert.ToUInt32(ReadGroupValueInt(match.Groups, 4));
                soa.RetryDelay       = Convert.ToUInt32(ReadGroupValueInt(match.Groups, 5));
                soa.ExpireLimit      = Convert.ToUInt32(ReadGroupValueInt(match.Groups, 6));
                soa.MinimumTTL       = Convert.ToUInt32(ReadGroupValueInt(match.Groups, 7));
            }

            return(soa);
        }
Exemplo n.º 2
0
        private SOAType GetSOAType(string zoneName)
        {
            var s = new SOAType();

            using (var query = GetProperties(String.Format("SELECT * FROM MicrosoftDNS_SOAType WHERE ContainerName = '{0}'", zoneName)))
            {
                foreach (ManagementObject item in query)
                {
                    s.ExpireLimit        = GetValue <uint>(item, "ExpireLimit");
                    s.MinimumTTL         = GetValue <uint>(item, "MinimumTTL");
                    s.PrimaryServer      = GetValue <string>(item, "PrimaryServer");
                    s.RefreshInterval    = GetValue <uint>(item, "RefreshInterval");
                    s.ResponsibleParty   = GetValue <string>(item, "ResponsibleParty");
                    s.RetryDelay         = GetValue <uint>(item, "RetryDelay");
                    s.SerialNumber       = GetValue <uint>(item, "SerialNumber");
                    s.TextRepresentation = GetValue <string>(item, "TextRepresentation");

                    break;
                }
            }

            return(s);
        }