naudio / NAudio

Audio and MIDI library for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AudioFileReader : Read zip file as audio

LiuYunPlayer opened this issue · comments

As shown in the code below, I tried to use AudioFileReader to read the file to determine whether it was an audio file by whether it threw an exception. However, when I used it to read the zip file, I was surprised to find that it threw no exception.

public static bool TryGetAudioInfo(string path, [NotNullWhen(true)] out AudioInfo audioInfo)
{
    audioInfo = new AudioInfo();
    try
    {
        using (var reader = new AudioFileReader(path))
        {
            audioInfo.duration = reader.TotalTime.TotalSeconds;
            return true;
        }
    }
    catch
    {
        return false; 
    }
}

OpenSVIP4TuneLab-v1.0.0.zip

When I tried to debug it, I got this:
C`PCJGBC@C}313U{@_UR($F

NAudio version: 2.2.1