private void DownloadWorker_DoWork_1(object sender, DoWorkEventArgs e) //When installwindow is activated { CurrentWorker.Text = "Base Skin"; List <bool> InstallerArguments = e.Argument as List <bool>; DownloadOfficial(InstallActions.GetLatestMetro()); if (InstallActions.err_ARCHIVE) { page1.Visible = true; InstallerPage.Visible = false; return; } InstallActions.InstallSkin(SteamSkinPath); installProgress.Value += 5; if (InstallerArguments[0]) { CurrentWorker.Text = "Unofficial Patch"; InstallActions.InstallPatch(SteamSkinPath); installProgress.Value += 25; InstallExtras(); } CurrentWorker.Text = "Cleaning Up"; InstallActions.Cleanup(); installProgress.Value = 100; CurrentWorker.Text = "Finished"; button1.Enabled = true; button1.ForeColor = Color.White; button1.Image = Properties.Resources.close_button; }
private void InstallExtras() { if (extrasListBox.CheckedItems.Count >= 1) { int incrementalProgressbarIncrease = 20 / extrasListBox.CheckedItems.Count; string[] manifest = File.ReadAllLines(Path.GetTempPath() + "\\UPMetroSkin-installer\\manifest.txt"); List <String> checkedExtras = new List <String>(); for (int i = 0; i < extrasListBox.Items.Count; i++) { if (extrasListBox.GetItemChecked(i)) { string ExtraPath = Regex.Match((manifest[i].Replace("\\", "")), "\"(.*?)\";\"(.*?)\";\"(.*?)\";\"(.*?)\"").Groups[2].Value; CurrentWorker.Text = extrasListBox.GetItemText(extrasListBox.Items[i]); checkedExtras.Add(CurrentWorker.Text); InstallActions.DirectoryCopy(Path.GetTempPath() + "\\UPMetroSkin-installer\\normal_Extras\\" + ExtraPath, SteamSkinPath + InstallActions.SkinFolder, true); installProgress.Value += incrementalProgressbarIncrease; } } if (saveExtrasCheckBox.Checked) { File.WriteAllLines(SteamSkinPath + InstallActions.SkinFolder + "\\extras.txt", checkedExtras); } } else { if (File.Exists(SteamSkinPath + InstallActions.SkinFolder + "\\extras.txt")) { File.Delete(SteamSkinPath + InstallActions.SkinFolder + "\\extras.txt"); } } }
private void PatchedNextButton_Click(object sender, EventArgs e) { page1.Visible = false; page2patched.Visible = true; if (InstallActions.CheckSteamSkinDirectoryExists(SteamSkinPath)) { DownloadPatchWorker.RunWorkerAsync(); } else { MessageBox.Show("No Steam Skin directory found."); } }
private void DownloadPatch_DoWork(object sender, DoWorkEventArgs e) //When select extras window is activated { DownloadPatch(); if (DownloadPatchWorker.CancellationPending) { InstallActions.Cleanup(); return; } progressBar1.Value = 100; InstallActions.ZipProgressChanged += (f) => { progressBar1.Value = f; }; InstallActions.TempExtractPatch(); InstallActions.ZipProgressChanged -= (f) => { progressBar1.Value = f; }; if (!DownloadPatchWorker.CancellationPending) { if (InstallActions.err_ARCHIVE) { page1.Visible = true; page2patched.Visible = false; return; } extrasListBox.DataSource = InstallActions.DetectExtras(); if (File.Exists(SteamSkinPath + InstallActions.SkinFolder + "\\extras.txt")) { string[] savedExtras = File.ReadAllLines(SteamSkinPath + InstallActions.SkinFolder + "\\extras.txt"); for (int i = 0; i < extrasListBox.Items.Count; i++) { if (savedExtras.Contains(extrasListBox.Items[i])) { extrasListBox.SetItemChecked(i, true); } } if (savedExtras.Length > 0) { saveExtrasCheckBox.Checked = true; } } progressBar1.Visible = false; extrasLoadingText.Visible = false; saveExtrasCheckBox.Invoke((MethodInvoker)(() => { saveExtrasCheckBox.Visible = true; })); PatchInstallButton.Enabled = true; PatchInstallButton.ForeColor = Color.White; PatchInstallButton.Image = Properties.Resources.right_arrow; } else { InstallActions.Cleanup(); } }
private void OfficialInstallbutton_Click(object sender, EventArgs e) { if (InstallActions.CheckSteamSkinDirectoryExists(SteamSkinPath)) { bool isPatch = false; List <bool> InstallerArguments = new List <bool>(); InstallerArguments.Add(isPatch); page1.Visible = false; InstallerPage.Visible = true; DownloadWorker.RunWorkerAsync(InstallerArguments); } else { MessageBox.Show("No Steam Skin directory found."); } }
private void InstallExtras() { if (extrasListBox.CheckedItems.Count >= 1) { int incrementalProgressbarIncrease = 20 / extrasListBox.CheckedItems.Count; for (int i = 0; i < extrasListBox.Items.Count; i++) { if (extrasListBox.GetItemChecked(i)) { string[] manifest = File.ReadAllLines(Path.GetTempPath() + "\\UPMetroSkin-installer\\manifest.txt"); string ExtraPath = Regex.Match((manifest[i].Replace("\\", "")), "\"(.*?)\";\"(.*?)\";\"(.*?)\";\"(.*?)\"").Groups[2].Value; CurrentWorker.Text = extrasListBox.GetItemText(extrasListBox.Items[i]); InstallActions.DirectoryCopy(Path.GetTempPath() + "\\UPMetroSkin-installer\\normal_Extras\\" + ExtraPath, FindSteamSkinDir() + "\\Metro 4.2.4", true); installProgress.Value += incrementalProgressbarIncrease; } } } }
private void DownloadPatch_DoWork(object sender, DoWorkEventArgs e) //When select extras window is activated { DownloadPatch(); progressBar1.Value = 100; InstallActions.TempExtractPatch(); if (InstallActions.err_ARCHIVE) { page1.Visible = true; page2patched.Visible = false; return; } extrasListBox.DataSource = InstallActions.DetectExtras(); progressBar1.Visible = false; extrasLoadingText.Visible = false; PatchInstallButton.Enabled = true; PatchInstallButton.ForeColor = Color.White; PatchInstallButton.Image = Properties.Resources.right_arrow; }
private void ExitButton_Click(object sender, EventArgs e) { InstallActions.Cleanup(); Application.Exit(); }