Combreal icon

objDumper.ps1

Combreal | PRO | 09/19/24 03:47:27 PM UTC (Edited) | 0 ⭐ | 14387 👁️ | Never ⏰ | []
PowerShell |

1.83 KB

|

None

|

0 👍

/

0 👎

[Console]::OutputEncoding = [System.Text.Encoding]::Default
 
Function Dump-Obj ($obj) {
    $finalOutput = ""
    $output = ""
    $output = $obj | Format-Custom | Out-String
    $output = $output -split "`n"
    Foreach ($line in $output) {
        If ($line.IndexOf('{') -eq -1 -And $line.IndexOf('}') -eq -1 -And $line.IndexOf('[') -eq -1 -And $line.IndexOf(']') -eq -1 -And $line -notlike "*class *" -And $line -notmatch '^\s*$') {
            $finalOutput += $line + "`n"
        }
    }
    $finalOutput = $finalOutput.Trim()
    Return $finalOutput
}
 
$cardGameDocumentation = New-Object -TypeName "PSObject" -Property @{
    'Definition' = "A card game is any game that uses playing cards as the primary device with which the game is played, whether the cards are of a traditional design or specifically created for the game.";
    'Links' = 'https://en.wikipedia.org/wiki/Card_game'
}
 
$murderDocumentation = New-Object -TypeName "PSObject" -Property @{
    'Definition' = "Murder is the unlawful killing of another human without justification or valid excuse committed with the necessary intention as defined by the law in a specific jurisdiction.";
    'Links' = 'https://en.wikipedia.org/wiki/Murder'
}
 
$userInterests = @()
$userInterest = New-Object -TypeName "PSObject" -Property @{
    'Name' = "Card game";
    'Requierement' = 'Good at math';
    'Documentation' = $cardGameDocumentation
}
$userInterests += $userInterest
 
$userInterest = New-Object -TypeName "PSObject" -Property @{
    'Name' = "Murder";
    'Requierement' = 'Cold blood';
    'Documentation' = $murderDocumentation
}
$userInterests += $userInterest
 
$userProfile = New-Object -TypeName "PSObject" -Property @{ 
    'Name' = "Tony";
    'Surname' = "Montana";
    'Date' = "01/12/1973";
    'Interests' = $userInterests        
}
 
Dump-Obj $userProfile

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎