コード例 #1
0
        /// <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 (PlugInAppDomain != null && AppDomain.CurrentDomain != PlugInAppDomain)
            {
                // Add it to the plug-in integration domain also
                mCrossDomain.AddPlugIn(fullPath);
            }
            else
            {
                // We get here only if we are in the plug-in app domain

                // 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 plugins
                if (plugins?.Count > 0)
                {
                    PlugInDetails[fullPath].AddRange(plugins);
                }
            }
        }
コード例 #2
0
        /// <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
                CrossDomain.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);
                }
            }
        }
コード例 #3
0
        /// <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>()
        {
            // 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,
            });

            if (PlugInAppDomain != null && AppDomain.CurrentDomain != PlugInAppDomain)
            {
                // Add it to the plug-in integration domain also
                mCrossDomain.AddPlugIn <T>();
            }
        }
コード例 #4
0
        /// <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)
            {
                CrossDomain.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,
                });
            }
        }