public bool HostsFileIsOk() { uint recVerifyCode = VerifyCode.ReadFileRecVerifyCode("hostsverifycode"); uint curVerifyCode = VerifyCode.MakeFileVerifyCode(strSysHosts); if (recVerifyCode == 0 || curVerifyCode == 0) { return(false); } return(recVerifyCode == curVerifyCode); }
protected void Check() { uint verifyCode = VerifyCode.ReadFileRecVerifyCode("dnsconfverifycode"); uint curVerifyCode = VerifyCode.MakeFileVerifyCode(strFileName); //重新设置hosts校验 if (verifyCode == 0 || verifyCode != curVerifyCode) { VerifyCode.WriteFileVerifyCode(0, "hostsverifycode"); } }
internal void Applicate() { //保存 this.dnsloader.SaveFile(); this.dnsloader.uiListener.WriteOut("写出修改结果到文件.."); //verify code uint verifycode = VerifyCode.MakeFileVerifyCode(dnsloader.strFileName); VerifyCode.WriteFileVerifyCode(verifycode, "dnsconfverifycode"); this.dnsloader.uiListener.WriteOut("更新Config文件验证码.."); //update to hosts UpdateRecordsToCacheFile(dnsloader.mDns); this.dnsloader.uiListener.WriteOut("更新hosts文件.."); //verify code verifycode = VerifyCode.MakeFileVerifyCode(this.strSysHosts); this.dnsloader.uiListener.WriteOut("更新hosts文件验证码.."); VerifyCode.WriteFileVerifyCode(verifycode, "hostsverifycode"); this.dnsloader.uiListener.WriteOut("应用完成"); }
protected bool UpdateDnsSystem(DnsConfigLoader dnsInfo) { List <DnsConfigLoader.DnsItem> LDns = dnsInfo.GetDnsList(); { //Log.Logger.Instance.WriteLog("no dns driver object:MicrosoftDNS !"); UpdateRecordsToCacheFile(LDns); uint verifyCode = VerifyCode.MakeFileVerifyCode(strSysHosts); if (verifyCode == 0) { dnsloader.uiListener.WriteOut("Make host file verycode==0!"); } else { VerifyCode.WriteFileVerifyCode(verifyCode, "hostsverifycode"); } } return(true); }