Exemplo n.º 1
0
        }     // ExplorerMulticastStream

        private void Storage_SegmentPayloadReceived(object sender, PayloadStorage.SegmentPayloadReceivedEventArgs e)
        {
            if (SegmentPayloadReceived != null)
            {
                SegmentPayloadReceived(this, e);
            }
        } // Storage_SegmentPayloadReceived
Exemplo n.º 2
0
        }         // Download

        private void SegmentPayloadReceived(object sender, PayloadStorage.SegmentPayloadReceivedEventArgs e)
        {
            Console.WriteLine("{0}:{1}", e.SegmentIdentity, e.Payload.Length);
            AddSegment(e);

            // TODO: stop when EPG is complete
            // Notify the caller.
            // Give the caller the option to download in a continuos loop
            // or the restart the download after a given time
        } // SegmentPayloadReceived
Exemplo n.º 3
0
        } // CreateStreamClient

        private void AddSegment(PayloadStorage.SegmentPayloadReceivedEventArgs e)
        {
            var segmentData = new SegmentData()
            {
                EndPoint           = _settings.EndPoint,
                SegmentIdentity    = e.SegmentIdentity,
                PayloadData        = e.Payload,
                DataReceivedAction = _settings.DataReceivedAction
            }; // segmentData

            _processor.AddSegment(segmentData);
        } // AddSegment
Exemplo n.º 4
0
        } // OnSectionReceived

        private void OnSegmentReceived(SegmentAssembler assembler)
        {
            if (SegmentReceived != null)
            {
                var args = new PayloadStorage.SegmentReceivedEventArgs(assembler);
                SegmentReceived(this, args);
            } // if

            if (SegmentPayloadReceived != null)
            {
                var args = new PayloadStorage.SegmentPayloadReceivedEventArgs(assembler);
                SegmentPayloadReceived(this, args);
            } // if
        }     // OnSegmentReceived
Exemplo n.º 5
0
        } // ProcessReceivedData

        private void PayloadReceived(object sender, PayloadStorage.SegmentPayloadReceivedEventArgs e)
        {
            SegmentPayloadReceived?.Invoke(this, e);

            if (_receivedSegments != null)
            {
                if (!_receivedSegments[e.SegmentIdentity.Id])
                {
                    _totalSegments++;
                    _receivedSegments[e.SegmentIdentity.Id] = true;
                    SegmentPayloadReceived?.Invoke(this, e);
                }
                else
                {
                    _loadedSegments++;
                    if (_loadedSegments >= (_totalSegments * _threshold))
                    {
                        EndReceptionLoop = true;
                        DownloadEnded?.Invoke(this, EventArgs.Empty);
                    } // if
                }     // if-else
            }         // if-else
        }             // PayloadReceived