public async void CheckFile() { StorageFolder storageFolder = KnownFolders.MusicLibrary; var checkFile = await storageFolder.TryGetItemAsync(this.Recorder.FileName); if (checkFile == null) { this.Info.Text = "Wav not recorded ..."; } else { StorageFile storageFile = await storageFolder.GetFileAsync(this.Recorder.FileName); var parser = new RiffParser(); // read file await Windows.System.Threading.ThreadPool.RunAsync( async (workItem) => { IRandomAccessStream stream = await storageFile.OpenAsync(FileAccessMode.Read); Stream sstream = stream.AsStream(); parser.OpenFile(sstream); // Define the processing delegates RiffParser.ProcessChunkElement pc = ProcessChunk; // Read all top level elements and chunks int size = parser.DataSize; while (size > 0) { // Prefix the line with the current top level type var info = (RiffParser.FromFourCC(parser.FileType) + " (" + size.ToString() + "): "); // Get the next element (if there is one) if (false == parser.ReadElement(ref size, pc, null)) { break; } } // Close the stream parser.CloseFile(); }); } }
/// <summary> /// Handle List elements found in the AVI file. Ignores unknown lists and recursively looks /// at the content of known lists. /// </summary> /// <param name="rp"></param> /// <param name="FourCC"></param> /// <param name="length"></param> private void ProcessAVIList(RiffParser rp, int FourCC, int length) { RiffParser.ProcessChunkElement pac = new RiffParser.ProcessChunkElement(ProcessAVIChunk); RiffParser.ProcessListElement pal = new RiffParser.ProcessListElement(ProcessAVIList); // Is this the header? if ((AviRiffData.ckidAVIHeaderList == FourCC) || (AviRiffData.ckidAVIStreamList == FourCC) || (AviRiffData.ckidINFOList == FourCC)) { while (length > 0) { if (false == rp.ReadElement(ref length, pac, pal)) { break; } } } else { // Unknown lists - ignore rp.SkipData(length); } }