Skip to content

Commit

Permalink
loader updoot & removed unused using
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxWorn3365 committed Sep 6, 2024
1 parent c9a1b9a commit 59568b9
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions EXILED/Exiled.Loader/Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ namespace Exiled.Loader
using Features;
using Features.Configs;
using Features.Configs.CustomConverters;
using MEC;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NodeDeserializers;

Expand Down Expand Up @@ -116,13 +115,30 @@ public Loader()
.Build();

/// <summary>
/// Loads all plugins.
/// Loads all plugins, both globals and locals.
/// </summary>
public static void LoadPlugins()
{
File.Delete(Path.Combine(Paths.Plugins, "Exiled.Updater.dll"));

foreach (string assemblyPath in Directory.GetFiles(Paths.Plugins, "*.dll"))
LoadPluginsFromDirectory();
LoadPluginsFromDirectory(Server.Port.ToString());
}

/// <summary>
/// Load every plugin inside the given directory, if null it's default EXILED one (global).
/// </summary>
/// <param name="dir">The sub-directory of the plugin - if null the default EXILED one will be used.</param>
public static void LoadPluginsFromDirectory(string dir = null)
{
string path = Paths.Plugins;
if (dir is not null)
path = Path.Combine(path, dir);

if (!Directory.Exists(path))
Directory.CreateDirectory(path);

foreach (string assemblyPath in Directory.GetFiles(path, "*.dll"))
{
Assembly assembly = LoadAssembly(assemblyPath);

Expand Down

0 comments on commit 59568b9

Please sign in to comment.