using System.Text.Json.Nodes;
using Triforce.Logic;
namespace Triforce.Launcher;
///
Evil HD's remastered textures are installed in your game folder. The game shows them while Evil HD is on.
" + "Remove them to free " + PackGb(m.Unpacked) + ". You can download them again any time.
", "texpack.go", new[] { ("no", "Keep them", true), ("rm", "Remove", false) }); return; } var left = tp.Remaining(g, m); var mins = (int)Math.Ceiling(left / (100e6 / 8) / 60); // (at 100 Mbit/s) Ask("Remastered textures", "" + m.Textures.ToString("N0") + " of the game's textures, remastered at twice the detail with their own grain kept. " + "The game shows them while Evil HD is on, from its next start.
" + "" + PackGb(left) + " to download" + (have == TexturePackHave.Partial ? " to finish" : "") + " (about " + mins + " minutes at 100 Mbit/s), unpacked into your game folder as it comes. " + "You can stop any time: it goes on where it stopped.
" + "They take more video memory: best with a graphics card of 10 GB or more.
", "texpack.go", new[] { ("no", "Not now", false), ("go", have == TexturePackHave.Partial ? "Continue" : "Download", true) }); } async Task RunPack() { var g = GameDir; if (g == null || packCts != null || packManifest == null) return; if (new Game(ctx).IsRunning(g)) { Toast("Close the game first: it reads the textures when it starts.", "error"); return; } using var cts = packCts = new CancellationTokenSource(); packFrac = 0; packLine = "Starting the download"; SendPack(); var last = DateTime.MinValue; try { await new TexturePack(ctx).InstallAsync(http, g, packManifest, p => { packFrac = p.Fraction; packLine = p.Text; if ((DateTime.UtcNow - last).TotalMilliseconds < 500) return; last = DateTime.UtcNow; SendPack(); }, cts.Token); Toast("◆ Remastered textures installed · turn on Evil HD to see them", "success"); Sfx("success"); } catch (OperationCanceledException) { Toast("Download stopped · it goes on where it stopped next time"); } catch (NoRoomException e) { Toast(H(e.Message), "error"); } catch (Exception e) { Log.Write("texture pack: " + e); Toast("The textures' download stopped: " + H(e.Message), "error"); } finally { packCts = null; packLine = ""; SendPack(); } } Task RemovePack() { var g = GameDir; if (g == null || packCts != null) return Task.CompletedTask; if (new Game(ctx).IsRunning(g)) { Toast("Close the game first.", "error"); return Task.CompletedTask; } try { new TexturePack(ctx).Remove(g); Toast("Remastered textures removed"); } catch (Exception e) { Log.Write("texture pack: remove: " + e); Toast("Could not remove them: " + H(e.Message), "error"); } SendPack(); return Task.CompletedTask; } }