Added the ability to load custom assemblies to the shell.
This commit is contained in:
parent
24fde24746
commit
b7a4333e2d
@ -95,6 +95,26 @@ public class Shell
|
||||
ReloadDirectoryInfo();
|
||||
}
|
||||
|
||||
public bool LoadModule(Type moduleType)
|
||||
{
|
||||
if (LoadedModules.Any(x => x.Type.FullName == moduleType.FullName)) return false;
|
||||
|
||||
ModuleInfo? module = ModuleInfo.FromType(moduleType);
|
||||
if (module is null) return false;
|
||||
|
||||
LoadedModules.Add(module);
|
||||
LoadedCommands.AddRange(module.Commands);
|
||||
|
||||
return true;
|
||||
}
|
||||
public bool LoadModule<T>() => LoadModule(typeof(T));
|
||||
public int LoadModules(Assembly moduleAssembly)
|
||||
{
|
||||
int loaded = 0;
|
||||
foreach (Type moduleType in moduleAssembly.GetTypes()) if (LoadModule(moduleType)) loaded++;
|
||||
return loaded;
|
||||
}
|
||||
|
||||
public void AddHistory(HistoryItem item) => History.Add(item);
|
||||
public void UndoItem()
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user