small code refactoring

This commit is contained in:
Schedel Pascal
2024-06-19 08:10:16 +02:00
parent 20770bed31
commit c9216ac79b
93 changed files with 2753 additions and 5835 deletions

View File

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