{
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文件的文件名,然后按回车键 。
推荐阅读
- 为什么人会有挖掘规律把一个事物做到极限的倾向
- 为什么猫会把舍友当成主人
- 怎样煮粥才不会稀?
- 如何评价正在播放的由庵野秀明主导的日本动画人博览会
- 女人一生总会遇到这种疼
- 轻微痛风会自愈吗?感觉痛风要犯了怎么办?
- 螺蛳粉对身体有害吗?螺蛳粉为什么会这么臭?
- 黑果花楸吃多了会怎么样?黑果花楸泡水的禁忌
- 为什么花生油冬天会有絮状?怎样鉴别纯正花生油真假
- 蕨菜什么情况下吃了会中毒?蕨菜如何保鲜才不容易变质