This commit is contained in:
2023-01-12 15:21:45 +02:00
parent 22f2cd4e59
commit 2d3566a01a
5 changed files with 33 additions and 10 deletions

View File

@@ -8,7 +8,7 @@
<StartupObject /> <StartupObject />
<SignAssembly>False</SignAssembly> <SignAssembly>False</SignAssembly>
<IsPublishable>True</IsPublishable> <IsPublishable>True</IsPublishable>
<AssemblyVersion>1.0.1.1</AssemblyVersion> <AssemblyVersion>1.0.1.2</AssemblyVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -322,7 +322,8 @@ public class ConsoleCommandsHandler
try try
{ {
var pName = string.Join(' ', args, 1, args.Length - 1); var pName = string.Join(' ', args, 1, args.Length - 1);
var client = new HttpClient(); using (var client = new HttpClient())
{
var url = (await manager.GetPluginLinkByName(pName))[1]; var url = (await manager.GetPluginLinkByName(pName))[1];
if (url is null) throw new Exception($"Invalid plugin name {pName}."); if (url is null) throw new Exception($"Invalid plugin name {pName}.");
var s = await client.GetStreamAsync(url); var s = await client.GetStreamAsync(url);
@@ -332,6 +333,9 @@ public class ConsoleCommandsHandler
await PluginLoader.LoadPluginFromAssembly(asmb, this.client); await PluginLoader.LoadPluginFromAssembly(asmb, this.client);
} }
}
catch (Exception ex) catch (Exception ex)
{ {
Logger.WriteLine(ex.Message); Logger.WriteLine(ex.Message);
@@ -351,6 +355,7 @@ public class ConsoleCommandsHandler
catch (Exception ex) catch (Exception ex)
{ {
Logger.WriteLine(ex.Message); Logger.WriteLine(ex.Message);
Logger.WriteErrFile(ex);
} }
}); });

View File

@@ -126,5 +126,6 @@ namespace PluginManager
if (!isInitialized) throw new Exception("Logger is not initialized"); if (!isInitialized) throw new Exception("Logger is not initialized");
WriteErrFile(ex.ToString()); WriteErrFile(ex.ToString());
} }
} }
} }

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Collections.Generic;
using PluginManager.Items; using PluginManager.Items;
using PluginManager.Others; using PluginManager.Others;
@@ -30,12 +31,22 @@ public class PluginUpdater
return false; return false;
} }
public static async Task Download(string pakName) public static async Task<List<string>> GetInfo(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" +
(await ServerCom.GetVersionOfPackageFromWeb(pakName))?.ToShortString() + (await ServerCom.GetVersionOfPackageFromWeb(pakName))?.ToShortString() +
"&c. Current Version: &y" + "&c. Current Version: &y" +
ServerCom.GetVersionOfPackage(pakName)?.ToShortString()); ServerCom.GetVersionOfPackage(pakName)?.ToShortString());
List<string> fileInfo = await ServerCom.ReadTextFromURL("");
return fileInfo;
}
public static async Task Download(string pakName)
{
var pakUpdateInfo = await GetInfo(pakName);
Logger.Log(string.Join("\n", pakUpdateInfo));
await ConsoleCommandsHandler.ExecuteCommad("dwplug " + pakName); await ConsoleCommandsHandler.ExecuteCommad("dwplug " + pakName);
} }
} }

View File

@@ -17,6 +17,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roles", "..\DiscordBotItems
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DBEconomy", "..\DiscordBotItems\Plugins\DBEconomy\DBEconomy.csproj", "{0321365B-4ADC-4B1D-BD98-F573D36E83B2}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DBEconomy", "..\DiscordBotItems\Plugins\DBEconomy\DBEconomy.csproj", "{0321365B-4ADC-4B1D-BD98-F573D36E83B2}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "..\DiscordBotItems\Updater\Updater.csproj", "{1A411BE0-6AE4-4129-A0BD-0D1D5D4E2D1A}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -51,6 +53,10 @@ Global
{0321365B-4ADC-4B1D-BD98-F573D36E83B2}.Debug|Any CPU.Build.0 = Debug|Any CPU {0321365B-4ADC-4B1D-BD98-F573D36E83B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0321365B-4ADC-4B1D-BD98-F573D36E83B2}.Release|Any CPU.ActiveCfg = Release|Any CPU {0321365B-4ADC-4B1D-BD98-F573D36E83B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0321365B-4ADC-4B1D-BD98-F573D36E83B2}.Release|Any CPU.Build.0 = Release|Any CPU {0321365B-4ADC-4B1D-BD98-F573D36E83B2}.Release|Any CPU.Build.0 = Release|Any CPU
{1A411BE0-6AE4-4129-A0BD-0D1D5D4E2D1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A411BE0-6AE4-4129-A0BD-0D1D5D4E2D1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A411BE0-6AE4-4129-A0BD-0D1D5D4E2D1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A411BE0-6AE4-4129-A0BD-0D1D5D4E2D1A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE