コード例 #1
0
        }     // Worker_DoWork

        private void Explorer_SectionReceived(object sender, DvbStpExplorer.SectionReceivedEventArgs e)
        {
            if (Storage != null)
            {
                Storage.AddSection(e.Header, e.Payload, false);
            }
            Worker.ReportProgress(1, e);
        } // Explorer_SectionReceived
コード例 #2
0
        }     // Worker_ProgressChanged

        private void ProgressSectionReceived(DvbStpExplorer.SectionReceivedEventArgs section)
        {
            if (statusLabelDataReception.Text == null)
            {
                statusLabelReceiving.Text = "Receiving data";
            } // if

            DatagramCount++;
            DatagramByteCount += section.BytesReceived;

            int length = (DatagramCount % 10) + 1;

            statusLabelDataReception.Text = new string('l', length);

            statusLabelDatagramCount.Text = string.Format("{0:N0} datagrams received", DatagramCount);
            statusLabelByteCount.Text     = string.Format("{0:N0} bytes received", DatagramByteCount);

            var itemData = new string[]
            {
                string.Format("p{0:X2}s{1:X4}v{2:X2}", section.Header.PayloadId, section.Header.SegmentId, section.Header.SegmentVersion),
                string.Format("{0,7:N0}", section.BytesReceived),
                string.Format(section.Header.HasCRC? "yes" : "no"),
                string.Format("{0,7:N0}", section.Payload.Length),
                string.Format("{0,7:N0}", section.Header.SectionNumber),
                string.Format("{0,7:N0}", section.Header.LastSectionNumber),
                string.Format("{0,7:N0}", section.Header.TotalSegmentSize),
                (DateTime.Now - StartTime).ToString(),
            };
            var item = new ListViewItem(itemData);

            listViewSections.Items.Add(item);
            item.EnsureVisible();

            if (DumpFolderSections != null)
            {
                var path = Path.Combine(DumpFolderSections, string.Format("p{0:X2}s{1:X4}v{2:X2}-{3:00000}.bin",
                                                                          section.Header.PayloadId, section.Header.SegmentId, section.Header.SegmentVersion,
                                                                          section.Header.SectionNumber));
                File.WriteAllBytes(path, section.Payload);
            } // if
        }     // ProgressSectionReceived