File tree Expand file tree Collapse file tree 8 files changed +113
-0
lines changed
Expand file tree Collapse file tree 8 files changed +113
-0
lines changed Original file line number Diff line number Diff line change 1+ @ {
2+ FriendlyName = " DisplayName"
3+ ValueFromPipelineByPropertyName = " ByPropertyName"
4+ VBN = " ByPropertyName"
5+ VFPBN = " ByPropertyName"
6+ ValueByName = " ByPropertyName"
7+ VFP = " FromPipeline"
8+ ValueFromPipeline = " FromPipeline"
9+ ValueFromRemainingArguments = " FromUnbound"
10+ ValueFromRemaining = " FromUnbound"
11+ }
Original file line number Diff line number Diff line change 1+ foreach ($attr in $this.Attributes ) {
2+ $reflectedType = $attr.TypeName.GetReflectionType ()
3+ if ($reflectedType -ne [Management.Automation.ParameterAttribute ]) {
4+ continue
5+ }
6+ foreach ($namedArgument in $attr.NamedArguments ) {
7+ if ($namedArgument.ArgumentName -ne ' ValueFromPipelineByPropertyName' ) {
8+ continue
9+ }
10+ if ($namedArgument.Argument -and $namedArgument.Argument.Value ) {
11+ return $true
12+ } elseif (-not $namedArgument.Argument ) {
13+ return $true
14+ }
15+ }
16+ }
17+
18+ return $false
Original file line number Diff line number Diff line change 1+ foreach ($attr in $this.Attributes ) {
2+ $reflectedType = $attr.TypeName.GetReflectionType ()
3+ if ($reflectedType -ne [Management.Automation.ParameterAttribute ]) {
4+ continue
5+ }
6+ foreach ($namedArgument in $attr.NamedArguments ) {
7+ if ($namedArgument.ArgumentName -ne ' ValueFromPipeline' ) {
8+ continue
9+ }
10+ if ($namedArgument.Argument -and $namedArgument.Argument.Value ) {
11+ return $true
12+ } elseif (-not $namedArgument.Argument ) {
13+ return $true
14+ }
15+ }
16+ }
17+
18+ return $false
Original file line number Diff line number Diff line change 1+ $metadata = [Ordered ]@ {}
2+
3+ foreach ($attr in $this.Attributes ) {
4+ $reflectedType = $attr.TypeName.GetReflectionType ()
5+ if ($reflectedType -ne [Reflection.AssemblyMetadataAttribute ]) {
6+ continue
7+ }
8+ $key , $value =
9+ foreach ($positionalParameter in $attr.PositionalArguments ) {
10+ $positionalParameter.Value
11+ }
12+
13+ foreach ($namedArgument in $attr.NamedArguments ) {
14+ if ($namedArgument.ArgumentName -eq ' Key' ) {
15+ $key = $namedArgument.Argument.Value
16+ }
17+ elseif ($namedArgument.ArgumentName -eq ' Value' ) {
18+ $value = $namedArgument.Argument.Value
19+ }
20+ }
21+ if (-not $metadata [$key ]) {
22+ $metadata [$key ] = $value
23+ } else {
24+ $metadata [$key ] = @ ($metadata [$key ]) + $value
25+ }
26+ }
27+
28+ return $metadata
Original file line number Diff line number Diff line change 1+ $parameterSetNames = @ (foreach ($attr in $this.Attributes ) {
2+ $reflectedType = $attr.TypeName.GetReflectionType ()
3+ if ($reflectedType -ne [Management.Automation.ParameterAttribute ]) {
4+ continue
5+ }
6+ foreach ($namedArgument in $attr.NamedArguments ) {
7+ if ($namedArgument.ArgumentName -eq ' ParameterSetName' ) {
8+ $namedArgument.Argument.Value
9+ }
10+ }
11+ })
12+
13+ if ($parameterSetNames ) {
14+ $parameterSetNames -as [string []]
15+ } else {
16+ " __AllParameterSets" -as [string []]
17+ }
Original file line number Diff line number Diff line change 1+ $positions = @ (
2+ :nextAttribute foreach ($attr in $this.Attributes ) {
3+ $reflectedType = $attr.TypeName.GetReflectionType ()
4+ if ($reflectedType -ne [Management.Automation.ParameterAttribute ]) {
5+ continue
6+ }
7+ foreach ($namedArgument in $attr.NamedArguments ) {
8+ if ($namedArgument.ArgumentName -eq ' Position' ) {
9+ $namedArgument.Argument.Value
10+ continue nextAttribute
11+ }
12+ }
13+ })
14+
15+ if ($positions.Length -gt 1 ) {
16+ $positions -as [int []]
17+ } elseif ($positions ) {
18+ $positions [0 ]
19+ } else {
20+ $null
21+ }
You can’t perform that action at this time.
0 commit comments