Esempio n. 1
0
 public static List<ReserveData> GetReserveList(this ManualAutoAddData mdata)
 {
     return CommonManager.Instance.DB.ReserveList.Values.Where(info =>
     {
         //イベントID無し、サービス、開始時刻、長さ一致の予約を拾う。EpgTimerSrv側と同じ内容の判定。
         return info != null && info.EventID == 0xFFFF
             && mdata.Create64Key() == info.Create64Key()
             && mdata.startTime == info.StartTime.Hour * 3600 + info.StartTime.Minute * 60 + info.StartTime.Second
             && mdata.durationSecond == info.DurationSecond
             && (mdata.dayOfWeekFlag & (byte)(0x01 << (int)info.StartTime.DayOfWeek)) != 0
             ;
     }).ToList();
 }
Esempio n. 2
0
        public static bool ConvertToReserveData(this EpgEventInfo epgInfo, ref ReserveData resInfo)
        {
            if (epgInfo == null || resInfo == null) return false;

            resInfo.Title = epgInfo.Title();
            resInfo.StartTime = epgInfo.start_time;
            resInfo.StartTimeEpg = epgInfo.start_time;
            resInfo.DurationSecond = (epgInfo.DurationFlag == 0 ? 10 * 60 : epgInfo.durationSec);

            UInt64 key = epgInfo.Create64Key();
            if (ChSet5.Instance.ChList.ContainsKey(key) == true)
            {
                resInfo.StationName = ChSet5.Instance.ChList[key].ServiceName;
            }
            resInfo.OriginalNetworkID = epgInfo.original_network_id;
            resInfo.TransportStreamID = epgInfo.transport_stream_id;
            resInfo.ServiceID = epgInfo.service_id;
            resInfo.EventID = epgInfo.event_id;

            return true;
        }
Esempio n. 3
0
        public static EpgEventInfo SearchEventInfoLikeThat(this ReserveData resInfo)
        {
            if (resInfo == null) return null;
            double dist = double.MaxValue, dist1;
            EpgEventInfo eventPossible = null;

            UInt64 key = resInfo.Create64Key();
            if (CommonManager.Instance.DB.ServiceEventList.ContainsKey(key) == true)
            {
                foreach (EpgEventInfo eventChkInfo in CommonManager.Instance.DB.ServiceEventList[key].eventList)
                {
                    dist1 = Math.Abs((resInfo.StartTime - eventChkInfo.start_time).TotalSeconds);
                    double overlapLength = MenuUtil.CulcOverlapLength(resInfo.StartTime, resInfo.DurationSecond,
                                                            eventChkInfo.start_time, eventChkInfo.durationSec);

                    //開始時間が最も近いものを選ぶ。同じ差なら時間が前のものを選ぶ
                    if (overlapLength >= 0 && (dist > dist1 ||
                        dist == dist1 && (eventPossible == null || resInfo.StartTime > eventChkInfo.start_time)))
                    {
                        dist = dist1;
                        eventPossible = eventChkInfo;
                        if (dist == 0) break;
                    }
                }
            }

            return eventPossible;
        }
Esempio n. 4
0
        public static EpgEventInfo SearchEventInfo(this ReserveData info, bool getSrv = false)
        {
            EpgEventInfo eventInfo = null;

            if (info != null)
            {
                try
                {
                    if (info.EventID != 0xFFFF)
                    {
                        UInt64 key = info.Create64Key();
                        if (CommonManager.Instance.DB.ServiceEventList.ContainsKey(key) == true)
                        {
                            foreach (EpgEventInfo eventChkInfo in CommonManager.Instance.DB.ServiceEventList[key].eventList)
                            {
                                if (eventChkInfo.event_id == info.EventID)
                                {
                                    eventInfo = eventChkInfo;
                                    break;
                                }
                            }
                        }
                        if (eventInfo == null && getSrv == true)
                        {
                            UInt64 pgId = info.Create64PgKey();
                            eventInfo = new EpgEventInfo();
                            cmd.SendGetPgInfo(pgId, ref eventInfo);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
                }

            }

            return eventInfo;
        }