public void CreateStartMenuShortcuts() { InstallerCommon.CreateStartMenuShortcut("Battlelogium - Battlefield 3.lnk", "Play Battlefield 3", Path.Combine(this.installPath, "Battlelogium.UI.BF3.exe")); InstallerCommon.CreateStartMenuShortcut("Battlelogium - Battlefield 4.lnk", "Play Battlefield 4", Path.Combine(this.installPath, "Battlelogium.UI.BF4.exe")); InstallerCommon.CreateStartMenuShortcut("Battlelogium - Battlefield Hardline.lnk", "Play Battlefield Hardline", Path.Combine(this.installPath, "Battlelogium.UI.BFH.exe")); InstallerCommon.CreateStartMenuShortcut("Battlelogium - Medal of Honor Warfighter.lnk", "Medal of Honor Warfighter", Path.Combine(this.installPath, "Battlelogium.UI.MOHW.exe")); }
internal async Task BeginUpdate() { this.DownloadComplete += async(s, e) => { await InstallerCommon.ExtractZipFile(e.completedFilePath, installPath); var completed = new UIComplete(installPath); completed.Show(); completed.Activate(); this.SyncCloseWindow(); }; this.Show(); this.Start(); }
public void CreateDesktopShortcuts() { if (bf3Shortcut_input.IsChecked == true) { InstallerCommon.CreateDesktopShortcut("Battlelogium - Battlefield 3.lnk", "Play Battlefield 3", Path.Combine(this.installPath, "Battlelogium.UI.BF3.exe")); } if (bf4Shortcut_input.IsChecked == true) { InstallerCommon.CreateDesktopShortcut("Battlelogium - Battlefield 4.lnk", "Play Battlefield 4", Path.Combine(this.installPath, "Battlelogium.UI.BF4.exe")); } if (bfhShortcut_input.IsChecked == true) { InstallerCommon.CreateDesktopShortcut("Battlelogium - Battlefield Hardline.lnk", "Play Battlefield Hardline", Path.Combine(this.installPath, "Battlelogium.UI.BFH.exe")); } if (mohwShortcut_input.IsChecked == true) { InstallerCommon.CreateDesktopShortcut("Battlelogium - Medal of Honor Warfighter.lnk", "Medal of Honor Warfighter", Path.Combine(this.installPath, "Battlelogium.UI.MOHW.exe")); } }
public async Task InstallDependency(string downloadKey, string labelName) { string originDownloadUrl = await InstallerCommon.GetDownload(downloadKey); this.SetStatusLabelSync("Downloading " + labelName + ". Please wait..."); await downloader.DownloadFileTaskAsync(originDownloadUrl, Path.Combine(this.tempPath, downloadKey + "_inst.exe")); this.SetStatusLabelSync("Installing " + labelName + ". Please wait..."); await Task.Run(() => { try { Process.Start(Path.Combine(this.tempPath, downloadKey + "_inst.exe"), "/s").WaitForExit(); } catch { return; } }); }
private async void Application_Startup(object sender, StartupEventArgs e) { AppDomain.CurrentDomain.UnhandledException += (s, unhandledevent) => { this.Shutdown(1); }; string[] args = Environment.GetCommandLineArgs(); if (args.Length == 1) { new UIInstaller().Show(); return; } if (args[1] == "update") { if (args.Length == 2) { MessageBox.Show("No update path provided"); this.Shutdown(); } InstallerCommon.KillBattlelogium(); string path = args[2]; string url = await InstallerCommon.GetDownload("battlelogium"); var updater = new BattlelogiumInstaller(url, path); updater.BeginUpdate(); return; } if (args[1] == "uninstall") { if (File.Exists("filelist")) { InstallerCommon.KillBattlelogium(); new UIUninstaller().Show(); return; } MessageBox.Show("filelist not found, Uninstall is unable to continue"); this.Shutdown(); return; } return; }
public async Task Install() { this.installButton.IsEnabled = false; this.browseButton.IsEnabled = false; this.dependencies = new DependencyCheck(); this.downloader = new WebClient(); progressBar.IsIndeterminate = true; if (!this.dependencies.IsOriginInstalled) { await InstallOrigin(); } await InstallDependency("vcredist", "Microsoft VC Redistributable 2012"); try { if (!Directory.Exists(installPath)) { Directory.CreateDirectory(installPath); } try { System.IO.File.Copy(Assembly.GetEntryAssembly().Location, Path.Combine(installPath, "Battlelogium.Installer.exe"), true); } catch { }; } catch { MessageBox.Show("Failure occured regarding install directory, please try again"); Environment.Exit(1); } this.Hide(); string url = await InstallerCommon.GetDownload("battlelogium"); var updater = new BattlelogiumInstaller(url, installPath); updater.DownloadComplete += (s, e) => { this.Close(); }; updater.BeginUpdate(); }