예제 #1
0
 public override bool CheckPgHit(IAutoAddTargetData data)
 {
     if (data == null)
     {
         return(false);
     }
     return(Create64Key() == data.Create64Key() &&
            startTime == data.PgStartTime.Hour * 3600 + data.PgStartTime.Minute * 60 + data.PgStartTime.Second &&
            durationSecond == data.PgDurationSecond &&
            (dayOfWeekFlag & (byte)(0x01 << (int)data.PgStartTime.DayOfWeek)) != 0);
 }
예제 #2
0
        public static EpgEventInfo SearchEventInfoLikeThat(IAutoAddTargetData item, bool includeArc = false)
        {
            double       dist          = double.MaxValue;
            EpgEventInfo eventPossible = null;

            UInt64 key      = item.Create64Key();
            var    eventDic = CommonManager.Instance.DB.ServiceEventList;

            if (eventDic.ContainsKey(key) == true)
            {
                var eList = includeArc == true ? eventDic[key].eventMergeList : eventDic[key].eventList;
                foreach (EpgEventInfo eventChkInfo in eList)
                {
                    //itemが調べている番組に完全に含まれているならそれを選択する
                    double overlapLength = CulcOverlapLength(item.PgStartTime, item.PgDurationSecond,
                                                             eventChkInfo.start_time, eventChkInfo.durationSec);
                    if (overlapLength > 0 && overlapLength == item.PgDurationSecond)
                    {
                        eventPossible = eventChkInfo;
                        break;
                    }

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

            return(eventPossible);
        }
예제 #3
0
 //CurrentPgUID()は同一のEventIDの番組をチェックするが、こちらは放映時刻をチェックする。
 //プログラム予約が絡んでいる場合、結果が変わってくる。
 public virtual bool IsSamePg(IAutoAddTargetData data)
 {
     if (data == null)
     {
         return(false);
     }
     return(PgStartTime == data.PgStartTime && PgDurationSecond == data.PgDurationSecond && Create64Key() == data.Create64Key());
 }
예제 #4
0
        private void CtxmGenerateChgAutoAddMenuItem(MenuItem menu, IAutoAddTargetData info, ICommand cmd, bool?IsAutoAddEnabled, bool ByFasy, int str_max = 35)
        {
            if (info != null)
            {
                Action <AutoAddData, string, uint> addSubMenuItem = (autoAdd, title, id) =>
                {
                    var menuItem = new MenuItem();
                    if (info is RecFileInfo && autoAdd is EpgAutoAddData)
                    {
                        menuItem.IsChecked = autoAdd.GetReserveList().FirstOrDefault(data => data.Create64Key() == info.Create64Key()) != null;
                    }
                    else
                    {
                        menuItem.IsChecked = autoAdd.CheckPgHit(info);
                    }
                    string header = title;
                    if (header.Length > str_max)
                    {
                        header           = header.Substring(0, str_max - 3) + "..."; // 長すぎる場合は省略
                        menuItem.ToolTip = title;
                    }
                    if (Settings.Instance.MenuSet.AutoAddSerachToolTip == true)
                    {
                        menuItem.ToolTip = AutoAddDataItemEx.CreateIncetance(autoAdd).ToolTipViewAutoAddSearch;
                    }
                    menuItem.Header           = header;
                    menuItem.Command          = cmd;
                    menuItem.CommandParameter = new EpgCmdParam(menu.CommandParameter as EpgCmdParam);
                    (menuItem.CommandParameter as EpgCmdParam).Data = autoAdd.GetType();//オブジェクト入れると残るので
                    (menuItem.CommandParameter as EpgCmdParam).ID   = (int)id;
                    menuItem.Tag = menuItem.Command;

                    menu.Items.Add(menuItem);
                };

                foreach (var data in info.SearchEpgAutoAddList(IsAutoAddEnabled, ByFasy).OrderBy(data => data.DataID))
                {
                    addSubMenuItem(data, data.DataTitle == "" ? "(空白)" : data.DataTitle, data.dataID);
                }
                foreach (var data in info.GetManualAutoAddList(IsAutoAddEnabled).OrderBy(data => data.DataID))
                {
                    var view = new ManualAutoAddDataItem(data);
                    addSubMenuItem(data, string.Format("({0}){1} {2}", view.DayOfWeek, view.StartTimeShort, data.DataTitle == "" ? "(空白)" : data.DataTitle), data.dataID);
                }
            }
        }
예제 #5
0
        private void CtxmGenerateChgAutoAddMenuItem(MenuItem menu, IAutoAddTargetData info, ICommand cmd, bool? IsAutoAddEnabled, bool ByFasy, int str_max = 35)
        {
            if (info != null)
            {
                Action<AutoAddData, string, uint> addSubMenuItem = (autoAdd, title, id) =>
                {
                    var menuItem = new MenuItem();
                    if (info is RecFileInfo && autoAdd is EpgAutoAddData)
                    {
                        menuItem.IsChecked = autoAdd.GetReserveList().FirstOrDefault(data => data.Create64Key() == info.Create64Key()) != null;
                    }
                    else
                    {
                        menuItem.IsChecked = autoAdd.CheckPgHit(info);
                    }
                    string header = title;
                    if (header.Length > str_max)
                    {
                        header = header.Substring(0, str_max - 3) + "..."; // 長すぎる場合は省略
                        menuItem.ToolTip = title;
                    }
                    if (Settings.Instance.MenuSet.AutoAddSerachToolTip == true)
                    {
                        menuItem.ToolTip = AutoAddDataItemEx.CreateIncetance(autoAdd).ToolTipViewAutoAddSearch;
                    }
                    menuItem.Header = header;
                    menuItem.Command = cmd;
                    menuItem.CommandParameter = new EpgCmdParam(menu.CommandParameter as EpgCmdParam);
                    (menuItem.CommandParameter as EpgCmdParam).Data = autoAdd.GetType();//オブジェクト入れると残るので
                    (menuItem.CommandParameter as EpgCmdParam).ID = (int)id;
                    menuItem.Tag = menuItem.Command;

                    menu.Items.Add(menuItem);
                };

                foreach (var data in info.SearchEpgAutoAddList(IsAutoAddEnabled, ByFasy).OrderBy(data => data.DataID))
                {
                    addSubMenuItem(data, data.DataTitle == "" ? "(空白)" : data.DataTitle, data.dataID);
                }
                foreach (var data in info.GetManualAutoAddList(IsAutoAddEnabled).OrderBy(data => data.DataID))
                {
                    var view = new ManualAutoAddDataItem(data);
                    addSubMenuItem(data, string.Format("({0}){1} {2}", view.DayOfWeek, view.StartTimeShort, data.DataTitle == "" ? "(空白)" : data.DataTitle), data.dataID);
                }
            }
        }