Пример #1
0
            } // Dispose

            private void ProcessSegments()
            {
                byte[] payload;

                while ((payload = GetNextSegment()) != null)
                {
                    try
                    {
                        var item     = XmlSerialization.Deserialize <TvaMain>(payload, trimExtraWhitespace: true, namespaceReplacer: NamespaceUnification.Replacer) as ExtendedPurchaseItem;
                        var schedule = item?.ProgramDescription?.LocationTable?.Schedule;
                        if (schedule == null)
                        {
                            // TODO: log
                            continue;
                        } // if
                        var epgService = EpgService.FromSchedule(schedule);
                        Datastore.Add(epgService);
                    }
                    catch (Exception ex)
                    {
                        // TODO: log
                        Console.WriteLine("Unable to parse: {0}", ex.Message);
                        return;
                    } // try-catch
                }     // while

                ProcessSegmentsEnded.Set();
            } // ProcessSegments
Пример #2
0
            } // Dispose

            private void ProcessSegments()
            {
                byte[] payload;

                while ((payload = GetNextSegment()) != null)
                {
                    try
                    {
                        var item     = XmlSerialization.Deserialize <TvaMain>(payload, trimExtraWhitespace: true, namespaceReplacer: NamespaceUnification.Replacer);
                        var schedule = item?.ProgramDescription?.LocationTable?.Schedule;
                        if (schedule == null)
                        {
                            // TODO: log
                            continue;
                        } // if
                        var epgService = EpgService.FromSchedule(schedule);
                        ScheduleReceived?.Invoke(this, EventArgs.Empty);
                        _datastore.Add(epgService);
                    }
                    catch (Exception ex)
                    {
                        ParseError?.Invoke(this, EventArgs.Empty);
#if DEBUG
                        // TODO: log
                        Console.WriteLine("Unable to parse: {0}", ex.Message);
#endif
                        return;
                    } // try-catch
                }     // while

                _processSegmentsEnded.Set();
            } // ProcessSegments