示例#1
0
        public TimeDescription(TimeDescription other, bool referenceRepeatTimes = false, bool shouldDispose = true)
            : base(shouldDispose)
        {
            StartTime = other.StartTime;

            StopTime = other.StopTime;

            if (referenceRepeatTimes)
            {
                RepeatLines = other.RepeatLines;
            }
            else
            {
                RepeatLines = new List <Lines.SessionRepeatTimeLine>(other.RepeatLines);
            }
        }
示例#2
0
        //Should have a date when or should return the date playable, which would then be used by another method to compare against a time.
        public static bool IsPlayable(this MediaDescription mediaDescription, SessionDescription sessionDescription) //, DateTime? check = null) ,TimeSpan within = TimeSpan.Zero
        {
            if (IDisposedExtensions.IsNullOrDisposed(mediaDescription) || IDisposedExtensions.IsNullOrDisposed(sessionDescription))
            {
                return(false);
            }

            //Get index of mediaDesription

            //Check TimeDescription @ index.

            TimeDescription td = GetTimeDescription(mediaDescription, sessionDescription);

            //Assume true
            if (IDisposedExtensions.IsNullOrDisposed(td))
            {
                return(true);
            }

            //Unbound start and end ?
            if (td.IsPermanent)
            {
                return(true);
            }

            //Notes multiple calls to UtcNow... (avoid with a within parameter)?
            try
            {
                //Ensure not a bounded end and that the end time is less than now
                if (false.Equals(td.StopTime.Equals(0))
                    &&
                    td.NtpStopDateTime >= DateTime.UtcNow)
                {
                    return(false);
                }

                //Ensure start time is not bounded and that the start time is greater than now
                if (false.Equals(td.StartTime.Equals(0))
                    &&
                    td.NtpStartDateTime > DateTime.UtcNow)
                {
                    return(false);
                }

                //Check repeat times.

                //td.RepeatTimes;
            }
            catch
            {
                //Out of range values for conversion, assume true if end is unbounded
                if (false.Equals(td.StopTime.Equals(0)))
                {
                    return(false);
                }
            }
            finally
            {
                td = null;
            }

            return(true);
        }
示例#3
0
 public bool Equals(TimeDescription other)
 {
     return(EnumerableExtensions.SequenceEquals(this, other));
 }