static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string txtContent = GetVersion("https://raw.githubusercontent.com/coding1618/TaleWindowUpData/master/version.txt"); string L = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); //MessageBox.Show(Tools.ReadTxtContent(@"C:\TaleBlog\tale\version.ini") + ":"+txtContent); //检查环境变量 if (Set_OS_Path.CheckSysEnvironmentExist("TaleHome")) { //检查更新 if (!txtContent.Equals(L)) { MessageBox.Show("软件已经发布更新!请去更新程序!"); Application.Run(new updata()); } else { Application.Run(new Tale()); } } else { Application.Run(new install()); } }
private void timer_Tick(object sender, EventArgs e) { this.timer.Enabled = false; string txtContent = GetVersion("https://raw.githubusercontent.com/coding1618/TaleWindowUpData/master/updata.json"); JObject jo = (JObject)JsonConvert.DeserializeObject(txtContent); DownloadFile(jo["fileurl"].ToString(), @"C:\tale.zip", progressBar1); Set_OS_Path.SetSysEnvironment("TaleHome", @"C:\TaleBlog"); MessageBox.Show("安装成功请重启,请使用桌面快捷方式启动,本文件请保留!请点击X退出重启软件!", "提示:"); SharpZip.UnZip(@"C:\\tale.zip", @"C:\TaleBlog"); Application.Exit(); }