Windows操作系统|Win10竟会损坏用户文件!教你解决这个Bug( 二 )
$MD5HashBytes = New-Object byte[] 16
$stream.Read($MD5HashBytes, 0, $MD5HashBytes.Length)
$MD5Hash = [Guid]($MD5HashBytes)
if ($sampleRate -eq 0)
{
return $false
}
【Windows操作系统|Win10竟会损坏用户文件!教你解决这个Bug】# 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)
}
# 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、保存文件,在“另存为”对话框中,将目录定位到你想要保存PowerShell脚本的位置;
4、在文件名输入框中,输入“FixFlacFiles.ps1”,将另存为文件的类型更改为Text Documents (*.txt);
5、进入到你保存该PowerShell脚本的目录;
6、右键点击刚刚保存的脚本,然后选择“使用PowerShell运行”;
7、出现提示时,输入无法播放的Flac文件的文件名,然后按下回车键 。
微软建议大家安装本月推送的可选累积更新,以避免修改Flac文件metadata出现的问题 。
文章图片
推荐阅读
- 操作系统|6年来首次更新 FreeDos系统新版下载:仅需20MB
- 微软|真正从头开始 消息称微软Windows 12系统与Win10/11大不同
- Windows操作系统|性能提升4倍 内存占用率暴降!Win11改进细节:UI响应速度最高提升76%
- 微软|新Windows就要来了!曝微软计划开展Win12开发工作
- Windows操作系统|实用经典功能回归!Win11文件管理器迎来大改
- Windows操作系统|不符合条件Win10设备升Win11:微软这手段着实不爽 在桌面打水印
- Windows|Windows 11加入多项新功能:“快速访问”能固定文件了
- 微软|Windows 11的某些功能 可能永远不会成真
- 联想|打通Windows与安卓壁垒!联想拯救者手机/平板/PC将支持“超级互联”
- Windows操作系统|性能提升4倍:内存占用率暴降!Windows 11大改进不杀进程
