Exemple #1
0
        public static String ConvertNetworkNameText(ushort originalNetworkID)
        {
            String retText = "";

            if (ChSet5.IsDttv(originalNetworkID) == true)
            {
                retText = "地デジ";
            }
            else if (ChSet5.IsBS(originalNetworkID) == true)
            {
                retText = "BS";
            }
            else if (ChSet5.IsCS1(originalNetworkID) == true)
            {
                retText = "CS1";
            }
            else if (ChSet5.IsCS2(originalNetworkID) == true)
            {
                retText = "CS2";
            }
            else if (ChSet5.IsCS3(originalNetworkID) == true)
            {
                retText = "CS3";
            }
            else
            {
                retText = "その他";
            }
            return(retText);
        }
Exemple #2
0
        public EpgDataViewSetting()
        {
            InitializeComponent();

            comboBox_timeH_week.ItemsSource   = Enumerable.Range(0, 24);
            comboBox_timeH_week.SelectedIndex = 4;

            for (int i = 0; i < 5; i++)
            {
                ListBox target = i == 0 ? listBox_serviceTere :
                                 i == 1 ? listBox_serviceBS :
                                 i == 2 ? listBox_serviceCS :
                                 i == 3 ? listBox_serviceCS3 : listBox_serviceOther;
                target.Items.Add(new Tuple <string, ulong>("[" + ((TabItem)target.Parent).Header + "]",
                                                           (ulong)(i == 0 ? CustomEpgTabInfo.SpecialViewServices.ViewServiceDttv :
                                                                   i == 1 ? CustomEpgTabInfo.SpecialViewServices.ViewServiceBS :
                                                                   i == 2 ? CustomEpgTabInfo.SpecialViewServices.ViewServiceCS :
                                                                   i == 3 ? CustomEpgTabInfo.SpecialViewServices.ViewServiceCS3 :
                                                                   CustomEpgTabInfo.SpecialViewServices.ViewServiceOther)));
                foreach (ChSet5Item info in ChSet5.Instance.ChListSelected)
                {
                    if (i == 0 && ChSet5.IsDttv(info.ONID) ||
                        i == 1 && ChSet5.IsBS(info.ONID) ||
                        i == 2 && ChSet5.IsCS(info.ONID) ||
                        i == 3 && ChSet5.IsCS3(info.ONID) ||
                        i == 4 && ChSet5.IsOther(info.ONID))
                    {
                        target.Items.Add(new Tuple <string, ulong>(info.ServiceName, info.Key));
                    }
                }
            }
            listBox_jyanru.ItemsSource = CommonManager.Instance.ContentKindList;
        }
Exemple #3
0
        /// <summary>
        /// デフォルト表示のために番組情報のサービスを選択する
        /// </summary>
        public static IEnumerable <EpgServiceAllEventInfo> SelectServiceEventList(IEnumerable <EpgServiceAllEventInfo> sel)
        {
            if (Settings.Instance.ShowEpgCapServiceOnly)
            {
                sel = sel.Where(info =>
                                ChSet5.Instance.ChList.ContainsKey(CommonManager.Create64Key(info.serviceInfo.ONID, info.serviceInfo.TSID, info.serviceInfo.SID)) &&
                                ChSet5.Instance.ChList[CommonManager.Create64Key(info.serviceInfo.ONID, info.serviceInfo.TSID, info.serviceInfo.SID)].EpgCapFlag);
            }
            //リモコンキー優先のID順ソート。BSはなるべくSID順
            var bsmin = new Dictionary <ushort, ushort>();

            foreach (EpgServiceAllEventInfo info in sel)
            {
                if (ChSet5.IsBS(info.serviceInfo.ONID) &&
                    (bsmin.ContainsKey(info.serviceInfo.TSID) == false || bsmin[info.serviceInfo.TSID] > info.serviceInfo.SID))
                {
                    bsmin[info.serviceInfo.TSID] = info.serviceInfo.SID;
                }
            }
            sel = sel.OrderBy(info =>
                              (ulong)(ChSet5.IsDttv(info.serviceInfo.ONID) ? (info.serviceInfo.remote_control_key_id + 255) % 256 : 0) << 48 |
                              CommonManager.Create64Key(info.serviceInfo.ONID,
                                                        (ChSet5.IsBS(info.serviceInfo.ONID) ? bsmin[info.serviceInfo.TSID] : info.serviceInfo.TSID),
                                                        info.serviceInfo.SID));
            return(sel);
        }
 private void button_bs_on2_Click(object sender, RoutedEventArgs e)
 {
     foreach (ServiceItem info in listView_service.Items)
     {
         if (ChSet5.IsBS(info.ServiceInfo.ONID) == true && ChSet5.IsVideo(info.ServiceInfo.service_type) == true)
         {
             info.IsSelected = true;
         }
     }
 }
Exemple #5
0
 public bool HasService(ushort onid, ushort tsid, ushort sid)
 {
     return(setViewInfo.ViewServiceList.Contains(CommonManager.Create64Key(onid, tsid, sid)) ||
            setViewInfo.ViewServiceList.Contains(
                (ulong)(ChSet5.IsDttv(onid) ? CustomEpgTabInfo.SpecialViewServices.ViewServiceDttv :
                        ChSet5.IsBS(onid) ? CustomEpgTabInfo.SpecialViewServices.ViewServiceBS :
                        ChSet5.IsCS(onid) ? CustomEpgTabInfo.SpecialViewServices.ViewServiceCS :
                        ChSet5.IsCS3(onid) ? CustomEpgTabInfo.SpecialViewServices.ViewServiceCS3 :
                        CustomEpgTabInfo.SpecialViewServices.ViewServiceOther)));
 }
Exemple #6
0
        public static ReserveData TryLoadTVPID(string filePath, IDictionary <ulong, ChSet5Item> chList)
        {
            Dictionary <string, string> paramList = TryLoadParamList(filePath);

            if (paramList != null &&
                paramList.ContainsKey("station") &&
                paramList.ContainsKey("version") &&
                paramList["version"] == "2")
            {
                // 放送種別とサービスID
                string station = paramList["station"];
                foreach (ChSet5Item info in chList.Values)
                {
                    ushort sid = 0;
                    if (ChSet5.IsDttv(info.ONID) &&
                        (station.StartsWith("DFS", StringComparison.Ordinal) || station.StartsWith("DOS", StringComparison.Ordinal)))
                    {
                        ushort.TryParse(station.Substring(3), NumberStyles.HexNumber, null, out sid);
                    }
                    else if (ChSet5.IsBS(info.ONID) && station.StartsWith("BSDT", StringComparison.Ordinal) ||
                             ChSet5.IsCS(info.ONID) && station.StartsWith("CSDT", StringComparison.Ordinal) ||
                             ChSet5.IsSP(info.ONID) && station.StartsWith("SPTV", StringComparison.Ordinal))
                    {
                        ushort.TryParse(station.Substring(4), out sid);
                    }
                    if (sid != 0 && sid == info.SID)
                    {
                        var addInfo = new ReserveData();
                        addInfo.OriginalNetworkID = info.ONID;
                        addInfo.TransportStreamID = info.TSID;
                        addInfo.ServiceID         = info.SID;
                        addInfo.StationName       = info.ServiceName;
                        // 開始時間と長さ
                        if (GetTimeValues(paramList, addInfo))
                        {
                            // イベントID(オプション)。なければプログラム予約
                            addInfo.EventID = 0xFFFF;
                            ushort eventID;
                            if (paramList.ContainsKey("program-id") && ushort.TryParse(paramList["program-id"], out eventID))
                            {
                                addInfo.EventID = eventID;
                            }
                            // 番組名(オプション)
                            if (paramList.ContainsKey("program-title"))
                            {
                                addInfo.Title = paramList["program-title"];
                            }
                            return(addInfo);
                        }
                        break;
                    }
                }
            }
            return(null);
        }
Exemple #7
0
        public EpgDataViewSetting()
        {
            InitializeComponent();

            try
            {
                comboBox_timeH_week.ItemsSource   = Enumerable.Range(0, 24);
                comboBox_timeH_week.SelectedIndex = 4;


                foreach (ChSet5Item info in ChSet5.Instance.ChListSelected)
                {
                    if (ChSet5.IsBS(info.ONID))
                    {
                        tabItem_bs.Visibility = Visibility.Visible;
                        listBox_serviceBS.Items.Add(info);
                    }
                    else if (ChSet5.IsCS3(info.ONID))
                    {
                        tabItem_cs3.Visibility = Visibility.Visible;
                        listBox_serviceCS3.Items.Add(info);
                    }
                    else if (ChSet5.IsCS(info.ONID))
                    {
                        tabItem_cs.Visibility = Visibility.Visible;
                        listBox_serviceCS.Items.Add(info);
                    }
                    else if (ChSet5.IsDttv(info.ONID))
                    {
                        tabItem_tere.Visibility = Visibility.Visible;
                        listBox_serviceTere.Items.Add(info);
                    }
                    else
                    {
                        tabItem_other.Visibility = Visibility.Visible;
                        listBox_serviceOther.Items.Add(info);
                    }
                }
                TabItem item = tabControl2.Items.Cast <TabItem>().FirstOrDefault(a => a.Visibility == Visibility.Visible);
                if (item != null)
                {
                    item.IsSelected = true;
                }
                listBox_jyanru.ItemsSource = CommonManager.Instance.ContentKindList;

                radioButton_rate.IsChecked = true;
                radioButton_week.IsChecked = false;
                radioButton_list.IsChecked = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Exemple #8
0
        /// <summary>
        /// タブ生成
        /// </summary>
        private bool CreateTabItem()
        {
            {
                List <CustomEpgTabInfo> defaultList = null;
                if (Settings.Instance.UseCustomEpgView == false)
                {
                    defaultList = new List <CustomEpgTabInfo>();
                    if (CommonManager.Instance.NWMode && CommonManager.Instance.NWConnectedIP == null)
                    {
                        return(false);
                    }
                    ErrCode err = CommonManager.Instance.DB.ReloadEpgData();
                    if (err != ErrCode.CMD_SUCCESS)
                    {
                        if (IsVisible && err != ErrCode.CMD_ERR_BUSY)
                        {
                            Dispatcher.BeginInvoke(new Action(() => MessageBox.Show(CommonManager.GetErrCodeText(err) ?? "EPGデータの取得でエラーが発生しました。")));
                        }
                        return(false);
                    }

                    //デフォルト表示
                    for (int i = 0; i < 5; i++)
                    {
                        var setInfo = new CustomEpgTabInfo();
                        foreach (EpgServiceInfo info in CommonManager.Instance.DB.ServiceEventList.Values.Select(allInfo => allInfo.serviceInfo))
                        {
                            if (Settings.Instance.ShowEpgCapServiceOnly &&
                                (ChSet5.Instance.ChList.ContainsKey(CommonManager.Create64Key(info.ONID, info.TSID, info.SID)) == false ||
                                 ChSet5.Instance.ChList[CommonManager.Create64Key(info.ONID, info.TSID, info.SID)].EpgCapFlag == false))
                            {
                                continue;
                            }
                            if (i == 0 && ChSet5.IsDttv(info.ONID))
                            {
                                setInfo.TabName = "地デジ";
                                setInfo.ViewServiceList.Add((ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceDttv);
                            }
                            else if (i == 1 && ChSet5.IsBS(info.ONID))
                            {
                                setInfo.TabName = "BS";
                                setInfo.ViewServiceList.Add((ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceBS);
                            }
                            else if (i == 2 && ChSet5.IsCS(info.ONID) && ChSet5.IsCS3(info.ONID) == false)
                            {
                                setInfo.TabName = "CS";
                                setInfo.ViewServiceList.Add((ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceCS);
                            }
                            else if (i == 3 && ChSet5.IsCS3(info.ONID))
                            {
                                setInfo.TabName = "CS3";
                                setInfo.ViewServiceList.Add((ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceCS3);
                            }
                            else if (i == 4 && ChSet5.IsOther(info.ONID))
                            {
                                setInfo.TabName = "その他";
                                setInfo.ViewServiceList.Add((ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceOther);
                            }
                            else
                            {
                                continue;
                            }
                            defaultList.Add(setInfo);
                            break;
                        }
                    }
                }
                foreach (CustomEpgTabInfo info in defaultList ?? Settings.Instance.CustomEpgTabList)
                {
                    var tabItem = new TabItem();
                    tabItem.Header = info.TabName;
                    if (info.ViewMode == 1)
                    {
                        //1週間表示
                        var epgView = new EpgWeekMainView(info, DateTime.MaxValue);
                        epgView.ViewModeChangeRequested += item_ViewModeChangeRequested;
                        tabItem.Content = epgView;
                    }
                    else if (info.ViewMode == 2)
                    {
                        //リスト表示
                        var epgView = new EpgListMainView(info, DateTime.MaxValue);
                        epgView.ViewModeChangeRequested += item_ViewModeChangeRequested;
                        tabItem.Content = epgView;
                    }
                    else
                    {
                        //標準ラテ欄表示
                        var epgView = new EpgMainView(info, DateTime.MaxValue);
                        epgView.ViewModeChangeRequested += item_ViewModeChangeRequested;
                        tabItem.Content = epgView;
                    }
                    tabControl.Items.Add(tabItem);
                }
                if (tabControl.Items.Count > 0)
                {
                    tabControl.SelectedIndex = 0;
                }
            }
            return(true);
        }
Exemple #9
0
        private void ReloadProgramViewItem(bool enablePrev, bool enableNext)
        {
            try
            {
                if (listBox_service.ItemsSource != null)
                {
                    foreach (ServiceItem info in listBox_service.ItemsSource)
                    {
                        lastChkSID[info.ID] = info.IsSelected;
                    }
                }
                listBox_service.ItemsSource = null;
                var serviceList = new List <ServiceItem>();

                //特殊なサービス指定の展開と重複除去
                var viewIDList = new List <ulong>();
                foreach (ulong id in setViewInfo.ViewServiceList)
                {
                    IEnumerable <EpgServiceAllEventInfo> sel =
                        id == (ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceDttv ?
                        serviceEventList.Values.Where(info => ChSet5.IsDttv(info.serviceInfo.ONID)) :
                        id == (ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceBS ?
                        serviceEventList.Values.Where(info => ChSet5.IsBS(info.serviceInfo.ONID)) :
                        id == (ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceCS ?
                        serviceEventList.Values.Where(info => ChSet5.IsCS(info.serviceInfo.ONID)) :
                        id == (ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceCS3 ?
                        serviceEventList.Values.Where(info => ChSet5.IsCS3(info.serviceInfo.ONID)) :
                        id == (ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceOther ?
                        serviceEventList.Values.Where(info => ChSet5.IsOther(info.serviceInfo.ONID)) : null;
                    if (sel == null)
                    {
                        if (viewIDList.Contains(id) == false)
                        {
                            viewIDList.Add(id);
                        }
                        continue;
                    }
                    foreach (EpgServiceInfo info in DBManager.SelectServiceEventList(sel).Select(allInfo => allInfo.serviceInfo))
                    {
                        if (viewIDList.Contains(CommonManager.Create64Key(info.ONID, info.TSID, info.SID)) == false)
                        {
                            viewIDList.Add(CommonManager.Create64Key(info.ONID, info.TSID, info.SID));
                        }
                    }
                }
                for (int i = 0; i < viewIDList.Count;)
                {
                    //TSIDが同じでSIDが逆順のときは正順にする
                    int skip = i + 1;
                    while (viewIDList.Count > skip &&
                           viewIDList[skip] >> 16 == viewIDList[skip - 1] >> 16 &&
                           (viewIDList[skip] & 0xFFFF) < (viewIDList[skip - 1] & 0xFFFF))
                    {
                        skip++;
                    }
                    for (int j = skip - 1; j >= i; j--)
                    {
                        ulong id = viewIDList[j];
                        if (serviceEventList.ContainsKey(id))
                        {
                            var item = new ServiceItem(serviceEventList[id].serviceInfo);
                            item.IsSelected = lastChkSID.ContainsKey(id) == false || lastChkSID[id];
                            serviceList.Add(item);
                        }
                    }
                    i = skip;
                }
                listBox_service.ItemsSource = serviceList;
                button_prev.IsEnabled       = enablePrev;
                button_next.IsEnabled       = enableNext;

                UpdateEventList();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #10
0
        /// <summary>
        /// タブ生成
        /// </summary>
        private bool CreateTabItem()
        {
            {
                List <CustomEpgTabInfo> defaultList = null;
                if (Settings.Instance.UseCustomEpgView == false)
                {
                    defaultList = new List <CustomEpgTabInfo>();
                    if (CommonManager.Instance.NWMode && CommonManager.Instance.NWConnectedIP == null)
                    {
                        return(false);
                    }
                    ErrCode err = CommonManager.Instance.DB.ReloadEpgData();
                    if (err != ErrCode.CMD_SUCCESS)
                    {
                        if (IsVisible && err != ErrCode.CMD_ERR_BUSY)
                        {
                            Dispatcher.BeginInvoke(new Action(() =>
                            {
                                MessageBox.Show(CommonManager.GetErrCodeText(err) ?? "EPGデータの取得でエラーが発生しました。EPGデータが読み込まれていない可能性があります。");
                            }));
                        }
                        return(false);
                    }

                    //デフォルト表示
                    bool ignoreEpgCap = Settings.Instance.ShowEpgCapServiceOnly == false;
                    IEnumerable <EpgServiceInfo> sel = CommonManager.Instance.DB.ServiceEventList.Values.Select(info => info.serviceInfo).Where(info => {
                        ulong key = CommonManager.Create64Key(info.ONID, info.TSID, info.SID);
                        return(ignoreEpgCap || ChSet5.Instance.ChList.ContainsKey(key) && ChSet5.Instance.ChList[key].EpgCapFlag);
                    });
                    //リモコンキー優先のID順ソート。BSはなるべくSID順
                    var bsmin = new Dictionary <ushort, ushort>();
                    foreach (EpgServiceInfo info in sel)
                    {
                        if (ChSet5.IsBS(info.ONID) && (bsmin.ContainsKey(info.TSID) == false || bsmin[info.TSID] > info.SID))
                        {
                            bsmin[info.TSID] = info.SID;
                        }
                    }
                    sel = sel.OrderBy(info => (ulong)(ChSet5.IsDttv(info.ONID) ? (info.remote_control_key_id + 255) % 256 : 0) << 48 |
                                      CommonManager.Create64Key(info.ONID, (ChSet5.IsBS(info.ONID) ? bsmin[info.TSID] : info.TSID), info.SID));
                    for (int i = 0; i < 5; i++)
                    {
                        CustomEpgTabInfo setInfo = null;
                        foreach (EpgServiceInfo info in sel)
                        {
                            string tabName = null;
                            if (i == 0 && ChSet5.IsDttv(info.ONID))
                            {
                                tabName = "地デジ";
                            }
                            else if (i == 1 && ChSet5.IsBS(info.ONID))
                            {
                                tabName = "BS";
                            }
                            else if (i == 2 && ChSet5.IsCS(info.ONID) && ChSet5.IsCS3(info.ONID) == false)
                            {
                                tabName = "CS";
                            }
                            else if (i == 3 && ChSet5.IsCS3(info.ONID))
                            {
                                tabName = "CS3";
                            }
                            else if (i == 4 && ChSet5.IsOther(info.ONID))
                            {
                                tabName = "その他";
                            }
                            if (tabName != null)
                            {
                                if (setInfo == null)
                                {
                                    setInfo         = new CustomEpgTabInfo();
                                    setInfo.TabName = tabName;
                                }
                                setInfo.ViewServiceList.Add(CommonManager.Create64Key(info.ONID, info.TSID, info.SID));
                            }
                        }
                        if (setInfo != null)
                        {
                            defaultList.Add(setInfo);
                        }
                    }
                }
                foreach (CustomEpgTabInfo info in defaultList ?? Settings.Instance.CustomEpgTabList)
                {
                    var tabItem = new TabItem();
                    tabItem.Header = info.TabName;
                    if (info.ViewMode == 1)
                    {
                        //1週間表示
                        var epgView = new EpgWeekMainView(info);
                        epgView.ViewModeChangeRequested += item_ViewModeChangeRequested;
                        tabItem.Content = epgView;
                    }
                    else if (info.ViewMode == 2)
                    {
                        //リスト表示
                        var epgView = new EpgListMainView(info);
                        epgView.ViewModeChangeRequested += item_ViewModeChangeRequested;
                        tabItem.Content = epgView;
                    }
                    else
                    {
                        //標準ラテ欄表示
                        var epgView = new EpgMainView(info);
                        epgView.ViewModeChangeRequested += item_ViewModeChangeRequested;
                        tabItem.Content = epgView;
                    }
                    tabControl.Items.Add(tabItem);
                }
                if (tabControl.Items.Count > 0)
                {
                    tabControl.SelectedIndex = 0;
                }
            }
            return(true);
        }