This commit is contained in:
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using PluginManager;
|
||||||
|
|
||||||
namespace DiscordBotGUI
|
namespace DiscordBotGUI
|
||||||
{
|
{
|
||||||
@@ -149,7 +150,10 @@ namespace DiscordBotGUI
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string current_version = Functions.readCodeFromFile("Version.txt", "DiscordBotVersion", '=') ?? "0";
|
string current_version = Config.GetValue("Version");
|
||||||
|
if (current_version == null)
|
||||||
|
if (!Config.SetValue("Version", "0"))
|
||||||
|
Config.AddValueToVariables("Version", "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) { return true; }
|
if (current_version != latest_version) { return true; }
|
||||||
@@ -159,6 +163,7 @@ namespace DiscordBotGUI
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
textBox1.Text = "Error while checking for updates. Server is not responding.";
|
textBox1.Text = "Error while checking for updates. Server is not responding.";
|
||||||
|
Functions.WriteErrFile(ex.Message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace DiscordBotGUI
|
|||||||
|
|
||||||
|
|
||||||
textBox3.Watermark = "Insert start arguments";
|
textBox3.Watermark = "Insert start arguments";
|
||||||
if (File.Exists("./Version.txt")) label5.Content = Config.ApplicationVariables["Version"] as string;
|
if (File.Exists("./Version.txt")) label5.Content = Config.GetValue("Version");
|
||||||
button1.Click += async (sender, e) =>
|
button1.Click += async (sender, e) =>
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -56,8 +56,8 @@ namespace DiscordBotGUI
|
|||||||
Directory.CreateDirectory(Functions.dataFolder);
|
Directory.CreateDirectory(Functions.dataFolder);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string? botToken = Config.ApplicationVariables["token"] as string;
|
string? botToken = Config.GetValue("token") as string;
|
||||||
string? botPrefix = Config.ApplicationVariables["prefix"] as string;
|
string? botPrefix = Config.GetValue("prefix") as string;
|
||||||
if (botToken == null || botPrefix == null)
|
if (botToken == null || botPrefix == null)
|
||||||
{
|
{
|
||||||
textBox1.IsReadOnly = false;
|
textBox1.IsReadOnly = false;
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ namespace PluginManager
|
|||||||
public static bool SetValue(string key, string value)
|
public static bool SetValue(string key, string value)
|
||||||
{
|
{
|
||||||
if (!ApplicationVariables.ContainsKey(key)) return false;
|
if (!ApplicationVariables.ContainsKey(key)) return false;
|
||||||
|
|
||||||
if (ConstantTokens.Contains(key)) return false;
|
if (ConstantTokens.Contains(key)) return false;
|
||||||
ApplicationVariables[key] = value;
|
ApplicationVariables[key] = value;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user