private void btnDownload_Click(object sender, RoutedEventArgs e)
        {
            Button        btn           = sender as Button;
            int           streamIndex   = (int)btn.Tag;
            StreamAddress streamAddress = (StreamAddress)(lvStreamAddress.ItemsSource as List <StreamAddress>)[streamIndex];

            if (streamAddress.StreamType != StreamType.M3U8)
            {
                MessageBox.Show("不是M3U8,下载不支持");
                return;
            }

            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter = "m3u8文件|*.m3u8";
            if (sfd.ShowDialog() == true)
            {
                String localPath = sfd.FileName;
                try
                {
                    if (SWFExtractor.DownloadM3U8(streamAddress.Address, sfd.FileName))
                    {
                        MessageBox.Show("下载成功");
                    }
                    else
                    {
                        MessageBox.Show("下载失败!");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("下载失败!" + ex.ToString());
                }
            }
            else
            {
                MessageBox.Show("取消保存");
            }
        }
        private void btnExtract_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Media media = SWFExtractor.Extract(tbURL.Text);
                if (media == null || media.Streams == null)
                {
                    MessageBox.Show("解析失败!");
                    return;
                }

                IList <StreamAddress> addresses = new List <StreamAddress>();
                int streamIndex = 1;
                foreach (Stream stream in media.Streams)
                {
                    int addressIndex = 1;
                    foreach (String address in stream.Addresses)
                    {
                        StreamAddress addr = new StreamAddress();
                        addr.StreamIndex       = streamIndex;
                        addr.StreamType        = stream.Type;
                        addr.AddressIndex      = addressIndex;
                        addr.Address           = address;
                        addr.SourceStreamIndex = addresses.Count;
                        addresses.Add(addr);
                        addressIndex++;
                    }
                    streamIndex++;
                }
                lvStreamAddress.ItemsSource = addresses;
                _currentMedia = media;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }