{
return $ false
}
# Passing these checks means that we likely have a stream info header and can rebuild the file
Write-Output "File Stream Information"
Write-Output "Sample Rate: $ sampleRate"
Write-Output "Audio Channels: $ channelCount"
Write-Output "Sample Depth: $ bitsPerSample"
Write-Output "MD5 Audio Sample Hash: $ MD5Hash"
return $ true
}
if ($ choice -eq 0)
{
Copy-Item $ FullPath -Destination $ BackupLocation -Force
$ stream = [System.IO.File]::Open( $ FullPath, [System.IO.FileMode]::Open)
$ stream.Seek(4, [System.IO.SeekOrigin]::Begin)
while ($ stream.ReadByte() -eq 0) {}
# We now need to figure out where a valid FLAC metadata frame begins
# We are likely pointing to the last byte of the size member so we'll seek back 4 bytes and retry
$ flacDataStartPosition = $ stream.Position - 4
$ stream.Seek( $ flacDataStartPosition, [System.IO.SeekOrigin]::Begin)
while (-not(ParseStreamInfoMetadataBlock( $ stream)))
{
$ flacDataStartPosition = $ flacDataStartPosition + 1
$ stream.Seek( $ flacDataStartPosition, [System.IO.SeekOrigin]::Begin)
【Windows|Windows 10 BUG會破壞FLAC音頻文件 現已修復】}
# Insert the start code
$ stream.Seek( $ flacDataStartPosition, [System.IO.SeekOrigin]::Begin)
if (Test-Path "$ FullPath.tmp")
{
Remove-Item "$ FullPath.tmp"
}
$ fixedStream = [System.IO.File]::Open(" $ FullPath.tmp", [System.IO.FileMode]::CreateNew)
[byte[]] $ startCode = [char[]]('f', 'L', 'a', 'C');
$ fixedStream.Write( $ startCode, 0, $ startCode.Length)
$ stream.CopyTo( $ fixedStream)
$ stream.Close()
$ fixedStream.Close()
Move-Item -Force "$ FullPath.tmp" $ FullPath
}
3. 文件菜單上,點擊保存 。
4. 在 "另存為 "對話框中,找到你要保存PowerShell腳本的文件夾 。
5. 在文件名框中,輸入FixFlacFiles.ps1,將保存類型框改為文本文檔(*.txt),然后點擊保存 。
6. 在Windows Explorer中,找到你保存的PowerShell腳本 。
7. 右鍵單擊該腳本,然后單擊用PowerShell運行 。
8. 當有提示時,輸入無法播放的FLAC文件的文件名,然后按回車鍵 。
推薦閱讀
- 為什么人會有挖掘規律把一個事物做到極限的傾向
- 為什么貓會把舍友當成主人
- 怎樣煮粥才不會稀?
- 如何評價正在播放的由庵野秀明主導的日本動畫人博覽會
- 女人一生總會遇到這種疼
- 輕微痛風會自愈嗎?感覺痛風要犯了怎么辦?
- 螺螄粉對身體有害嗎?螺螄粉為什么會這么臭?
- 黑果花楸吃多了會怎么樣?黑果花楸泡水的禁忌
- 為什么花生油冬天會有絮狀?怎樣鑒別純正花生油真假
- 蕨菜什么情況下吃了會中毒?蕨菜如何保鮮才不容易變質
