This commit is contained in:
2022-11-02 18:59:33 +02:00
parent e5f3aff39a
commit d32b3902c9
2 changed files with 2 additions and 46 deletions

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using PluginManager.Items; using PluginManager.Items;
using PluginManager.Others; using PluginManager.Others;
@@ -11,7 +12,7 @@ public class PluginUpdater
{ {
try try
{ {
var webV = await ServerCom.GetVersionOfPackageFromWeb(pakName); var webV = await ServerCom.GetVersionOfPackageFromWeb(pakName);
var local = ServerCom.GetVersionOfPackage(pakName); var local = ServerCom.GetVersionOfPackage(pakName);
if (local is null) return true; if (local is null) return true;
@@ -29,17 +30,6 @@ public class PluginUpdater
return false; return false;
} }
public static async Task<Update> DownloadUpdateInfo(string pakName)
{
var url = "https://raw.githubusercontent.com/Wizzy69/installer/discord-bot-files/Versions";
var info = await ServerCom.ReadTextFromURL(url);
var version = await ServerCom.GetVersionOfPackageFromWeb(pakName);
if (version is null) return Update.Empty;
var update = new Update(pakName, string.Join('\n', info), version);
return update;
}
public static async Task Download(string pakName) public static async Task Download(string pakName)
{ {
Utilities.WriteColorText("An update was found for &g" + pakName + "&c. Version: &r" + Utilities.WriteColorText("An update was found for &g" + pakName + "&c. Version: &r" +

View File

@@ -1,34 +0,0 @@
using System;
using PluginManager.Online.Helpers;
namespace PluginManager.Online.Updates;
public class Update
{
public static Update Empty = new(null, null, null);
private readonly bool isEmpty;
public VersionString newVersion;
public string pakName;
public string UpdateMessage;
public Update(string pakName, string updateMessage, VersionString newVersion)
{
this.pakName = pakName;
UpdateMessage = updateMessage;
this.newVersion = newVersion;
if (pakName is null && updateMessage is null && newVersion is null)
isEmpty = true;
}
public override string ToString()
{
if (isEmpty)
throw new Exception("The update is EMPTY. Can not print information about an empty update !");
return $"Package Name: {pakName}\n" +
$"Update Message: {UpdateMessage}\n" +
$"Version: {newVersion}";
}
}