/// <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) { Log.WriteLine("Sorting PluginDescriptor Collection. LeastDependentFirst: '{0}'.", leastDependentFirst.ToString()); PluginDescriptor[] descriptors = descriptorCollection.ToArray(); PluginDescriptor.Sort(descriptors, leastDependentFirst); descriptorCollection.Clear(); descriptorCollection.Add(descriptors); return(descriptorCollection); }
/// <summary> /// Creates PluginDescriptors from each Plugin Type specified. /// </summary> /// <param name="progressViewer">The callback object implementing IProgressViewer that will be used to monitor progress.</param> /// <param name="types">The collection of Plugin Types to create descriptors for.</param> /// <returns></returns> public static PluginDescriptorCollection CreatePluginDescriptors(IProgressViewer progressViewer, TypeCollection types) { PluginDescriptorCollection descriptors = new PluginDescriptorCollection(); foreach (Type type in types) { try { string message = string.Format("Creating PluginDescriptor, Type: '{0}'.", type.FullName); ProgressViewer.SetExtendedDescription(progressViewer, message); Log.WriteLine(message); PluginDescriptor descriptor = new PluginDescriptor(type); descriptors.Add(descriptor); } catch (Exception ex) { Log.WriteLine(ex); } } return(descriptors); }
/// <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) { Log.WriteLine("Sorting PluginDescriptor Collection. LeastDependentFirst: '{0}'.", leastDependentFirst.ToString()); PluginDescriptor[] descriptors = descriptorCollection.ToArray(); PluginDescriptor.Sort(descriptors, leastDependentFirst); descriptorCollection.Clear(); descriptorCollection.Add(descriptors); return descriptorCollection; }
/// <summary> /// Creates PluginDescriptors from each Plugin Type specified. /// </summary> /// <param name="progressViewer">The callback object implementing IProgressViewer that will be used to monitor progress.</param> /// <param name="types">The collection of Plugin Types to create descriptors for.</param> /// <returns></returns> public static PluginDescriptorCollection CreatePluginDescriptors(IProgressViewer progressViewer, TypeCollection types) { PluginDescriptorCollection descriptors = new PluginDescriptorCollection(); foreach (Type type in types) { try { string message = string.Format("Creating PluginDescriptor, Type: '{0}'.", type.FullName); ProgressViewer.SetExtendedDescription(progressViewer, message); Log.WriteLine(message); PluginDescriptor descriptor = new PluginDescriptor(type); descriptors.Add(descriptor); } catch(Exception ex) { Log.WriteLine(ex); } } return descriptors; }