-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
-Show compistion doesn't work when static methods #108
Labels
bug
Something isn't working
Comments
Another example: Enum RunSourceType {
json
xml
database
}
Class PCCRunDocument {
[String]$ComputerName
[String]$PackageName
[DateTime]$Executiondate
[RunSourceType]$FileType
[Object]$Data
Hidden [String]$Source
#[PCCRunDocument]::New('C:\Users\taavast3\OneDrive\Repo\Projects\Clients\Swisscom\ESC\PCCComplianceChecks\Tests\PCC_SAGITTA5170017_PCC.chk.esc.win.spdn_20191023-172317.json')
PccRunDocument([system.io.fileInfo]$Document){
$d = $Document.Name.Split('_')
$This.ComputerName = $d[1]
$This.PackageName = $d[2]
If($d[3] -match "^(?'year'\d{4})(?'month'\d{2})(?'day'\d{2})-(?'hour'\d{2})(?'minute'\d{2})(?'second'\d{2}).*$"){
$this.Executiondate = Get-date -Year $Matches.Year -Month $Matches.Month -Day $Matches.Day -Hour $Matches.Hour -Minute $Matches.minute -Second $Matches.second
}
$This.FileType = $Document.Extension.Replace(".","")
$this.Data = gc $Document.FullName | ConvertFrom-Json
$This.Source = $Document
}
<#
static [PccRunDocument[]] GetPccRunDocument([System.IO.DirectoryInfo]$Folder){
$RunDocuments = Find-pccRunDocument -Path $Folder
$AllDocuments = @()
Foreach($Doc in $RunDocuments){
$AllDocuments = [PCCRunDocument]::New($Doc)
}
Return $AllDocuments
}
#>
}
Class PCCRunDocumentFactory{
<#
static [PCCRunDocument[]] Create([String]$Path){
$Item = Get-Item -Path $Path
$Return = @()
Switch($Item.GetType().FullName){
"system.io.FileInfo"{
$Return += [PCCRunDocument]::New($Item)
}
"system.io.DirectoryInfo"{
$Files = Find-pccRunDocument -Path $Item.FullName
Foreach($File in $Files){
$Return += [PCCRunDocument]::New($File)
}
}
}
return $Return
}
#>
static [PCCRunDocuments] Create([String]$Path){
$Item = Get-Item -Path $Path
$Return = [PccRunDocuments]::New()
Switch($Item.GetType().FullName){
"system.io.FileInfo"{
$Return.AddRunDocument([PCCRunDocument]::New($Item))
}
"system.io.DirectoryInfo"{
$Files = Find-pccRunDocument -Path $Item.FullName
Foreach($File in $Files){
$Return.AddRunDocument([PCCRunDocument]::New($File))
}
}
}
return $Return
}
}
Class PCCRunDocuments {
[System.Collections.Generic.List[PCCRunDocument]]$RunDocuments = @()
PccRunDocuments(){
}
AddRunDocument([PccRunDocument[]]$Document){
Foreach($doc in $Document){
$this.RunDocuments.Add($doc)
}
}
[System.Collections.Generic.List[PCCRunDocument]]GetRunDocuments(){
return $This.RunDocuments
}
[PCCRunDocument[]] GetRunDocumentsOfComputer([String]$ComputerName){
$Return = @()
$Return += $This.RunDocuments | ? {$_.ComputerName -eq $ComputerName}
return $Return
}
[PCCRunDocument[]] GetRunDocumentsOfPackage([String]$PackageName){
$Return = @()
$Return += $This.RunDocuments | ? {$_.PackageName -eq $PackageName}
return $Return
}
} REturns
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Result of image below
The text was updated successfully, but these errors were encountered: