excel/Autoupdate/Program.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net.NetworkInformation;
using System.Text;

namespace Autoupdate
{
	class Program
	{
		static AutoUpdateConfig _config;

		static AutoUpdateConfig _configInServer;

		static bool _isHasNetWork;


		static void Main(string[] args)
		{
			_isHasNetWork = NetHelper.CheckNet();

			if (!_isHasNetWork)
			{
				return; 
			}
			_config = AutoUpdateHelper.GetConfig();
			using (var wc = new System.Net.WebClient())
			{
				var data=wc.DownloadString(new Uri(_config.Url));
				//wc.DownloadStringCompleted += Wc_DownloadStringCompleted;
				CheckVer(data);

			}
			//Console.ReadLine();
		}

		private static void CheckVer(string data) {
			 

			_configInServer = Newtonsoft.Json.JsonConvert.DeserializeObject<AutoUpdateConfig>(data);

			if (_configInServer == null)
			{
				Console.WriteLine("下载失败");
				Console.ReadLine();
			}

			//版本比较
			if (_config.Version != _configInServer.Version)
			{
				//先结束主进程
				var pro = Process.GetProcessesByName(_configInServer.MainExe);//获取已开启的所有进程

				foreach (var item in pro)
				{
					item.Kill();

				}

后面还有 53 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。