国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

谷歌chrome更新服務器hosts

這篇具有很好參考價值的文章主要介紹了谷歌chrome更新服務器hosts。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using TravelRepublic.DnsClient;
using TravelRepublic.DnsClient.Records;
using System.Windows;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Drawing;

namespace Chrome更新服務器Hosts
{
    internal class Program
    {
        static void Main(string[] args)
        {
			Console.Title = "設置Chrome更新服務器地址 by 福建-兮";
			Console.SetWindowSize(70, 10);
			Console.SetBufferSize(70, 10);
			IntPtr consoleWindow = Program.GetConsoleWindow();
			Program.RECT rect;
			Program.GetWindowRect(consoleWindow, out rect);
			Screen screen = Screen.FromPoint(new Point(rect.left, rect.top));
			int x = screen.WorkingArea.Left + (screen.WorkingArea.Width - (rect.right - rect.left)) / 2;
			int y = screen.WorkingArea.Top + (screen.WorkingArea.Height - (rect.bottom - rect.top)) / 2;
			Program.MoveWindow(consoleWindow, x, y, rect.right - rect.left, rect.bottom - rect.top, true);
			Program.GetChromeUpdateServerIP("tools.google.com");//"tools.google.com"
			Console.ReadKey();
		}
		private static void GetChromeUpdateServerIP(string domain)
		{
			Console.Write("請輸入解析DNS地址(默認為:114.114.114.114):");
			string text = Console.ReadLine();
			bool flag = string.IsNullOrEmpty(text);
			if (flag)
			{
				text = "114.114.114.114";
			}
			IDnsClient dnsClient = new DnsClientBuilder().WithDnsServer(new IPEndPoint(IPAddress.Parse(text), 53)).Build();
			try
			{
				Response response = dnsClient.Query(domain, NsType.A, NsClass.INET, ProtocolType.Udp);
				ARecord arecord = (ARecord)response.Answers[2];
				Console.Write("使用DNS:");
				Console.ForegroundColor = ConsoleColor.DarkGreen;
				Console.Write(text);
				Console.ResetColor();
				Console.Write("解析chrome更新服務器地址");
				Console.WriteLine();
				Console.Write("chrome更新服務器地址為:");
				Console.ForegroundColor = ConsoleColor.DarkGreen;
				Console.Write(arecord.Address);
				Console.ResetColor();
				Console.WriteLine();
				Console.WriteLine();
				Console.ForegroundColor = ConsoleColor.Magenta;
				Console.WriteLine("開始修改host");
				Console.ResetColor();
				Console.Write(arecord.Address);
				Console.WriteLine();
				Process process = new Process();
				process.StartInfo.FileName = "cmd.exe";
				process.StartInfo.UseShellExecute = false;
				process.StartInfo.RedirectStandardInput = true;
				process.StartInfo.RedirectStandardOutput = true;
				process.StartInfo.RedirectStandardError = true;
				process.StartInfo.CreateNoWindow = true;
				process.Start();
				process.StandardInput.WriteLine("attrib -r -a -s -h %windir%\\system32\\drivers\\etc\\hosts & exit");
				//process.StandardInput.AutoFlush= true;
                //string outstr = process.StandardOutput.ReadToEnd();
				process.WaitForExit();
				process.Close();
				string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "drivers\\etc\\hosts");
				List<string> list = File.ReadAllLines(path).ToList<string>();
				list.RemoveAll((string z) => z.Contains(domain));
				foreach (string text2 in list.ToArray())
				{
					bool flag2 = text2.Contains(domain);
					if (flag2)
					{
						list.Remove(text2);
					}
				}
				list.Add(string.Format("{0}  {domain}", arecord.Address));//tools.google.com
				//list.Add(string.Format("{0}  dl.google.com", arecord.Address));
				File.WriteAllLines(path, list.ToArray());
				Console.ForegroundColor = ConsoleColor.Blue;
				Console.WriteLine("host修改完成");
				Console.ResetColor();
				Console.ReadLine();
			}
			catch (Exception ex)
			{
                System.Windows.MessageBox.Show(ex.StackTrace, "錯誤", MessageBoxButton.OK, MessageBoxImage.Hand);
			}
		}
		private static void SetConsolePosition()
		{
			IntPtr hWin = GetConsoleWindow();
			RECT rc;
			GetWindowRect(hWin, out rc);
			Screen scr = Screen.FromPoint(new Point(rc.left, rc.top));
			int x = scr.WorkingArea.Left + (scr.WorkingArea.Width - (rc.right - rc.left)) / 2;
			int y = scr.WorkingArea.Top + (scr.WorkingArea.Height - (rc.bottom - rc.top)) / 2;
			MoveWindow(hWin, x, y, rc.right - rc.left, rc.bottom - rc.top, true);
		}
		private struct RECT { public int left, top, right, bottom; }

		[DllImport("kernel32.dll", SetLastError = true)]
		private static extern IntPtr GetConsoleWindow();
		[DllImport("user32.dll", SetLastError = true)]
		private static extern bool GetWindowRect(IntPtr hWnd, out RECT rc);
		[DllImport("user32.dll", SetLastError = true)]
		private static extern bool MoveWindow(IntPtr hWnd, int x, int y, int w, int h, bool repaint);
	}
}

文章來源地址http://www.zghlxwxcb.cn/news/detail-569288.html

到了這里,關于谷歌chrome更新服務器hosts的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領支付寶紅包贊助服務器費用

相關文章

  • 寫一個hosts文件屏蔽所有關于微軟的網(wǎng)站,包括子域名,服務器地址

    下面是如何寫一個 hosts 文件來屏蔽所有關于微軟的網(wǎng)站的方法: 打開您的計算機上的文本編輯器,例如記事本。 在文本編輯器中輸入以下內(nèi)容: 保存文件,并將其命名為 \\\"hosts\\\"。注意,文件名不帶有擴展名。 將 hosts 文件復制到您的計算機上的以下位置: Windows:C:Windows

    2024年04月25日
    瀏覽(92)
  • deepin系統(tǒng)更新谷歌瀏覽器chrome的方法

    deepin系統(tǒng)更新谷歌瀏覽器chrome的方法 1 為什么要更新谷歌瀏覽器 谷歌瀏覽器更新頻繁,隔一段時間不更新,打開瀏覽器時會自動彈出一個提示更新的窗口,有點煩,如果使用python自動處理程序時,如webbrowser.open(\\\'http://×.html\\\')語句,不能正確執(zhí)行。 目前,deepin系統(tǒng)谷歌瀏覽器

    2024年02月07日
    瀏覽(29)
  • 全網(wǎng)多種方法解決Invalid Host header(無效的主機頭)服務器域名訪問出現(xiàn)的錯誤

    全網(wǎng)多種方法解決Invalid Host header(無效的主機頭)服務器域名訪問出現(xiàn)的錯誤

    在搭建 vue-cli 環(huán)境,用 nginx 做代理服務器,訪問時卻顯示: Invalid Host header 。 知其然,知其所以然,我們在解決該問題之前,要弄明白 Invalid Host header 是什么。 ChatGPT 目前正火,可以借助 ChatGPT 來回答, Invalid Host header 是什么,如下圖所示: The “Invalid Host header” error typ

    2024年02月03日
    瀏覽(39)
  • 華為harmonyos4.0鴻蒙4.0安裝谷歌服務框架Play商店,解決從服務器檢索信息時出錯

    華為harmonyos4.0鴻蒙4.0安裝谷歌服務框架Play商店,解決從服務器檢索信息時出錯

    8月4號華為手機發(fā)布了全新的harmonyos4.0鴻蒙4.0系統(tǒng),很多人需要問還是不是支持谷歌服務框架?那么答案是肯定的,它和鴻蒙3是一樣的,一樣的操作,一樣的支持安裝谷歌服務框架,安裝Google play商店。測試機型,Mate30,Mate40,Mate50,P50,P60,華為的幾款折疊屏xs,x3,這幾款測試都是

    2024年02月13日
    瀏覽(22)
  • vscode連接服務器時卡在setting up ssh host:initializing vscode server

    vscode連接服務器時卡在setting up ssh host:initializing vscode server

    ?我不能保證這個方法對所有人都有效,只是我的問題恰好是這么解決的,只是給大家提供一個可能的方法 在Remote SSH擴展設置中找到 去掉這個對勾就正常了,我是對比兩臺電腦上vscode中Remote SSH擴展設置發(fā)現(xiàn)的這個區(qū)別,但不了解原因

    2024年02月11日
    瀏覽(23)
  • 服務器或服務器主板中的BIOS更新詳解

    服務器或服務器主板中的BIOS更新詳解

    BIOS更新總共有三種方式:DOS、UEFI Shell以及BMC網(wǎng)頁更新,而其中,DOS與Shell的更新方式類似,因此以下為統(tǒng)一描述。 一、 UEFI Shell 或 DOS 下更新 當我們下載了官網(wǎng)的BIOS更新包并解壓后可以獲得一些更新文件,在更新文件中通常會有更新說明例如下圖所示: Flash文件是.nsh結尾的

    2024年01月23日
    瀏覽(97)
  • 【已解決】多種方式最新解決Invalid Host header(無效的主機頭)服務器域名訪問出現(xiàn)的錯誤

    【已解決】多種方式最新解決Invalid Host header(無效的主機頭)服務器域名訪問出現(xiàn)的錯誤

    ?? 個人主頁: 不叫貓先生 ,公眾號: 前端舵手 ???♂? 作者簡介:CSDN博客專家、內(nèi)容合伙人,2023新星計劃導師,前端領域優(yōu)質(zhì)創(chuàng)作者,共同學習共同進步,一起加油呀! ?? 資料領取:前端進階資料可以找我免費領取 Invalid Host header 這個報錯在網(wǎng)上有很多文章介紹解決

    2024年02月08日
    瀏覽(20)
  • 【colab】谷歌colab免費服務器訓練自己的模型,本文以yolov5為例介紹流程

    【colab】谷歌colab免費服務器訓練自己的模型,本文以yolov5為例介紹流程

    目錄 一.前言 二.準備工作 1.注冊Google drive(谷歌云盤) Google Driver官網(wǎng):https://drive.google.com/drive/ Colab官網(wǎng):https://colab.research.google.com/ 2.上傳項目文件 3.安裝Colaboratory 4.colab相關操作和命令 5.項目相關操作? 三.異常處理 ????????本文介紹了在谷歌開放平臺Google colab上租用免

    2023年04月08日
    瀏覽(23)
  • ssh連接服務器出現(xiàn):ssh: connect to host **** port 22: Connection refused 的解決方法

    ssh連接服務器出現(xiàn):ssh: connect to host **** port 22: Connection refused 的解決方法

    我是windows10 連接 windows server2019 一直出現(xiàn) ssh: connect to host **** port 22: Connection refused 查了一堆方法沒有想要的 首先去看你的虛擬機有沒有開啟遠程訪問,沒有開啟當然訪問不了。 點擊允許遠程訪問 點擊允許,然后選擇用戶添加你新增的用戶。 然后不要看本機上面的的ipv4地址

    2024年02月11日
    瀏覽(24)
  • 阿里云輕量應用服務器和云服務器有什么區(qū)別?2023更新

    阿里云輕量應用服務器和云服務器有什么區(qū)別?2023更新

    阿里云輕量應用服務器和云服務器ECS有什么區(qū)別?ECS是專業(yè)級云服務器,輕量應用服務器是輕量級服務器,輕量服務器使用門檻更低,適合個人開發(fā)者或中小企業(yè)新手使用,可視化運維,云服務器ECS適合集群類、高可用、高容災企業(yè)級架構,使用相對于輕量更復雜一些,云服

    2024年02月12日
    瀏覽(26)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領取紅包,優(yōu)惠每天領

二維碼1

領取紅包

二維碼2

領紅包