public void Show(ArchiveListing listing, ArchiveEntry entry) { _listing = listing; _entry = entry; Visibility = Visibility.Visible; using (Stream input = listing.Accessor.ExtractBinary(entry)) { ScdFileReader reader = new ScdFileReader(input); WaveStream[] waveProviders = reader.Read(); ListItem[] items = new ListItem[waveProviders.Length]; for (int i = 0; i < items.Length; i++) items[i] = new ListItem(i.ToString("D3"), waveProviders[i]); _listView.ItemsSource = items; if (items.Length > 0) _listView.SelectedIndex = 0; } }
public void Extract(ArchiveEntry entry, StreamSequence output, Stream input, Byte[] buff) { int size = (int)entry.UncompressedSize; if (size == 0) return; ScdFileReader reader = new ScdFileReader(input); WaveStream[] waveStreams = reader.Read(); if (waveStreams.Length == 0) return; Extract(output, waveStreams[0], buff); for (int i = 1; i < waveStreams.Length; i++) { if (!output.TryCreateNextStream(i.ToString("D3"))) throw new InvalidDataException(); Extract(output, waveStreams[i], buff); } }