@@ -2586,6 +2586,67 @@ foreach ($psProperty in $theseProperties) {
2586
2586
<Members >
2587
2587
</Members >
2588
2588
</Type >
2589
+ <Type >
2590
+ <Name >Namespace</Name >
2591
+ <Members >
2592
+ <ScriptProperty >
2593
+ <Name >Pattern</Name >
2594
+ <GetScriptBlock >
2595
+ < #
2596
+ .SYNOPSIS
2597
+ Gets the namespace pattern.
2598
+ .DESCRIPTION
2599
+ Gets the pattern of a namespace object.
2600
+ #>
2601
+ # If we already have a cached .Pattern, return it.
2602
+ if ($this.'.Pattern') {
2603
+ return $this.'.Pattern'
2604
+ }
2605
+
2606
+ # Several types of objects can be used directly as patterns.
2607
+ # These patterns can still be overridden by setting the .Pattern property.
2608
+ # (in fact, that's also how they are set)
2609
+
2610
+ # If we are actually a regex, set the .Pattern property and return.
2611
+ if ($this -is [regex]) {
2612
+ $this.Pattern = "$this"
2613
+ }
2614
+
2615
+ # If we are a URI, set the .Pattern property to the URI pattern.
2616
+ if ($this -is [uri]) {
2617
+ $this.Pattern = [regex]::Escape("$($this.DnsSafeHost)")
2618
+ }
2619
+
2620
+ if ($this.Name) {
2621
+ $this.Pattern = "^$([Regex]::Escape($this.Name))"
2622
+ }
2623
+ else {
2624
+ $this.Pattern = [regex]::Escape("$this")
2625
+ }
2626
+
2627
+ return $this.'.Pattern'
2628
+
2629
+ </GetScriptBlock >
2630
+ <SetScriptBlock >
2631
+ < #
2632
+ .SYNOPSIS
2633
+ Sets the namespace pattern.
2634
+ .DESCRIPTION
2635
+ Sets the pattern of a namespace object.
2636
+ #>
2637
+ param($value)
2638
+
2639
+ if (-not $Value) { return}
2640
+
2641
+ if ($value -isnot [regex]) {
2642
+ $value = [regex]::new($value,'IgnoreCase,IgnorePatternWhitespace','00:00:00.01')
2643
+ }
2644
+
2645
+ $this.psobject.properties.add([psnoteproperty]::new('.Pattern',$value), $true)
2646
+ </SetScriptBlock >
2647
+ </ScriptProperty >
2648
+ </Members >
2649
+ </Type >
2589
2650
<Type >
2590
2651
<Name >System.Management.Automation.Language.ParamBlockAst</Name >
2591
2652
<Members >
0 commit comments