MegaBites-AI/Windows-powershell
0372
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4using System.Collections.ObjectModel;5 6using Dbg = System.Management.Automation;7 8namespace System.Management.Automation9{10 /// <summary>11 /// Exposes the Children noun of the Cmdlet Providers to the Cmdlet base class. The methods of this class12 /// use the providers to perform operations.13 /// </summary>14 public sealed class ChildItemCmdletProviderIntrinsics15 {16 #region Constructors17 18 /// <summary>19 /// Hide the default constructor since we always require an instance of SessionState.20 /// </summary>21 private ChildItemCmdletProviderIntrinsics()22 {23 Dbg.Diagnostics.Assert(24 false,25 "This constructor should never be called. Only the constructor that takes an instance of SessionState should be called.");26 }27 28 /// <summary>29 /// Constructs a facade over the "real" session state API.30 /// </summary>31 /// <param name="cmdlet">32 /// An instance of the cmdlet that this class is acting as a facade for.33 /// </param>34 internal ChildItemCmdletProviderIntrinsics(Cmdlet cmdlet)35 {36 if (cmdlet == null)37 {38 throw PSTraceSource.NewArgumentNullException(nameof(cmdlet));39 }40 41 _cmdlet = cmdlet;42 _sessionState = cmdlet.Context.EngineSessionState;43 }44 45 /// <summary>46 /// Constructs a facade over the "real" session state API.47 /// </summary>48 /// <param name="sessionState">49 /// An instance of the "real" session state.50 /// </param>51 /// <exception cref="ArgumentNullException">52 /// If <paramref name="sessionState"/> is null.53 /// </exception>54 internal ChildItemCmdletProviderIntrinsics(SessionStateInternal sessionState)55 {56 if (sessionState == null)57 {58 throw PSTraceSource.NewArgumentNullException(nameof(sessionState));59 }60 61 _sessionState = sessionState;62 }63 #endregion Constructors64 65 #region Public methods66 67 #region GetChildItems68 69 /// <summary>70 /// Gets the child items of the container at the given path.71 /// </summary>72 /// <param name="path">73 /// The path to the item to retrieve. It may be a drive or provider-qualified path and may include74 /// glob characters.75 /// </param>76 /// <param name="recurse">77 /// If true, gets all the children in all the sub-containers of the specified78 /// container. If false, only gets the immediate children of the specified79 /// container.80 /// </param>81 /// <returns>82 /// The children of the container at the specified path. The type of the objects returned are83 /// determined by the provider that supports the given path.84 /// </returns>85 /// <exception cref="ArgumentNullException">86 /// If <paramref name="path"/> or <paramref name="context"/> is null.87 /// </exception>88 /// <exception cref="ProviderNotFoundException">89 /// If the <paramref name="path"/> refers to a provider that could not be found.90 /// </exception>91 /// <exception cref="DriveNotFoundException">92 /// If the <paramref name="path"/> refers to a drive that could not be found.93 /// </exception>94 /// <exception cref="ItemNotFoundException">95 /// If <paramref name="path"/> does not contain glob characters and96 /// could not be found.97 /// </exception>98 /// <exception cref="NotSupportedException">99 /// If the provider that the <paramref name="path"/> refers to does100 /// not support this operation.101 /// </exception>102 /// <exception cref="ProviderInvocationException">103 /// If the provider threw an exception.104 /// </exception>105 public Collection<PSObject> Get(string path, bool recurse)106 {107 Dbg.Diagnostics.Assert(108 _sessionState != null,109 "The only constructor for this class should always set the sessionState field");110 111 // Parameter validation is done in the session state object112 113 return _sessionState.GetChildItems(new string[] { path }, recurse, uint.MaxValue, false, false);114 }115 116 /// <summary>117 /// Gets the child items of the container at the given path(s).118 /// </summary>119 /// <param name="path">120 /// The path(s) to the item(s) to retrieve. They may be drive or provider-qualified paths and may include121 /// glob characters.122 /// </param>123 /// <param name="recurse">124 /// If true, gets all the children in all the sub-containers of the specified125 /// container. If false, only gets the immediate children of the specified126 /// container.127 /// </param>128 /// <param name="depth">129 /// Limits the depth of recursion; uint.MaxValue performs full recursion.130 /// </param>131 /// <param name="force">132 /// Passed on to providers to force operations.133 /// </param>134 /// <param name="literalPath">135 /// If true, globbing is not done on paths.136 /// </param>137 /// <returns>138 /// The children of the container at the specified path. The type of the objects returned are139 /// determined by the provider that supports the given path.140 /// </returns>141 /// <exception cref="ArgumentNullException">142 /// If <paramref name="path"/> or <paramref name="context"/> is null.143 /// </exception>144 /// <exception cref="ProviderNotFoundException">145 /// If the <paramref name="path"/> refers to a provider that could not be found.146 /// </exception>147 /// <exception cref="DriveNotFoundException">148 /// If the <paramref name="path"/> refers to a drive that could not be found.149 /// </exception>150 /// <exception cref="ItemNotFoundException">151 /// If <paramref name="path"/> does not contain glob characters and152 /// could not be found.153 /// </exception>154 /// <exception cref="NotSupportedException">155 /// If the provider that the <paramref name="path"/> refers to does156 /// not support this operation.157 /// </exception>158 /// <exception cref="ProviderInvocationException">159 /// If the provider threw an exception.160 /// </exception>161 public Collection<PSObject> Get(string[] path, bool recurse, uint depth, bool force, bool literalPath)162 {163 Dbg.Diagnostics.Assert(164 _sessionState != null,165 "The only constructor for this class should always set the sessionState field");166 167 // Parameter validation is done in the session state object168 169 return _sessionState.GetChildItems(path, recurse, depth, force, literalPath);170 }171 172 /// <summary>173 /// Gets the child items of the container at the given path(s).174 /// </summary>175 /// <param name="path">176 /// The path(s) to the item(s) to retrieve. They may be drive or provider-qualified paths and may include177 /// glob characters.178 /// </param>179 /// <param name="recurse">180 /// If true, gets all the children in all the sub-containers of the specified181 /// container. If false, only gets the immediate children of the specified182 /// container.183 /// </param>184 /// <param name="force">185 /// Passed on to providers to force operations.186 /// </param>187 /// <param name="literalPath">188 /// If true, globbing is not done on paths.189 /// </param>190 /// <returns>191 /// The children of the container at the specified path. The type of the objects returned are192 /// determined by the provider that supports the given path.193 /// </returns>194 /// <exception cref="ArgumentNullException">195 /// If <paramref name="path"/> or <paramref name="context"/> is null.196 /// </exception>197 /// <exception cref="ProviderNotFoundException">198 /// If the <paramref name="path"/> refers to a provider that could not be found.199 /// </exception>200 /// <exception cref="DriveNotFoundException">201 /// If the <paramref name="path"/> refers to a drive that could not be found.202 /// </exception>203 /// <exception cref="ItemNotFoundException">204 /// If <paramref name="path"/> does not contain glob characters and205 /// could not be found.206 /// </exception>207 /// <exception cref="NotSupportedException">208 /// If the provider that the <paramref name="path"/> refers to does209 /// not support this operation.210 /// </exception>211 /// <exception cref="ProviderInvocationException">212 /// If the provider threw an exception.213 /// </exception>214 public Collection<PSObject> Get(string[] path, bool recurse, bool force, bool literalPath)215 {216 Dbg.Diagnostics.Assert(217 _sessionState != null,218 "The only constructor for this class should always set the sessionState field");219 220 // Parameter validation is done in the session state object221 222 return this.Get(path, recurse, uint.MaxValue, force, literalPath);223 }224 225 /// <summary>226 /// Gets the child items of the container at the given path.227 /// </summary>228 /// <param name="path">229 /// The path to the item to retrieve. It may be a drive or provider-qualified path and may include230 /// glob characters.231 /// </param>232 /// <param name="recurse">233 /// If true, gets all the children in all the sub-containers of the specified234 /// container. If false, only gets the immediate children of the specified235 /// container.236 /// </param>237 /// <param name="depth">238 /// Limits the depth of recursion; uint.MaxValue performs full recursion.239 /// </param>240 /// <param name="context">241 /// The context under which the command is running.242 /// </param>243 /// <returns>244 /// Nothing. The children of the container at the specified path are written to the context.245 /// </returns>246 /// <exception cref="ArgumentNullException">247 /// If <paramref name="path"/> or <paramref name="context"/> is null.248 /// </exception>249 /// <exception cref="ProviderNotFoundException">250 /// If the <paramref name="path"/> refers to a provider that could not be found.251 /// </exception>252 /// <exception cref="DriveNotFoundException">253 /// If the <paramref name="path"/> refers to a drive that could not be found.254 /// </exception>255 /// <exception cref="ItemNotFoundException">256 /// If <paramref name="path"/> does not contain glob characters and257 /// could not be found.258 /// </exception>259 /// <exception cref="NotSupportedException">260 /// If the provider that the <paramref name="path"/> refers to does261 /// not support this operation.262 /// </exception>263 /// <exception cref="ProviderInvocationException">264 /// If the provider threw an exception.265 /// </exception>266 internal void Get(267 string path,268 bool recurse,269 uint depth,270 CmdletProviderContext context)271 {272 Dbg.Diagnostics.Assert(273 _sessionState != null,274 "The only constructor for this class should always set the sessionState field");275 276 // Parameter validation is done in the session state object277 278 _sessionState.GetChildItems(path, recurse, depth, context);279 }280 281 /// <summary>282 /// Gets the dynamic parameters for the get-childitem cmdlet.283 /// </summary>284 /// <param name="path">285 /// The path to the item if it was specified on the command line.286 /// </param>287 /// <param name="recurse">288 /// If true, gets all the children in all the sub-containers of the specified289 /// container. If false, only gets the immediate children of the specified290 /// container.291 /// </param>292 /// <param name="context">293 /// The context which the core command is running.294 /// </param>295 /// <returns>296 /// An object that has properties and fields decorated with297 /// parsing attributes similar to a cmdlet class.298 /// </returns>299 /// <exception cref="ProviderNotFoundException">300 /// If the <paramref name="path"/> refers to a provider that could not be found.301 /// </exception>302 /// <exception cref="DriveNotFoundException">303 /// If the <paramref name="path"/> refers to a drive that could not be found.304 /// </exception>305 /// <exception cref="ItemNotFoundException">306 /// If <paramref name="path"/> does not contain glob characters and307 /// could not be found.308 /// </exception>309 /// <exception cref="NotSupportedException">310 /// If the provider that the <paramref name="path"/> refers to does311 /// not support this operation.312 /// </exception>313 /// <exception cref="ProviderInvocationException">314 /// If the provider threw an exception.315 /// </exception>316 internal object GetChildItemsDynamicParameters(317 string path,318 bool recurse,319 CmdletProviderContext context)320 {321 Dbg.Diagnostics.Assert(322 _sessionState != null,323 "The only constructor for this class should always set the sessionState field");324 325 // Parameter validation is done in the session state object326 327 return _sessionState.GetChildItemsDynamicParameters(path, recurse, context);328 }329 330 #endregion GetChildItems331 332 #region GetChildNames333 334 /// <summary>335 /// Gets the child names of the container at the given path.336 /// </summary>337 /// <param name="path">338 /// The path to the item to retrieve. It may be a drive or provider-qualified path and may include339 /// glob characters.340 /// </param>341 /// <param name="returnContainers">342 /// Determines if all containers should be returned or only those containers that match the343 /// filter(s).344 /// </param>345 /// <param name="recurse">346 /// If true, gets all the relative paths of all the children347 /// in all the sub-containers of the specified348 /// container. If false, only gets the immediate child names of the specified349 /// container.350 /// </param>351 /// <returns>352 /// The children of the container at the specified path. The type of the objects returned are353 /// determined by the provider that supports the given path.354 /// </returns>355 /// <exception cref="ArgumentNullException">356 /// If <paramref name="path"/> or <paramref name="propertyToClear"/> is null.357 /// </exception>358 /// <exception cref="ProviderNotFoundException">359 /// If the <paramref name="path"/> refers to a provider that could not be found.360 /// </exception>361 /// <exception cref="DriveNotFoundException">362 /// If the <paramref name="path"/> refers to a drive that could not be found.363 /// </exception>364 /// <exception cref="ItemNotFoundException">365 /// If <paramref name="path"/> does not contain glob characters and366 /// could not be found.367 /// </exception>368 /// <exception cref="NotSupportedException">369 /// If the provider that the <paramref name="path"/> refers to does370 /// not support this operation.371 /// </exception>372 /// <exception cref="ProviderInvocationException">373 /// If the provider threw an exception.374 /// </exception>375 public Collection<string> GetNames(376 string path,377 ReturnContainers returnContainers,378 bool recurse)379 {380 Dbg.Diagnostics.Assert(381 _sessionState != null,382 "The only constructor for this class should always set the sessionState field");383 384 // Parameter validation is done in the session state object385 386 return _sessionState.GetChildNames(new string[] { path }, returnContainers, recurse, uint.MaxValue, false, false);387 }388 389 /// <summary>390 /// Gets the child names of the container at the given path.391 /// </summary>392 /// <param name="path">393 /// The path(s) to the item(s) to retrieve. They may be drive or provider-qualified paths and may include394 /// glob characters.395 /// </param>396 /// <param name="returnContainers">397 /// Determines if all containers should be returned or only those containers that match the398 /// filter(s).399 /// </param>400 /// <param name="recurse">401 /// If true, gets all the relative paths of all the children402 /// in all the sub-containers of the specified403 /// container. If false, only gets the immediate child names of the specified404 /// container.405 /// </param>406 /// <param name="force">407 /// Passed on to providers to force operations.408 /// </param>409 /// <param name="literalPath">410 /// If true, globbing is not done on paths.411 /// </param>412 /// <returns>413 /// The children of the container at the specified path. The type of the objects returned are414 /// determined by the provider that supports the given path.415 /// </returns>416 /// <exception cref="ArgumentNullException">417 /// If <paramref name="path"/> or <paramref name="propertyToClear"/> is null.418 /// </exception>419 /// <exception cref="ProviderNotFoundException">420 /// If the <paramref name="path"/> refers to a provider that could not be found.421 /// </exception>422 /// <exception cref="DriveNotFoundException">423 /// If the <paramref name="path"/> refers to a drive that could not be found.424 /// </exception>425 /// <exception cref="ItemNotFoundException">426 /// If <paramref name="path"/> does not contain glob characters and427 /// could not be found.428 /// </exception>429 /// <exception cref="NotSupportedException">430 /// If the provider that the <paramref name="path"/> refers to does431 /// not support this operation.432 /// </exception>433 /// <exception cref="ProviderInvocationException">434 /// If the provider threw an exception.435 /// </exception>436 public Collection<string> GetNames(437 string[] path,438 ReturnContainers returnContainers,439 bool recurse,440 bool force,441 bool literalPath)442 {443 Dbg.Diagnostics.Assert(444 _sessionState != null,445 "The only constructor for this class should always set the sessionState field");446 447 return _sessionState.GetChildNames(path, returnContainers, recurse, uint.MaxValue, force, literalPath);448 }449 450 /// <summary>451 /// Gets the child names of the container at the given path.452 /// </summary>453 /// <param name="path">454 /// The path(s) to the item(s) to retrieve. They may be drive or provider-qualified paths and may include455 /// glob characters.456 /// </param>457 /// <param name="returnContainers">458 /// Determines if all containers should be returned or only those containers that match the459 /// filter(s).460 /// </param>461 /// <param name="recurse">462 /// If true, gets all the relative paths of all the children463 /// in all the sub-containers of the specified464 /// container. If false, only gets the immediate child names of the specified465 /// container.466 /// </param>467 /// <param name="depth">468 /// Limits the depth of recursion; uint.MaxValue performs full recursion.469 /// </param>470 /// <param name="force">471 /// Passed on to providers to force operations.472 /// </param>473 /// <param name="literalPath">474 /// If true, globbing is not done on paths.475 /// </param>476 /// <returns>477 /// The children of the container at the specified path. The type of the objects returned are478 /// determined by the provider that supports the given path.479 /// </returns>480 /// <exception cref="ArgumentNullException">481 /// If <paramref name="path"/> or <paramref name="propertyToClear"/> is null.482 /// </exception>483 /// <exception cref="ProviderNotFoundException">484 /// If the <paramref name="path"/> refers to a provider that could not be found.485 /// </exception>486 /// <exception cref="DriveNotFoundException">487 /// If the <paramref name="path"/> refers to a drive that could not be found.488 /// </exception>489 /// <exception cref="ItemNotFoundException">490 /// If <paramref name="path"/> does not contain glob characters and491 /// could not be found.492 /// </exception>493 /// <exception cref="NotSupportedException">494 /// If the provider that the <paramref name="path"/> refers to does495 /// not support this operation.496 /// </exception>497 /// <exception cref="ProviderInvocationException">498 /// If the provider threw an exception.499 /// </exception>500 public Collection<string> GetNames(501 string[] path,502 ReturnContainers returnContainers,503 bool recurse,504 uint depth,505 bool force,506 bool literalPath)507 {508 Dbg.Diagnostics.Assert(509 _sessionState != null,510 "The only constructor for this class should always set the sessionState field");511 512 return _sessionState.GetChildNames(path, returnContainers, recurse, depth, force, literalPath);513 }514 515 /// <summary>516 /// Gets the child names of the container at the given path.517 /// </summary>518 /// <param name="path">519 /// The path to the item to retrieve. It may be a drive or provider-qualified path and may include520 /// glob characters.521 /// </param>522 /// <param name="returnContainers">523 /// Determines if all containers should be returned or only those containers that match the524 /// filter(s).525 /// </param>526 /// <param name="recurse">527 /// If true, gets all the relative paths of all the children528 /// in all the sub-containers of the specified529 /// container. If false, only gets the immediate child names of the specified530 /// container.531 /// </param>532 /// <param name="depth">533 /// Limits the depth of recursion; uint.MaxValue performs full recursion.534 /// </param>535 /// <param name="context">536 /// The context under which the command is running.537 /// </param>538 /// <returns>539 /// Nothing. The names of the children of the specified container are written to the context.540 /// </returns>541 /// <exception cref="ArgumentNullException">542 /// If <paramref name="path"/> or <paramref name="propertyToClear"/> is null.543 /// </exception>544 /// <exception cref="ProviderNotFoundException">545 /// If the <paramref name="path"/> refers to a provider that could not be found.546 /// </exception>547 /// <exception cref="DriveNotFoundException">548 /// If the <paramref name="path"/> refers to a drive that could not be found.549 /// </exception>550 /// <exception cref="ItemNotFoundException">551 /// If <paramref name="path"/> does not contain glob characters and552 /// could not be found.553 /// </exception>554 /// <exception cref="NotSupportedException">555 /// If the provider that the <paramref name="path"/> refers to does556 /// not support this operation.557 /// </exception>558 /// <exception cref="ProviderInvocationException">559 /// If the provider threw an exception.560 /// </exception>561 internal void GetNames(562 string path,563 ReturnContainers returnContainers,564 bool recurse,565 uint depth,566 CmdletProviderContext context)567 {568 Dbg.Diagnostics.Assert(569 _sessionState != null,570 "The only constructor for this class should always set the sessionState field");571 572 // Parameter validation is done in the session state object573 574 _sessionState.GetChildNames(path, returnContainers, recurse, depth, context);575 }576 577 /// <summary>578 /// Gets the dynamic parameters for the get-childitem -name cmdlet.579 /// </summary>580 /// <param name="path">581 /// The path to the item if it was specified on the command line.582 /// </param>583 /// <param name="context">584 /// The context which the core command is running.585 /// </param>586 /// <returns>587 /// An object that has properties and fields decorated with588 /// parsing attributes similar to a cmdlet class.589 /// </returns>590 /// <exception cref="ProviderNotFoundException">591 /// If the <paramref name="path"/> refers to a provider that could not be found.592 /// </exception>593 /// <exception cref="DriveNotFoundException">594 /// If the <paramref name="path"/> refers to a drive that could not be found.595 /// </exception>596 /// <exception cref="ItemNotFoundException">597 /// If <paramref name="path"/> does not contain glob characters and598 /// could not be found.599 /// </exception>600 /// <exception cref="NotSupportedException">601 /// If the provider that the <paramref name="path"/> refers to does602 /// not support this operation.603 /// </exception>604 /// <exception cref="ProviderInvocationException">605 /// If the provider threw an exception.606 /// </exception>607 internal object GetChildNamesDynamicParameters(608 string path,609 CmdletProviderContext context)610 {611 Dbg.Diagnostics.Assert(612 _sessionState != null,613 "The only constructor for this class should always set the sessionState field");614 615 // Parameter validation is done in the session state object616 617 return _sessionState.GetChildNamesDynamicParameters(path, context);618 }619 620 #endregion GetChildNames621 622 #region HasChildItems623 624 /// <summary>625 /// Determines if an item at the given path has children.626 /// </summary>627 /// <param name="path">628 /// The path to the item to determine if it has children. It may be a drive or provider-qualified path and may include629 /// glob characters.630 /// </param>631 /// <returns>632 /// True if the item at the specified path has children. False otherwise.633 /// </returns>634 /// <exception cref="ArgumentNullException">635 /// If <paramref name="path"/> is null.636 /// </exception>637 /// <exception cref="ProviderNotFoundException">638 /// If the <paramref name="path"/> refers to a provider that could not be found.639 /// </exception>640 /// <exception cref="DriveNotFoundException">641 /// If the <paramref name="path"/> refers to a drive that could not be found.642 /// </exception>643 /// <exception cref="ItemNotFoundException">644 /// If <paramref name="path"/> does not contain glob characters and645 /// could not be found.646 /// </exception>647 /// <exception cref="NotSupportedException">648 /// If the provider that the <paramref name="path"/> refers to does649 /// not support this operation.650 /// </exception>651 /// <exception cref="ProviderInvocationException">652 /// If the provider threw an exception.653 /// </exception>654 public bool HasChild(string path)655 {656 Dbg.Diagnostics.Assert(657 _sessionState != null,658 "The only constructor for this class should always set the sessionState field");659 660 // Parameter validation is done in the session state object661 662 return _sessionState.HasChildItems(path, false, false);663 }664 665 /// <summary>666 /// Determines if an item at the given path has children.667 /// </summary>668 /// <param name="path">669 /// The path to the item to determine if it has children. It may be a drive or provider-qualified path and may include670 /// glob characters.671 /// </param>672 /// <param name="force">673 /// Passed on to providers to force operations.674 /// </param>675 /// <param name="literalPath">676 /// If true, globbing is not done on paths.677 /// </param>678 /// <returns>679 /// True if the item at the specified path has children. False otherwise.680 /// </returns>681 /// <exception cref="ArgumentNullException">682 /// If <paramref name="path"/> is null.683 /// </exception>684 /// <exception cref="ProviderNotFoundException">685 /// If the <paramref name="path"/> refers to a provider that could not be found.686 /// </exception>687 /// <exception cref="DriveNotFoundException">688 /// If the <paramref name="path"/> refers to a drive that could not be found.689 /// </exception>690 /// <exception cref="ItemNotFoundException">691 /// If <paramref name="path"/> does not contain glob characters and692 /// could not be found.693 /// </exception>694 /// <exception cref="NotSupportedException">695 /// If the provider that the <paramref name="path"/> refers to does696 /// not support this operation.697 /// </exception>698 /// <exception cref="ProviderInvocationException">699 /// If the provider threw an exception.700 /// </exception>701 public bool HasChild(string path, bool force, bool literalPath)702 {703 Dbg.Diagnostics.Assert(704 _sessionState != null,705 "The only constructor for this class should always set the sessionState field");706 707 // Parameter validation is done in the session state object708 709 return _sessionState.HasChildItems(path, force, literalPath);710 }711 712 /// <summary>713 /// Determines if an item at the given path has children.714 /// </summary>715 /// <param name="path">716 /// The path to the item to determine if it has children. It may be a drive or provider-qualified path and may include717 /// glob characters.718 /// </param>719 /// <param name="context">720 /// The context under which the command is running.721 /// </param>722 /// <returns>723 /// True if the item at the specified path has children. False otherwise.724 /// </returns>725 /// <exception cref="ArgumentNullException">726 /// If <paramref name="path"/> is null.727 /// </exception>728 /// <exception cref="ProviderNotFoundException">729 /// If the <paramref name="path"/> refers to a provider that could not be found.730 /// </exception>731 /// <exception cref="DriveNotFoundException">732 /// If the <paramref name="path"/> refers to a drive that could not be found.733 /// </exception>734 /// <exception cref="ItemNotFoundException">735 /// If <paramref name="path"/> does not contain glob characters and736 /// could not be found.737 /// </exception>738 /// <exception cref="NotSupportedException">739 /// If the provider that the <paramref name="path"/> refers to does740 /// not support this operation.741 /// </exception>742 /// <exception cref="ProviderInvocationException">743 /// If the provider threw an exception.744 /// </exception>745 internal bool HasChild(746 string path,747 CmdletProviderContext context)748 {749 Dbg.Diagnostics.Assert(750 _sessionState != null,751 "The only constructor for this class should always set the sessionState field");752 753 // Parameter validation is done in the session state object754 755 return _sessionState.HasChildItems(path, context);756 }757 758 #endregion HasChildItems759 760 #endregion Public methods761 762 #region private data763 764 private readonly Cmdlet _cmdlet;765 private readonly SessionStateInternal _sessionState;766 767 #endregion private data768 }769 770 /// <summary>771 /// This enum determines which types of containers are returned from some of772 /// the provider methods.773 /// </summary>774 public enum ReturnContainers775 {776 /// <summary>777 /// Only containers that match the filter(s) are returned.778 /// </summary>779 ReturnMatchingContainers,780 781 /// <summary>782 /// All containers are returned even if they don't match the filter(s).783 /// </summary>784 ReturnAllContainers785 }786}787 