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 Crestron.SimplSharp;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using System.Reflection.PortableExecutable;
|
using System.Reflection.PortableExecutable;
|
||||||
using System.Reflection.Metadata;
|
using System.Reflection.Metadata;
|
||||||
using SystemIO = System.IO;
|
|
||||||
using CrestronIO = System.IO;
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Essentials;
|
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides functionality for loading and managing plugins and assemblies in the application.
|
/// Provides functionality for loading and managing plugins and assemblies in the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -75,19 +72,6 @@ public static class PluginLoader
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static string TempDirectory => PluginDirectory + Global.DirectorySeparator + "temp";
|
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>
|
/// <summary>
|
||||||
/// Represents a collection of fully qualified type names that are known to be incompatible with the current
|
/// Represents a collection of fully qualified type names that are known to be incompatible with the current
|
||||||
/// application or framework.
|
/// application or framework.
|
||||||
|
|
@ -142,7 +126,6 @@ public static class PluginLoader
|
||||||
|
|
||||||
Debug.LogMessage(LogEventLevel.Verbose, "Found {0} Assemblies", assemblyFiles.Length);
|
Debug.LogMessage(LogEventLevel.Verbose, "Found {0} Assemblies", assemblyFiles.Length);
|
||||||
|
|
||||||
|
|
||||||
foreach (var fi in assemblyFiles.Where(fi => fi.Name.Contains("Essentials") || fi.Name.Contains("PepperDash")))
|
foreach (var fi in assemblyFiles.Where(fi => fi.Name.Contains("Essentials") || fi.Name.Contains("PepperDash")))
|
||||||
{
|
{
|
||||||
string version = string.Empty;
|
string version = string.Empty;
|
||||||
|
|
@ -190,7 +173,6 @@ public static class PluginLoader
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Associates the specified assembly with the given name in the loaded assemblies collection.
|
/// Associates the specified assembly with the given name in the loaded assemblies collection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -335,7 +317,7 @@ public static class PluginLoader
|
||||||
}
|
}
|
||||||
return null;
|
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
|
// Get the assembly name from the file path
|
||||||
string assemblyName = Path.GetFileNameWithoutExtension(filePath);
|
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);
|
Debug.LogMessage(LogEventLevel.Warning, "Assembly with same name already loaded but couldn't find it: {0}", filePath);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
string fileName = Path.GetFileName(filePath);
|
string fileName = Path.GetFileName(filePath);
|
||||||
|
|
||||||
|
|
@ -730,6 +712,7 @@ public static class PluginLoader
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var type in types)
|
foreach (var type in types)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -853,7 +836,7 @@ public static class PluginLoader
|
||||||
|
|
||||||
LoadDeviceFactories(deviceFactory);
|
LoadDeviceFactories(deviceFactory);
|
||||||
|
|
||||||
if (!EssentialsPluginAssemblies.Contains(loadedAssembly))
|
if(!EssentialsPluginAssemblies.Contains(loadedAssembly))
|
||||||
EssentialsPluginAssemblies.Add(loadedAssembly);
|
EssentialsPluginAssemblies.Add(loadedAssembly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue