private void btn_GoUpdate_Click(object sender, RoutedEventArgs e) { var platform = "x86"; if (Tools.IsFile64Bit(txb_SourceDirectory.Text + @"\Yatse2.exe") == true) platform = "x64"; var repo = new RemoteRepository(); repo.LoadRepository(Repository, platform, Helper.AppPath + "Updates"); var versions = repo.GetBuildList(_allowBeta); if (versions == null) { MessageBox.Show(GetLocalizedString(10)); repo.CleanTemporary(); return; } if (versions.Version.Count < 1) { MessageBox.Show(GetLocalizedString(10)); repo.CleanTemporary(); return; } var lastBuild = versions.Version[versions.Version.Count - 1]; brd_Update.Visibility = Visibility.Hidden; brd_BuildlInfos.Visibility = Visibility.Hidden; brd_InstallInfos.Visibility = Visibility.Visible; btn_Cancel.IsEnabled = false; txb_InstallInfos.Text = GetLocalizedString(6) + " " + lastBuild.Build + "\n\n" + GetLocalizedString(7); var updateInfo = new RepoInfo { Repo = Repository, Platform = platform, Source = txb_SourceDirectory.Text, Destination = txb_TargetDirectory.Text, Version = lastBuild }; var backgroundWorker = new BackgroundWorker(); backgroundWorker.DoWork += backgroundWorker_Update; backgroundWorker.RunWorkerCompleted += backgroundWorker_UpdateCompleted; backgroundWorker.RunWorkerAsync(updateInfo); }
private void Install(string platform) { var repo = new RemoteRepository(); repo.LoadRepository(Repository, platform, Helper.AppPath + "Updates"); _allowBeta = File.Exists(txb_TargetDirectory.Text + @"\Yatse2.beta"); var versions = repo.GetBuildList(_allowBeta); if (versions == null) { MessageBox.Show(GetLocalizedString(10)); repo.CleanTemporary(); return; } if (versions.Version.Count < 1) { MessageBox.Show(GetLocalizedString(10)); repo.CleanTemporary(); return; } var lastBuild = versions.Version[versions.Version.Count - 1]; txb_InstallInfos.Text = GetLocalizedString(6) + " " + lastBuild.Build + " (" + platform + ")\n\n" + GetLocalizedString(7); brd_InstallInfos.Visibility = Visibility.Visible; brd_Install.Visibility = Visibility.Hidden; brd_BuildlInfos.Visibility = Visibility.Hidden; btn_Cancel.IsEnabled = false; var updateInfo = new RepoInfo { Repo = Repository, Platform = platform, Source = txb_SourceDirectory.Text, Destination = txb_TargetDirectory.Text, Version = lastBuild }; var backgroundWorker = new BackgroundWorker(); backgroundWorker.DoWork += backgroundWorker_Install; backgroundWorker.RunWorkerCompleted += backgroundWorker_InstallCompleted; backgroundWorker.RunWorkerAsync(updateInfo); }