/// <summary> /// Adds a plug-in based on it's <see cref="SolidPlugIn"/> implementation /// </summary> /// <typeparam name="fullPath">The absolute path to the plug-in dll</typeparam> public static void AddPlugIn(string fullPath) { if (UseDetachedAppDomain) { // Add it to the plug-in integration domain also PluginCrossDomain.AddPlugIn(fullPath); } else { // Create list if one doesn't exist if (!PlugInDetails.ContainsKey(fullPath)) { PlugInDetails[fullPath] = new List <PlugInDetails>(); } List <PlugInDetails> plugins; plugins = GetPlugInDetails(fullPath); // Add any found plug-ins if (plugins?.Count > 0) { PlugInDetails[fullPath].AddRange(plugins); } } }
/// <summary> /// Adds a plug-in based on it's <see cref="SolidPlugIn"/> implementation /// </summary> /// <typeparam name="T">The class that implements the <see cref="SolidPlugIn"/></typeparam> /// </param> public static void AddPlugIn <T>() { if (UseDetachedAppDomain) { PluginCrossDomain.AddPlugIn <T>(); } else { // Get the full path to the assembly var fullPath = typeof(T).Assembly.CodeBase.Replace(@"file:\", "").Replace(@"file:///", ""); // Create list if one doesn't exist if (!PlugInDetails.ContainsKey(fullPath)) { PlugInDetails[fullPath] = new List <PlugInDetails>(); } // Add it PlugInDetails[fullPath].Add(new PlugInDetails { FullPath = fullPath, AssemblyFullName = AssemblyName.GetAssemblyName(fullPath).FullName, TypeFullName = typeof(T).FullName, }); } }