This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using PluginManager.Items;
|
||||
using PluginManager.Others;
|
||||
|
||||
@@ -29,17 +30,6 @@ public class PluginUpdater
|
||||
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)
|
||||
{
|
||||
Utilities.WriteColorText("An update was found for &g" + pakName + "&c. Version: &r" +
|
||||
|
||||
@@ -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}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user