This commit is contained in:
@@ -27,6 +27,7 @@ namespace DiscordBot
|
|||||||
private static bool listLanguagAtStartup = false;
|
private static bool listLanguagAtStartup = false;
|
||||||
|
|
||||||
private static bool PluginsLoaded = false;
|
private static bool PluginsLoaded = false;
|
||||||
|
private static bool ShowStartupMessage = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
@@ -411,10 +412,15 @@ namespace DiscordBot
|
|||||||
Console.ForegroundColor = ConsoleColor.DarkYellow;
|
Console.ForegroundColor = ConsoleColor.DarkYellow;
|
||||||
Console.WriteLine("Discord BOT for Cross Platform");
|
Console.WriteLine("Discord BOT for Cross Platform");
|
||||||
Console.WriteLine("Created by: Wizzy\nDiscord: Wizzy#9181");
|
Console.WriteLine("Created by: Wizzy\nDiscord: Wizzy#9181");
|
||||||
|
if (ShowStartupMessage)
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Console.WriteLine("Connecting to server ...");
|
||||||
|
List<string> text = await ServerCom.ReadTextFromFile("https://sethdiscordbot.000webhostapp.com/Storage/Discord%20Bot/StartupMessage");
|
||||||
|
foreach (var t in text) Console_Utilities.WriteColorText(t);
|
||||||
|
|
||||||
List<string> text = await ServerCom.ReadTextFromFile("https://sethdiscordbot.000webhostapp.com/Storage/Discord%20Bot/StartupMessage");
|
}
|
||||||
foreach (var t in text) Console_Utilities.WriteColorText(t);
|
catch { Console.WriteLine("Failed to connect to server."); }
|
||||||
|
|
||||||
Console.ForegroundColor = ConsoleColor.White;
|
Console.ForegroundColor = ConsoleColor.White;
|
||||||
Console.WriteLine("============================ Discord BOT - Cross Platform ============================");
|
Console.WriteLine("============================ Discord BOT - Cross Platform ============================");
|
||||||
string token = Functions.readCodeFromFile(Functions.dataFolder + "DiscordBotCore.data", "BOT_TOKEN", '=');
|
string token = Functions.readCodeFromFile(Functions.dataFolder + "DiscordBotCore.data", "BOT_TOKEN", '=');
|
||||||
@@ -449,23 +455,22 @@ namespace DiscordBot
|
|||||||
private static async Task HandleInput(string[] args)
|
private static async Task HandleInput(string[] args)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (args.Length > 0)
|
/* if (args.Length > 0)
|
||||||
if (args[0] == "progress")
|
if (args[0] == "progress")
|
||||||
{
|
{
|
||||||
Console_Utilities.ProgressBar bar = new Console_Utilities.ProgressBar(100, "Download");
|
Console_Utilities.ProgressBar bar = new Console_Utilities.ProgressBar(100, "Download");
|
||||||
for (int i = 0; i <= 100; i++)
|
for (int i = 0; i <= 100; i++)
|
||||||
{
|
{
|
||||||
bar.Update(i);
|
bar.Update(i);
|
||||||
await Task.Delay(10);
|
await Task.Delay(10);
|
||||||
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (args[0] == "test")
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (args[0] == "test")
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}*/
|
||||||
|
|
||||||
if (args.Length == 0)
|
if (args.Length == 0)
|
||||||
{
|
{
|
||||||
@@ -498,7 +503,7 @@ namespace DiscordBot
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len > 0 && (args.Contains("--cmd") || args.Contains("--args")))
|
if (len > 0 && (args.Contains("--cmd") || args.Contains("--args") || args.Contains("--nomessage")))
|
||||||
{
|
{
|
||||||
if (args.Contains("lp") || args.Contains("loadplugins"))
|
if (args.Contains("lp") || args.Contains("loadplugins"))
|
||||||
loadPluginsOnStartup = true;
|
loadPluginsOnStartup = true;
|
||||||
@@ -506,12 +511,14 @@ namespace DiscordBot
|
|||||||
listPluginsAtStartup = true;
|
listPluginsAtStartup = true;
|
||||||
if (args.Contains("listlang"))
|
if (args.Contains("listlang"))
|
||||||
listLanguagAtStartup = true;
|
listLanguagAtStartup = true;
|
||||||
|
if (args.Contains("--nomessage"))
|
||||||
|
ShowStartupMessage = false;
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (len == 0 || args[0] != "--exec" && args[0] != "--execute")
|
if (len == 0 || args[0] != "--exec" && args[0] != "--execute")
|
||||||
{
|
{
|
||||||
Boot b = await StartNoGUI();
|
Boot b = await StartNoGUI();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace DiscordBotGUI
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
desktop.MainWindow = new AppUpdater() { Width = 250, Height = 50 };
|
desktop.MainWindow = new AppUpdater() { Width = 300, Height = 50, WindowStartupLocation = Avalonia.Controls.WindowStartupLocation.CenterScreen };
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,13 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d" d:DesignWidth="250" d:DesignHeight="50"
|
mc:Ignorable="d" d:DesignWidth="250" d:DesignHeight="50"
|
||||||
x:Class="DiscordBotGUI.AppUpdater"
|
x:Class="DiscordBotGUI.AppUpdater"
|
||||||
Title="AppUpdater">
|
Title="AppUpdater"
|
||||||
|
Background="Transparent"
|
||||||
|
TransparencyLevelHint="AcrylicBlur"
|
||||||
|
HasSystemDecorations="False">
|
||||||
|
|
||||||
<StackPanel Margin="10">
|
<StackPanel Margin="10">
|
||||||
<TextBlock x:Class="DiscordBotGUI.AppUpdater" x:Name="textBox1" Text="Checking for updates..." />
|
<TextBlock x:Class="DiscordBotGUI.AppUpdater" x:Name="textBox1" Text="Checking for updates..." />
|
||||||
<ProgressBar IsIndeterminate="True" x:Class="DiscordBotGUI.AppUpdater" x:Name="progressBar1" Foreground="Purple" />
|
<ProgressBar IsIndeterminate="True" x:Class="DiscordBotGUI.AppUpdater" x:Name="progressBar1" Foreground="Yellow" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -7,11 +7,15 @@ using PluginManager.Others;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Drawing;
|
||||||
|
using Avalonia.Media;
|
||||||
|
|
||||||
namespace DiscordBotGUI
|
namespace DiscordBotGUI
|
||||||
{
|
{
|
||||||
public partial class AppUpdater : Window
|
public partial class AppUpdater : Window
|
||||||
{
|
{
|
||||||
|
private string _version;
|
||||||
public AppUpdater()
|
public AppUpdater()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -19,38 +23,51 @@ namespace DiscordBotGUI
|
|||||||
{
|
{
|
||||||
textBox1.Text = "Checking ...";
|
textBox1.Text = "Checking ...";
|
||||||
File.WriteAllText("./Version.txt", "DiscordBotVersion=0");
|
File.WriteAllText("./Version.txt", "DiscordBotVersion=0");
|
||||||
DownloadDiscordBotClientNoGUIAsDLL();
|
//DownloadDiscordBotClientNoGUIAsDLL();
|
||||||
}
|
}
|
||||||
|
|
||||||
Updates();
|
Updates();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void DownloadDiscordBotClientNoGUIAsDLL()
|
/* private async void DownloadDiscordBotClientNoGUIAsDLL()
|
||||||
{
|
{
|
||||||
|
|
||||||
//await Task.Delay(5000);
|
//await Task.Delay(5000);
|
||||||
string url_bot_dll = "https://sethdiscordbot.000webhostapp.com/Storage/Discord%20Bot/Updates/DiscordBot.dll";
|
string url_bot_dll = "https://sethdiscordbot.000webhostapp.com/Storage/Discord%20Bot/Updates/DiscordBot.dll";
|
||||||
IProgress<float> progress = new Progress<float>((percent) =>
|
IProgress<float> progress = new Progress<float>((percent) =>
|
||||||
{
|
{
|
||||||
textBox1.Text = "Downloading DiscordBot.dll ... " + percent.ToString() + "%";
|
textBox1.Text = "Downloading DiscordBot.dll ... " + (percent * 100).ToString() + "%";
|
||||||
this.progressBar1.Value = percent * 100;
|
this.progressBar1.Value = percent * 100;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.progressBar1.IsIndeterminate = false;
|
this.progressBar1.IsIndeterminate = false;
|
||||||
await ServerCom.DownloadFileAsync(url_bot_dll, "./DiscordBot.dll", progress);
|
try
|
||||||
new MainWindow().Show();
|
{
|
||||||
Close();
|
await ServerCom.DownloadFileAsync(url_bot_dll, "./DiscordBot.dll", progress);
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
textBox1.Text = "Error downloading DiscordBot.dll. Server is not responding.";
|
||||||
|
|
||||||
|
await Task.Delay(1000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//new MainWindow() { Height = 425, Width = 500 }.Show();
|
||||||
|
//Close();
|
||||||
|
}*/
|
||||||
|
|
||||||
private async void Updates()
|
private async void Updates()
|
||||||
{
|
{
|
||||||
|
this.progressBar1.IsIndeterminate = true;
|
||||||
|
await Task.Delay(1000);
|
||||||
if (!await CheckForUpdates())
|
if (!await CheckForUpdates())
|
||||||
{
|
{
|
||||||
await Task.Delay(5000);
|
//await Task.Delay(5000);
|
||||||
textBox1.Text = "There is no update found !";
|
textBox1.Text = $"You are running on the latest version ({_version}) !";
|
||||||
await Task.Delay(2000);
|
await Task.Delay(2000);
|
||||||
new MainWindow().Show();
|
new MainWindow() { Height = 425, Width = 650 }.Show();
|
||||||
this.Close();
|
this.Close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -59,8 +76,8 @@ namespace DiscordBotGUI
|
|||||||
if (file == null)
|
if (file == null)
|
||||||
{
|
{
|
||||||
textBox1.Text = "There was an error while downloading the update !";
|
textBox1.Text = "There was an error while downloading the update !";
|
||||||
await Task.Delay(5000);
|
await Task.Delay(2000);
|
||||||
new MainWindow().Show();
|
new MainWindow() { Height = 425, Width = 650 }.Show();
|
||||||
this.Close();
|
this.Close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -69,12 +86,15 @@ namespace DiscordBotGUI
|
|||||||
{
|
{
|
||||||
this.progressBar1.Value = percent;
|
this.progressBar1.Value = percent;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
textBox1.Text = "Extracting update files ...";
|
||||||
await Functions.ExtractArchive(file, "./", progress);
|
await Functions.ExtractArchive(file, "./", progress);
|
||||||
|
progressBar1.IsIndeterminate = true;
|
||||||
|
textBox1.Text = "Setting up the new version ...";
|
||||||
textBox1.Text = "Update downloaded successfully !";
|
File.Delete(file);
|
||||||
await Task.Delay(2000);
|
File.WriteAllText("./Version.txt", "DiscordBotVersion=" + _version);
|
||||||
new MainWindow().Show();
|
await Task.Delay(5000);
|
||||||
|
new MainWindow() { Height = 425, Width = 650 }.Show();
|
||||||
this.Close();
|
this.Close();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -82,16 +102,47 @@ namespace DiscordBotGUI
|
|||||||
private async Task<string> DownloadNewUpdate()
|
private async Task<string> DownloadNewUpdate()
|
||||||
{
|
{
|
||||||
string urlNewUpdateZip = (await ServerCom.ReadTextFromFile("https://sethdiscordbot.000webhostapp.com/Storage/Discord%20Bot/Updates/Version"))[1];
|
string urlNewUpdateZip = (await ServerCom.ReadTextFromFile("https://sethdiscordbot.000webhostapp.com/Storage/Discord%20Bot/Updates/Version"))[1];
|
||||||
|
int secondsPast = 0;
|
||||||
|
|
||||||
|
bool isDownloading = true;
|
||||||
|
this.progressBar1.IsIndeterminate = true;
|
||||||
|
textBox1.Text = "Downloading update ...";
|
||||||
|
|
||||||
|
|
||||||
|
IProgress<long> downloaded = new Progress<long>((bytes) =>
|
||||||
|
{
|
||||||
|
(double, string) download = Functions.ConvertBytes(bytes);
|
||||||
|
textBox1.Text = $"Downloading update ... {Math.Round(download.Item1 / secondsPast, 2)} {download.Item2}/s";
|
||||||
|
});
|
||||||
IProgress<float> progress = new Progress<float>((percent) =>
|
IProgress<float> progress = new Progress<float>((percent) =>
|
||||||
{
|
{
|
||||||
|
progressBar1.IsIndeterminate = false;
|
||||||
this.progressBar1.Value = percent;
|
this.progressBar1.Value = percent;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.progressBar1.IsIndeterminate = false;
|
|
||||||
string FileName = $"{urlNewUpdateZip.Split('/')[urlNewUpdateZip.Split('/').Length - 1]}.zip";
|
|
||||||
await ServerCom.DownloadFileAsync(urlNewUpdateZip, FileName, progress);
|
|
||||||
|
|
||||||
|
string FileName = $"{urlNewUpdateZip.Split('/')[urlNewUpdateZip.Split('/').Length - 1]}";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
new Thread(new Task(() =>
|
||||||
|
{
|
||||||
|
while (isDownloading)
|
||||||
|
{
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
secondsPast++;
|
||||||
|
}
|
||||||
|
}).Start).Start();
|
||||||
|
await ServerCom.DownloadFileAsync(urlNewUpdateZip, FileName, progress, downloaded);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
textBox1.Text = "Error downloading the update. Server is not responding.";
|
||||||
|
isDownloading = false;
|
||||||
|
await Task.Delay(1000);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
isDownloading = false;
|
||||||
return FileName;
|
return FileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +153,7 @@ namespace DiscordBotGUI
|
|||||||
|
|
||||||
string current_version = Functions.readCodeFromFile("Version.txt", "DiscordBotVersion", '=') ?? "0";
|
string current_version = Functions.readCodeFromFile("Version.txt", "DiscordBotVersion", '=') ?? "0";
|
||||||
string latest_version = (await ServerCom.ReadTextFromFile("https://sethdiscordbot.000webhostapp.com/Storage/Discord%20Bot/Updates/Version"))[0];
|
string latest_version = (await ServerCom.ReadTextFromFile("https://sethdiscordbot.000webhostapp.com/Storage/Discord%20Bot/Updates/Version"))[0];
|
||||||
|
_version = latest_version;
|
||||||
if (current_version != latest_version)
|
if (current_version != latest_version)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@@ -111,7 +163,7 @@ namespace DiscordBotGUI
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
//File.WriteAllText("./Debug.txt", "Error while checking for updates !\n" + ex.ToString());
|
textBox1.Text = "Error while checking for updates. Server is not responding.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,15 +2,15 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="500"
|
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="425"
|
||||||
x:Class="DiscordBotGUI.MainWindow"
|
x:Class="DiscordBotGUI.MainWindow"
|
||||||
Title="DiscordBotGUI">
|
Title="DiscordBotGUI"
|
||||||
|
Background="Transparent"
|
||||||
|
TransparencyLevelHint="AcrylicBlur"
|
||||||
|
ExtendClientAreaToDecorationsHint="True" >
|
||||||
|
|
||||||
<StackPanel Margin="10">
|
<StackPanel Margin="20">
|
||||||
<Menu>
|
<Menu>
|
||||||
<!--
|
|
||||||
<MenuItem Header="Settings" x:Name="settings"/>
|
|
||||||
-->
|
|
||||||
<MenuItem Header="Plugins">
|
<MenuItem Header="Plugins">
|
||||||
<MenuItem Header="Commands" x:Class="DiscordBotGUI.MainWindow" x:Name="commandsSettingMenuItem" />
|
<MenuItem Header="Commands" x:Class="DiscordBotGUI.MainWindow" x:Name="commandsSettingMenuItem" />
|
||||||
<MenuItem Header="Events" x:Class="DiscordBotGUI.MainWindow" x:Name="eventsSettingMenuItem" />
|
<MenuItem Header="Events" x:Class="DiscordBotGUI.MainWindow" x:Name="eventsSettingMenuItem" />
|
||||||
@@ -24,8 +24,8 @@
|
|||||||
<Label x:Class="DiscordBotGUI.MainWindow" x:Name="label3" Content="Start Arguments: " />
|
<Label x:Class="DiscordBotGUI.MainWindow" x:Name="label3" Content="Start Arguments: " />
|
||||||
<TextBox x:Class="DiscordBotGUI.MainWindow" x:Name="textBox3" Width="250" TextAlignment="Center" HorizontalAlignment="Left" IsReadOnly="False" Text=""/>
|
<TextBox x:Class="DiscordBotGUI.MainWindow" x:Name="textBox3" Width="250" TextAlignment="Center" HorizontalAlignment="Left" IsReadOnly="False" Text=""/>
|
||||||
<Label x:Class="DiscordBotGUI.MainWindow" x:Name="label4" Content="" Foreground="Red" Margin="10"/>
|
<Label x:Class="DiscordBotGUI.MainWindow" x:Name="label4" Content="" Foreground="Red" Margin="10"/>
|
||||||
<Button x:Class="DiscordBotGUI.MainWindow" x:Name="button1" HorizontalAlignment="Center" VerticalAlignment="Bottom" Padding="10" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Width="200" Content="Start Bot" Margin="0,75,0,0" />
|
<Button x:Class="DiscordBotGUI.MainWindow" x:Name="button1" HorizontalAlignment="Center" VerticalAlignment="Bottom" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Width="200" Content="Start Bot" Margin="0,75,0,0" />
|
||||||
|
<Label x:Class="DiscordBotGUI.MainWindow" x:Name="label5" Content="" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,0,0,0"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using System.IO;
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using DiscordBotGUI.Settings;
|
using DiscordBotGUI.Settings;
|
||||||
|
using Avalonia.Themes.Fluent;
|
||||||
|
|
||||||
namespace DiscordBotGUI
|
namespace DiscordBotGUI
|
||||||
{
|
{
|
||||||
@@ -26,12 +27,14 @@ namespace DiscordBotGUI
|
|||||||
|
|
||||||
|
|
||||||
textBox3.Watermark = "Insert start arguments";
|
textBox3.Watermark = "Insert start arguments";
|
||||||
|
if (File.Exists("./Version.txt"))
|
||||||
|
label5.Content = Functions.readCodeFromFile("./Version.txt", "DiscordBotVersion", '=');
|
||||||
button1.Click += async (sender, e) =>
|
button1.Click += async (sender, e) =>
|
||||||
{
|
{
|
||||||
|
|
||||||
string token = textBox1.Text;
|
string token = textBox1.Text;
|
||||||
string prefix = textBox2.Text;
|
string prefix = textBox2.Text;
|
||||||
string args = textBox3.Text;
|
string args = "--nomessage " + textBox3.Text;
|
||||||
|
|
||||||
if (!((token.Length == 70 || token.Length == 59) && prefix.Length == 1))
|
if (!((token.Length == 70 || token.Length == 59) && prefix.Length == 1))
|
||||||
{
|
{
|
||||||
@@ -47,8 +50,9 @@ namespace DiscordBotGUI
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
commandsSettingMenuItem.Click += (sender, e) => new Commands().ShowDialog(this);
|
commandsSettingMenuItem.Click += (sender, e) => new Commands() /*{ Height = 200, Width = 550 }*/.ShowDialog(this);
|
||||||
eventsSettingMenuItem.Click += (sender, e) => new Events().ShowDialog(this);
|
eventsSettingMenuItem.Click += (sender, e) => new Events() /*{ Height = 200, Width = 550 }*/.ShowDialog(this);
|
||||||
|
|
||||||
|
|
||||||
string folder = $"{Functions.dataFolder}DiscordBotCore.data";
|
string folder = $"{Functions.dataFolder}DiscordBotCore.data";
|
||||||
Directory.CreateDirectory(Functions.dataFolder);
|
Directory.CreateDirectory(Functions.dataFolder);
|
||||||
|
|||||||
@@ -2,16 +2,19 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="550" d:DesignHeight="200"
|
||||||
x:Class="DiscordBotGUI.Settings.Commands"
|
x:Class="DiscordBotGUI.Settings.Commands"
|
||||||
Title="Commands">
|
Title="Commands"
|
||||||
|
Background="Transparent"
|
||||||
|
TransparencyLevelHint="AcrylicBlur"
|
||||||
|
ExtendClientAreaToDecorationsHint="True">
|
||||||
<StackPanel x:Class="DiscordBotGUI.Settings.Commands" x:Name="stackpanel1" Margin="10">
|
<StackPanel x:Class="DiscordBotGUI.Settings.Commands" x:Name="stackpanel1" Margin="10">
|
||||||
<Label Content="Installed Commands" />
|
<Label Content="Installed Commands" />
|
||||||
<TextBox x:Class="DiscordBotGUI.Settings.Commands" x:Name="textbox1" TextAlignment="Left" IsReadOnly="True" />
|
<TextBox x:Class="DiscordBotGUI.Settings.Commands" x:Name="textbox1" TextAlignment="Left" IsReadOnly="True" />
|
||||||
<Label Content="Install another command" />
|
<Label Content="Install another command" />
|
||||||
<ComboBox x:Class="DiscordBotGUI.Settings.Commands" x:Name="comboBox1" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,10" Padding="200,0" />
|
<ComboBox x:Class="DiscordBotGUI.Settings.Commands" x:Name="comboBox1" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,10" Padding="200,0" />
|
||||||
<Button x:Class="DiscordBotGUI.Settings.Commands" x:Name="button1" HorizontalAlignment="Left" Content="Install" />
|
<Button x:Class="DiscordBotGUI.Settings.Commands" x:Name="button1" HorizontalAlignment="Left" Content="Install" />
|
||||||
<ProgressBar x:Class="DiscordBotGUI.Settings.Commands" x:Name="progressBar1" HorizontalAlignment="Left" Margin="0,10" />
|
<ProgressBar x:Class="DiscordBotGUI.Settings.Commands" x:Name="progressBar1" HorizontalAlignment="Left" Margin="0,10" Foreground="Yellow" />
|
||||||
<Label x:Class="DiscordBotGUI.Settings.Commands" x:Name="label1" Content="" HorizontalAlignment="Left" Margin="0,10" />
|
<Label x:Class="DiscordBotGUI.Settings.Commands" x:Name="label1" Content="" HorizontalAlignment="Left" Margin="0,10" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using System.Linq;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace DiscordBotGUI.Settings
|
namespace DiscordBotGUI.Settings
|
||||||
{
|
{
|
||||||
@@ -32,6 +33,7 @@ namespace DiscordBotGUI.Settings
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
textbox1.Text = "";
|
textbox1.Text = "";
|
||||||
|
Directory.CreateDirectory("./Data/Plugins/Commands/");
|
||||||
var files = System.IO.Directory.EnumerateFiles("./Data/Plugins/Commands/");
|
var files = System.IO.Directory.EnumerateFiles("./Data/Plugins/Commands/");
|
||||||
if (files == null || files.Count() < 1) return;
|
if (files == null || files.Count() < 1) return;
|
||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
|
|||||||
@@ -2,16 +2,19 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="550" d:DesignHeight="200"
|
||||||
x:Class="DiscordBotGUI.Settings.Events"
|
x:Class="DiscordBotGUI.Settings.Events"
|
||||||
Title="Events">
|
Title="Events"
|
||||||
|
Background="Transparent"
|
||||||
|
TransparencyLevelHint="AcrylicBlur"
|
||||||
|
ExtendClientAreaToDecorationsHint="True">
|
||||||
<StackPanel Margin="10">
|
<StackPanel Margin="10">
|
||||||
<Label Content="Installed Events" />
|
<Label Content="Installed Events" />
|
||||||
<TextBox x:Class="DiscordBotGUI.Settings.Events" x:Name="textbox1" TextAlignment="Left" IsReadOnly="True" />
|
<TextBox x:Class="DiscordBotGUI.Settings.Events" x:Name="textbox1" TextAlignment="Left" IsReadOnly="True" />
|
||||||
<Label Content="Install another Events" />
|
<Label Content="Install another Events" />
|
||||||
<ComboBox x:Class="DiscordBotGUI.Settings.Events" x:Name="comboBox1" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,10" Padding="200,0" />
|
<ComboBox x:Class="DiscordBotGUI.Settings.Events" x:Name="comboBox1" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,10" Padding="200,0" />
|
||||||
<Button x:Class="DiscordBotGUI.Settings.Events" x:Name="button1" HorizontalAlignment="Left" Content="Install" />
|
<Button x:Class="DiscordBotGUI.Settings.Events" x:Name="button1" HorizontalAlignment="Left" Content="Install" />
|
||||||
<ProgressBar x:Class="DiscordBotGUI.Settings.Events" x:Name="progressBar1" HorizontalAlignment="Left" Margin="0,10" />
|
<ProgressBar x:Class="DiscordBotGUI.Settings.Events" x:Name="progressBar1" HorizontalAlignment="Left" Margin="0,10" Foreground="Yellow" />
|
||||||
<Label x:Class="DiscordBotGUI.Settings.Events" x:Name="label1" Content="" HorizontalAlignment="Left" Margin="0,10" />
|
<Label x:Class="DiscordBotGUI.Settings.Events" x:Name="label1" Content="" HorizontalAlignment="Left" Margin="0,10" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using System.Reflection.Emit;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using static PluginManager.Others.Console_Utilities;
|
using static PluginManager.Others.Console_Utilities;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace DiscordBotGUI.Settings
|
namespace DiscordBotGUI.Settings
|
||||||
{
|
{
|
||||||
@@ -35,6 +36,7 @@ namespace DiscordBotGUI.Settings
|
|||||||
//textbox1 = new TextBox();
|
//textbox1 = new TextBox();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Directory.CreateDirectory("./Data/Plugins/Events/");
|
||||||
textbox1.IsReadOnly = false;
|
textbox1.IsReadOnly = false;
|
||||||
textbox1.Text = "";
|
textbox1.Text = "";
|
||||||
var files = System.IO.Directory.EnumerateFiles("./Data/Plugins/Events/");
|
var files = System.IO.Directory.EnumerateFiles("./Data/Plugins/Events/");
|
||||||
|
|||||||
@@ -62,5 +62,8 @@ namespace PluginManager.Online.Helpers
|
|||||||
return await client.GetStringAsync(url);
|
return await client.GetStringAsync(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,5 +82,6 @@ namespace PluginManager.Online
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -274,5 +274,15 @@ namespace PluginManager.Others
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static (double, string) ConvertBytes(long bytes)
|
||||||
|
{
|
||||||
|
if (bytes < 1024) return (bytes, "B");
|
||||||
|
if (bytes < 1024 * 1024) return (bytes / 1024.0, "KB");
|
||||||
|
if (bytes < 1024 * 1024 * 1024) return (bytes / 1024.0 / 1024.0, "MB");
|
||||||
|
return (bytes / 1024.0 / 1024.0 / 1024.0, "GB");
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user