コード例 #1
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>();
            }
        }
コード例 #2
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,
                });
            }
        }