本文整理汇总了C#中Pash.Implementation.ProviderRuntime.HasFilters方法的典型用法代码示例。如果您正苦于以下问题:C# ProviderRuntime.HasFilters方法的具体用法?C# ProviderRuntime.HasFilters怎么用?C# ProviderRuntime.HasFilters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pash.Implementation.ProviderRuntime
的用法示例。
在下文中一共展示了ProviderRuntime.HasFilters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get
// actual work with callid the providers
internal void Get(string[] paths, bool recurse, ProviderRuntime runtime)
{
// the include/exclude filters apply to the results, not to the globbing process. Make this sure
runtime.IgnoreFiltersForGlobbing = true;
// globbing is here a little more complicated, so we do it "manually" (without GlobAndInvoke)
foreach (var curPath in paths)
{
var path = curPath;
// if the path won't be globbed or filtered, we will directly list it's child
var listChildsWithoutRecursion = !Globber.ShouldGlob(path, runtime) && !runtime.HasFilters();
// the Path might be a mixture of a path and an include filter
bool clearIncludeFilter;
path = SplitFilterFromPath(path, recurse, runtime, out clearIncludeFilter);
// now perform the actual globbing
CmdletProvider provider;
var globbed = Globber.GetGlobbedProviderPaths(path, runtime, out provider);
var containerProvider = CmdletProvider.As<ContainerCmdletProvider>(provider);
var filter = new IncludeExcludeFilter(runtime.Include, runtime.Exclude, false);
foreach (var globPath in globbed)
{
try
{
// if we need to actively filter that stuff, we have to handle the recursion manually
if (!filter.CanBeIgnored)
{
ManuallyGetChildItems(containerProvider, globPath, recurse, filter, runtime);
return;
}
// otherwise just get the child items / the item directly
if (recurse || listChildsWithoutRecursion)
{
GetItemOrChildItems(containerProvider, globPath, recurse, runtime);
return;
}
// no recursion and globbing was performed: get the item, not the child items
containerProvider.GetItem(globPath, runtime);
}
catch (Exception e)
{
HandleCmdletProviderInvocationException(e);
}
}
// clean up the include filter of the runtime for the next item, if we split a filter from the path
if (clearIncludeFilter)
{
runtime.Include.Clear();
}
}
}