Redesigned the DiscordBotCore by splitting it into multiple projects. Created a WebUI and preparing to remove the DiscordBot application
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user