Ejemplo n.º 1
0
 public EpgSearchKeyInfo GetSearchKey()
 {
     var key = new EpgSearchKeyInfo();
     key.andKey = ComboBox_andKey.Text;
     key.notKey = ComboBox_notKey.Text;
     searchKeyDescView.GetSearchKey(ref key);
     return key;
 }
Ejemplo n.º 2
0
 public CustomEpgTabInfo()
 {
     ViewServiceList = new List<UInt64>();
     ViewContentKindList = new List<UInt16>();
     ViewMode = 0;
     NeedTimeOnlyBasic = false;
     NeedTimeOnlyWeek = false;
     StartTimeWeek = 4;
     SearchMode = false;
     SearchKey = new EpgSearchKeyInfo();
 }
Ejemplo n.º 3
0
        public SearchWindow()
        {
            InitializeComponent();

            try
            {
                if (Settings.Instance.NoStyle == 0)
                {
                    ResourceDictionary rd = new ResourceDictionary();
                    rd.MergedDictionaries.Add(
                        Application.LoadComponent(new Uri("/PresentationFramework.Aero, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35;component/themes/aero.normalcolor.xaml", UriKind.Relative)) as ResourceDictionary
                        //Application.LoadComponent(new Uri("/PresentationFramework.Classic, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/Classic.xaml", UriKind.Relative)) as ResourceDictionary
                        );
                    this.Resources = rd;
                }
                else
                {
                    button_search.Style = null;
                    button_add_reserve.Style = null;
                    button_add_epgAutoAdd.Style = null;
                    button_chg_epgAutoAdd.Style = null;
                }

                //ウインドウ位置の復元
                if (Settings.Instance.SearchWndTop != 0)
                {
                    this.Top = Settings.Instance.SearchWndTop;
                }
                if (Settings.Instance.SearchWndLeft != 0)
                {
                    this.Left = Settings.Instance.SearchWndLeft;
                }
                if (Settings.Instance.SearchWndWidth != 0)
                {
                    this.Width = Settings.Instance.SearchWndWidth;
                }
                if (Settings.Instance.SearchWndHeight != 0)
                {
                    this.Height = Settings.Instance.SearchWndHeight;
                }

                EpgSearchKeyInfo defKey = new EpgSearchKeyInfo();
                Settings.GetDefSearchSetting(ref defKey);

                searchKeyView.SetSearchKey(defKey);
            }
            catch
            {
            }
        }
Ejemplo n.º 4
0
 public void GetSearchKey(ref EpgSearchKeyInfo key)
 {
     searchKeyDescView.GetSearchKey(ref key);
     key.andKey = ComboBox_andKey.Text;
     key.notKey = ComboBox_notKey.Text;
 }
Ejemplo n.º 5
0
 public EpgAutoAddData()
 {
     dataID = 0;
     searchInfo = new EpgSearchKeyInfo();
     recSetting = new RecSettingData();
     addCount = 0;
 }
Ejemplo n.º 6
0
 public void SetSearchKey(EpgSearchKeyInfo key)
 {
     searchKeyDescView.SetSearchKey(key);
     ComboBox_andKey.Text = key.andKey;
     ComboBox_notKey.Text = key.notKey;
 }
Ejemplo n.º 7
0
        private void autoadd_Click(object sender, RoutedEventArgs e)
        {
            if (listView_recinfo.SelectedItem != null)
            {
                SearchWindow dlg = new SearchWindow();
                dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual;
                dlg.SetViewMode(1);

                EpgSearchKeyInfo key = new EpgSearchKeyInfo();

                RecInfoItem item = listView_recinfo.SelectedItem as RecInfoItem;

                key.andKey = item.RecInfo.Title;
                Int64 sidKey = ((Int64)item.RecInfo.OriginalNetworkID) << 32 | ((Int64)item.RecInfo.TransportStreamID) << 16 | ((Int64)item.RecInfo.ServiceID);
                key.serviceList.Add(sidKey);

                dlg.SetSearchDefKey(key);
                dlg.ShowDialog();
            }
        }
Ejemplo n.º 8
0
 public static void CopyTo(this EpgSearchKeyInfo src, EpgSearchKeyInfo dest)
 {
     CopyObj.CopyTo(src, dest, CopyData);
 }
Ejemplo n.º 9
0
 public void SetSearchKey(EpgSearchKeyInfo key)
 {
     defKey = key;
     UpdateView();
 }
Ejemplo n.º 10
0
 public void SetDefSetting(EpgSearchKeyInfo key)
 {
     searchKey.SetSearchKey(key);
 }
Ejemplo n.º 11
0
        public void SetSearchKey(EpgSearchKeyInfo key)
        {
            comboBox_andKey.Text         = Regex.Replace(key.andKey, @"^(?:\^!\{999\})?(?:C!\{999\})?(?:D!\{1[0-9]{8}\})?", "");
            comboBox_notKey.Text         = key.notKey;
            checkBox_regExp.IsChecked    = key.regExpFlag != 0;
            checkBox_aimai.IsChecked     = key.aimaiFlag != 0;
            checkBox_titleOnly.IsChecked = key.titleOnlyFlag != 0;
            var match = Regex.Match(key.andKey, @"^((?:\^!\{999\})?)((?:C!\{999\})?)((?:D!\{1[0-9]{8}\})?)");

            checkBox_keyDisabled.IsChecked = match.Groups[1].Value.Length > 0;
            checkBox_case.IsChecked        = match.Groups[2].Value.Length > 0;
            uint dur = 0;

            if (match.Groups[3].Value.Length > 0)
            {
                dur = uint.Parse(match.Groups[3].Value.Substring(3, 9));
            }
            textBox_chkDurationMin.Text = (dur / 10000 % 10000).ToString();
            textBox_chkDurationMax.Text = (dur % 10000).ToString();

            EnableContentListBox(true);
            listBox_content.Items.Clear();
            foreach (EpgContentData item in key.contentList)
            {
                ushort contentKey = (ushort)(item.content_nibble_level_1 << 8 | item.content_nibble_level_2);
                if (CommonManager.Instance.ContentKindDictionary.ContainsKey(contentKey))
                {
                    listBox_content.Items.Add(CommonManager.Instance.ContentKindDictionary[contentKey]);
                }
                else
                {
                    //未知のジャンル
                    listBox_content.Items.Add(new ContentKindInfo("?", "?", item.content_nibble_level_1, item.content_nibble_level_2));
                }
            }
            if (listBox_content.Items.Count == 0)
            {
                EnableContentListBox(false);
            }
            checkBox_notContent.IsChecked = key.notContetFlag != 0;

            EnableDateListBox(true);
            listBox_date.Items.Clear();
            foreach (EpgSearchDateInfo info in key.dateList)
            {
                DateItem item = new DateItem();
                item.DateInfo = info;
                listBox_date.Items.Add(item);
            }
            if (listBox_date.Items.Count == 0)
            {
                EnableDateListBox(false);
            }
            checkBox_notDate.IsChecked = key.notDateFlag != 0;

            var keySortedServiceList = new List <long>(key.serviceList);

            keySortedServiceList.Sort();
            ServiceItem firstSelected = null;

            foreach (ServiceItem info in listView_service.ItemsSource)
            {
                info.IsSelected = keySortedServiceList.BinarySearch((long)info.ID) >= 0;
                if (firstSelected == null && info.IsSelected)
                {
                    firstSelected = info;
                }
            }
            if (firstSelected != null)
            {
                listView_service.ScrollIntoView(firstSelected);
            }

            comboBox_free.SelectedIndex        = key.freeCAFlag % 3;
            checkBox_chkRecEnd.IsChecked       = key.chkRecEnd != 0;
            textBox_chkRecDay.Text             = (key.chkRecDay >= 40000 ? key.chkRecDay % 10000 : key.chkRecDay).ToString();
            checkBox_chkRecNoService.IsChecked = key.chkRecDay >= 40000;
        }
Ejemplo n.º 12
0
        private void button_del2_Click(object sender, RoutedEventArgs e)
        {
            if (listView_key.SelectedItems.Count == 0)
            {
                return;
            }

            string text1 = "予約項目ごと削除してよろしいですか?\r\n"
                           + "(無効の「自動予約登録項目」による予約も削除されます。)";
            string caption1 = "[予約ごと削除]の確認";

            if (MessageBox.Show(text1, caption1, MessageBoxButton.OKCancel,
                                MessageBoxImage.Exclamation, MessageBoxResult.OK) != MessageBoxResult.OK)
            {
                return;
            }

            //EpgTimerSrvでの自動予約登録の実行タイミングに左右されず確実に予約を削除するため、
            //先に自動予約登録項目を削除する。

            //自動予約登録項目のリストを保持
            List <EpgAutoDataItem> autoaddlist = new List <EpgAutoDataItem>();

            foreach (EpgAutoDataItem item in listView_key.SelectedItems)
            {
                autoaddlist.Add(item);
            }

            button_del_Click(sender, e);

            try
            {
                //配下の予約の削除

                //検索リストの取得
                List <EpgSearchKeyInfo> keyList = new List <EpgSearchKeyInfo>();
                List <EpgEventInfo>     list    = new List <EpgEventInfo>();

                foreach (EpgAutoDataItem item in autoaddlist)
                {
                    EpgSearchKeyInfo key = item.EpgAutoAddInfo.searchInfo;
                    key.andKey = key.andKey.Substring(key.andKey.StartsWith("^!{999}") ? 7 : 0);//無効解除
                    keyList.Add(key);
                }

                cmd.SendSearchPg(keyList, ref list);

                List <UInt32> dellist = new List <UInt32>();

                foreach (EpgEventInfo info in list)
                {
                    if (info.start_time.AddSeconds(info.durationSec) > DateTime.Now)
                    {
                        foreach (ReserveData info2 in CommonManager.Instance.DB.ReserveList.Values)
                        {
                            if (info.original_network_id == info2.OriginalNetworkID &&
                                info.transport_stream_id == info2.TransportStreamID &&
                                info.service_id == info2.ServiceID &&
                                info.event_id == info2.EventID)
                            {
                                //重複したEpgEventInfoは送られてこないので、登録時の重複チェックは不要
                                dellist.Add(info2.ReserveID);
                                break;
                            }
                        }
                    }
                }

                if (dellist.Count > 0)
                {
                    cmd.SendDelReserve(dellist);
                    CommonManager.Instance.DB.SetUpdateNotify((UInt32)UpdateNotifyItem.ReserveInfo);
                    CommonManager.Instance.DB.ReloadReserveInfo();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// デフォルト表示の設定値
        /// </summary>
        /// <param name="setInfo"></param>
        public void SetSetting(CustomEpgTabInfo setInfo)
        {
            searchKey = setInfo.SearchKey.DeepClone();

            textBox_tabName.Text                = setInfo.TabName;
            radioButton_rate.IsChecked          = setInfo.ViewMode != 1 && setInfo.ViewMode != 2;
            radioButton_week.IsChecked          = setInfo.ViewMode == 1;
            radioButton_list.IsChecked          = setInfo.ViewMode == 2;
            radioButton_designDefault.IsChecked = setInfo.EpgSettingIndex != 1 && setInfo.EpgSettingIndex != 2;
            radioButton_designSub1.IsChecked    = setInfo.EpgSettingIndex == 1;
            radioButton_designSub2.IsChecked    = setInfo.EpgSettingIndex == 2;

            if (setInfo.NeedTimeOnlyBasic == true)
            {
                checkBox_noTimeView_rate.IsChecked = true;
            }
            else
            {
                checkBox_noTimeView_rate.IsChecked = false;
            }
            if (setInfo.NeedTimeOnlyWeek == true)
            {
                checkBox_noTimeView_week.IsChecked = true;
            }
            else
            {
                checkBox_noTimeView_week.IsChecked = false;
            }
            comboBox_timeH_week.SelectedIndex = setInfo.StartTimeWeek;

            checkBox_highlightContentKind.IsChecked = setInfo.HighlightContentKind;
            checkBox_searchMode.IsChecked           = setInfo.SearchMode;

            foreach (UInt64 id in setInfo.ViewServiceList)
            {
                listBox_serviceView.Items.Add(
                    id == (ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceDttv ? listBox_serviceTere.Items[0] :
                    id == (ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceBS ? listBox_serviceBS.Items[0] :
                    id == (ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceCS ? listBox_serviceCS.Items[0] :
                    id == (ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceCS3 ? listBox_serviceCS3.Items[0] :
                    id == (ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceOther ? listBox_serviceOther.Items[0] :
                    new Tuple <string, ulong>(ChSet5.Instance.ChList.ContainsKey(id) ? ChSet5.Instance.ChList[id].ServiceName : "???", id));
            }
            foreach (UInt16 id in setInfo.ViewContentKindList)
            {
                listBox_jyanruView.Items.Add(listBox_jyanru.Items.Cast <ContentKindInfo>().FirstOrDefault(info => info.ID == id) ??
                                             new ContentKindInfo()
                {
                    Nibble1 = (byte)(id >> 8), Nibble2 = (byte)id
                });
            }

            if (setInfo.FilterEnded == true)
            {
                checkBox_filterEnded.IsChecked = true;
            }
            else
            {
                checkBox_filterEnded.IsChecked = false;
            }
        }
Ejemplo n.º 14
0
        public static EpgSearchKeyInfo SendAutoAddKey(IBasicPgInfo item, bool NotToggle = false, EpgSearchKeyInfo key = null)
        {
            key            = key ?? Settings.Instance.SearchPresetList[0].Data.DeepClone();
            key.andKey     = TrimEpgKeyword(item.DataTitle, NotToggle);
            key.regExpFlag = 0;
            key.serviceList.Clear();
            key.serviceList.Add((Int64)item.Create64Key());

            var eventInfo = item as EpgEventInfo;

            if (eventInfo != null && Settings.Instance.MenuSet.SetJunreToAutoAdd == true)
            {
                key.notContetFlag = 0;
                key.contentList.Clear();
                if (eventInfo.ContentInfo != null)
                {
                    var kindList = eventInfo.ContentInfo.nibbleList.Where(info => info.IsAttributeInfo == false);
                    if (Settings.Instance.MenuSet.SetJunreContentToAutoAdd == true)
                    {
                        kindList = kindList.GroupBy(info => info.CategoryKey).Select(gr => new EpgContentData(gr.Key));
                    }
                    key.contentList = kindList.DeepClone();
                }
            }
            return(key);
        }
Ejemplo n.º 15
0
 public static void CopyTo(this EpgSearchKeyInfo src, EpgSearchKeyInfo dest)
 {
     CopyObj.CopyTo(src, dest, CopyData);
 }
Ejemplo n.º 16
0
 private static void CopyData(EpgSearchKeyInfo src, EpgSearchKeyInfo dest)
 {
     dest.aimaiFlag = src.aimaiFlag;
     dest.andKey = src.andKey;
     dest.audioList = src.audioList.ToList();
     dest.contentList = src.contentList.Clone(); //EpgContentData
     dest.dateList = src.dateList.Clone();       //EpgSearchDateInfo
     dest.freeCAFlag = src.freeCAFlag;
     dest.notContetFlag = src.notContetFlag;
     dest.notDateFlag = src.notDateFlag;
     dest.notKey = src.notKey;
     dest.regExpFlag = src.regExpFlag;
     dest.serviceList = src.serviceList.ToList();
     dest.titleOnlyFlag = src.titleOnlyFlag;
     dest.videoList = src.videoList.ToList();
     dest.chkRecEnd = src.chkRecEnd;
     dest.chkRecDay = src.chkRecDay;
     dest.chkRecNoService = src.chkRecNoService;
     dest.chkDurationMin = src.chkDurationMin;
     dest.chkDurationMax = src.chkDurationMax;
     dest.caseFlag = src.caseFlag;
     dest.keyDisabledFlag = src.keyDisabledFlag;
 }
Ejemplo n.º 17
0
        public bool LoadEAAFile(String filePath)
        {
            bool ret = false;

            System.IO.StreamReader reader = null;
            try
            {
                reader = (new System.IO.StreamReader(filePath, System.Text.Encoding.Default));
                while (reader.Peek() >= 0)
                {
                    string buff = reader.ReadLine();
                    if (buff.IndexOf(";") == 0)
                    {
                        //コメント行
                    }
                    else
                    {
                        AddKey = new EpgAutoAddData();
                        EpgSearchKeyInfo searchKey = new EpgSearchKeyInfo();
                        RecSettingData   recSetKey = new RecSettingData();

                        string[] list = buff.Split('\t');
                        if (list.Length == 0)
                        {
                            continue;
                        }
                        try
                        {
                            searchKey.andKey        = list[0];
                            searchKey.notKey        = list[1];
                            searchKey.regExpFlag    = Convert.ToByte(list[2]);
                            searchKey.titleOnlyFlag = Convert.ToByte(list[3]);
                            //対象ジャンル
                            searchKey.contentList = new List <EpgContentData>();
                            string[] valBuff;
                            if (list[4].Length > 0)
                            {
                                valBuff = list[4].Split(',');
                                foreach (string val in valBuff)
                                {
                                    UInt32         content = Convert.ToUInt32(val);
                                    EpgContentData addItem = new EpgContentData();
                                    addItem.content_nibble_level_1 = (byte)((content & 0xFF000000) >> 24);
                                    addItem.content_nibble_level_2 = (byte)((content & 0x00FF0000) >> 16);
                                    addItem.user_nibble_1          = (byte)((content & 0x0000FF00) >> 8);
                                    addItem.user_nibble_2          = (byte)((content & 0x000000FF));

                                    searchKey.contentList.Add(addItem);
                                }
                            }
                            //対象期間
                            searchKey.dateList = new List <EpgSearchDateInfo>();
                            if (list[5].Length > 0)
                            {
                                valBuff = list[5].Split(',');
                                foreach (string val in valBuff)
                                {
                                    string[]          dateBuff = val.Split('-');
                                    EpgSearchDateInfo addItem  = new EpgSearchDateInfo();
                                    addItem.startDayOfWeek = Convert.ToByte(dateBuff[0]);
                                    UInt32 time = Convert.ToUInt32(dateBuff[1]);
                                    addItem.startHour    = (UInt16)((time & 0xFFFF0000) >> 16);
                                    addItem.startMin     = (UInt16)((time & 0x0000FFFF));
                                    addItem.endDayOfWeek = Convert.ToByte(dateBuff[2]);
                                    time            = Convert.ToUInt32(dateBuff[3]);
                                    addItem.endHour = (UInt16)((time & 0xFFFF0000) >> 16);
                                    addItem.endMin  = (UInt16)((time & 0x0000FFFF));

                                    searchKey.dateList.Add(addItem);
                                }
                            }
                            //対象サービス
                            searchKey.serviceList = new List <long>();
                            if (list[6].Length > 0)
                            {
                                valBuff = list[6].Split(',');
                                foreach (string val in valBuff)
                                {
                                    Int64 addItem = 0;
                                    addItem = Convert.ToInt64(val, 16);

                                    searchKey.serviceList.Add(addItem);
                                }
                            }
                            searchKey.aimaiFlag = Convert.ToByte(list[7]);


                            Settings.GetDefRecSetting(0, ref recSetKey);

                            AddKey.searchInfo = searchKey;
                            AddKey.recSetting = recSetKey;

                            ret = true;
                        }
                        catch
                        {
                        }
                    }
                }
            }
            catch
            {
                AddKey = null;
            }
            if (reader != null)
            {
                reader.Close();
            }
            return(ret);
        }
Ejemplo n.º 18
0
 private void button_searchKey_Click(object sender, RoutedEventArgs e)
 {
     var dlg = new SetDefSearchSettingWindow();
     dlg.Owner = CommonUtil.GetTopWindow(this);
     EpgSearchKeyInfo setKey = searchKey.Clone();
     if (checkBox_searchServiceFromView.IsChecked == true)
     {
         setKey.serviceList = listBox_serviceView.Items.OfType<ChSet5Item>().Select(ch => (long)ch.Key).ToList();
     }
     dlg.SetDefSetting(setKey);
     if (dlg.ShowDialog() == true)
     {
         searchKey = dlg.GetSetting();
         if (checkBox_searchServiceFromView.IsChecked == true)
         {
             var oldList = listBox_serviceView.Items.OfType<object>().ToList();
             var searchList = new List<object>();
             foreach (ulong sv in searchKey.serviceList)
             {
                 if (ChSet5.ChList.ContainsKey(sv) == true)
                 {
                     searchList.Add(ChSet5.ChList[sv]);
                 }
             }
             listBox_serviceView.UnselectAll();
             listBox_serviceView.Items.RemoveItems(oldList.Where(sv => searchList.Contains(sv) == false));
             listBox_serviceView.Items.AddItems(searchList.Where(sv => oldList.Contains(sv) == false));
         }
     }
 }
Ejemplo n.º 19
0
 public void GetSetting(ref EpgSearchKeyInfo key)
 {
     searchKey.GetSearchKey(ref key);
 }
Ejemplo n.º 20
0
 public void GetSearchKey(ref EpgSearchKeyInfo key)
 {
     searchKeyView.GetSearchKey(ref key);
 }
Ejemplo n.º 21
0
        public void GetSearchKey(ref EpgSearchKeyInfo key)
        {
            try
            {
                if (checkBox_regExp.IsChecked == true)
                {
                    key.regExpFlag = 1;
                    key.aimaiFlag = 0;
                }
                else
                {
                    key.regExpFlag = 0;
                    if (checkBox_aimai.IsChecked == true)
                    {
                        key.aimaiFlag = 1;
                    }
                    else
                    {
                        key.aimaiFlag = 0;
                    }
                }
                if (checkBox_titleOnly.IsChecked == true)
                {
                    key.titleOnlyFlag = 1;
                }
                else
                {
                    key.titleOnlyFlag = 0;
                }
                if (checkBox_keyDisabled.IsChecked == true)
                {
                    key.andKey = (key.andKey.StartsWith("^!{999}") ? "" : "^!{999}") + key.andKey;
                }
                else
                {
                    key.andKey = key.andKey.Substring(key.andKey.StartsWith("^!{999}") ? 7 : 0);
                }

                key.contentList.Clear();
                foreach (ContentKindInfo info in listBox_content.Items)
                {
                    EpgContentData item = new EpgContentData();
                    item.content_nibble_level_1 = info.Nibble1;
                    item.content_nibble_level_2 = info.Nibble2;
                    key.contentList.Add(item);
                }
                if (checkBox_notContent.IsChecked == true)
                {
                    key.notContetFlag = 1;
                }
                else
                {
                    key.notContetFlag = 0;
                }

                key.serviceList.Clear();
                foreach (ServiceItem info in listView_service.Items)
                {
                    if (info.IsSelected == true)
                    {
                        key.serviceList.Add((Int64)info.ID);
                    }
                }

                key.dateList.Clear();
                foreach (DateItem info in listBox_date.Items)
                {
                    key.dateList.Add(info.DateInfo);
                }
                if (checkBox_notDate.IsChecked == true)
                {
                    key.notDateFlag = 1;
                }
                else
                {
                    key.notDateFlag = 0;
                }

                if (radioButton_free_2.IsChecked == true)
                {
                    //無料
                    key.freeCAFlag = 1;
                }
                else if (radioButton_free_3.IsChecked == true)
                {
                    //有料
                    key.freeCAFlag = 2;
                }
                else
                {
                    key.freeCAFlag = 0;
                }

                if (checkBox_chkRecEnd.IsChecked == true)
                {
                    key.chkRecEnd = 1;
                }
                else
                {
                    key.chkRecEnd = 0;
                }
                key.chkRecDay = Convert.ToUInt16(textBox_chkRecDay.Text.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Ejemplo n.º 22
0
        private void SearchPg()
        {
            try
            {
                ICollectionView dataView = CollectionViewSource.GetDefaultView(listView_result.DataContext);
                if (dataView != null)
                {
                    dataView.SortDescriptions.Clear();
                    dataView.Refresh();
                }
                listView_result.DataContext = null;

                resultList.Clear();


                EpgSearchKeyInfo key = new EpgSearchKeyInfo();
                searchKeyView.GetSearchKey(ref key);
                key.andKey = key.andKey.Substring(key.andKey.StartsWith("^!{999}") ? 7 : 0);
                List <EpgSearchKeyInfo> keyList = new List <EpgSearchKeyInfo>();

                keyList.Add(key);
                List <EpgEventInfo> list = new List <EpgEventInfo>();

                cmd.SendSearchPg(keyList, ref list);
                foreach (EpgEventInfo info in list)
                {
                    SearchItem item = new SearchItem();
                    item.EventInfo = info;

                    if (item.EventInfo.start_time.AddSeconds(item.EventInfo.durationSec) > DateTime.Now)
                    {
                        foreach (ReserveData info2 in CommonManager.Instance.DB.ReserveList.Values)
                        {
                            if (info.original_network_id == info2.OriginalNetworkID &&
                                info.transport_stream_id == info2.TransportStreamID &&
                                info.service_id == info2.ServiceID &&
                                info.event_id == info2.EventID)
                            {
                                item.ReserveInfo = info2;
                                break;
                            }
                        }
                        UInt64 serviceKey = CommonManager.Create64Key(info.original_network_id, info.transport_stream_id, info.service_id);
                        if (ChSet5.Instance.ChList.ContainsKey(serviceKey) == true)
                        {
                            item.ServiceName = ChSet5.Instance.ChList[serviceKey].ServiceName;
                        }
                        if (Settings.Instance.FixSearchResult)
                        {
                            item.EventInfo.ShortInfo.text_char = "省略";
                        }

                        resultList.Add(item);
                    }
                }

                listView_result.DataContext = resultList;
                //if (_lastHeaderClicked != null) {
                //    Sort(_lastHeaderClicked, _lastDirection);
                //} else {
                //    string header = ((Binding)gridView_result.Columns[1].DisplayMemberBinding).Path.Path;
                //    Sort(header, _lastDirection);
                //    _lastHeaderClicked = header;
                //}
                if (this.gridViewSorter.isExistSortParams)
                {
                    this.gridViewSorter.SortByMultiHeader(this.resultList);
                }
                else
                {
                    this.gridViewSorter.resetSortParams();
                    this.gridViewSorter.SortByMultiHeader(
                        this.resultList,
                        gridView_result.Columns[1].Header as GridViewColumnHeader);
                }

                searchKeyView.SaveSearchLog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Ejemplo n.º 23
0
 public EpgAutoAddData()
 {
     dataID = 0;
     searchInfo = new EpgSearchKeyInfo();
     recSetting = new RecSettingData();
     addCount = 0;
     reserveList = new List<ReserveBasicData>();
     recFileList = new List<RecFileBasicInfo>();
 }
Ejemplo n.º 24
0
 public String ConvertJyanruText(EpgSearchKeyInfo searchKeyInfo)
 {
     if (searchKeyInfo == null)
     {
         return "";
     }
     else
     {
         return ConvertJyanruText(searchKeyInfo.contentList);
     }
 }
Ejemplo n.º 25
0
        /// <summary>
        /// デフォルト表示の設定値
        /// </summary>
        /// <param name="setInfo"></param>
        public void SetSetting(CustomEpgTabInfo setInfo)
        {
            searchKey = setInfo.SearchKey.DeepClone();

            textBox_tabName.Text = setInfo.TabName;
            if (setInfo.ViewMode == 1)
            {
                radioButton_rate.IsChecked = false;
                radioButton_week.IsChecked = true;
                radioButton_list.IsChecked = false;
            }
            else if (setInfo.ViewMode == 2)
            {
                radioButton_rate.IsChecked = false;
                radioButton_week.IsChecked = false;
                radioButton_list.IsChecked = true;
            }
            else
            {
                radioButton_rate.IsChecked = true;
                radioButton_week.IsChecked = false;
                radioButton_list.IsChecked = false;
            }

            if (setInfo.NeedTimeOnlyBasic == true)
            {
                checkBox_noTimeView_rate.IsChecked = true;
            }
            else
            {
                checkBox_noTimeView_rate.IsChecked = false;
            }
            if (setInfo.NeedTimeOnlyWeek == true)
            {
                checkBox_noTimeView_week.IsChecked = true;
            }
            else
            {
                checkBox_noTimeView_week.IsChecked = false;
            }
            comboBox_timeH_week.SelectedIndex = setInfo.StartTimeWeek;

            if (setInfo.SearchMode == true)
            {
                checkBox_searchMode.IsChecked = true;
            }
            else
            {
                checkBox_searchMode.IsChecked = false;
            }

            foreach (UInt64 id in setInfo.ViewServiceList)
            {
                if (ChSet5.Instance.ChList.ContainsKey(id) == true)
                {
                    listBox_serviceView.Items.Add(ChSet5.Instance.ChList[id]);
                }
            }
            foreach (UInt16 id in setInfo.ViewContentKindList)
            {
                if (CommonManager.Instance.ContentKindDictionary.ContainsKey(id) == true)
                {
                    listBox_jyanruView.Items.Add(CommonManager.Instance.ContentKindDictionary[id]);
                }
            }

            if (setInfo.FilterEnded == true)
            {
                checkBox_filterEnded.IsChecked = true;
            }
            else
            {
                checkBox_filterEnded.IsChecked = false;
            }
        }
Ejemplo n.º 26
0
 public void GetSearchKey(ref EpgSearchKeyInfo key)
 {
     searchKeyDescView.GetSearchKey(ref key);
     key.andKey = ComboBox_andKey.Text;
     key.notKey = ComboBox_notKey.Text;
 }
Ejemplo n.º 27
0
        private void cm_autoadd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender.GetType() != typeof(MenuItem))
                {
                    return;
                }
                if (listView_event.SelectedItem != null)
                {
                    SearchItem item = listView_event.SelectedItem as SearchItem;

                    SearchWindow dlg = new SearchWindow();
                    dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual;
                    dlg.SetViewMode(1);

                    EpgSearchKeyInfo key = new EpgSearchKeyInfo();

                    if (item.EventInfo.ShortInfo != null)
                    {
                        key.andKey = item.EventInfo.ShortInfo.event_name;
                    }
                    Int64 sidKey = ((Int64)item.EventInfo.original_network_id) << 32 | ((Int64)item.EventInfo.transport_stream_id) << 16 | ((Int64)item.EventInfo.service_id);
                    key.serviceList.Add(sidKey);

                    dlg.SetSearchDefKey(key);
                    dlg.ShowDialog();                
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Ejemplo n.º 28
0
        private void MenuItem_Click_Research(object sender, RoutedEventArgs e)
        {
            if (listView_result.SelectedItem != null)
            {
                SearchItem item = listView_result.SelectedItem as SearchItem;
                EpgSearchKeyInfo defKey = new EpgSearchKeyInfo();
                defKey.andKey = item.EventName;
                defKey.serviceList.Clear();

                foreach (ServiceItem info in searchKeyView.searchKeyDescView.listView_service.Items)
                {
                    if (info.ServiceName.Equals(item.ServiceName))
                    {
                        defKey.serviceList.Add((long)info.ID);
                    }
                }
                searchKeyView.SetSearchKey(defKey);

                button_search_Click(sender, e);
            }
        }
Ejemplo n.º 29
0
        public void GetSearchKey(ref EpgSearchKeyInfo key)
        {
            try
            {
                key.regExpFlag      = (byte)(checkBox_regExp.IsChecked == true ? 1 : 0);
                key.aimaiFlag       = (byte)(checkBox_aimai.IsChecked == true ? 1 : 0);
                key.titleOnlyFlag   = (byte)(checkBox_titleOnly.IsChecked == true ? 1 : 0);
                key.caseFlag        = (byte)(checkBox_case.IsChecked == true ? 1 : 0);
                key.keyDisabledFlag = (byte)(checkBox_keyDisabled.IsChecked == true ? 1 : 0);

                key.contentList.Clear();
                foreach (ContentKindInfo info in listBox_content.Items)
                {
                    EpgContentData item = new EpgContentData();
                    item.content_nibble_level_1 = info.Nibble1;
                    item.content_nibble_level_2 = info.Nibble2;
                    key.contentList.Add(item);
                }
                key.notContetFlag = (byte)(checkBox_notContent.IsChecked == true ? 1 : 0);

                key.serviceList.Clear();
                foreach (ServiceItem info in listView_service.Items)
                {
                    if (info.IsSelected == true)
                    {
                        key.serviceList.Add((Int64)info.ID);
                    }
                }

                key.dateList.Clear();
                foreach (DateItem info in listBox_date.Items)
                {
                    key.dateList.Add(info.DateInfo);
                }
                key.notDateFlag = (byte)(checkBox_notDate.IsChecked == true ? 1 : 0);

                if (radioButton_free_2.IsChecked == true)
                {
                    //無料
                    key.freeCAFlag = 1;
                }
                else if (radioButton_free_3.IsChecked == true)
                {
                    //有料
                    key.freeCAFlag = 2;
                }
                else
                {
                    key.freeCAFlag = 0;
                }

                key.chkRecEnd       = (byte)(checkBox_chkRecEnd.IsChecked == true ? 1 : 0);
                key.chkRecDay       = MenuUtil.MyToNumerical(textBox_chkRecDay, Convert.ToUInt16, ushort.MinValue);
                key.chkRecNoService = (byte)(radioButton_chkRecNoService2.IsChecked == true ? 1 : 0);
                key.chkDurationMin  = MenuUtil.MyToNumerical(textBox_chkDurationMin, Convert.ToUInt16, ushort.MinValue);
                key.chkDurationMax  = MenuUtil.MyToNumerical(textBox_chkDurationMax, Convert.ToUInt16, ushort.MinValue);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Ejemplo n.º 30
0
 public void SetSearchKey(EpgSearchKeyInfo key)
 {
     searchKeyDescView.SetSearchKey(key);
     ComboBox_andKey.Text = key.andKey.Substring(key.andKey.StartsWith("^!{999}") ? 7 : 0);
     ComboBox_notKey.Text = key.notKey;
 }
Ejemplo n.º 31
0
        public EpgSearchKeyInfo GetSearchKey()
        {
            var key = new EpgSearchKeyInfo();

            key.andKey        = comboBox_andKey.Text;
            key.notKey        = comboBox_notKey.Text;
            key.regExpFlag    = checkBox_regExp.IsChecked == true ? 1 : 0;
            key.aimaiFlag     = (byte)(key.regExpFlag == 0 && checkBox_aimai.IsChecked == true ? 1 : 0);
            key.titleOnlyFlag = checkBox_titleOnly.IsChecked == true ? 1 : 0;
            uint durMin;
            uint durMax;

            if (uint.TryParse(textBox_chkDurationMin.Text, out durMin) &&
                uint.TryParse(textBox_chkDurationMax.Text, out durMax) && (durMin > 0 || durMax > 0))
            {
                key.andKey = "D!{" + ((10000 + Math.Min(durMin, 9999)) * 10000 + Math.Min(durMax, 9999)) + "}" + key.andKey;
            }
            if (checkBox_case.IsChecked == true)
            {
                key.andKey = "C!{999}" + key.andKey;
            }
            if (checkBox_keyDisabled.IsChecked == true)
            {
                key.andKey = "^!{999}" + key.andKey;
            }

            if (listBox_content.IsEnabled)
            {
                foreach (ContentKindInfo info in listBox_content.Items)
                {
                    EpgContentData item = new EpgContentData();
                    item.content_nibble_level_1 = info.Nibble1;
                    item.content_nibble_level_2 = info.Nibble2;
                    key.contentList.Add(item);
                }
            }
            key.notContetFlag = (byte)(checkBox_notContent.IsChecked == true ? 1 : 0);

            if (listBox_date.IsEnabled)
            {
                foreach (Tuple <string, EpgSearchDateInfo> info in listBox_date.Items)
                {
                    key.dateList.Add(info.Item2);
                }
            }
            key.notDateFlag = (byte)(checkBox_notDate.IsChecked == true ? 1 : 0);

            foreach (ServiceItem info in listView_service.Items)
            {
                if (info.IsSelected)
                {
                    key.serviceList.Add((long)info.ID);
                }
            }

            key.freeCAFlag = (byte)Math.Min(Math.Max(comboBox_free.SelectedIndex, 0), 2);
            key.chkRecEnd  = (byte)(checkBox_chkRecEnd.IsChecked == true ? 1 : 0);
            ushort.TryParse(textBox_chkRecDay.Text, out key.chkRecDay);
            if (checkBox_chkRecNoService.IsChecked == true)
            {
                key.chkRecDay = (ushort)(key.chkRecDay % 10000 + 40000);
            }
            return(key);
        }
Ejemplo n.º 32
0
 public void SetSearchKey(EpgSearchKeyInfo key)
 {
     searchKeyDescView.SetSearchKey(key);
     ComboBox_andKey.Text = key.andKey;
     ComboBox_notKey.Text = key.notKey;
 }
Ejemplo n.º 33
0
        public void SetSearchKey(EpgSearchKeyInfo key)
        {
            comboBox_andKey.Text         = Regex.Replace(key.andKey, @"^(?:\^!\{999\})?(?:C!\{999\})?(?:D!\{1[0-9]{8}\})?", "");
            comboBox_notKey.Text         = key.notKey;
            checkBox_regExp.IsChecked    = key.regExpFlag != 0;
            checkBox_aimai.IsChecked     = key.aimaiFlag != 0;
            checkBox_titleOnly.IsChecked = key.titleOnlyFlag != 0;
            var match = Regex.Match(key.andKey, @"^((?:\^!\{999\})?)((?:C!\{999\})?)((?:D!\{1[0-9]{8}\})?)");

            checkBox_keyDisabled.IsChecked = match.Groups[1].Value.Length > 0;
            checkBox_case.IsChecked        = match.Groups[2].Value.Length > 0;
            uint dur = 0;

            if (match.Groups[3].Value.Length > 0)
            {
                dur = uint.Parse(match.Groups[3].Value.Substring(3, 9));
            }
            textBox_chkDurationMin.Text = (dur / 10000 % 10000).ToString();
            textBox_chkDurationMax.Text = (dur % 10000).ToString();

            EnableContentListBox(true);
            listBox_content.Items.Clear();
            foreach (EpgContentData item in key.contentList)
            {
                ushort          contentKey = (ushort)(item.content_nibble_level_1 << 8 | item.content_nibble_level_2);
                ContentKindInfo info       = comboBox_content.Items.Cast <ContentKindInfo>().FirstOrDefault(a => a.ID == contentKey);
                if (info == null)
                {
                    //未知のジャンル
                    info = new ContentKindInfo()
                    {
                        Nibble1 = item.content_nibble_level_1, Nibble2 = item.content_nibble_level_2
                    };
                }
                listBox_content.Items.Add(info);
            }
            if (listBox_content.Items.Count == 0)
            {
                EnableContentListBox(false);
            }
            checkBox_notContent.IsChecked = key.notContetFlag != 0;

            EnableDateListBox(true);
            listBox_date.Items.Clear();
            foreach (EpgSearchDateInfo info in key.dateList)
            {
                listBox_date.Items.Add(new Tuple <string, EpgSearchDateInfo>(
                                           (new DateTime(2000, 1, 2 + info.startDayOfWeek % 7, info.startHour % 24, info.startMin % 60, 0)).ToString("ddd HH\\:mm") +
                                           (new DateTime(2000, 1, 2 + info.endDayOfWeek % 7, info.endHour % 24, info.endMin % 60, 0)).ToString(" ~ ddd HH\\:mm"), info));
            }
            if (listBox_date.Items.Count == 0)
            {
                EnableDateListBox(false);
            }
            checkBox_notDate.IsChecked = key.notDateFlag != 0;

            var keySortedServiceList = new List <long>(key.serviceList);

            keySortedServiceList.Sort();
            ServiceItem firstSelected = null;

            foreach (ServiceItem info in listView_service.Items)
            {
                info.IsSelected = keySortedServiceList.BinarySearch((long)info.ID) >= 0;
                if (firstSelected == null && info.IsSelected)
                {
                    firstSelected = info;
                }
            }
            if (firstSelected != null)
            {
                listView_service.ScrollIntoView(firstSelected);
            }

            comboBox_free.SelectedIndex        = key.freeCAFlag % 3;
            checkBox_chkRecEnd.IsChecked       = key.chkRecEnd != 0;
            textBox_chkRecDay.Text             = (key.chkRecDay >= 40000 ? key.chkRecDay % 10000 : key.chkRecDay).ToString();
            checkBox_chkRecNoService.IsChecked = key.chkRecDay >= 40000;
        }
Ejemplo n.º 34
0
        /// <summary>
        /// 右クリックメニュー 自動予約登録イベント呼び出し
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cm_autoadd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender.GetType() != typeof(MenuItem))
                {
                    return;
                }

                EpgEventInfo program = new EpgEventInfo();
                if (GetProgramItem(clickPos, ref program) == false)
                {
                    return;
                }

                SearchWindow dlg = new SearchWindow();
                dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual;
                dlg.SetViewMode(1);

                EpgSearchKeyInfo key = new EpgSearchKeyInfo();

                if (program.ShortInfo != null)
                {
                    key.andKey = program.ShortInfo.event_name;
                }
                Int64 sidKey = ((Int64)program.original_network_id) << 32 | ((Int64)program.transport_stream_id) << 16 | ((Int64)program.service_id);
                key.serviceList.Add(sidKey);

                dlg.SetSearchDefKey(key);
                dlg.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Ejemplo n.º 35
0
        public void GetSearchKey(ref EpgSearchKeyInfo key)
        {
            try
            {
                key.regExpFlag = (byte)(checkBox_regExp.IsChecked == true ? 1 : 0);
                key.aimaiFlag = (byte)(checkBox_aimai.IsChecked == true ? 1 : 0);
                key.titleOnlyFlag = (byte)(checkBox_titleOnly.IsChecked == true ? 1 : 0);
                key.caseFlag = (byte)(checkBox_case.IsChecked == true ? 1 : 0);
                key.keyDisabledFlag = (byte)(checkBox_keyDisabled.IsChecked == true ? 1 : 0);

                key.contentList.Clear();
                foreach (ContentKindInfo info in listBox_content.Items)
                {
                    EpgContentData item = new EpgContentData();
                    item.content_nibble_level_1 = info.Nibble1;
                    item.content_nibble_level_2 = info.Nibble2;
                    key.contentList.Add(item);
                }
                key.notContetFlag = (byte)(checkBox_notContent.IsChecked == true ? 1 : 0);

                key.serviceList.Clear();
                foreach (ServiceItem info in listView_service.Items)
                {
                    if (info.IsSelected == true)
                    {
                        key.serviceList.Add((Int64)info.ID);
                    }
                }

                key.dateList.Clear();
                foreach (DateItem info in listBox_date.Items)
                {
                    key.dateList.Add(info.DateInfo);
                }
                key.notDateFlag = (byte)(checkBox_notDate.IsChecked == true ? 1 : 0);

                if (radioButton_free_2.IsChecked == true)
                {
                    //無料
                    key.freeCAFlag = 1;
                }
                else if (radioButton_free_3.IsChecked == true)
                {
                    //有料
                    key.freeCAFlag = 2;
                }
                else
                {
                    key.freeCAFlag = 0;
                }

                key.chkRecEnd = (byte)(checkBox_chkRecEnd.IsChecked == true ? 1 : 0);
                key.chkRecDay = MenuUtil.MyToNumerical(textBox_chkRecDay, Convert.ToUInt16, ushort.MinValue);
                key.chkRecNoService = (byte)(radioButton_chkRecNoService2.IsChecked == true ? 1 : 0);
                key.chkDurationMin = MenuUtil.MyToNumerical(textBox_chkDurationMin, Convert.ToUInt16, ushort.MinValue);
                key.chkDurationMax = MenuUtil.MyToNumerical(textBox_chkDurationMax, Convert.ToUInt16, ushort.MinValue);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Ejemplo n.º 36
0
        /// <summary>
        /// デフォルト表示の設定値
        /// </summary>
        /// <param name="setInfo"></param>
        public void SetSetting(CustomEpgTabInfo setInfo)
        {
            tabInfoID = setInfo.ID;
            searchKey = setInfo.SearchKey.Clone();

            textBox_tabName.Text = setInfo.TabName;
            radioButton_rate.IsChecked = false;
            radioButton_week.IsChecked = false;
            radioButton_list.IsChecked = false;
            switch (setInfo.ViewMode)
            {
                case 1:
                    radioButton_week.IsChecked = true;
                    break;
                case 2:
                    radioButton_list.IsChecked = true;
                    break;
                default:
                    radioButton_rate.IsChecked = true;
                    break;
            }

            checkBox_noTimeView_rate.IsChecked = setInfo.NeedTimeOnlyBasic;
            checkBox_noTimeView_week.IsChecked = setInfo.NeedTimeOnlyWeek;
            comboBox_timeH_week.SelectedIndex = setInfo.StartTimeWeek;
            checkBox_searchMode.IsChecked = setInfo.SearchMode;
            checkBox_searchServiceFromView.IsChecked = setInfo.SearchServiceFromView;
            checkBox_filterEnded.IsChecked = (setInfo.FilterEnded == true);

            foreach (UInt64 id in setInfo.ViewServiceList)
            {
                if (ChSet5.ChList.ContainsKey(id) == true)
                {
                    listBox_serviceView.Items.Add(ChSet5.ChList[id]);
                }
            }
            foreach (UInt16 id in setInfo.ViewContentKindList)
            {
                if (CommonManager.Instance.ContentKindDictionary.ContainsKey(id) == true)
                {
                    listBox_jyanruView.Items.Add(CommonManager.Instance.ContentKindDictionary[id]);
                }
            }
        }
Ejemplo n.º 37
0
 public void SetSearchKey(EpgSearchKeyInfo key)
 {
     defKey = key.Clone();
     UpdateView();
 }
Ejemplo n.º 38
0
 public void SetSearchDefKey(EpgSearchKeyInfo key)
 {
     searchKeyView.SetSearchKey(key);
 }
Ejemplo n.º 39
0
        /// <summary>
        /// 右クリックメニュー 自動予約登録イベント呼び出し
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cm_autoadd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender.GetType() != typeof(MenuItem))
                {
                    return;
                }

                ReserveData reserve = new ReserveData();
                if (GetReserveItem(clickPos, ref reserve) == false)
                {
                    return;
                }

                SearchWindow dlg = new SearchWindow();
                dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual;
                dlg.SetViewMode(1);

                EpgSearchKeyInfo key = new EpgSearchKeyInfo();

                if (reserve.Title != null)
                {
                    key.andKey = reserve.Title;
                }
                Int64 sidKey = ((Int64)reserve.OriginalNetworkID) << 32 | ((Int64)reserve.TransportStreamID) << 16 | ((Int64)reserve.ServiceID);
                key.serviceList.Add(sidKey);

                dlg.SetSearchDefKey(key);
                dlg.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Ejemplo n.º 40
0
        public void GetSearchKey(ref EpgSearchKeyInfo key)
        {
            try
            {
                if (checkBox_regExp.IsChecked == true)
                {
                    key.regExpFlag = 1;
                    key.aimaiFlag  = 0;
                }
                else
                {
                    key.regExpFlag = 0;
                    if (checkBox_aimai.IsChecked == true)
                    {
                        key.aimaiFlag = 1;
                    }
                    else
                    {
                        key.aimaiFlag = 0;
                    }
                }
                if (checkBox_titleOnly.IsChecked == true)
                {
                    key.titleOnlyFlag = 1;
                }
                else
                {
                    key.titleOnlyFlag = 0;
                }

                key.contentList.Clear();
                foreach (ContentKindInfo info in listBox_content.Items)
                {
                    EpgContentData item = new EpgContentData();
                    item.content_nibble_level_1 = info.Nibble1;
                    item.content_nibble_level_2 = info.Nibble2;
                    key.contentList.Add(item);
                }
                if (checkBox_notContent.IsChecked == true)
                {
                    key.notContetFlag = 1;
                }
                else
                {
                    key.notContetFlag = 0;
                }

                key.serviceList.Clear();
                foreach (ServiceItem info in listView_service.Items)
                {
                    if (info.IsSelected == true)
                    {
                        key.serviceList.Add((UInt64)info.ID);
                    }
                }

                key.dateList.Clear();
                foreach (DateItem info in listBox_date.Items)
                {
                    key.dateList.Add(info.DateInfo);
                }
                if (checkBox_notDate.IsChecked == true)
                {
                    key.notDateFlag = 1;
                }
                else
                {
                    key.notDateFlag = 0;
                }

                if (radioButton_free_2.IsChecked == true)
                {
                    //無料
                    key.freeCAFlag = 1;
                }
                else if (radioButton_free_3.IsChecked == true)
                {
                    //有料
                    key.freeCAFlag = 2;
                }
                else
                {
                    key.freeCAFlag = 0;
                }

                key.chkRecDay = Convert.ToUInt16(textBox_chkRecDay.Text.ToString());
                if (key.chkRecDay > 0)
                {
                    key.chkRecEnd = 1;
                }
                else
                {
                    key.chkRecEnd = 0;
                }
                key.chkRecMin = Convert.ToUInt16(textBox_chkRecMin.Text.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Ejemplo n.º 41
0
        private void button_chg_epgAutoAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                EpgAutoAddData addItem = new EpgAutoAddData();
                addItem.dataID = autoAddID;
                EpgSearchKeyInfo searchKey = new EpgSearchKeyInfo();
                searchKeyView.GetSearchKey(ref searchKey);

                RecSettingData recSetKey = new RecSettingData();
                recSettingView.GetRecSetting(ref recSetKey);

                addItem.searchInfo = searchKey;
                addItem.recSetting = recSetKey;

                List<EpgAutoAddData> addList = new List<EpgAutoAddData>();
                addList.Add(addItem);

                if (cmd.SendChgEpgAutoAdd(addList) != 1)
                {
                    MessageBox.Show("変更に失敗しました");
                }
                else
                {
                    CommonManager.Instance.DB.SetUpdateNotify((UInt32)UpdateNotifyItem.ReserveInfo);
                    CommonManager.Instance.DB.ReloadReserveInfo();
                    SearchPg();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Ejemplo n.º 42
0
 public void GetSetting(ref EpgSearchKeyInfo key)
 {
     searchKey.GetSearchKey(ref key);
 }
Ejemplo n.º 43
0
        private void SearchPg()
        {
            try
            {
                ICollectionView dataView = CollectionViewSource.GetDefaultView(listView_result.DataContext);
                if (dataView != null)
                {
                    dataView.SortDescriptions.Clear();
                    dataView.Refresh();
                }
                listView_result.DataContext = null;

                resultList.Clear();

                EpgSearchKeyInfo key = new EpgSearchKeyInfo();
                searchKeyView.GetSearchKey(ref key);
                List<EpgSearchKeyInfo> keyList = new List<EpgSearchKeyInfo>();

                keyList.Add(key);
                List<EpgEventInfo> list = new List<EpgEventInfo>();

                cmd.SendSearchPg(keyList, ref list);
                foreach (EpgEventInfo info in list)
                {
                    SearchItem item = new SearchItem();
                    item.EventInfo = info;

                    if (item.EventInfo.start_time.AddSeconds(item.EventInfo.durationSec) > DateTime.Now)
                    {
                        foreach (ReserveData info2 in CommonManager.Instance.DB.ReserveList.Values)
                        {
                            if (info.original_network_id == info2.OriginalNetworkID &&
                                info.transport_stream_id == info2.TransportStreamID &&
                                info.service_id == info2.ServiceID &&
                                info.event_id == info2.EventID)
                            {
                                item.ReserveInfo = info2;
                                break;
                            }
                        }
                        UInt64 serviceKey = CommonManager.Create64Key(info.original_network_id, info.transport_stream_id, info.service_id);
                        if (ChSet5.Instance.ChList.ContainsKey(serviceKey) == true)
                        {
                            item.ServiceName = ChSet5.Instance.ChList[serviceKey].ServiceName;
                        }
                        if (Settings.Instance.FixSearchResult)
                        {
                            item.EventInfo.ShortInfo.text_char = "省略";
                        }

                        resultList.Add(item);
                    }
                }

                listView_result.DataContext = resultList;
                //if (_lastHeaderClicked != null) {
                //    Sort(_lastHeaderClicked, _lastDirection);
                //} else {
                //    string header = ((Binding)gridView_result.Columns[1].DisplayMemberBinding).Path.Path;
                //    Sort(header, _lastDirection);
                //    _lastHeaderClicked = header;
                //}
                if (this.gridViewSorter.isExistSortParams)
                {
                    this.gridViewSorter.SortByMultiHeader(this.resultList);
                }
                else
                {
                    this.gridViewSorter.resetSortParams();
                    this.gridViewSorter.SortByMultiHeader(
                        this.resultList,
                        gridView_result.Columns[1].Header as GridViewColumnHeader);
                }

                searchKeyView.SaveSearchLog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Ejemplo n.º 44
0
        public bool LoadEAAFile(String filePath)
        {
            bool ret = false;
            System.IO.StreamReader reader = null;
            try
            {
                reader = (new System.IO.StreamReader(filePath, System.Text.Encoding.Default));
                while (reader.Peek() >= 0)
                {
                    string buff = reader.ReadLine();
                    if (buff.IndexOf(";") == 0)
                    {
                        //コメント行
                    }
                    else
                    {
                        AddKey = new EpgAutoAddData();
                        EpgSearchKeyInfo searchKey = new EpgSearchKeyInfo();
                        RecSettingData recSetKey = new RecSettingData();

                        string[] list = buff.Split('\t');
                        if (list.Length == 0)
                        {
                            continue;
                        }
                        try
                        {
                            searchKey.andKey = list[0];
                            searchKey.notKey = list[1];
                            searchKey.regExpFlag = Convert.ToByte(list[2]);
                            searchKey.titleOnlyFlag = Convert.ToByte(list[3]);
                            //対象ジャンル
                            searchKey.contentList = new List<EpgContentData>();
                            string[] valBuff;
                            if (list[4].Length > 0)
                            {
                                valBuff = list[4].Split(',');
                                foreach (string val in valBuff)
                                {
                                    UInt32 content = Convert.ToUInt32(val);
                                    EpgContentData addItem = new EpgContentData();
                                    addItem.content_nibble_level_1 = (byte)((content & 0xFF000000) >> 24);
                                    addItem.content_nibble_level_2 = (byte)((content & 0x00FF0000) >> 16);
                                    addItem.user_nibble_1 = (byte)((content & 0x0000FF00) >> 8);
                                    addItem.user_nibble_2 = (byte)((content & 0x000000FF));

                                    searchKey.contentList.Add(addItem);
                                }
                            }
                            //対象期間
                            searchKey.dateList = new List<EpgSearchDateInfo>();
                            if (list[5].Length > 0)
                            {
                                valBuff = list[5].Split(',');
                                foreach (string val in valBuff)
                                {
                                    string[] dateBuff = val.Split('-');
                                    EpgSearchDateInfo addItem = new EpgSearchDateInfo();
                                    addItem.startDayOfWeek = Convert.ToByte(dateBuff[0]);
                                    UInt32 time = Convert.ToUInt32(dateBuff[1]);
                                    addItem.startHour = (UInt16)((time & 0xFFFF0000) >> 16);
                                    addItem.startMin = (UInt16)((time & 0x0000FFFF));
                                    addItem.endDayOfWeek = Convert.ToByte(dateBuff[2]);
                                    time = Convert.ToUInt32(dateBuff[3]);
                                    addItem.endHour = (UInt16)((time & 0xFFFF0000) >> 16);
                                    addItem.endMin = (UInt16)((time & 0x0000FFFF));

                                    searchKey.dateList.Add(addItem);
                                }
                            }
                            //対象サービス
                            searchKey.serviceList = new List<long>();
                            if (list[6].Length > 0)
                            {
                                valBuff = list[6].Split(',');
                                foreach (string val in valBuff)
                                {
                                    Int64 addItem = 0;
                                    addItem = Convert.ToInt64(val, 16);

                                    searchKey.serviceList.Add(addItem);
                                }
                            }
                            searchKey.aimaiFlag = Convert.ToByte(list[7]);

                            Settings.GetDefRecSetting(0, ref recSetKey);

                            AddKey.searchInfo = searchKey;
                            AddKey.recSetting = recSetKey;

                            ret = true;
                        }
                        catch
                        {
                        }
                    }
                }
            }
            catch
            {
                AddKey = null;
            }
            if( reader != null ){
                reader.Close();
            }
            return ret;
        }
Ejemplo n.º 45
0
        /// <summary>
        /// baseTimeから1週間分(EventBaseTimeをしきい値とし、このとき上限なし)のEPGデータを検索する
        /// </summary>
        public ErrCode SearchWeeklyEpgData(DateTime baseTime, EpgSearchKeyInfo key, out Dictionary <ulong, EpgServiceAllEventInfo> list)
        {
            list = null;
            List <EpgEventInfo> eventList;
            List <EpgEventInfo> arcList = null;
            ErrCode             ret     = SearchPg(new List <EpgSearchKeyInfo>()
            {
                key
            }, out eventList);

            if (ret == ErrCode.CMD_SUCCESS)
            {
                ret      = ErrCode.CMD_ERR;
                baseTime = baseTime > EventBaseTime ? EventBaseTime : baseTime;
                arcList  = new List <EpgEventInfo>();
                //1週間分の過去番組情報
                var param = new SearchPgParam();
                param.keyList = new List <EpgSearchKeyInfo>()
                {
                    key
                };
                param.enumStart = baseTime.ToFileTime();
                param.enumEnd   = baseTime.AddDays(baseTime < EventBaseTime ? 7 : 14).ToFileTime();
                try
                {
                    CommonManager.CreateSrvCtrl().SendSearchPgArc(param, ref arcList);
                    ret = ErrCode.CMD_SUCCESS;
                }
                catch { }
            }
            if (ret == ErrCode.CMD_SUCCESS)
            {
                list = new Dictionary <ulong, EpgServiceAllEventInfo>();
                //サービス毎のリストに変換
                foreach (EpgEventInfo info in eventList)
                {
                    if (baseTime < EventBaseTime ? (info.StartTimeFlag != 0 && info.start_time >= baseTime && info.start_time < baseTime.AddDays(7))
                                                 : (info.StartTimeFlag == 0 || info.start_time >= baseTime))
                    {
                        ulong id = CommonManager.Create64Key(info.original_network_id, info.transport_stream_id, info.service_id);
                        EpgServiceAllEventInfo allInfo;
                        if (list.TryGetValue(id, out allInfo) == false)
                        {
                            if (ChSet5.Instance.ChList.ContainsKey(id) == false)
                            {
                                //サービス情報ないので無効
                                continue;
                            }
                            allInfo = new EpgServiceAllEventInfo(CommonManager.ConvertChSet5To(ChSet5.Instance.ChList[id]));
                            if (serviceEventList.ContainsKey(id))
                            {
                                //リモコンキー情報を補完
                                allInfo.serviceInfo.remote_control_key_id = serviceEventList[id].serviceInfo.remote_control_key_id;
                            }
                            list.Add(id, allInfo);
                        }
                        allInfo.eventList.Add(info);
                    }
                }
                foreach (EpgEventInfo info in arcList)
                {
                    ulong id = CommonManager.Create64Key(info.original_network_id, info.transport_stream_id, info.service_id);
                    EpgServiceAllEventInfo allInfo;
                    if (list.TryGetValue(id, out allInfo) == false)
                    {
                        if (ChSet5.Instance.ChList.ContainsKey(id) == false)
                        {
                            //サービス情報ないので無効
                            continue;
                        }
                        allInfo = new EpgServiceAllEventInfo(CommonManager.ConvertChSet5To(ChSet5.Instance.ChList[id]));
                        if (serviceEventList.ContainsKey(id))
                        {
                            //リモコンキー情報を補完
                            allInfo.serviceInfo.remote_control_key_id = serviceEventList[id].serviceInfo.remote_control_key_id;
                        }
                        list.Add(id, allInfo);
                    }
                    allInfo.eventArcList.Add(info);
                }
            }
            return(ret);
        }
Ejemplo n.º 46
0
 public void SetSearchDefKey(EpgSearchKeyInfo key)
 {
     searchKeyView.SetSearchKey(key);
 }
Ejemplo n.º 47
0
 public void SetSearchDefKey(EpgSearchKeyInfo key)
 {
     searchKeyView.SetSearchKey(key);
     searchOnLoaded = true;
 }
 public void SetDefSetting(EpgSearchKeyInfo key)
 {
     searchKey.SetSearchKey(key);
 }
Ejemplo n.º 49
0
        public static string Generate(DateTime StartTime, int MaxHour, List<ulong> ServiceKeys = null, int MinSize = 5, bool SetBgColor = true, bool IncludeNotEpg = false, bool EpgCapOnly = true, EpgSearchKeyInfo Search = null)
        {
            DateTime Start = ConvertDateTime(StartTime.AddSeconds(StartTime.Second * -1).AddMinutes(StartTime.Minute * -1));
            DateTime End = Start.AddHours(MaxHour);
            StringBuilder sb = new StringBuilder();
            StringBuilder sb1 = new StringBuilder();
            sb1.Append("<div id=\"epg\">\n");
            sb1.Append("<div id=\"header\">\n");
            sb1.Append("<div class=\"time\">時間</div>\n");
            //Select Item
            var Out = new Dictionary<EpgServiceInfo, List<EventInfoItem>>();
            var List = new Dictionary<ulong, EpgServiceEventInfo>();
            List<EpgServiceEventInfo> list = new List<EpgServiceEventInfo>();
            ErrCode ret = (ErrCode)CommonManager.Instance.CtrlCmd.SendEnumPgAll(ref list);
            if (ret == ErrCode.CMD_SUCCESS)
            {
                foreach (EpgServiceEventInfo info in list)
                {
                    UInt64 id = CommonManager.Create64Key(
                        info.serviceInfo.ONID,
                        info.serviceInfo.TSID,
                        info.serviceInfo.SID);
                    List.Add(id, info);
                }
            }
            else
            {
                return "";
            }
            list.Clear();
            list = null;

            if (Search != null)
            {
                Start = DateTime.MinValue;
                End = DateTime.MaxValue;
                List<EpgEventInfo> Events = new List<EpgEventInfo>();
                var Res = CommonManager.Instance.CtrlCmd.SendSearchPg(new List<EpgSearchKeyInfo>() { Search }, ref Events);
                if ((ErrCode)Res != ErrCode.CMD_SUCCESS || Events.Count == 0) return "";
                foreach (var item in List)
                {
                    item.Value.eventList.Clear();
                }
                foreach (var item in Events)
                {
                    var Key = CommonManager.Create64Key(item.original_network_id, item.transport_stream_id, item.service_id);
                    if (List.ContainsKey(Key))
                    {
                        List[Key].eventList.Add(item);
                    }
                    else
                    {
                        if (!CommonManager.Instance.DB.ServiceEventList.ContainsKey(Key)) return "";
                        List[Key] = new EpgServiceEventInfo();
                        List[Key].serviceInfo = CommonManager.Instance.DB.ServiceEventList[Key].serviceInfo;
                        List[Key].eventList = new List<EpgEventInfo>();
                        List[Key].eventList.Add(item);
                    }
                }
            }
            foreach (var a in List)
            {
                if (a.Value.eventList.Count == 0) continue;
                if (ServiceKeys != null && ServiceKeys.Count != 0 && !ServiceKeys.Contains(a.Key)) continue;
                if (EpgCapOnly && (!ChSet5.Instance.ChList.ContainsKey(a.Key) || ChSet5.Instance.ChList[a.Key].EpgCapFlag != 1)) continue;
                if (Search == null)
                {
                    var Events = a.Value.eventList
                            .Where(x => x.ShortInfo != null)
                            .Where(b => b.start_time < End && b.start_time.AddSeconds(b.durationSec) > Start)
                            .OrderBy(d => d.start_time);
                    Debug.Print("{0}: {1}", a.Value.serviceInfo.service_name, Events.Count());
                    if (Events.Count() == 0) continue;
                    Out.Add(
                        a.Value.serviceInfo,
                            Events
                            .Select(e => new EventInfoItem(e))
                            .ToList()
                        );
                }
                else
                {
                    Out.Add(
                        a.Value.serviceInfo,
                        a.Value.eventList
                            .Select(e => new EventInfoItem(e))
                            .ToList()
                        );
                }
            }

            SortedList<long, DateTime> TimeList = new SortedList<long, DateTime>();
            foreach (var Item3 in Out.Values)
            {
                foreach (var Item2 in Item3)
                {
                    var TempDate = ConvertDateTime(Item2.Start);
                    var TempDate2 = ConvertDateTime(Item2.End);
                    if (TempDate < Start)
                        TempDate = Start;
                    if (TempDate2 > End)
                        TempDate2 = End;
                    for (; TempDate < TempDate2; )
                    {
                        long Unix = UnixTime.ToUnixTime(TempDate);
                        TimeList[Unix] = TempDate;
                        TempDate = TempDate.AddHours(1);
                    }
                }
            }

            sb.Append("</div>\n<div id=\"body\">\n");
            //Print Time
            sb.Append("<div id=\"timeline\" class=\"list\">\n");
            for (int i = 0; i < TimeList.Values.Count; i++)
            {
                DateTime Temp = TimeList.Values[i];
                string Text = (TimeList.Values.Count(s => s < Temp && s > Temp.AddHours(-1 * Temp.Hour)) == 0) ? "<p>" + Temp.Month + "/" + Temp.Day + "</p>" + Temp.Hour : Temp.Hour.ToString();
                sb.AppendFormat("<div style=\"height:{1}px;top:{2}px;\">{0}</div>\n", Text, MinSize * 60, MinSize * 60 * i);
            }
            sb.Append("</div>\n");

            //Print EPG
            foreach (var Item in Out)
            {
                StringBuilder sb2 = new StringBuilder();
                sb2.AppendFormat("<div class=\"list\" ts=\"{0}\" on=\"{1}\" s=\"{2}\">", Item.Key.TSID, Item.Key.ONID, Item.Key.SID);
                if (Item.Value == null || Item.Value.Count == 0)
                {
                    if (!IncludeNotEpg) continue;
                }
                else
                {
                    DateTime OldTime = Start;
                    int ItemCount = 0;
                    foreach (var Event in Item.Value)
                    {
                        //Debug.Print("EPG Header {0}", Item.Key.service_name);
                        if (Event.Short == null || !Event.StartFlg) continue;
                        DateTime EventStart = Event.Start, EventEnd = Event.End;
                        long Size = 0;
                        OldTime = EventEnd;
                        if (EventStart < Start)
                            EventStart = Start;
                        if (EventEnd > End)
                            EventEnd = End;

                        Size = (UnixTime.ToUnixTime(EventEnd) - UnixTime.ToUnixTime(EventStart)) / 60 * MinSize;
                        if (Size <= 0) continue;
                        string StartTimeStr = Event.Start.ToString("HH:mm");
                        var EventName = String.Format("{0} <span title=\"{1}\">{1}</span>\n<p>{2}</p>\n", StartTimeStr,
                            HttpUtility.HtmlEncode(Event.Short.event_name),
                            HttpUtility.HtmlEncode(Event.Short.text_char));
                        DateTime Time1 = ConvertDateTime(EventStart);
                        long Top = 0;
                        foreach (var Time2 in TimeList.Values)
                        {
                            if (Time1 == ConvertDateTime(Time2)) break;
                            Top += MinSize * 60;
                        }
                        Top += ((UnixTime.ToUnixTime(EventStart) - UnixTime.ToUnixTime(Start)) % 3600) / 60 * MinSize;
                        var Reserve = CommonManager.Instance.DB.ReserveList.Values.Where(s =>
                            s.EventID == Event.EID &&
                            s.ServiceID == Event.SID &&
                            s.TransportStreamID == Event.TSID &&
                            s.OriginalNetworkID == Event.ONID);
                        string AddClass = (Reserve.Count() > 0) ? (Reserve.First().RecSetting.RecMode == 5 ? " disable-reserve" : " reserved") : "";
                        if (SetBgColor)
                        {
                            if (Event.Content != null && Event.Content.nibbleList != null && Event.Content.nibbleList.Count != 0 &&
                                Setting.Instance.ContentToColorTable
                                        .Count(s => s.ContentLevel1 == Event.Content.nibbleList[0].content_nibble_level_1) > 0)
                                sb2.AppendFormat("<div class=\"event{4} ct-{6}\" e=\"{0}\" style=\"top:{3}px;min-height:{2}px;max-height:{2}px;z-index:{5};\">{1}</div>\n", Event.EID, EventName, Size, Top, AddClass, ItemCount, Event.Content.nibbleList[0].content_nibble_level_1);
                            else
                                sb2.AppendFormat("<div class=\"event{4}\" e=\"{0}\" style=\"top:{3}px;min-height:{2}px;max-height:{2}px;z-index:{5};\">{1}</div>\n",
                                    Event.EID, EventName, Size, Top, AddClass, ItemCount);
                        }
                        else
                        {
                            sb2.AppendFormat("<div class=\"event{4}\" e=\"{0}\" style=\"top:{3}px;min-height:{2}px;max-height:{2}px;z-index:{5};\">{1}</div>\n",
                                Event.EID, EventName, Size, Top, AddClass, ItemCount);
                        }
                        ItemCount++;
                    }
                    sb.Append(sb2.ToString());
                    if (Item.Key.remote_control_key_id == 0)
                        sb1.AppendFormat("<div>{0}<p>{1}</p></div>", Item.Key.service_name, Item.Key.network_name + " " + Item.Key.SID);
                    else
                        sb1.AppendFormat("<div>{0}<p>{1}</p></div>", Item.Key.service_name, Item.Key.remote_control_key_id);
                }
                sb.Append("</div>");
            }
            sb.Append("</div>");

            return sb1.ToString() + sb.ToString();
        }
Ejemplo n.º 50
0
 public void GetSearchKey(ref EpgSearchKeyInfo key)
 {
     searchKeyView.GetSearchKey(ref key);
 }
Ejemplo n.º 51
0
 public static EpgSearchKeyInfo Clone(this EpgSearchKeyInfo src)
 {
     return(CopyObj.Clone(src, CopyData));
 }
Ejemplo n.º 52
0
 public static EpgSearchKeyInfo GetEpgSKey(Dictionary<string, string> Arg)
 {
     var e = new EpgSearchKeyInfo();
     if (Arg.ContainsKey("srvlist"))
     {
         if (Arg["srvlist"].IndexOf(",") > 0)
         {
             e.serviceList = Arg["srvlist"].Split(',').Select(s => long.Parse(s)).ToList();
         }
         else
         {
             if (Arg["srvlist"] == "*")
             {
                 foreach (var ch in ChSet5.Instance.ChList)
                 {
                     e.serviceList.Add((long)ch.Value.Key);
                 }
             }
             else
             {
                 e.serviceList.Add(long.Parse(Arg["srvlist"]));
             }
         }
     }
     else
     {
         foreach (var ch in ChSet5.Instance.ChList)
         {
             e.serviceList.Add((long)ch.Value.Key);
         }
     }
     if (Arg.ContainsKey("content") && Arg["content"].IndexOf(".") > 0)
     {
         if (Arg["content"].IndexOf(",") > 0)
         {
             e.contentList.AddRange(Arg["content"].Split(',').Select(s =>
             {
                 string[] c = s.Split('.');
                 if (c.Length != 4) return null;
                 return new EpgContentData()
                 {
                     content_nibble_level_1 = byte.Parse(c[0]),
                     content_nibble_level_2 = byte.Parse(c[1]),
                     user_nibble_1 = byte.Parse(c[2]),
                     user_nibble_2 = byte.Parse(c[3])
                 };
             }).Where(s => s != null));
         }
         else
         {
             string[] c = Arg["content"].Split('.');
             if (c.Length == 4)
             {
                 e.contentList.Add(new EpgContentData()
                 {
                     content_nibble_level_1 = byte.Parse(c[0]),
                     content_nibble_level_2 = byte.Parse(c[1]),
                     user_nibble_1 = byte.Parse(c[2]),
                     user_nibble_2 = byte.Parse(c[3])
                 });
             }
         }
     }
     if (Arg.ContainsKey("notcontent")) e.notContetFlag = 1;
     if (Arg.ContainsKey("useregex")) e.regExpFlag = 1;
     if (Arg.ContainsKey("useregex")) e.aimaiFlag = 0;
     if (Arg.ContainsKey("aimai")) e.aimaiFlag = 1;
     if (Arg.ContainsKey("aimai")) e.regExpFlag = 0;
     if (Arg.ContainsKey("tonly")) e.titleOnlyFlag = 1;
     if (Arg.ContainsKey("kw"))
     {
         e.andKey = Arg["kw"];
     }
     if (Arg.ContainsKey("notkw"))
     {
         e.notKey = Arg["notkw"];
     }
     if (Arg.ContainsKey("freeca"))
     {
         e.freeCAFlag = byte.Parse(Arg["freeca"]);
     }
     if (Arg.ContainsKey("date"))
     {
         if (Arg["date"].IndexOf(",") > 0)
         {
             e.dateList.AddRange(Arg["date"].Split(',').Select(s =>
             {
                 if (s.IndexOf("-") < 0) return null;
                 if (s.Split('-')[0].IndexOf(".") < 0 || s.Split('-')[1].IndexOf(".") < 0) return null;
                 string[] a = s.Split('-');
                 string[] b = a[0].Split('.');
                 string[] c = a[1].Split('.');
                 if (uint.Parse(c[1]) > 24 || uint.Parse(b[1]) > 24 || uint.Parse(c[2]) > 60 || uint.Parse(b[2]) > 60 || uint.Parse(c[0]) > 7 || uint.Parse(b[0]) > 7) return null;
                 return new EpgSearchDateInfo()
                 {
                     startDayOfWeek = byte.Parse(b[0]),
                     startHour = ushort.Parse(b[1]),
                     startMin = ushort.Parse(b[2]),
                     endDayOfWeek = byte.Parse(c[0]),
                     endHour = ushort.Parse(c[1]),
                     endMin = ushort.Parse(c[2])
                 };
             }).Where(p => p != null));
         }
         else
         {
             string s = Arg["date"];
             if (s.IndexOf("-") < 0) return null;
             if (s.Split('-')[0].IndexOf(".") < 0 || s.Split('-')[1].IndexOf(".") < 0) return null;
             string[] a = s.Split('-');
             string[] b = a[0].Split('.');
             string[] c = a[1].Split('.');
             if (uint.Parse(c[1]) > 24 || uint.Parse(b[1]) > 24 || uint.Parse(c[2]) > 60 || uint.Parse(b[2]) > 60 || uint.Parse(c[0]) > 7 || uint.Parse(b[0]) > 7) return null;
             e.dateList.Add(new EpgSearchDateInfo()
             {
                 startDayOfWeek = byte.Parse(b[0]),
                 startHour = ushort.Parse(b[1]),
                 startMin = ushort.Parse(b[2]),
                 endDayOfWeek = byte.Parse(c[0]),
                 endHour = ushort.Parse(c[1]),
                 endMin = ushort.Parse(c[2])
             });
             //Debug.Print("OK");
         }
     }
     if (Arg.ContainsKey("notdate"))
     {
         e.notDateFlag = 1;
     }
     return e;
 }
Ejemplo n.º 53
0
        private void SearchPg()
        {
            try
            {
                ICollectionView dataView = CollectionViewSource.GetDefaultView(listView_result.DataContext);
                if (dataView != null)
                {
                    dataView.SortDescriptions.Clear();
                    dataView.Refresh();
                }
                listView_result.DataContext = null;

                resultList.Clear();


                EpgSearchKeyInfo key = new EpgSearchKeyInfo();
                searchKeyView.GetSearchKey(ref key);
                List <EpgSearchKeyInfo> keyList = new List <EpgSearchKeyInfo>();

                keyList.Add(key);
                List <EpgEventInfo> list = new List <EpgEventInfo>();

                cmd.SendSearchPg(keyList, ref list);
                foreach (EpgEventInfo info in list)
                {
                    SearchItem item = new SearchItem();
                    item.EventInfo = info;
                    foreach (ReserveData info2 in CommonManager.Instance.DB.ReserveList.Values)
                    {
                        if (info.original_network_id == info2.OriginalNetworkID &&
                            info.transport_stream_id == info2.TransportStreamID &&
                            info.service_id == info2.ServiceID &&
                            info.event_id == info2.EventID)
                        {
                            item.ReserveInfo = info2;
                            break;
                        }
                    }

                    UInt64 serviceKey = CommonManager.Create64Key(info.original_network_id, info.transport_stream_id, info.service_id);
                    if (ChSet5.Instance.ChList.ContainsKey(serviceKey) == true)
                    {
                        item.ServiceName = ChSet5.Instance.ChList[serviceKey].ServiceName;
                    }
                    resultList.Add(item);
                }

                listView_result.DataContext = resultList;
                if (_lastHeaderClicked != null)
                {
                    Sort(_lastHeaderClicked, _lastDirection);
                }
                else
                {
                    string header = ((Binding)gridView_result.Columns[1].DisplayMemberBinding).Path.Path;
                    Sort(header, _lastDirection);
                    _lastHeaderClicked = header;
                }

                searchKeyView.SaveSearchLog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }