本帖最后由 idwma 于 2022-1-18 15:58 编辑
回复 23# 5i365 | $krc='test.krc' | | $krcbytes = gc $krc -enc byte | | $key = @(0x0040, 0x0047, 0x0061, 0x0077, 0x005e, 0x0032, 0x0074, 0x0047, 0x0051, 0x0036, 0x0031, 0x002d, 0x00ce, 0x00d2, 0x006e, 0x0069) | | [byte[]]$decompress_bytes = foreach($ch in $krcbytes[4..$krcbytes.count]){$ch -bxor $key[$i++ % 16]} | | $in = New-Object System.IO.MemoryStream( , $decompress_bytes ) | | $in.Position=2 | | $gzipStream = New-Object System.IO.Compression.DeflateStream $in, ([IO.Compression.CompressionMode]::Decompress) | | $buf = New-Object 'byte[]' 1024 | | [System.IO.MemoryStream] $out = New-Object System.IO.MemoryStream | | while ($($len = $gzipStream.Read($buf,0,$buf.length);$len) -gt 0){$out.Write($buf, 0, $len)} | | $gzipStream.Close() | | $out.Close() | | $tmp = $out.ToArray() | | $decode_bytes=[Text.Encoding]::utf8.GetString($tmp[0..$tmp.count]) -replace '<[^>]*>' | | sc -enc utf8 $($krc -replace '\.krc$','.lcr') $(foreach($match in ($decode_bytes -split '\n') -replace '^.*\[.*\]\s*$'){if($match -match '\[(\d*),\d*\]'){'[{0:mm:ss.ff}]{1}' -f [datetime]([int64]$matches[1]*10000),($match -replace '^\[\d*,\d*\]')}elseif($match -ne ''){$match}})COPY |
|