// CLASS FUNCTIONS // search the class registry for a Plugin with the given name public static IPlugIn FindByName(String name) { if (String.IsNullOrEmpty(name) == false) { for (int i = 0; i < _itemsInRegistry; i++) { PlugIn pi = _registry[i]; String s = pi.Name; if (String.IsNullOrEmpty(s) && name == s) { return(pi); } } } return(null); }
// sort PlugIn registry by "selection order" public static void SortBySelectionOrder() { // I know, I know, just what the world needs: // another inline shell sort implementation... // starting at each of the first n-1 elements of the array for (int i = 0; i < _itemsInRegistry - 1; i++) { // scan over subsequent pairs, swapping if larger value is first for (int j = i + 1; j < _itemsInRegistry; j++) { float iKey = _registry[i].SelectionOrderSortKey; float jKey = _registry[j].SelectionOrderSortKey; if (iKey > jKey) { PlugIn temporary = _registry[i]; _registry[i] = _registry[j]; _registry[j] = temporary; } } } }
private static void SelectNextPlugin() { CloseSelectedPlugIn(); _selectedPlugIn = _selectedPlugIn.Next(); OpenSelectedPlugIn(); }
// select the "next" plug-in, cycling through "plug-in selection order" static void SelectDefaultPlugIn() { PlugIn.SortBySelectionOrder(); _selectedPlugIn = PlugIn.FindDefault(); }