chore: move all files to file-scoped namespace

This commit is contained in:
Andrew Welker
2025-07-04 16:02:32 -05:00
parent 8b873b7248
commit 6d2cd75cbe
552 changed files with 46137 additions and 46725 deletions

View File

@@ -2,18 +2,28 @@ using PepperDash.Essentials.Core.Config;
using System.Collections.Generic;
namespace PepperDash.Essentials.Core
{
namespace PepperDash.Essentials.Core;
/// <summary>
/// Defines a class that is capable of loading custom plugin device types
/// </summary>
public interface IPluginDeviceFactory : IDeviceFactory
{
/// <summary>
/// Defines a class that is capable of loading custom plugin device types
/// Required to define the minimum version for Essentials in the format xx.yy.zz
/// </summary>
public interface IPluginDeviceFactory : IDeviceFactory
{
/// <summary>
/// Required to define the minimum version for Essentials in the format xx.yy.zz
/// </summary>
string MinimumEssentialsFrameworkVersion { get; }
}
string MinimumEssentialsFrameworkVersion { get; }
}
/// <summary>
/// Defines a factory for creating plugin development devices, including support for specific framework versions.
/// </summary>
/// <remarks>This interface extends <see cref="IPluginDeviceFactory"/> to provide additional functionality
/// specific to plugin development, such as access to supported framework versions.</remarks>
public interface IPluginDevelopmentDeviceFactory : IPluginDeviceFactory
{
/// <summary>
/// Gets a list of framework versions that are essential for development.
/// </summary>
List<string> DevelopmentEssentialsFrameworkVersions { get; }
}

View File

@@ -181,7 +181,7 @@ public static class PluginLoader
/// this method updates its associated assembly. If no matching name is found, the method does nothing.</remarks>
/// <param name="name">The name used to identify the assembly. This value is case-sensitive and must not be null or empty.</param>
/// <param name="assembly">The assembly to associate with the specified name. This value must not be null.</param>
public static void SetEssentialsAssembly(string name, Assembly assembly)
public static void AddLoadedAssembly(string name, Assembly assembly)
{
var loadedAssembly = LoadedAssemblies.FirstOrDefault(la => la.Name.Equals(name));
@@ -717,22 +717,23 @@ public static class PluginLoader
foreach (var type in types)
{
try
{
if (typeof (IPluginDeviceFactory).IsAssignableFrom(type) && !type.IsAbstract)
{
var plugin =
(IPluginDeviceFactory)Activator.CreateInstance(type);
LoadCustomPlugin(plugin, loadedAssembly);
}
}
{
if (!typeof(IPluginDeviceFactory).IsAssignableFrom(type) || type.IsAbstract)
{
continue;
}
var plugin = (IPluginDeviceFactory)Activator.CreateInstance(type);
LoadCustomPlugin(plugin, loadedAssembly);
}
catch (NotSupportedException)
{
//this happens for dlls that aren't PD dlls, like ports of Mono classes into S#. Swallowing.
}
catch (Exception e)
catch (Exception ex)
{
Debug.LogMessage(LogEventLevel.Error, "Load Plugin not found. {0}.{2} is not a plugin factory. Exception: {1}",
loadedAssembly.Name, e.Message, type.Name);
Debug.LogError("Load Plugin not found. {assemblyName}.{typeName} is not a plugin factory. Exception: {exception}",
loadedAssembly.Name, type.Name, ex.Message);
continue;
}
}
@@ -814,7 +815,11 @@ public static class PluginLoader
/// <param name="loadedAssembly">The assembly associated with the plugin being loaded. This is used for logging and tracking purposes.</param>
private static void LoadCustomPlugin(IPluginDeviceFactory deviceFactory, LoadedAssembly loadedAssembly)
{
var passed = Global.IsRunningMinimumVersionOrHigher(deviceFactory.MinimumEssentialsFrameworkVersion);
var developmentDeviceFactory = deviceFactory as IPluginDevelopmentDeviceFactory;
var passed = developmentDeviceFactory != null ? Global.IsRunningDevelopmentVersion
(developmentDeviceFactory.DevelopmentEssentialsFrameworkVersions, developmentDeviceFactory.MinimumEssentialsFrameworkVersion)
: Global.IsRunningMinimumVersionOrHigher(deviceFactory.MinimumEssentialsFrameworkVersion);
if (!passed)
{