using System; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Threading.Tasks; using Avalonia; using Avalonia.Controls; using Avalonia.Input; using Avalonia.Layout; using Avalonia.Media; using Avalonia.Media.Imaging; using Avalonia.Threading; namespace UltraParadise.Linux { internal static class Draw { public static readonly FontFamily Font = new("fonts:Inter#Inter"); public static FormattedText Text(string s, double size, IBrush b, bool bold, double maxWidth, TextAlignment align) { FormattedText ft = new(s ?? "", CultureInfo.InvariantCulture, FlowDirection.LeftToRight, new Typeface(Font, FontStyle.Normal, bold ? FontWeight.SemiBold : FontWeight.Normal), size, b); if (maxWidth > 0) ft.MaxTextWidth = maxWidth; ft.TextAlignment = align; ft.Trimming = TextTrimming.WordEllipsis; return ft; } public static void Cover(DrawingContext ctx, Bitmap img, Rect dest, double focusY) { if (img == null) return; double iw = img.PixelSize.Width, ih = img.PixelSize.Height; double sc = Math.Max(dest.Width / iw, dest.Height / ih); double sw = dest.Width / sc, sh = dest.Height / sc; double sy = Math.Clamp(ih * focusY - sh / 2, 0, ih - sh); ctx.DrawImage(img, new Rect((iw - sw) / 2, sy, sw, sh), dest); } public static IBrush Fade(Color top, Color bottom) => new LinearGradientBrush { StartPoint = new RelativePoint(0, 0, RelativeUnit.Relative), EndPoint = new RelativePoint(0, 1, RelativeUnit.Relative), GradientStops = { new GradientStop(top, 0), new GradientStop(bottom, 1) }, }; } internal sealed class LauncherWindow : Window { public static string Result; public static bool Checked; public bool Restarting; private readonly Bitmap art = Program.Image("splash.jpg"), logo = Program.Image("tile.png"); private readonly Stopwatch clock = Stopwatch.StartNew(); private readonly DispatcherTimer timer = new() { Interval = TimeSpan.FromMilliseconds(16) }; private readonly LauncherView view; private string status = "Starting up", detail = ""; private int progress = -1; private bool busy = true, asking, closing; private long closeAt = long.MaxValue, closingFrom; private UpdateInfo found; private Rect updRect, laterRect; private int hover; public LauncherWindow() { Title = Program.Name; Width = 300; Height = 350; CanResize = false; SystemDecorations = SystemDecorations.None; WindowStartupLocation = WindowStartupLocation.CenterScreen; Background = new SolidColorBrush(Ui.Back); Opacity = 0; Bitmap icon = Program.Image("icon.png"); if (icon != null) Icon = new WindowIcon(icon); view = new LauncherView(this); Content = view; timer.Tick += (_, _) => Step(); Opened += (_, _) => { clock.Restart(); timer.Start(); _ = Work(); }; PointerPressed += OnDown; PointerMoved += (_, e) => { Point p = e.GetPosition(this); int h = asking ? (updRect.Contains(p) ? 1 : laterRect.Contains(p) ? 2 : 0) : 0; if (h != hover) { hover = h; Cursor = new Cursor(h != 0 ? StandardCursorType.Hand : StandardCursorType.Arrow); } }; } private void Finish(string s, string d, int ms) { status = s; detail = d ?? ""; progress = -1; busy = false; asking = false; closeAt = clock.ElapsedMilliseconds + ms; } private async Task Work() { await Task.Delay(450); if (!Settings.On("autoupdate", true)) { Finish("Starting", null, 250); return; } status = "Checking for updates"; UpdateInfo u; try { u = await Updater.Check(); } catch (Exception) { Checked = true; Result = "Couldn't reach the update server. You have v" + Program.Version + "."; Finish("Couldn't check for updates", "Starting anyway", 1100); return; } Checked = true; Updater.Ready = u; if (u == null) { Result = "You're up to date (v" + Program.Version + "). Checked " + DateTime.Now.ToString("HH:mm", CultureInfo.InvariantCulture) + "."; Finish("You're up to date", "Starting", 500); return; } Result = "v" + u.Version + " is out (you have v" + Program.Version + "). Click Update Now."; if (Settings.On("silentupdate", false) && !Updater.Manual && !Game.GameRunning() && u.VtClean) { await Install(u); return; } found = u; busy = false; asking = true; status = "Update available"; detail = "v" + u.Version + (Updater.Manual ? " is out. Get it from Nexus Mods" : " is ready to install") + (u.Notes.Length > 0 ? "\n\nWhat's new:\n" + u.Notes : "") + (Updater.Manual ? "" : "\n\n" + u.VtLine + (u.VtFlagged ? " Look at the report on virustotal.com before you install it." : "")); FitNotes(); } private double detailH; private void FitNotes() { double W = 440; FormattedText d = Draw.Text(detail, 12, new SolidColorBrush(Ui.Soft), false, W - 48, TextAlignment.Left); double maxText = 420; try { if (Screens.ScreenFromWindow(this) is Avalonia.Platform.Screen sc) maxText = Math.Max(60, sc.WorkingArea.Height / sc.Scaling - (186 + 28 + 14 + 34 + 60)); } catch (Exception) { } detailH = Math.Min(maxText, Math.Ceiling(d.Height) + 4); PixelPoint old = Position; double ow = Width, oh = Height; Width = W; Height = Math.Max(350, 186 + 28 + detailH + 14 + 34 + 46); Position = new PixelPoint(old.X + (int)((ow - Width) / 2), Math.Max(0, old.Y + (int)((oh - Height) / 2))); } private async Task Install(UpdateInfo u) { busy = true; asking = false; status = "Downloading update"; detail = "v" + u.Version + " · 0%"; progress = 0; string err; try { err = await Updater.Install(u, pc => Dispatcher.UIThread.Post(() => { progress = pc; status = pc >= 100 ? "Installing update" : "Downloading update"; detail = "v" + u.Version + " · " + pc + "%"; })); } catch (Exception e) { err = e.Message; } if (err == null) { Restarting = true; Finish("Restarting", "Opening v" + u.Version, 350); return; } Result = "Update failed: " + err; Finish("Update failed", err, 4000); } private void OnDown(object sender, PointerPressedEventArgs e) { if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return; Point p = e.GetPosition(this); if (asking && updRect.Contains(p)) { if (Updater.Manual) { Game.Open(Updater.ManualPage); Finish("Starting", "Download v" + found.Version + " from Nexus Mods", 1200); return; } _ = Install(found); return; } if (asking && laterRect.Contains(p)) { Finish("Starting", null, 200); return; } try { BeginMoveDrag(e); } catch (Exception) { } } private void Step() { long t = clock.ElapsedMilliseconds; if (closing) { double o = 1.0 - (t - closingFrom) / 180.0; if (o <= 0) { timer.Stop(); Close(); return; } Opacity = o; return; } if (Opacity < 1) Opacity = Math.Min(1.0, t / 220.0); if (t >= closeAt) { closing = true; closingFrom = t; } view.InvalidateVisual(); } private sealed class LauncherView : Control { private readonly LauncherWindow w; public LauncherView(LauncherWindow owner) { w = owner; } public override void Render(DrawingContext ctx) { double W = Bounds.Width, H = Bounds.Height; double t = w.clock.ElapsedMilliseconds / 1000.0; Color back = Ui.Back; ctx.FillRectangle(new SolidColorBrush(back), new Rect(0, 0, W, H)); double band = 150; Draw.Cover(ctx, w.art, new Rect(0, 0, W, band), 0.45); ctx.FillRectangle(Draw.Fade(Ui.Alpha(back, 70), back), new Rect(0, 0, W, band + 1)); double ls = 92; double bob = w.busy ? Math.Sin(t * 3.2) * 4 : 0; double pulse = w.busy ? 1 + Math.Sin(t * 3.2 + 1.2) * 0.03 : 1; double lw = ls * pulse; double lx = (W - lw) / 2, ly = 70 + bob - (lw - ls) / 2; byte ga = (byte)(w.busy ? 40 + 25 * Math.Sin(t * 3.2) : 30); ctx.DrawEllipse(new SolidColorBrush(Ui.Alpha(Ui.Orange, (byte)ga)), null, new Point(W / 2, ly + lw / 2), lw / 2 + 12, lw / 2 + 12); if (w.logo != null) { using (ctx.PushRenderOptions(new RenderOptions { BitmapInterpolationMode = BitmapInterpolationMode.None })) ctx.DrawImage(w.logo, new Rect(lx, ly, lw, lw)); } double ty = 186; ctx.DrawText(Draw.Text(w.status, 15, new SolidColorBrush(Ui.Bright), true, W - 24, TextAlignment.Center), new Point(12, ty)); double by = 262; if (w.asking && w.detailH > 0) { FormattedText d = Draw.Text(w.detail, 12, new SolidColorBrush(Ui.Soft), false, W - 48, TextAlignment.Left); d.MaxTextHeight = w.detailH; ctx.DrawText(d, new Point(24, ty + 28)); by = ty + 28 + w.detailH + 14; } else { FormattedText d = Draw.Text(w.detail, 12, new SolidColorBrush(Ui.Soft), false, W - 40, TextAlignment.Center); d.MaxTextHeight = 40; ctx.DrawText(d, new Point(20, ty + 28)); } if (w.progress >= 0) { Rect bar = new(40, by + 10, W - 80, 6); ctx.DrawRectangle(new SolidColorBrush(Ui.Line), null, bar, 3, 3); ctx.DrawRectangle(new SolidColorBrush(Ui.Orange), null, new Rect(bar.X, bar.Y, Math.Max(bar.Height, bar.Width * Math.Min(100, w.progress) / 100.0), bar.Height), 3, 3); } else if (w.asking) { double bw = 112, bh = 34, gap = 10, bx = (W - bw * 2 - gap) / 2; w.updRect = new Rect(bx, by, bw, bh); w.laterRect = new Rect(bx + bw + gap, by, bw, bh); ctx.DrawRectangle(new SolidColorBrush(w.hover == 1 ? Ui.AccentHover : Ui.Orange), null, w.updRect, 5, 5); ctx.DrawRectangle(new SolidColorBrush(w.hover == 2 ? Ui.Mix(Ui.Line, Ui.Text, 0.18) : Ui.Line), null, w.laterRect, 5, 5); FormattedText u = Draw.Text("Update", 13, new SolidColorBrush(Ui.OnAccent), true, bw, TextAlignment.Center); ctx.DrawText(u, new Point(w.updRect.X, w.updRect.Y + (bh - u.Height) / 2)); FormattedText l = Draw.Text("Later", 13, new SolidColorBrush(Ui.Text), true, bw, TextAlignment.Center); ctx.DrawText(l, new Point(w.laterRect.X, w.laterRect.Y + (bh - l.Height) / 2)); } else if (w.busy) { double sp = 14, dx = (W - 2 * sp) / 2; for (int i = 0; i < 3; i++) { double ph = Math.Max(0, Math.Sin(t * 6 - i * 0.7)); byte a = (byte)(90 + 165 * ph); ctx.DrawEllipse(new SolidColorBrush(Ui.Alpha(Ui.Orange, (byte)a)), null, new Point(dx + i * sp, by + 12 - ph * 3), 4, 4); } } ctx.DrawText(Draw.Text("v" + Program.Version + " · official copies only on Nexus Mods and GameBanana", 10, new SolidColorBrush(Ui.Dim), false, W, TextAlignment.Center), new Point(0, H - 26)); } } } internal sealed class SplashWindow : Window { private const int FadeIn = 350, Hold = 1700, FadeOut = 350; private readonly Bitmap art = Program.Image("splash.jpg"); private readonly Stopwatch clock = Stopwatch.StartNew(); private readonly DispatcherTimer timer = new() { Interval = TimeSpan.FromMilliseconds(16) }; private bool skipping; private double skipFrom; public SplashWindow() { Title = Program.Name; double w = 760, h = art != null ? w * art.PixelSize.Height / art.PixelSize.Width : 500; Width = w; Height = h; CanResize = false; SystemDecorations = SystemDecorations.None; WindowStartupLocation = WindowStartupLocation.CenterScreen; Background = Brushes.Black; Opacity = 0; Bitmap icon = Program.Image("icon.png"); if (icon != null) Icon = new WindowIcon(icon); Content = new SplashView(art); timer.Tick += (_, _) => Step(); Opened += (_, _) => { clock.Restart(); timer.Start(); }; PointerPressed += (_, _) => Skip(); KeyDown += (_, _) => Skip(); } private void Skip() { if (skipping || clock.ElapsedMilliseconds >= FadeIn + Hold) return; skipFrom = Opacity; skipping = true; clock.Restart(); } private void Step() { long t = clock.ElapsedMilliseconds; if (skipping) { double o = skipFrom * (1.0 - t / (double)FadeOut); if (o <= 0) { timer.Stop(); Close(); return; } Opacity = o; return; } if (t < FadeIn) Opacity = t / (double)FadeIn; else if (t < FadeIn + Hold) Opacity = 1; else if (t < FadeIn + Hold + FadeOut) Opacity = 1 - (t - FadeIn - Hold) / (double)FadeOut; else { timer.Stop(); Close(); } } private sealed class SplashView : Control { private readonly Bitmap art; public SplashView(Bitmap a) { art = a; } public override void Render(DrawingContext ctx) { double W = Bounds.Width, H = Bounds.Height; if (art != null) ctx.DrawImage(art, new Rect(0, 0, W, H)); ctx.FillRectangle(Draw.Fade(Color.FromArgb(0, 10, 10, 11), Color.FromArgb(215, 10, 10, 11)), new Rect(0, H - 76, W, 76)); ctx.DrawText(Draw.Text("The only official trainer app by casualexpie", 13, Brushes.White, true, 0, TextAlignment.Left), new Point(12, H - 42)); ctx.DrawText(Draw.Text("Only download it from Nexus Mods or GameBanana", 11.5, new SolidColorBrush(Ui.Orange), false, 0, TextAlignment.Left), new Point(13, H - 22)); FormattedText v = Draw.Text("CU:Trainer v" + Program.Version + " for " + Program.Platform + " · open source, (c) casualexpie", 11.5, new SolidColorBrush(Color.FromRgb(170, 170, 170)), false, 0, TextAlignment.Left); ctx.DrawText(v, new Point(W - v.Width - 10, H - v.Height - 8)); } } } internal static class Setup { private static string Data { get { string x = Environment.GetEnvironmentVariable("XDG_DATA_HOME"); return string.IsNullOrEmpty(x) ? Path.Combine(Dirs.Home, ".local", "share") : x; } } public static string Dest => Path.Combine(Data, "ultraparadise-cutrainer"); private static string Bin => Path.Combine(Dirs.Home, ".local", "bin"); private static string Apps => Path.Combine(Data, "applications"); private const string Exe = "UltraParadiseCUTrainer"; private const string DesktopName = "ultraparadise-cutrainer.desktop"; private static string DesktopDir { get { try { string f = Path.Combine(Dirs.Home, ".config", "user-dirs.dirs"); if (File.Exists(f)) foreach (string line in File.ReadAllLines(f)) if (line.StartsWith("XDG_DESKTOP_DIR=", StringComparison.Ordinal)) { string d = line[16..].Trim('"').Replace("$HOME", Dirs.Home); if (Directory.Exists(d)) return d; } } catch (Exception) { } string def = Path.Combine(Dirs.Home, "Desktop"); return Directory.Exists(def) ? def : null; } } public static bool Installed => File.Exists(Path.Combine(Dest, Exe)); public static bool RunningInstalled { get { string p = Environment.ProcessPath; return p != null && Path.GetFullPath(p).StartsWith(Path.GetFullPath(Dest) + Path.DirectorySeparatorChar, StringComparison.Ordinal); } } public static bool HasShortcut => DesktopDir != null && File.Exists(Path.Combine(DesktopDir, DesktopName)); public static string Status() { if (OperatingSystem.IsWindows()) return "Installing works on Linux only."; if (Mac.On) return "On a Mac, keep the app in your Applications folder. Uninstall removes the app and, if you choose, UltraPara.dll and your settings."; if (RunningInstalled) return "Installed in your home folder, with an app menu entry" + (HasShortcut ? " and a desktop shortcut" : "") + "."; if (Installed) return "Another copy is installed in your home folder. You're running this one from " + Path.GetDirectoryName(Environment.ProcessPath) + "."; return "Not installed. You're running it from " + Path.GetDirectoryName(Environment.ProcessPath) + "."; } private static string Entry() => "[Desktop Entry]\nType=Application\nName=" + Program.Name + "\nComment=Trainer for Casualties: Unknown, by casualexpie\nExec=\"" + Path.Combine(Dest, Exe) + "\"\nIcon=" + Path.Combine(Dest, "icon.png") + "\nTerminal=false\nCategories=Game;Utility;\nStartupWMClass=UltraParadiseCUTrainer\n"; public static string Install(bool shortcut) { if (OperatingSystem.IsWindows()) return "installing works on Linux only"; if (Mac.On) return "on a Mac, drag the app into your Applications folder instead"; try { string cur = Environment.ProcessPath; string exe = Path.Combine(Dest, Exe); Directory.CreateDirectory(Dest); if (!RunningInstalled) { string tmp = exe + ".new"; File.Copy(cur, tmp, true); File.Move(tmp, exe, true); } File.SetUnixFileMode(exe, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute | UnixFileMode.GroupRead | UnixFileMode.GroupExecute | UnixFileMode.OtherRead | UnixFileMode.OtherExecute); using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("icon.png")) using (FileStream fs = File.Create(Path.Combine(Dest, "icon.png"))) s?.CopyTo(fs); Directory.CreateDirectory(Bin); string link = Path.Combine(Bin, "ultraparadise"); if (File.Exists(link) || new FileInfo(link).LinkTarget != null) File.Delete(link); File.CreateSymbolicLink(link, exe); Directory.CreateDirectory(Apps); File.WriteAllText(Path.Combine(Apps, DesktopName), Entry()); if (shortcut) AddShortcut(); Quiet("update-desktop-database", Apps); return null; } catch (Exception e) { return e.Message; } } public static string AddShortcut() { string d = DesktopDir; if (d == null) return "couldn't find your desktop folder"; try { string f = Path.Combine(d, DesktopName); File.WriteAllText(f, Entry()); File.SetUnixFileMode(f, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute | UnixFileMode.GroupRead | UnixFileMode.OtherRead); Quiet("gio", "set", f, "metadata::trusted", "true"); return null; } catch (Exception e) { return e.Message; } } public static void OpenInstalled() { try { Process.Start(new ProcessStartInfo(Path.Combine(Dest, Exe), "--installed") { UseShellExecute = false }); } catch (Exception) { } } public static string Uninstall(string game, bool plugin, bool settings) { if (plugin && game != null && Game.IsGameDir(game)) { if (Game.GameRunning()) return "close the game first, so UltraPara.dll can be removed"; string e = Game.RemovePlugin(game); if (e != null) return "couldn't remove UltraPara.dll: " + e; } if (Mac.On) { try { if (settings) { if (Directory.Exists(Dirs.Config)) Directory.Delete(Dirs.Config, true); if (Directory.Exists(Dirs.Cache)) Directory.Delete(Dirs.Cache, true); } string bundle = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Environment.ProcessPath), "..", "..")); if (bundle.EndsWith(".app", StringComparison.OrdinalIgnoreCase) && Directory.Exists(bundle)) Directory.Delete(bundle, true); return null; } catch (Exception e) { return e.Message; } } try { foreach (string f in new[] { Path.Combine(Bin, "ultraparadise"), Path.Combine(Apps, DesktopName), DesktopDir != null ? Path.Combine(DesktopDir, DesktopName) : null }) if (f != null && (File.Exists(f) || new FileInfo(f).LinkTarget != null)) File.Delete(f); if (Directory.Exists(Dest)) Directory.Delete(Dest, true); if (settings) { if (Directory.Exists(Dirs.Config)) Directory.Delete(Dirs.Config, true); if (Directory.Exists(Dirs.Cache)) Directory.Delete(Dirs.Cache, true); } Quiet("update-desktop-database", Apps); return null; } catch (Exception e) { return e.Message; } } private static void Quiet(string exe, params string[] args) { string p = Game.Which(exe); if (p == null) return; try { ProcessStartInfo si = new(p) { UseShellExecute = false, RedirectStandardError = true, RedirectStandardOutput = true }; foreach (string a in args) si.ArgumentList.Add(a); using Process pr = Process.Start(si); pr?.WaitForExit(4000); } catch (Exception) { } } } internal static class Piracy { public const string SteamPage = "https://store.steampowered.com/app/4576490/"; private static readonly string[] Files = { "steam_emu.ini", "smartsteamemu.ini", "cream_api.ini", "codex.ini", "steam_api64.cdx", "onlinefix.ini", "onlinefix64.dll", "ali213.ini", "3dmgame.ini", "tenoke.ini", "unsteam.ini", "steam_interfaces.txt", "local_save.txt", "account_name.txt", "user_steam_id.txt", "coldclientloader.ini", "steamclient_loader_x64.exe", "empress.ini", "rune.ini", "skidrow.ini" }; private static readonly string[] Dirs = { "steam_settings", "smartsteamemu", "goldberg steamemu saves", "onlinefix" }; public static bool Flagged(string game) { if (string.IsNullOrEmpty(game)) return false; try { foreach (string w in new[] { game, Path.Combine(game, "CasualtiesUnknown_Data", "Plugins", "x86_64"), Path.Combine(game, "CasualtiesUnknown_Data", "Plugins") }) { if (!Directory.Exists(w)) continue; foreach (string e in Directory.EnumerateFileSystemEntries(w)) { string n = Path.GetFileName(e).ToLowerInvariant(); if (Directory.Exists(e) ? Dirs.Contains(n) : Files.Contains(n)) return true; } } } catch (Exception) { } return false; } public static bool Ok(string game) => !Flagged(game) || Settings.Get("piracy.ok", "") == game; } internal sealed class PiracyDialog : Window { public bool Proceed; public PiracyDialog() { Title = Program.Name; Width = 460; SizeToContent = SizeToContent.Height; CanResize = false; WindowStartupLocation = WindowStartupLocation.CenterOwner; Background = Ui.B(Ui.Back); StackPanel sp = new() { Margin = new Thickness(20), Spacing = 12 }; sp.Children.Add(new TextBlock { Text = "This doesn't look like an official copy", FontSize = 18, FontWeight = FontWeight.Bold, Foreground = Ui.B(Ui.Orange) }); sp.Children.Add(new TextBlock { Text = "The trainer found files in your game folder that come from cracked copies of the game.", TextWrapping = TextWrapping.Wrap, Foreground = Ui.B(Ui.Text) }); sp.Children.Add(new TextBlock { Text = "Ultra Paradise doesn't condone piracy. Casualties: Unknown is made by a small team, so please support Orsoniks and Oro Interactive by buying it on Steam.", TextWrapping = TextWrapping.Wrap, Foreground = Ui.B(Ui.Text) }); sp.Children.Add(new TextBlock { Text = "If you think this is a mistake, you can pick the game's .exe yourself.", TextWrapping = TextWrapping.Wrap, Foreground = Ui.B(Ui.Dim) }); StackPanel btns = new() { Orientation = Orientation.Horizontal, Spacing = 8, HorizontalAlignment = HorizontalAlignment.Right }; Button steam = new() { Content = "Open the Steam page", Padding = new Thickness(16, 6), Background = Ui.B(Ui.Orange), Foreground = Ui.B(Ui.OnAccent) }; steam.Click += (_, _) => { Game.Open(Piracy.SteamPage); Close(); }; Button go = new() { Content = "Proceed and pick the .exe", Padding = new Thickness(16, 6) }; go.Click += (_, _) => { Proceed = true; Close(); }; btns.Children.Add(go); btns.Children.Add(steam); sp.Children.Add(btns); Content = sp; } } internal sealed class UninstallDialog : Window { public bool Confirmed, Plugin = true, Settings_; public UninstallDialog() { Title = "Uninstall " + Program.Name; Width = 440; SizeToContent = SizeToContent.Height; CanResize = false; WindowStartupLocation = WindowStartupLocation.CenterOwner; Background = Ui.B(Ui.Back); StackPanel sp = new() { Margin = new Thickness(20), Spacing = 12 }; sp.Children.Add(new TextBlock { Text = "Uninstall the trainer?", FontSize = 18, FontWeight = FontWeight.Bold, Foreground = Ui.B(Ui.Text) }); sp.Children.Add(new TextBlock { Text = Mac.On ? "This removes the app from your Mac." : "This removes the app, its app menu entry, desktop shortcut and the 'ultraparadise' command.", TextWrapping = TextWrapping.Wrap, Foreground = Ui.B(Ui.Dim) }); CheckBox pl = new() { Content = "Also remove UltraPara.dll from the game folder (the cheats inside the game)", IsChecked = true }; CheckBox st = new() { Content = "Also remove my settings and cached sounds", IsChecked = false }; sp.Children.Add(pl); sp.Children.Add(st); StackPanel btns = new() { Orientation = Orientation.Horizontal, Spacing = 8, HorizontalAlignment = HorizontalAlignment.Right }; Button cancel = new() { Content = "Cancel", Padding = new Thickness(16, 6) }; cancel.Click += (_, _) => Close(); Button ok = new() { Content = "Uninstall", Padding = new Thickness(16, 6), Background = Ui.B(Ui.Bad), Foreground = Brushes.White }; ok.Click += (_, _) => { Confirmed = true; Plugin = pl.IsChecked == true; Settings_ = st.IsChecked == true; Close(); }; btns.Children.Add(cancel); btns.Children.Add(ok); sp.Children.Add(btns); Content = sp; } } }