mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-20 07:56:50 +00:00
chore: remove duplication namespace declaration
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
7f60dcb4cf
commit
5d90fafbd7
1 changed files with 48 additions and 65 deletions
|
|
@ -4,18 +4,15 @@ using System.Linq;
|
|||
using Crestron.SimplSharp;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using System.Reflection.PortableExecutable;
|
||||
using System.Reflection.Metadata;
|
||||
using SystemIO = System.IO;
|
||||
using CrestronIO = System.IO;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials;
|
||||
|
||||
namespace PepperDash.Essentials;
|
||||
/// <summary>
|
||||
/// Provides functionality for loading and managing plugins and assemblies in the application.
|
||||
/// </summary>
|
||||
|
|
@ -75,19 +72,6 @@ public static class PluginLoader
|
|||
/// </summary>
|
||||
private static string TempDirectory => PluginDirectory + Global.DirectorySeparator + "temp";
|
||||
|
||||
/// <summary>
|
||||
/// The directory to look in for .cplz plugin packages
|
||||
/// </summary>
|
||||
static string _pluginDirectory => Global.FilePathPrefix + "plugins";
|
||||
|
||||
/// <summary>
|
||||
/// The directory where plugins will be moved to and loaded from
|
||||
/// </summary>
|
||||
static string _loadedPluginsDirectoryPath => _pluginDirectory + Global.DirectorySeparator + "loadedAssemblies";
|
||||
|
||||
// The temp directory where .cplz archives will be unzipped to
|
||||
static string _tempDirectory => _pluginDirectory + Global.DirectorySeparator + "temp";
|
||||
|
||||
/// <summary>
|
||||
/// Represents a collection of fully qualified type names that are known to be incompatible with the current
|
||||
/// application or framework.
|
||||
|
|
@ -96,8 +80,8 @@ public static class PluginLoader
|
|||
/// incompatible with the intended usage of the application. These types may represent security risks, unsupported
|
||||
/// features, or legacy APIs that should be avoided.</remarks>
|
||||
private static readonly HashSet<string> KnownIncompatibleTypes =
|
||||
[
|
||||
"System.Net.ICertificatePolicy",
|
||||
[
|
||||
"System.Net.ICertificatePolicy",
|
||||
"System.Security.Cryptography.SHA1CryptoServiceProvider",
|
||||
"System.Web.HttpUtility",
|
||||
"System.Configuration.ConfigurationManager",
|
||||
|
|
@ -108,7 +92,7 @@ public static class PluginLoader
|
|||
"System.Security.SecurityManager",
|
||||
"System.Security.Permissions.FileIOPermission",
|
||||
"System.AppDomain.CreateDomain"
|
||||
];
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Initializes static members of the <see cref="PluginLoader"/> class.
|
||||
|
|
@ -142,7 +126,6 @@ public static class PluginLoader
|
|||
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "Found {0} Assemblies", assemblyFiles.Length);
|
||||
|
||||
|
||||
foreach (var fi in assemblyFiles.Where(fi => fi.Name.Contains("Essentials") || fi.Name.Contains("PepperDash")))
|
||||
{
|
||||
string version = string.Empty;
|
||||
|
|
@ -190,7 +173,6 @@ public static class PluginLoader
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Associates the specified assembly with the given name in the loaded assemblies collection.
|
||||
/// </summary>
|
||||
|
|
@ -335,7 +317,7 @@ public static class PluginLoader
|
|||
}
|
||||
return null;
|
||||
}
|
||||
catch (FileLoadException ex) when (ex.Message.Contains("Assembly with same name is already loaded"))
|
||||
catch(FileLoadException ex) when (ex.Message.Contains("Assembly with same name is already loaded"))
|
||||
{
|
||||
// Get the assembly name from the file path
|
||||
string assemblyName = Path.GetFileNameWithoutExtension(filePath);
|
||||
|
|
@ -356,7 +338,7 @@ public static class PluginLoader
|
|||
Debug.LogMessage(LogEventLevel.Warning, "Assembly with same name already loaded but couldn't find it: {0}", filePath);
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch(Exception ex)
|
||||
{
|
||||
string fileName = Path.GetFileName(filePath);
|
||||
|
||||
|
|
@ -730,6 +712,7 @@ public static class PluginLoader
|
|||
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
try
|
||||
|
|
@ -853,7 +836,7 @@ public static class PluginLoader
|
|||
|
||||
LoadDeviceFactories(deviceFactory);
|
||||
|
||||
if (!EssentialsPluginAssemblies.Contains(loadedAssembly))
|
||||
if(!EssentialsPluginAssemblies.Contains(loadedAssembly))
|
||||
EssentialsPluginAssemblies.Add(loadedAssembly);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue