diff --git a/DiscordBotGUI/Settings/Commands.axaml.cs b/DiscordBotGUI/Settings/Commands.axaml.cs index 3ee1073..24bec8c 100644 --- a/DiscordBotGUI/Settings/Commands.axaml.cs +++ b/DiscordBotGUI/Settings/Commands.axaml.cs @@ -31,16 +31,18 @@ namespace DiscordBotGUI.Settings { try { + textbox1.Text = ""; var files = System.IO.Directory.EnumerateFiles("./Data/Plugins/Commands/"); if (files == null || files.Count() < 1) return; foreach (var file in files) - textbox1.Text += file + "\n"; + textbox1.Text += file.Split('/')[file.Split('/').Length - 1] + "\n"; } catch { } } private async void LoadComboBox() { + comboBox1.Items = null; commands = await PluginManager.Online.ServerCom.ReadTextFromFile("https://sethdiscordbot.000webhostapp.com/Storage/Discord%20Bot/Plugins"); if (commands == null) return; string[] plugins = commands.ToArray(); @@ -55,7 +57,11 @@ namespace DiscordBotGUI.Settings if (!plugins[i].Contains(OS) || !plugins[i].Contains("Commands")) continue; + + string[] info = plugins[i].Split(','); + if (System.IO.Directory.EnumerateFiles("./Data/Plugins/Commands/").Any(x => x.EndsWith(info[0] + ".dll"))) + continue; data.Add($"{info[0]} - {info[1]} - {info[2]}"); } @@ -77,11 +83,18 @@ namespace DiscordBotGUI.Settings if (URL == null) return; - IProgress progress = new Progress(value => + IProgress progress = new Progress(async value => { label1.Content = $"Downloading {pluginName} {MathF.Round(value, 2)}%"; if (value == 1f) + { label1.Content = "Successfully Downloaded " + pluginName; + LoadData(); + LoadComboBox(); + + await Task.Delay(5000); + label1.Content = ""; + } progressBar1.Value = value; }); diff --git a/DiscordBotGUI/Settings/Events.axaml.cs b/DiscordBotGUI/Settings/Events.axaml.cs index 599c1eb..28aabc8 100644 --- a/DiscordBotGUI/Settings/Events.axaml.cs +++ b/DiscordBotGUI/Settings/Events.axaml.cs @@ -25,6 +25,7 @@ namespace DiscordBotGUI.Settings button1.Click += async (sender, e) => { await Download(); + }; } @@ -35,15 +36,17 @@ namespace DiscordBotGUI.Settings try { textbox1.IsReadOnly = false; + textbox1.Text = ""; var files = System.IO.Directory.EnumerateFiles("./Data/Plugins/Events/"); if (files == null || files.Count() < 1) return; foreach (var file in files) - textbox1.Text += file + "\n"; + textbox1.Text += file.Split('/')[file.Split('/').Length - 1] + "\n"; } catch { } } private async void LoadComboBox() { + comboBox1.Items = null; events = await PluginManager.Online.ServerCom.ReadTextFromFile("https://sethdiscordbot.000webhostapp.com/Storage/Discord%20Bot/Plugins"); if (events == null) return; string[] plugins = events.ToArray(); @@ -59,6 +62,9 @@ namespace DiscordBotGUI.Settings continue; string[] info = plugins[i].Split(','); + if (System.IO.Directory.EnumerateFiles("./Data/Plugins/Events/").Any(x => x.EndsWith(info[0] + ".dll"))) + continue; + data.Add($"{info[0]} - {info[1]} - {info[2]}"); } @@ -78,11 +84,18 @@ namespace DiscordBotGUI.Settings if (URL == null) return; - IProgress progress = new Progress(value => + IProgress progress = new Progress(async value => { label1.Content = $"Downloading {pluginName} {MathF.Round(value, 2)}%"; if (value == 1f) + { label1.Content = "Successfully Downloaded " + pluginName; + LoadData(); + LoadComboBox(); + + await Task.Delay(5000); + label1.Content = ""; + } progressBar1.Value = value; });