From e8d6b4f247b8f72f5acaa931eca1abe8bec0bec4 Mon Sep 17 00:00:00 2001 From: Zack Rauen Date: Fri, 24 May 2019 23:46:28 -0400 Subject: [PATCH] various fixes --- BandagedBD/BandagedBD.csproj | 4 ---- BandagedBD/Controls/FlatCheckBox.cs | 14 +++++++++++--- BandagedBD/Panels/InstallConfigPanel.cs | 1 + BandagedBD/Panels/InstallPanel.cs | 13 +++++++++++++ BandagedBD/Utilities.cs | 1 + 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/BandagedBD/BandagedBD.csproj b/BandagedBD/BandagedBD.csproj index 349e9be..520b4cf 100644 --- a/BandagedBD/BandagedBD.csproj +++ b/BandagedBD/BandagedBD.csproj @@ -81,9 +81,6 @@ Component - - Button.cs - Component @@ -214,7 +211,6 @@ - diff --git a/BandagedBD/Controls/FlatCheckBox.cs b/BandagedBD/Controls/FlatCheckBox.cs index 4fa0398..88c705f 100644 --- a/BandagedBD/Controls/FlatCheckBox.cs +++ b/BandagedBD/Controls/FlatCheckBox.cs @@ -1,9 +1,17 @@ -using System.Drawing; +using System.ComponentModel; +using System.Drawing; using System.Drawing.Text; using System.Windows.Forms; namespace BandagedBD.Controls { class FlatCheckBox : CheckBox { + + [Description("Background color for the CheckBox"), Category("Flatpak")] + public Color BoxBackColor { get; set; } = Color.FromArgb(60, 60, 60); + + [Description("Foreground color for the CheckBox"), Category("Flatpak")] + public Color BoxForeColor { get; set; } = Properties.Settings.Default.Accent; + public FlatCheckBox() { SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); @@ -11,10 +19,10 @@ namespace BandagedBD.Controls { protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); - e.Graphics.FillRectangle(new SolidBrush(Properties.Settings.Default.SecondaryBackground), new Rectangle(0, 0, 13, 14)); + e.Graphics.FillRectangle(new SolidBrush(BoxBackColor), new Rectangle(0, 0, 13, 14)); if (Checked) { e.Graphics.TextRenderingHint = TextRenderingHint.AntiAlias; - e.Graphics.DrawString("\u2714", this.Font, new SolidBrush(Properties.Settings.Default.Accent), -1, 1); + e.Graphics.DrawString("\u2714", this.Font, new SolidBrush(BoxForeColor), -1, 1); } } } diff --git a/BandagedBD/Panels/InstallConfigPanel.cs b/BandagedBD/Panels/InstallConfigPanel.cs index 1f4e482..9c4b591 100644 --- a/BandagedBD/Panels/InstallConfigPanel.cs +++ b/BandagedBD/Panels/InstallConfigPanel.cs @@ -16,6 +16,7 @@ namespace BandagedBD.Panels { public bool shouldRestart => cbShouldRestart.Checked; public string[] paths => Utilities.GetLocalPaths(discordLocator.stable, discordLocator.canary, discordLocator.ptb); public string[] executables => Utilities.GetExecutables(discordLocator.stable, discordLocator.canary, discordLocator.ptb); + public string[] roamings => Utilities.GetRoamingPaths(discordLocator.stable, discordLocator.canary, discordLocator.ptb); public InstallConfigPanel() { InitializeComponent(); diff --git a/BandagedBD/Panels/InstallPanel.cs b/BandagedBD/Panels/InstallPanel.cs index 7adb182..bb0fd44 100644 --- a/BandagedBD/Panels/InstallPanel.cs +++ b/BandagedBD/Panels/InstallPanel.cs @@ -138,6 +138,19 @@ namespace BandagedBD.Panels { private int Verify(string installationPath) { Append("Verifying installation"); + Append("Checking for old style injection"); + foreach (var roaming in config.roamings) { + var core = $"{roaming}\\modules\\discord_desktop_core\\core"; + Append($"Checking for old injection {roaming}", true); + if (!Directory.Exists(core)) continue; + Append($"Deleting old injection {roaming}", true); + try { + Directory.Delete(roaming, true); + } + catch { + Append($"Please delete this folder: {roaming}"); + } + } var appFolder = $"{installationPath}\\resources\\app"; if (!Directory.Exists(appFolder)) { diff --git a/BandagedBD/Utilities.cs b/BandagedBD/Utilities.cs index 989afdd..c19bbb5 100644 --- a/BandagedBD/Utilities.cs +++ b/BandagedBD/Utilities.cs @@ -133,6 +133,7 @@ namespace BandagedBD { public static string GetLatestVersion(string path) { if (path == string.Empty) return path; + if (!Directory.Exists(path)) return string.Empty; var dirs = Directory.GetDirectories(path); if (dirs.Length <= 0) return string.Empty; var latest = Path.GetFileName(dirs[0]);