Exemple #1
0
        /// <summary>
        /// Sorts the collection of PluginDescriptors according to their dependency chain.
        /// </summary>
        /// <param name="descriptorCollection">The collection of descriptors to sort.</param>
        /// <param name="leastDependentFirst">A flag that determines how the descriptors are sorted.</param>
        /// <returns></returns>
        public static PluginDescriptorCollection Sort(PluginDescriptorCollection descriptorCollection, bool leastDependentFirst)
        {
            CairoLogger.Instance.Debug(string.Format("Sorting PluginDescriptor Collection. LeastDependentFirst: '{0}'.", leastDependentFirst.ToString()));



            PluginDescriptor[] descriptors = descriptorCollection.ToArray();
            PluginDescriptor.Sort(descriptors, leastDependentFirst);

            descriptorCollection.Clear();
            descriptorCollection.Add(descriptors);

            return(descriptorCollection);
        }
Exemple #2
0
        /// <summary>
        /// Creates PluginDescriptors from each Plugin Type specified.
        /// </summary>
        /// <param name="types">The collection of Plugin Types to create descriptors for.</param>
        /// <returns></returns>
        public static PluginDescriptorCollection CreatePluginDescriptors(TypeCollection types)
        {
            var descriptors = new PluginDescriptorCollection();

            foreach (Type type in types)
            {
                try
                {
                    CairoLogger.Instance.Debug(string.Format("Creating PluginDescriptor, Type: '{0}'.", type.FullName));

                    var descriptor = new PluginDescriptor(type);

                    descriptors.Add(descriptor);
                }
                catch (Exception ex)
                {
                    CairoLogger.Instance.Debug(ex.Message, ex);
                }
            }
            return(descriptors);
        }