Deleting plugins is now available
This commit is contained in:
@@ -18,13 +18,12 @@ public class InternalActionManager
|
||||
|
||||
public async Task Initialize()
|
||||
{
|
||||
//loader.ActionLoadedEvent += OnActionLoaded;
|
||||
var m_actions = await loader.Load();
|
||||
if (m_actions == null) return;
|
||||
if (m_actions == null)
|
||||
return;
|
||||
foreach (var action in m_actions)
|
||||
{
|
||||
Actions.TryAdd(action.ActionName, action);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task Refresh()
|
||||
@@ -33,34 +32,23 @@ public class InternalActionManager
|
||||
await Initialize();
|
||||
}
|
||||
|
||||
// private void OnActionLoaded(string name, string typeName, bool success, Exception? e)
|
||||
// {
|
||||
// if (!success)
|
||||
// {
|
||||
// Config.Logger.Error(e);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// Config.Logger.Log($"Action {name} loaded successfully", LogLevel.INFO, true);
|
||||
// }
|
||||
|
||||
public async Task<string> Execute(string actionName, params string[]? args)
|
||||
public async Task<bool> Execute(string actionName, params string[]? args)
|
||||
{
|
||||
if (!Actions.ContainsKey(actionName))
|
||||
{
|
||||
Config.Logger.Log($"Action {actionName} not found", type: LogType.ERROR, source: typeof(InternalActionManager));
|
||||
return "Action not found";
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await Actions[actionName].Execute(args);
|
||||
return "Action executed";
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Config.Logger.Log(e.Message, type: LogType.ERROR, source: typeof(InternalActionManager));
|
||||
return e.Message;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace PluginManager.Others;
|
||||
|
||||
public static class ArchiveManager
|
||||
{
|
||||
private static string? _archiveFolder;
|
||||
private static string? _ArchiveFolder;
|
||||
private static bool IsInitialized { get; set; }
|
||||
|
||||
public static void Initialize()
|
||||
@@ -19,7 +19,7 @@ public static class ArchiveManager
|
||||
if (!Config.AppSettings.ContainsKey("ArchiveFolder"))
|
||||
Config.AppSettings["ArchiveFolder"] = "./Data/Archives/";
|
||||
|
||||
_archiveFolder = Config.AppSettings["ArchiveFolder"];
|
||||
_ArchiveFolder = Config.AppSettings["ArchiveFolder"];
|
||||
|
||||
IsInitialized = true;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public static class ArchiveManager
|
||||
{
|
||||
if (!IsInitialized) throw new Exception("ArchiveManager is not initialized");
|
||||
|
||||
archName = _archiveFolder + archName;
|
||||
archName = _ArchiveFolder + archName;
|
||||
|
||||
if (!File.Exists(archName))
|
||||
throw new Exception("Failed to load file !");
|
||||
@@ -81,7 +81,7 @@ public static class ArchiveManager
|
||||
public static async Task<string?> ReadFromPakAsync(string fileName, string archFile)
|
||||
{
|
||||
if (!IsInitialized) throw new Exception("ArchiveManager is not initialized");
|
||||
archFile = _archiveFolder + archFile;
|
||||
archFile = _ArchiveFolder + archFile;
|
||||
if (!File.Exists(archFile))
|
||||
throw new Exception("Failed to load file !");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user