public void ThreadUpdateFunc() { string PATH = Path.GetFullPath("./tidal_new/"); string VERF = PATH + "version"; string BATF = PATH + "update.bat"; string sSelfVer = VersionHelper.GetSelfVersion(); //Get Already Download Ver string sDlVer = FileHelper.Read(VERF); if (sDlVer.IsNotBlank() && VersionHelper.Compare(sSelfVer, sDlVer) < 0 && File.Exists(PATH + "tidal-gui.exe") && File.Exists(BATF)) { MessageBoxResult ret = MessageBox.Show("Update new version?", "Info", MessageBoxButton.YesNo); if (ret == MessageBoxResult.No) { return; } if (Application.Current != null) { Application.Current.Dispatcher.BeginInvoke((Action) delegate() { CmdHelper.StartExe(BATF, null, IsShowWindow: false); WindowClose(); }); } return; } //Get Github Last Ver string sLastVer = GithubHelper.getLastReleaseVersion("yaronzz", "Tidal-Media-Downloader"); if (VersionHelper.Compare(sSelfVer, sLastVer) >= 0) { return; } if (Directory.Exists(PATH)) { Directory.Delete(PATH, true); } PathHelper.Mkdirs(PATH); if (GithubHelper.getLastReleaseFile("yaronzz", "Tidal-Media-Downloader", "tidal-gui.zip", PATH + "tidal-gui.zip")) { FastZip fz = new FastZip(); try { fz.ExtractZip(PATH + "tidal-gui.zip", PATH, null); if (File.Exists(PATH + "tidal-gui.exe")) { string sBat = "ping -n 5 127.0.0.1\n"; sBat += string.Format("move {0}tidal-gui.exe {0}..\\tidal-gui.exe\n", PATH); sBat += string.Format("start {0}..\\tidal-gui.exe\n", PATH); FileHelper.Write(sBat, true, BATF); FileHelper.Write(sLastVer, true, VERF); } } catch { return; } } }