async Task update(string uri, bool force) { ////try { webClient.DownloadProgressChanged += onDownloadProgressChanged; string downloadedZipPath = getDownloadedZipDestinationPath(); await webClient.DownloadFileTaskAsync(new Uri(uri), downloadedZipPath); string destinationPath = getPathToUpdatePack(); if (Directory.Exists(destinationPath)) { Directory.Delete(destinationPath, true); } ZipFile.ExtractToDirectory(downloadedZipPath, destinationPath); install(force); updateAppVersion(); removeInstallationFiles(); Installed?.Invoke(appName); fileSizeInfoGet = false; } //catch { System.Console.WriteLine($"zal"); } }
void AwaitInstall(Game game, string destination) { var source = new ELPathInfo(Game); var stopWatch = Stopwatch.StartNew(); #if !DEBUG await #endif source.CopyTo(destination); var installDir = Path.Combine(destination, source.RelativeInstallPath); var gamePath = Path.Combine(destination, source.RelativeRomPath); if (PlayniteAPI.ApplicationInfo.IsPortable) { installDir = installDir.Replace(PlayniteAPI.Paths.ApplicationPath, Playnite.SDK.ExpandableVariables.PlayniteDirectory); gamePath = gamePath.Replace(PlayniteAPI.Paths.ApplicationPath, Playnite.SDK.ExpandableVariables.PlayniteDirectory); } var gameInfo = new GameInfo() { InstallDirectory = installDir, GameImagePath = gamePath, }; stopWatch.Stop(); execContext.Post((a) => Installed?.Invoke(this, new GameInstalledEventArgs(gameInfo, this, stopWatch.Elapsed.TotalSeconds)), null); // This is actually ignored in the GameInfo above... Maybe fixed now in latest version. TODO: recheck var g = PlayniteAPI.Database.Games[Game.Id]; g.GameImagePath = gameInfo.GameImagePath; PlayniteAPI.Database.Games.Update(g); // }
private static void InstallThreadStart() { try { string dirPath = Path.GetDirectoryName(InstallFilePath); if (dirPath == null) { FailCode = 1; if (InstallFailed != null) { InstallFailed.Invoke(null, new EventArgs()); } return; } FailCode = 2; if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } FailCode = 3; if (File.Exists(InstallFilePath)) { File.Delete(InstallFilePath); } FailCode = 4; File.Copy(InstallLocalFilePath, InstallFilePath); FailCode = 5; if (File.Exists(UninstallFilePath)) { File.Delete(UninstallFilePath); } FailCode = 6; File.Copy(UninstallLocalFilePath, UninstallFilePath); FailCode = 7; } catch (Exception) { if (InstallFailed != null) { InstallFailed.Invoke(null, new EventArgs()); } return; } IsInstalled = InstallUtil(true); FailCode = 8; if (IsInstalled && (Installed != null)) { Installed.Invoke(null, new EventArgs()); } else if (InstallFailed != null) { InstallFailed.Invoke(null, new EventArgs()); } }
/// <summary> /// Internal method that is called from Hardpoint.InstallEquipment. Do not call from anywhere else! /// </summary> internal void HandleInstallation(Hardpoint hardpoint) { Assert.IsFalse(IsInstalled, "Tried to install equipment that is already installed somewhere."); Assert.IsFalse(Enabled, "Tried to install enabled equipment."); Hardpoint = hardpoint; Installed?.Invoke(this, hardpoint); if (TargetEnabled) { TryToEngage(); } }
/// <summary> /// Buy an upgrade, deducting the specified amount of Codepoints. /// </summary> /// <param name="id">The upgrade ID to buy</param> /// <param name="cost">The amount of Codepoints to deduct</param> /// <returns>True if the upgrade was installed successfully, false if the user didn't have enough Codepoints or the upgrade wasn' found.</returns> public static bool Buy(string id, ulong cost) { if (SaveSystem.CurrentSave.Codepoints >= cost) { SaveSystem.CurrentSave.Upgrades[id] = true; TerminalBackend.InvokeCommand("sos.save"); SaveSystem.TransferCodepointsToVoid(cost); Installed?.Invoke(); Desktop.ResetPanelButtons(); Desktop.PopulateAppLauncher(); return(true); } else { if (!Silent) { Console.WriteLine($"{{SHIFTORIUM_NOTENOUGHCP}}: {cost} > {SaveSystem.CurrentSave.Codepoints}"); } return(false); } }
/// <summary> /// Causes the engine to alert the frontend of a new Shiftorium upgrade install. /// </summary> public static void InvokeUpgradeInstalled() { Installed?.Invoke(); }
private void Controller_Installed(object sender, GameInstalledEventArgs e) { Installed?.Invoke(this, e); }
public virtual void OnInstalled(object sender, GameControllerEventArgs args) { execContext.Post((a) => Installed?.Invoke(sender, args), null); }
public virtual void OnInstalled(object sender, GameInstalledEventArgs args) { Installed?.Invoke(sender, args); }
internal virtual void OnInstalled() { Installed?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Invoke to signal that installation completed. /// </summary> /// <param name="args"></param> protected void InvokeOnInstalled(GameInstalledEventArgs args) { args.Source = this; execContext.Send((a) => Installed?.Invoke(this, args), null); }
public virtual void OnInstalled(object sender, GameInstalledEventArgs args) { execContext.Send((a) => Installed?.Invoke(sender, args), null); }
internal void OnInstalled() { Log.Success($"Server {this.ID:00} Installed."); Installed.Invoke(this, null); }