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""

foreach( $k in  $data.Keys | sort) {
    $a = $data[$k]
    $line = ""
    for( $i=0; $i -lt $a.Count; $i += 1) {
        if ($a[$i] -eq 0) {
            $line = $line + $OFF_CHAR
            continue
        }
        if ($a[$i] -eq 1) {
            $line = $line + $ON_CHAR
            continue
        }
        $line = $line + $NG_CHAR
    }
    Write-Host ("{0:00}  {1}" -f ([int]$k + 1), $line)
}

Write-Host ""

コメント