Files
Pilz.Updating/Pilz.Updating.UpdateInstaller/General.cs
2024-06-19 08:10:16 +02:00

33 lines
935 B
C#

using Pilz.Plugins;
using System.IO;
namespace Pilz.Updating.UpdateInstaller;
internal static class General
{
private static string p = null;
public static string MyAppPath
{
get
{
if (string.IsNullOrEmpty(p))
p = Path.GetDirectoryName(IO.Extensions.GetExecutablePath());
return p;
}
}
public static void LoadAddons(Lib.UpdateInstaller installer)
{
var pluginsPath = Path.Combine(MyAppPath, "AddOns");
if (Directory.Exists(pluginsPath))
{
foreach (var subdir in Directory.GetDirectories(pluginsPath, string.Empty, SearchOption.TopDirectoryOnly))
{
var pluginPath = Path.Combine(subdir, Path.GetFileName(subdir) + ".dll");
if (File.Exists(pluginPath))
PluginManager.Instance.LoadPlugin(pluginPath, installer);
}
}
}
}