コード例 #1
0
        /// <summary>
        /// Prüft die Eingangsdaten.
        /// </summary>
        /// <returns>Gesetzt, wenn weitere Aktionen notwendig sind.</returns>
        private bool Validate()
        {
            // Validation phase
            try
            {
                // Check times
                if (m_originalEndTime < m_startTime)
                    throw new InvalidOperationException( "ends before start" );

                // Load the device
                m_device = m_service.Devices[m_allocation.CardId];
                if (m_device == null)
                    throw new InvalidOperationException( "bad device name" );

                // Find the possible sources
                m_sources = m_device.Resolve( m_allocation.ChannelName );
                if (m_sources == null)
                    throw new InvalidOperationException( "no such channel" );

                // Prepare next step
                m_run = Start;

                // When we should go for it
                NextTime = m_startTime;

                // If we are overdue just start immediately
                return (NextTime <= DateTime.UtcNow) ? Run() : true;
            }
            catch (Exception e)
            {
                // Report to scheduler
                using (var sink = new RecorderCallbackServiceAgent( m_schedulerHost, m_schedulerPort ))
                    sink.StartRecordingFailed( m_allocation, m_program, e.Message );

                // No further error processing required
                return false;
            }
        }