This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
using PluginManager.Online;
|
using PluginManager.Online;
|
||||||
using PluginManager.Others;
|
using PluginManager.Others;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -16,6 +15,7 @@ namespace DiscordBotGUI
|
|||||||
public partial class AppUpdater : Window
|
public partial class AppUpdater : Window
|
||||||
{
|
{
|
||||||
private string _version;
|
private string _version;
|
||||||
|
|
||||||
public AppUpdater()
|
public AppUpdater()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -27,7 +27,6 @@ namespace DiscordBotGUI
|
|||||||
|
|
||||||
if (!File.Exists("./DiscordBot.exe")) DownloadDiscordBotClientNoGUIAsDLL();
|
if (!File.Exists("./DiscordBot.exe")) DownloadDiscordBotClientNoGUIAsDLL();
|
||||||
Updates();
|
Updates();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void DownloadDiscordBotClientNoGUIAsDLL()
|
private async void DownloadDiscordBotClientNoGUIAsDLL()
|
||||||
@@ -88,10 +87,7 @@ namespace DiscordBotGUI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IProgress<float> progress = new Progress<float>((percent) =>
|
IProgress<float> progress = new Progress<float>((percent) => { this.progressBar1.Value = percent; });
|
||||||
{
|
|
||||||
this.progressBar1.Value = percent;
|
|
||||||
});
|
|
||||||
|
|
||||||
textBox1.Text = "Extracting update files ...";
|
textBox1.Text = "Extracting update files ...";
|
||||||
await Functions.ExtractArchive(file, "./", progress);
|
await Functions.ExtractArchive(file, "./", progress);
|
||||||
@@ -102,7 +98,6 @@ namespace DiscordBotGUI
|
|||||||
await Task.Delay(5000);
|
await Task.Delay(5000);
|
||||||
new MainWindow() { Height = 425, Width = 650 }.Show();
|
new MainWindow() { Height = 425, Width = 650 }.Show();
|
||||||
this.Close();
|
this.Close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<string> DownloadNewUpdate()
|
private async Task<string> DownloadNewUpdate()
|
||||||
@@ -130,7 +125,6 @@ namespace DiscordBotGUI
|
|||||||
string FileName = $"{urlNewUpdateZip.Split('/')[urlNewUpdateZip.Split('/').Length - 1]}";
|
string FileName = $"{urlNewUpdateZip.Split('/')[urlNewUpdateZip.Split('/').Length - 1]}";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
new Thread(new Task(() =>
|
new Thread(new Task(() =>
|
||||||
{
|
{
|
||||||
while (isDownloading)
|
while (isDownloading)
|
||||||
@@ -148,6 +142,7 @@ namespace DiscordBotGUI
|
|||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
isDownloading = false;
|
isDownloading = false;
|
||||||
return FileName;
|
return FileName;
|
||||||
}
|
}
|
||||||
@@ -156,14 +151,10 @@ namespace DiscordBotGUI
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
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;
|
_version = latest_version;
|
||||||
if (current_version != latest_version)
|
if (current_version != latest_version) { return true; }
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user