调用复制代码 - param(
- [int]$count
- )
-
- function get-idxReal() {
- param(
- [int]$count ,
- [int]$idxScan
- )
- $r = [math]::Ceiling( $idxScan / 4 )
- $c = $idxScan - ($r-1)*4
- $idxReal = switch( $c ) {
- 1 { $count/2 + 0 - ($r-1)*2 }
- 2 { $count/2 + 1 + ($r-1)*2 }
- 3 { $count/2 + 2 + ($r-1)*2 }
- 4 { $count/2 - 1 - ($r-1)*2 }
- }
- return $idxReal
- }
-
- $order = [System.Array]::CreateInstance([int], ($count + 1))
-
- if ( ($count % 4) -eq 0 ) {
- 1..$count | ForEach-Object {
- $order[$_] = get-idxReal $count $_
- }
- }
- $order[1..$count] -join ' '
复制代码
|