Updated documentation

This commit is contained in:
2022-05-03 21:58:44 +03:00
parent f3d0ea426e
commit f5f1827540
26 changed files with 520 additions and 180 deletions

View File

@@ -8,25 +8,41 @@ using PluginManager.Interfaces;
namespace PluginManager.Loaders
{
public class CommandsLoader
internal class CommandsLoader
{
private readonly string CMDPath;
private readonly string CMDExtension;
public delegate void onCommandLoaded(string name, bool success, DBCommand? command = null, Exception? exception = null);
public delegate void onCommandFileLoaded(string path);
internal delegate void onCommandLoaded(string name, bool success, DBCommand? command = null, Exception? exception = null);
internal delegate void onCommandFileLoaded(string path);
public onCommandLoaded? OnCommandLoaded;
public onCommandFileLoaded? OnCommandFileLoaded;
/// <summary>
/// Event fired when a command is loaded
/// </summary>
internal onCommandLoaded? OnCommandLoaded;
public CommandsLoader(string CommandPath, string CommandExtension)
/// <summary>
/// Event fired when the file is loaded
/// </summary>
internal onCommandFileLoaded? OnCommandFileLoaded;
/// <summary>
/// Command Loader contructor
/// </summary>
/// <param name="CommandPath">The path to the commands</param>
/// <param name="CommandExtension">The extension to search for in the <paramref name="CommandPath"/></param>
internal CommandsLoader(string CommandPath, string CommandExtension)
{
CMDPath = CommandPath;
CMDExtension = CommandExtension;
}
public List<DBCommand>? LoadCommands()
/// <summary>
/// The method that loads all commands
/// </summary>
/// <returns></returns>
internal List<DBCommand>? LoadCommands()
{
if (!Directory.Exists(CMDPath))
{

View File

@@ -8,25 +8,41 @@ using PluginManager.Interfaces;
namespace PluginManager.Loaders
{
public class EventsLoader
internal class EventsLoader
{
private readonly string EVPath;
private readonly string EVExtension;
public delegate void onEventLoad(string name, bool success, DBEvent? ev = null, Exception? e = null);
public delegate void onEventFileLoaded(string path);
internal delegate void onEventLoad(string name, bool success, DBEvent? ev = null, Exception? e = null);
internal delegate void onEventFileLoaded(string path);
public onEventLoad? EventLoad;
public onEventFileLoaded? EventFileLoaded;
/// <summary>
/// An event that is fired whenever a <see cref="DBEvent"/> event is loaded in memory
/// </summary>
internal onEventLoad? EventLoad;
public EventsLoader(string path, string ext)
/// <summary>
/// An event that is fired whenever a <see cref="DBEvent"/> event file is loaded
/// </summary>
internal onEventFileLoaded? EventFileLoaded;
/// <summary>
/// The Event Loader constructor
/// </summary>
/// <param name="path">The path to all events</param>
/// <param name="ext">The extension for events</param>
internal EventsLoader(string path, string ext)
{
EVPath = path;
EVExtension = ext;
}
public List<DBEvent>? LoadEvents()
/// <summary>
/// The method that loads all events
/// </summary>
/// <returns></returns>
internal List<DBEvent>? LoadEvents()
{
if (!Directory.Exists(EVPath))

View File

@@ -10,6 +10,11 @@ namespace PluginManager.Loaders
public class PluginLoader
{
private DiscordSocketClient client;
/// <summary>
/// The Plugin Loader constructor
/// </summary>
/// <param name="discordSocketClient">The discord bot client where the plugins will pe attached to</param>
public PluginLoader(DiscordSocketClient discordSocketClient)
{
this.client = discordSocketClient;
@@ -21,17 +26,33 @@ namespace PluginManager.Loaders
private const string pluginCMDExtension = ".dll";
private const string pluginEVEExtension = ".dll";
/// <summary>
/// A list of <see cref="DBCommand"/> commands
/// </summary>
public static List<DBCommand>? Plugins { get; set; }
/// <summary>
/// A list of <see cref="DBEvent"/> commands
/// </summary>
public static List<DBEvent>? Events { get; set; }
public delegate void CMDLoaded(string name, string typeName, bool success, Exception? e = null);
public delegate void CMDLoaded(string name, string typeName, bool success, Exception? e = null);
public delegate void EVELoaded(string name, string typeName, bool success, Exception? e = null);
/// <summary>
/// Event that is fired when a <see cref="DBCommand"/> is successfully loaded into commands list
/// </summary>
public CMDLoaded? onCMDLoad;
/// <summary>
/// Event that is fired when a <see cref="DBEvent"/> is successfully loaded into events list
/// </summary>
public EVELoaded? onEVELoad;
/// <summary>
/// The main mathod that is called to load all events
/// </summary>
public void LoadPlugins()
{