예제 #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);
        }
예제 #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;
        }
예제 #3
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)));
 }
예제 #4
0
 private void button_cs3_on_Click(object sender, RoutedEventArgs e)
 {
     foreach (ServiceItem info in listView_service.Items)
     {
         if (ChSet5.IsCS3(info.ServiceInfo.ONID) &&
             ChSet5.IsVideo(info.ServiceInfo.service_type))
         {
             info.IsSelected = true;
         }
     }
 }
예제 #5
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);
            }
        }
예제 #6
0
        public SearchKeyView()
        {
            InitializeComponent();

            foreach (string info in Settings.Instance.AndKeyList)
            {
                comboBox_andKey.Items.Add(info);
            }
            foreach (string info in Settings.Instance.NotKeyList)
            {
                comboBox_notKey.Items.Add(info);
            }

            EnableContentListBox(false);
            foreach (ushort id in CommonManager.Instance.ContentKindList)
            {
                comboBox_content.Items.Add(new ContentKindInfo()
                {
                    Nibble1 = (byte)(id >> 8), Nibble2 = (byte)id
                });
            }
            comboBox_content.SelectedIndex = 0;

            EnableDateListBox(false);
            comboBox_time_sw.ItemsSource   = Enumerable.Range(0, 7).Select(i => (new DateTime(2000, 1, 2 + i)).ToString("ddd"));
            comboBox_time_sw.SelectedIndex = 0;
            comboBox_time_sh.ItemsSource   = Enumerable.Range(0, 24);
            comboBox_time_sh.SelectedIndex = 0;
            comboBox_time_sm.ItemsSource   = Enumerable.Range(0, 60);
            comboBox_time_sm.SelectedIndex = 0;
            comboBox_time_ew.ItemsSource   = Enumerable.Range(0, 7).Select(i => (new DateTime(2000, 1, 2 + i)).ToString("ddd"));
            comboBox_time_ew.SelectedIndex = 6;
            comboBox_time_eh.ItemsSource   = Enumerable.Range(0, 24);
            comboBox_time_eh.SelectedIndex = 23;
            comboBox_time_em.ItemsSource   = Enumerable.Range(0, 60);
            comboBox_time_em.SelectedIndex = 59;
            comboBox_week_sh.ItemsSource   = Enumerable.Range(0, 24);
            comboBox_week_sh.SelectedIndex = 0;
            comboBox_week_sm.ItemsSource   = Enumerable.Range(0, 60);
            comboBox_week_sm.SelectedIndex = 0;
            radioButton_week.IsChecked     = true;

            foreach (ChSet5Item info in ChSet5.Instance.ChListSelected)
            {
                if (ChSet5.IsCS3(info.ONID))
                {
                    button_cs3.Visibility = Visibility.Visible;
                }
                listView_service.Items.Add(new ServiceItem(CommonManager.ConvertChSet5To(info)));
            }
        }
예제 #7
0
        private void listBox_service_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            textBox_serviceView2.Text = "";
            if (((ListBox)sender).SelectedItem != null)
            {
                var info = (ChSet5Item)((ListBox)sender).SelectedItem;

                textBox_serviceView2.Text  = info.NetworkName + "\r\n";
                textBox_serviceView2.Text += "OriginalNetworkID : " + info.ONID.ToString() + " (0x" + info.ONID.ToString("X4") + ")\r\n";
                textBox_serviceView2.Text += "TransportStreamID : " + info.TSID.ToString() + " (0x" + info.TSID.ToString("X4") + ")\r\n";
                textBox_serviceView2.Text += "ServiceID : " + info.SID.ToString() + " (0x" + info.SID.ToString("X4") + ")" +
                                             (ChSet5.IsCS3(info.ONID) ? " " + (info.SID & 0x3FF) + "ch" : "") + "\r\n";
            }
        }
예제 #8
0
        public SearchKeyView()
        {
            InitializeComponent();

            foreach (string info in Settings.Instance.AndKeyList)
            {
                comboBox_andKey.Items.Add(info);
            }
            foreach (string info in Settings.Instance.NotKeyList)
            {
                comboBox_notKey.Items.Add(info);
            }

            EnableContentListBox(false);
            comboBox_content.ItemsSource   = CommonManager.Instance.ContentKindList;
            comboBox_content.SelectedIndex = 0;

            EnableDateListBox(false);
            comboBox_time_sw.ItemsSource   = CommonManager.Instance.DayOfWeekArray;
            comboBox_time_sw.SelectedIndex = 0;
            comboBox_time_sh.ItemsSource   = Enumerable.Range(0, 24);
            comboBox_time_sh.SelectedIndex = 0;
            comboBox_time_sm.ItemsSource   = Enumerable.Range(0, 60);
            comboBox_time_sm.SelectedIndex = 0;
            comboBox_time_ew.ItemsSource   = CommonManager.Instance.DayOfWeekArray;
            comboBox_time_ew.SelectedIndex = 6;
            comboBox_time_eh.ItemsSource   = Enumerable.Range(0, 24);
            comboBox_time_eh.SelectedIndex = 23;
            comboBox_time_em.ItemsSource   = Enumerable.Range(0, 60);
            comboBox_time_em.SelectedIndex = 59;
            comboBox_week_sh.ItemsSource   = Enumerable.Range(0, 24);
            comboBox_week_sh.SelectedIndex = 0;
            comboBox_week_sm.ItemsSource   = Enumerable.Range(0, 60);
            comboBox_week_sm.SelectedIndex = 0;
            radioButton_week.IsChecked     = true;

            var serviceList = new List <ServiceItem>();

            foreach (ChSet5Item info in ChSet5.Instance.ChListSelected)
            {
                if (ChSet5.IsCS3(info.ONID))
                {
                    button_cs3.Visibility = Visibility.Visible;
                }
                serviceList.Add(new ServiceItem(CommonManager.ConvertChSet5To(info)));
            }
            listView_service.ItemsSource = serviceList;
        }
예제 #9
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);
        }
예제 #10
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());
            }
        }
예제 #11
0
        private void listBox_service_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string text = "";

            if (((ListBox)sender).SelectedItem != null)
            {
                var info = (Tuple <string, ulong>)((ListBox)sender).SelectedItem;
                if (info.Item2 >> 48 != 0)
                {
                    text = info.Item1;
                }
                else
                {
                    ushort onid = (ushort)(info.Item2 >> 32);
                    ushort tsid = (ushort)(info.Item2 >> 16);
                    ushort sid  = (ushort)info.Item2;
                    text  = (ChSet5.Instance.ChList.ContainsKey(info.Item2) ? ChSet5.Instance.ChList[info.Item2].NetworkName : "???") + "\r\n";
                    text += "OriginalNetworkID : " + onid + " (0x" + onid.ToString("X4") + ")\r\n";
                    text += "TransportStreamID : " + tsid + " (0x" + tsid.ToString("X4") + ")\r\n";
                    text += "ServiceID : " + sid + " (0x" + sid.ToString("X4") + ")" + (ChSet5.IsCS3(onid) ? " " + (sid & 0x3FF) + "ch" : "");
                }
            }
            (sender == listBox_serviceView ? textBox_serviceView1 : textBox_serviceView2).Text = text;
        }
예제 #12
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);
        }