Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EXILED::Loader] Allow port-binded plugin loading #89

Open
wants to merge 15 commits into
base: dev
Choose a base branch
from
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)
FoxWorn3365 marked this conversation as resolved.
Show resolved Hide resolved
{
string path = Paths.Plugins;
if (dir is not null)
path = Path.Combine(path, dir);
FoxWorn3365 marked this conversation as resolved.
Show resolved Hide resolved

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

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

Expand Down
Loading