/********************************************************************++ Copyright (c) Microsoft Corporation. All rights reserved. --********************************************************************/ using System; using System.Management.Automation; using Dbg = System.Management.Automation; namespace Microsoft.PowerShell.Commands { /// /// The base class for the */property commands that also take /// a passthrough parameter /// public class PassThroughItemPropertyCommandBase : ItemPropertyCommandBase { #region Parameters /// /// Gets or sets the passthrough parameter to the command /// [Parameter] public SwitchParameter PassThru { get { return _passThrough; } // get set { _passThrough = value; } // set } // PassThru /// /// Gets or sets the force property /// /// /// /// Gives the provider guidance on how vigorous it should be about performing /// the operation. If true, the provider should do everything possible to perform /// the operation. If false, the provider should attempt the operation but allow /// even simple errors to terminate the operation. /// For example, if the user tries to copy a file to a path that already exists and /// the destination is read-only, if force is true, the provider should copy over /// the existing read-only file. If force is false, the provider should write an error. /// /// [Parameter] public override SwitchParameter Force { get { return base.Force; } set { base.Force = value; } } // Force #endregion Parameters #region parameter data /// /// Determines if the property returned from the provider should /// be passed through to the pipeline. /// private bool _passThrough; #endregion parameter data #region protected members /// /// Determines if the provider for the specified path supports ShouldProcess /// /// protected override bool ProviderSupportsShouldProcess { get { return base.DoesProviderSupportShouldProcess(base.paths); } } /// /// Initializes a CmdletProviderContext instance to the current context of /// the command. /// /// /// /// A CmdletProviderContext instance initialized to the context of the current /// command. /// /// internal CmdletProviderContext GetCurrentContext() { CmdletProviderContext currentCommandContext = CmdletProviderContext; currentCommandContext.PassThru = PassThru; return currentCommandContext; } // GetCurrentContext #endregion protected members } // PassThroughItemPropertyCommandBase } // namespace Microsoft.PowerShell.Commands