//過去番組も含めた検索 public List <EpgEventInfo> SearchPg(List <EpgSearchKeyInfo> key, EpgViewPeriod period = null) { //サービス名の補正など行うためにSearchPgLists()から作成する。 Dictionary <UInt64, EpgServiceAllEventInfo> dic = null; SearchPgLists(key, ref dic, period); return(dic == null ? new List <EpgEventInfo>() : dic.Values.SelectMany(info => info.eventMergeList).ToList()); }
private List <EpgEventInfo> PeriodApplied(List <EpgEventInfo> list, EpgViewPeriod period) { if (period == null) { return(list.ToList()); } bool needNow = period.End >= CommonUtil.EdcbNow; return(list.FindAll(d => needNow && d.StartTimeFlag == 0 || period.Contains(d.PgStartTime))); }
private EpgViewPeriod MoveTimeTarget(int mode) { EpgViewPeriod pr = timeJumpView.GetDate(); if (pr.Equals(prdef.DefPeriod)) { pr.Days = prdef.InitMoveDays; } pr.Start += TimeSpan.FromDays(mode * (int)pr.Days); return(pr); }
private void RefreshPeriod() { prdef = new EpgViewPeriodDef(Settings.Instance.EpgSettingList[0]); timeJumpView.RefreshPeriod(); EpgViewPeriod pr = timeJumpView.GetDate(); if (pr.Equals(prdef.DefPeriod) == false) { pr.Days = prdef.InitMoveDays; } timeJumpView.SetDate(pr); }
private void SearchPg(bool addSearchLog = false) { if (addSearchLog == true) { searchKeyView.AddSearchLog(); } lstCtrl.ReloadInfoData(dataList => { EpgSearchKeyInfo key = GetSearchKey(); key.keyDisabledFlag = 0; //無効解除 ArcSearch = searchKeyView.checkBox_noArcSearch.IsChecked == false && Settings.Instance.EpgSettingList[0].EpgArcDefaultDays > 0; EpgViewPeriod period = IsJumpPanelOpened ? SearchPeriod : ArcSearch ? prdef.DefPeriod : null; if (period != null) { period.StrictLoad = true; } var list = CommonManager.Instance.DB.SearchPg(key.IntoList(), period); dataList.AddRange(list.ToSearchList(period == null)); //起動直後用。実際には過去検索して無くても必要な場合があるが、あまり重要ではないので無視する。 if (ArcSearch) { CommonManager.Instance.DB.ReloadRecFileInfo(); } return(true); }); UpdateStatus(); SetRecSettingTabHeader(false); SetWindowTitle(); RefreshMoveButtonStatus(); Searched = true; }
private void button_Time_Click(EpgViewPeriod period) { timeJumpView.SetDate(period); SearchPg(); }
public ErrCode SearchPgLists(List <EpgSearchKeyInfo> key, ref Dictionary <UInt64, EpgServiceAllEventInfo> serviceDic, EpgViewPeriod period = null) { ErrCode err = ErrCode.CMD_SUCCESS; //Epgデータ未取得時、SendSearchPg()の最古データは取得してみないと分からない。 var list = new List <EpgEventInfo>(); bool noSearchCurrent = period != null && IsEpgLoaded && period.End <= EventTimeMinCurrent; if (noSearchCurrent == false) { try { err = CommonManager.CreateSrvCtrl().SendSearchPg(key, ref list); } catch { err = ErrCode.CMD_ERR; } if (err != ErrCode.CMD_SUCCESS) { return(err); } if (period != null && period.StrictLoad) { list = PeriodApplied(list, period); } } var list2 = new List <EpgEventInfo>(); bool noSearchArc = period == null || EventTimeMaxArc != DateTime.MinValue && period.StartLoad > EventTimeMaxArc; if (noSearchArc == false) { try { var pram = new SearchPgParam(); pram.keyList = key; pram.enumStart = period.StartLoad.ToFileTimeUtc(); pram.enumEnd = period.End == DateTime.MaxValue ? long.MaxValue : period.End.ToFileTimeUtc(); CommonManager.CreateSrvCtrl().SendSearchPgArc(pram, ref list2); } catch { } } //サービス毎のリストに変換 var sList = list.GroupBy(info => info.Create64Key()).Select(gr => new EpgServiceEventInfo { serviceInfo = EpgServiceInfo.FromKey(gr.Key), eventList = gr.ToList() }).ToList(); var sList2 = list2.GroupBy(info => info.Create64Key()).Select(gr => new EpgServiceEventInfo { serviceInfo = EpgServiceInfo.FromKey(gr.Key), eventList = gr.ToList() }).ToList(); serviceDic = EpgServiceAllEventInfo.CreateEpgServiceDictionary(sList, sList2); //サービス名の補正、イベントデータの再使用 CorrectServiceInfo(serviceDic.Values, period == null || EventTimeBaseArc < period.End || EventTimeMinCurrent < period.End); return(err); }
public ErrCode LoadEpgData(ref Dictionary <UInt64, EpgServiceAllEventInfo> serviceDic, EpgViewPeriod period = null, IEnumerable <ulong> keys = null) { ErrCode err = ReloadEpgData(); if (err != ErrCode.CMD_SUCCESS) { return(err); } bool noCurrent = period != null && IsEpgLoaded && period.End <= EventTimeMinCurrent; bool noArc = period == null || EventTimeBaseArc != DateTime.MaxValue && period.End <= EventTimeBaseArc; serviceDic = ServiceEventList.ToDictionary(item => item.Key, item => new EpgServiceAllEventInfo(item.Value.serviceInfo , noCurrent ? null : item.Value.eventList, noArc ? null : item.Value.eventArcList)); var list = new List <EpgServiceEventInfo>(); if (period != null && period.StartLoad < EventTimeBaseArc) { EpgViewPeriod prLoad = new EpgViewPeriod(period.StartLoad, CommonUtil.Min(period.End, EventTimeBaseArc)); //DB更新の判定 DateTime EventTimeBaseArcMin = Settings.Instance.EpgSettingList.Min(set => new EpgViewPeriodDef(set).DefPeriod.StartLoad); bool addDB = prLoad.End > EventTimeBaseArcMin; if (addDB) { prLoad.Start = Settings.Instance.PrebuildEpg ? CommonUtil.Min(EventTimeBaseArcMin, prLoad.Start) : prLoad.Start; prLoad.End = EventTimeBaseArc; } err = LoadEpgArcData(prLoad.Start, prLoad.End, ref list, addDB ? null : keys); if (err != ErrCode.CMD_SUCCESS) { return(err); } //リモコンIDの登録、サービス名の補正 ChSet5.SetRemoconID(list.Select(info => info.serviceInfo), true); CorrectServiceInfo(list); EpgServiceAllEventInfo.AddArcEpgServiceDictionary(serviceDic, list); //DB更新。EventTimeBaseArcが毎回固定でなくて良いなら、この回の取得を全てキャッシュする手もある。 ReloadWork(UpdateNotifyItem.EpgDataAdd, addDB, false, ret => { EventTimeBaseArc = CommonUtil.Max(EventTimeBaseArcMin, prLoad.Start); if (prLoad.Start < EventTimeBaseArcMin) { foreach (var info in list) { info.eventList = info.eventList.FindAll(d => d.start_time >= EventTimeBaseArc); } } EpgServiceAllEventInfo.AddArcEpgServiceDictionary(ServiceEventList, list); foreach (var data in list.SelectMany(info => info.eventList)) { EventUIDList[data.CurrentPgUID()] = data;//通常あり得ないがUID被りは後優先。 } return(ret); }); } //必要なら期間を適用。未適用でもリストは再作成される。 foreach (var info in serviceDic.Values) { info.eventList = PeriodApplied(info.eventList, period.StrictLoad ? period : null); info.eventArcList = PeriodApplied(info.eventArcList, period.StrictLoad ? period : null); } //イベントリストが空の場合もあるが、そのまま返す。 return(err); }
public EpgViewPeriod(EpgViewPeriod data) { Start = data.Start.Date; Days = data.Days; }