Example #1
0
        protected bool UpdateDnsSystem(DnsConfigLoader dnsInfo)
        {
            List <DnsConfigLoader.DnsItem> LDns = dnsInfo.GetDnsList();
            bool bDnsInst = CheckDnsInst();

            if (!bDnsInst)
            {
                //Log.Logger.Instance.WriteLog("no dns driver object:MicrosoftDNS !");
                UpdateRecordsToCacheFile(LDns);
                uint verifyCode = VerifyCode.MakeFileVerifyCode(strSysHosts);
                if (verifyCode == 0)
                {
                    Log.Logger.Instance.WriteLog("Make host file verycode==0!");
                }
                else
                {
                    VerifyCode.WriteFileVerifyCode(verifyCode, "hostsverifycode");
                }
            }
            else
            {
                foreach (DnsConfigLoader.DnsItem item in LDns)
                {
                    UpdateARecord("", item.strDomain, item.strIp);
                }
            }

            return(true);
        }
Example #2
0
        public bool HostsFileIsOk()
        {
            uint recVerifyCode = VerifyCode.ReadFileRecVerifyCode("hostsverifycode");
            uint curVerifyCode = VerifyCode.MakeFileVerifyCode(strSysHosts);

            if (recVerifyCode == 0 || curVerifyCode == 0)
            {
                return(false);
            }
            return(recVerifyCode == curVerifyCode);
        }
Example #3
0
        protected void Check()
        {
            uint verifyCode    = VerifyCode.ReadFileRecVerifyCode("dnsconfverifycode");
            uint curVerifyCode = VerifyCode.MakeFileVerifyCode(strFileName);

            //重新设置hosts校验
            if (verifyCode == 0 || verifyCode != curVerifyCode)
            {
                VerifyCode.WriteFileVerifyCode(0, "hostsverifycode");
                VerifyCode.WriteFileVerifyCode(curVerifyCode, "dnsconfverifycode");
            }
        }