private void ManuallyGetChildItems(ContainerCmdletProvider provider, string path, bool recurse, 
                                    IncludeExcludeFilter filter, ProviderRuntime runtime)
 {
     // recursively get child names of containers or just the current child if the filter accepts it
     if (recurse && Item.IsContainer(path, runtime))
     {
         ManuallyGetChildItemsFromContainer(provider, path, recurse, filter, runtime);
         return;
     }
     var childName = Path.ParseChildName(provider, path, runtime);
     if (filter.Accepts(childName))
     {
         provider.GetItem(path, runtime);
     }
 }
 private void ManuallyGetChildItemsFromContainer(ContainerCmdletProvider provider, string path, bool recurse, 
                                                 IncludeExcludeFilter filter, ProviderRuntime runtime)
 {
     // we deal with a container: get all child items (all containers if we recurse)
     Dictionary<string, bool> matches = null;
     // When a provider specific filter is set, and we need to recurse, we need to check recurse into all
     // containers, but just get those that match the internal filter. Therefore we construct a lookup dict.
     // Looking up in a dictionary whether or not the itemis a match should be faster than using a list
     // If there is no filter, then ReturnAllContainers and ReturnMatchingContainers don't differ
     if (!String.IsNullOrEmpty(runtime.Filter))
     {
         matches = GetValidChildNames(provider, path, ReturnContainers.ReturnMatchingContainers,
                                      runtime).ToDictionary(c => c, c => true);
     }
     var childNames = GetValidChildNames(provider, path, ReturnContainers.ReturnAllContainers, runtime);
     foreach (var childName in childNames)
     {
         var childPath = Path.Combine(provider, path, childName, runtime);
         // if the filter accepts the child (leaf or container) and it's potentially a filter match, get it
         if (filter.Accepts(childName) && (matches == null || matches.ContainsKey(childName)))
         {
             provider.GetItem(childPath, runtime);
         }
         // if we need to recurse and deal with a container, dive into it
         if (recurse && Item.IsContainer(childPath, runtime))
         {
             ManuallyGetChildItemsFromContainer(provider, childPath, true, filter, runtime);
         }
     }
 }
 private void GetItemOrChildItems(ContainerCmdletProvider provider, string path, bool recurse, ProviderRuntime runtime)
 {
     // If path identifies a container it gets all child items (recursively or not). Otherwise it returns the leaf
     if (Item.IsContainer(provider, path, runtime))
     {
         provider.GetChildItems(path, recurse, runtime);
         return;
     }
     provider.GetItem(path, runtime);
 }