Redesigned the DiscordBotCore by splitting it into multiple projects. Created a WebUI and preparing to remove the DiscordBot application

This commit is contained in:
2025-04-04 22:07:30 +03:00
parent 62ba5ec63d
commit a4afb28f36
2290 changed files with 76694 additions and 17052 deletions

View File

@@ -1,4 +1,5 @@
using DiscordBotCore;
using DiscordBotCore.Logging;
using DiscordBotCore.Others;
namespace CppCompatibilityModule.Extern;
@@ -7,11 +8,13 @@ public class ExternalApplication
{
public Guid ApplicationId { get; private set; }
private readonly ExternLibrary _ExternLibrary;
private readonly ILogger _Logger;
private ExternalApplication(Guid applicationGuid, ExternLibrary library)
private ExternalApplication(ILogger logger, Guid applicationGuid, ExternLibrary library)
{
this.ApplicationId = applicationGuid;
this._ExternLibrary = library;
this._Logger = logger;
}
internal void CallFunction(string methodName, ref object parameter)
@@ -39,15 +42,15 @@ public class ExternalApplication
_ExternLibrary.FreeLibrary();
}
public static ExternalApplication? CreateFromDllFile(string dllFilePath)
public static ExternalApplication? CreateFromDllFile(ILogger logger, string dllFilePath)
{
ExternLibrary library = new ExternLibrary(dllFilePath);
ExternLibrary library = new ExternLibrary(logger, dllFilePath);
var result = library.InitializeLibrary();
return result.Match<ExternalApplication?>(
() => new ExternalApplication(Guid.NewGuid(), library),
() => new ExternalApplication(logger, Guid.NewGuid(), library),
(ex) => {
Application.CurrentApplication.Logger.Log(ex.Message, LogType.Error);
logger.Log(ex.Message, LogType.Error);
library.FreeLibrary();
return null;
});