forked from PowerShell/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPassThroughPropertyCommandBase.cs
More file actions
102 lines (88 loc) · 2.98 KB
/
Copy pathPassThroughPropertyCommandBase.cs
File metadata and controls
102 lines (88 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System.Management.Automation;
namespace Microsoft.PowerShell.Commands
{
/// <summary>
/// The base class for the */property commands that also take
/// a passthrough parameter.
/// </summary>
public class PassThroughItemPropertyCommandBase : ItemPropertyCommandBase
{
#region Parameters
/// <summary>
/// Gets or sets the passthrough parameter to the command.
/// </summary>
[Parameter]
public SwitchParameter PassThru
{
get
{
return _passThrough;
}
set
{
_passThrough = value;
}
}
/// <summary>
/// Gets or sets the force property.
/// </summary>
/// <remarks>
/// 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.
/// </remarks>
[Parameter]
public override SwitchParameter Force
{
get
{
return base.Force;
}
set
{
base.Force = value;
}
}
#endregion Parameters
#region parameter data
/// <summary>
/// Determines if the property returned from the provider should
/// be passed through to the pipeline.
/// </summary>
private bool _passThrough;
#endregion parameter data
#region protected members
/// <summary>
/// Determines if the provider for the specified path supports ShouldProcess.
/// </summary>
/// <value></value>
protected override bool ProviderSupportsShouldProcess
{
get
{
return base.DoesProviderSupportShouldProcess(base.paths);
}
}
/// <summary>
/// Initializes a CmdletProviderContext instance to the current context of
/// the command.
/// </summary>
/// <returns>
/// A CmdletProviderContext instance initialized to the context of the current
/// command.
/// </returns>
internal CmdletProviderContext GetCurrentContext()
{
CmdletProviderContext currentCommandContext = CmdletProviderContext;
currentCommandContext.PassThru = PassThru;
return currentCommandContext;
}
#endregion protected members
}
}