예제 #1
0
        private void starter_Tick( object sender, EventArgs e )
        {
            // Disable
            starter.Enabled = false;

            // Finsih
            if (null == File)
            {
                // Stop
                Close();

                // Done
                return;
            }

            // Set mode
            m_Loading = true;

            // May stop
            cmdStop.Enabled = true;

            // Reset GUI
            m_ListItems.Clear();
            m_Entries.Clear();

            // Be safe
            try
            {
                // Choose decoding mode
                Section.ISO6937Encoding = ckStandardSI.Checked;

                // The mode
                bool TSMode = (0 == string.Compare( File.Extension, ".ts", true ));

                // Blocksize
                byte[] Buffer = new byte[TSMode ? 10000000 : 100000];

                // Open the file and create parser
                using (FileStream read = new FileStream( File.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, Buffer.Length ))
                using (TSParser parser = new TSParser())
                {
                    // Skip junk
                    if (TSMode) parser.SetFilter( 0x12, true, EPGParser.OnData );

                    // Content
                    for (int n; (n = read.Read( Buffer, 0, Buffer.Length )) > 0; )
                    {
                        // Report progress
                        progress.Value = (int) (read.Position * progress.Maximum / read.Length);

                        // Show up
                        Application.DoEvents();

                        // Done
                        if (!cmdStop.Enabled) break;

                        // Check mode
                        if (TSMode)
                        {
                            // Feed into parser
                            parser.AddPayload( Buffer, 0, n );
                        }
                        else
                        {
                            // SI Table
                            EPGParser.OnData( Buffer, 0, n );
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                // Report
                MessageBox.Show( this, ex.Message );
            }
            finally
            {
                // Done
                m_Loading = false;
            }

            // Prepare load
            cmdStop.Text = m_LoadText;
            cmdStop.Enabled = true;

            // Load all we found
            lstEntries.Items.Clear();
            lstEntries.Items.AddRange( m_ListItems.ToArray() );

            // Prepare sorter
            lstEntries.ListViewItemSorter = new EPGEntry.Comparer();
        }
예제 #2
0
        /// <summary>
        /// Meldet sich als Verbraucher an eine Analyse an.
        /// </summary>
        /// <param name="analyser">Die Analyseeinheit.</param>
        public void RegisterPhase2( TSParser analyser )
        {
            // See if there is a well known table 
            foreach (var tableType in typeof( WellKnownTable ).Assembly.GetExportedTypes())
                if (typeof( WellKnownTable ).IsAssignableFrom( tableType ))
                    if (!tableType.IsAbstract)
                        if (WellKnownTable.GetWellKnownStream( tableType ) == PID)
                        {
                            // Remember
                            SubItems[6].Text = tableType.Name;

                            // Create consumer
                            var parser = TableParser.Create( CountTable, tableType );

                            // Connect
                            analyser.SetFilter( PID, true, parser.AddPayload );

                            // Done
                            break;
                        }
        }