-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.class.ps1
35 lines (23 loc) · 910 Bytes
/
test.class.ps1
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
using namespace System.Xml.Linq
class testinstance {
[string]$txt
[string]$name
hidden [string]$path="c:\users\adminnistrator\my-modules\import-xml\xml\test.xml"
[void] DoInit( [pscustomobject]$pscustomobject){
$pscustomobjectName= (($pscustomobject)|Get-Member -Type NoteProperty ).Name
foreach($propertyName in $pscustomobjectName ){
$this.$Propertyname= $pscustomobject.$Propertyname
}
}
script ($pscustomobject){
$this.doinit($pscustomobject)
}
[object] save(){
$object=[XElement]::new("object",
[XAttribute]::new("type","testinstance"),
[XElement]::new("property",[XAttribute]::new("name","txt"),$this.txt),
[XElement]::new("property",[XAttribute]::new("name","name"),$this.name)
)
return $object.ToString()
}
}