public RecSettingView() { InitializeComponent(); comboBox_tuner.Items.Add(new TunerSelectInfo("自動", 0)); foreach (TunerReserveInfo info in CommonManager.Instance.DB.TunerReserveList.Values) { if (info.tunerID != 0xFFFFFFFF) { comboBox_tuner.Items.Add(new TunerSelectInfo(info.tunerName, info.tunerID)); } } comboBox_tuner.SelectedIndex = 0; foreach (RecPresetItem info in Settings.GetRecPresetList()) { comboBox_preSet.Items.Add(info); } comboBox_preSet.SelectedIndex = 0; if (CommonManager.Instance.NWMode) { button_bat.IsEnabled = false; } setDefSetting = Settings.CreateRecSetting(0); UpdateView(setDefSetting); }
public void CtxmGenerateOpenFolderItems(MenuItem menu, RecSettingData recSetting = null) { CtxmClearItemMenu(menu); //ツールチップのクリアがあるので先 if (menu.IsEnabled == false) { return; } bool defOutPutted = false; recSetting = recSetting == null ? new RecSettingData() : recSetting; var addFolderList = new Action <List <RecFileSetInfo>, bool, string>((fldrs, recflg, header_exp) => { //ワンセグ出力未チェックでも、フォルダ設定があれば表示する。 //ただし、デフォルトフォルダは1回だけ展開して表示する。 if (defOutPutted == false && (recflg && fldrs.Count == 0 || fldrs.Any(info => info.RecFolder == "!Default"))) { defOutPutted = true; Settings.Instance.DefRecFolders.ForEach(folder => CtxmGenerateOpenFolderItem(menu, folder, header_exp + "(デフォルト) ")); } foreach (var info in fldrs.Where(info => info.RecFolder != "!Default")) { CtxmGenerateOpenFolderItem(menu, info.RecFolder, header_exp); } }); addFolderList(recSetting.RecFolderList, true, ""); addFolderList(recSetting.PartialRecFolder, recSetting.PartialRecFlag != 0, "(ワンセグ) "); //候補が一つの時は直接メニューを実行出来るようにする CtxmPullUpSubMenu(menu); }
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); } }
public static bool ReserveChangeOnOff(List <ReserveData> itemlist, RecSettingView recSettingView = null, bool cautionMany = true) { try { //無効から戻す録画モードの選択 var setInfo = new RecSettingData(); //現在の設定を読み込む。SearchWindowの場合だけ。 if (recSettingView != null) { setInfo = recSettingView.GetRecSetting(); //現在の設定が無効で登録の場合は、デフォルトの設定を読み込みに行く if (setInfo.RecMode == 5) { recSettingView = null; } } //デフォルト設定を読み込む if (recSettingView == null) { Settings.GetDefRecSetting(0, ref setInfo); } //デフォルトも無効で登録なら、指定サービスにする byte recMode = setInfo.RecMode != 5 ? setInfo.RecMode : (byte)1; //個別設定なので、ChangeRecmode()は不可。 itemlist.ForEach(item => item.RecSetting.RecMode = (item.RecSetting.RecMode == 5 ? recMode : (byte)5)); return(ReserveChange(itemlist, cautionMany)); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } return(false); }
public RecSettingData GetRecSetting() { var setInfo = new RecSettingData(); setInfo.RecMode = (byte)comboBox_recMode.SelectedIndex; setInfo.Priority = (byte)(comboBox_priority.SelectedIndex + 1); setInfo.TuijyuuFlag = (byte)comboBox_tuijyu.SelectedIndex; setInfo.PittariFlag = (byte)comboBox_pittari.SelectedIndex; setInfo.ServiceModeIsDefault = checkBox_serviceMode.IsChecked == true; setInfo.ServiceCaption = checkBox_serviceCaption.IsChecked == true; setInfo.ServiceData = checkBox_serviceData.IsChecked == true; setInfo.BatFilePath = textBox_bat.Text; setInfo.RecTag = textBox_recTag.Text; setInfo.RecFolderList.Clear(); setInfo.PartialRecFolder.Clear(); foreach (RecFileSetInfoView view in listView_recFolder.Items) { (view.PartialRec ? setInfo.PartialRecFolder : setInfo.RecFolderList).Add(view.Info); } setInfo.SetSuspendMode(checkBox_suspendDef.IsChecked == true, recEndModeRadioBtns.Value); setInfo.RebootFlag = (byte)(checkBox_reboot.IsChecked == true ? 1 : 0); setInfo.IsMarginDefault = checkBox_margineDef.IsChecked == true; setInfo.StartMargine = GetMargin(textBox_margineStart.Text); setInfo.EndMargine = GetMargin(textBox_margineEnd.Text); setInfo.PartialRecFlag = (byte)(checkBox_partial.IsChecked == true ? 1 : 0); setInfo.ContinueRecFlag = (byte)(checkBox_continueRec.IsChecked == true ? 1 : 0); setInfo.TunerID = (uint)(comboBox_tuner.SelectedValue ?? 0); return(setInfo); }
public static void SendAutoAdd(IBasicPgInfo item, bool NotToggle = false, EpgSearchKeyInfo key = null) { try { if (item == null) { return; } var dlg = new SearchWindow(mode: AutoAddMode.NewAdd); dlg.SetSearchKey(key ?? SendAutoAddKey(item, NotToggle)); if (item is IRecSetttingData) { var item_r = (item as IRecSetttingData); RecPresetItem recPreSet = item_r.RecSettingInfo.LookUpPreset(item_r.IsManual, true); RecSettingData recSet = recPreSet.Data; if (recPreSet.IsCustom == true && recSet.RecMode == 5) { recSet.RecMode = 1; } dlg.SetRecSetting(recSet); } dlg.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void comboBox_preSet_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (comboBox_preSet.SelectedItem != null) { RecPresetItem item = comboBox_preSet.SelectedItem as RecPresetItem; if (item.ID == 0xFFFFFFFF) { recSetting = setDefSetting; } else { recSetting = null; recSetting = new RecSettingData(); Settings.GetDefRecSetting(item.ID, ref recSetting); } lastSelectIndex = comboBox_preSet.SelectedIndex; UpdateView(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public EpgAutoAddData() { dataID = 0; searchInfo = new EpgSearchKeyInfo(); recSetting = new RecSettingData(); addCount = 0; }
public static void SendAutoAdd(IBasicPgInfo item, bool NotToggle = false) { try { if (item == null) { return; } var dlg = new SearchWindow(); dlg.SetViewMode(SearchWindow.SearchMode.NewAdd); EpgSearchKeyInfo key = Settings.Instance.DefSearchKey.Clone(); key.andKey = TrimEpgKeyword(item.DataTitle, NotToggle); key.regExpFlag = 0; key.serviceList.Clear(); key.serviceList.Add((Int64)item.Create64Key()); dlg.SetSearchKey(key); if (item is IRecSetttingData) { var item_r = (item as IRecSetttingData); RecPresetItem recPreSet = item_r.RecSettingInfo.LookUpPreset(item_r.IsManual, true); RecSettingData recSet = recPreSet.RecPresetData; if (recPreSet.IsCustom == true && recSet.RecMode == 5) { recSet.RecMode = 1; } dlg.SetRecSetting(recSet); } dlg.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void checkBox_margineDef_Checked(object sender, RoutedEventArgs e) { RecSettingData recSet = recSetting.Clone(); recSet.UseMargineFlag = (byte)(checkBox_margineDef.IsChecked == true ? 0 : 1); textBox_margineStart.Text = recSet.GetTrueMargin(true).ToString(); textBox_margineEnd.Text = recSet.GetTrueMargin(false).ToString(); }
public ContextMenu CreatePresetSlelectMenu() { SelectedPreset_Changed(false);//状態の確定 RecSettingData setting = GetRecSetting(); bool chk = false; return(preEdit.CreateSlelectMenu(item => !chk && (chk = setting.EqualsSettingTo(item.Data, IsManual)))); }
public void LoadRecPresetData() { recPresetData = new RecSettingData(); String defName = "REC_DEF"; String defFolderName = "REC_DEF_FOLDER"; String defFolder1SegName = "REC_DEF_FOLDER_1SEG"; if (ID > 0) { defName += ID.ToString(); defFolderName += ID.ToString(); defFolder1SegName += ID.ToString(); } recPresetData.RecMode = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "RecMode", 1, SettingPath.TimerSrvIniPath); recPresetData.Priority = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "Priority", 2, SettingPath.TimerSrvIniPath); recPresetData.TuijyuuFlag = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "TuijyuuFlag", 1, SettingPath.TimerSrvIniPath); recPresetData.ServiceMode = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "ServiceMode", 0, SettingPath.TimerSrvIniPath); recPresetData.PittariFlag = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "PittariFlag", 0, SettingPath.TimerSrvIniPath); recPresetData.BatFilePath = IniFileHandler.GetPrivateProfileString(defName, "BatFilePath", "", SettingPath.TimerSrvIniPath); recPresetData.RecTag = IniFileHandler.GetPrivateProfileString(defName, "RecTag", "", SettingPath.TimerSrvIniPath); recPresetData.RecFolderList.Clear(); int count = IniFileHandler.GetPrivateProfileInt(defFolderName, "Count", 0, SettingPath.TimerSrvIniPath); for (int i = 0; i < count; i++) { RecFileSetInfo folderInfo = new RecFileSetInfo(); folderInfo.RecFolder = IniFileHandler.GetPrivateProfileString(defFolderName, i.ToString(), "", SettingPath.TimerSrvIniPath); folderInfo.WritePlugIn = IniFileHandler.GetPrivateProfileString(defFolderName, "WritePlugIn" + i.ToString(), "Write_Default.dll", SettingPath.TimerSrvIniPath); folderInfo.RecNamePlugIn = IniFileHandler.GetPrivateProfileString(defFolderName, "RecNamePlugIn" + i.ToString(), "", SettingPath.TimerSrvIniPath); recPresetData.RecFolderList.Add(folderInfo); } recPresetData.PartialRecFolder.Clear(); count = IniFileHandler.GetPrivateProfileInt(defFolder1SegName, "Count", 0, SettingPath.TimerSrvIniPath); for (int i = 0; i < count; i++) { RecFileSetInfo folderInfo = new RecFileSetInfo(); folderInfo.RecFolder = IniFileHandler.GetPrivateProfileString(defFolder1SegName, i.ToString(), "", SettingPath.TimerSrvIniPath); folderInfo.WritePlugIn = IniFileHandler.GetPrivateProfileString(defFolder1SegName, "WritePlugIn" + i.ToString(), "Write_Default.dll", SettingPath.TimerSrvIniPath); folderInfo.RecNamePlugIn = IniFileHandler.GetPrivateProfileString(defFolder1SegName, "RecNamePlugIn" + i.ToString(), "", SettingPath.TimerSrvIniPath); recPresetData.PartialRecFolder.Add(folderInfo); } recPresetData.SuspendMode = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "SuspendMode", 0, SettingPath.TimerSrvIniPath); recPresetData.RebootFlag = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "RebootFlag", 0, SettingPath.TimerSrvIniPath); recPresetData.UseMargineFlag = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "UseMargineFlag", 0, SettingPath.TimerSrvIniPath); recPresetData.StartMargine = IniFileHandler.GetPrivateProfileInt(defName, "StartMargine", 0, SettingPath.TimerSrvIniPath); recPresetData.EndMargine = IniFileHandler.GetPrivateProfileInt(defName, "EndMargine", 0, SettingPath.TimerSrvIniPath); recPresetData.ContinueRecFlag = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "ContinueRec", 0, SettingPath.TimerSrvIniPath); recPresetData.PartialRecFlag = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "PartialRec", 0, SettingPath.TimerSrvIniPath); recPresetData.TunerID = (UInt32)IniFileHandler.GetPrivateProfileInt(defName, "TunerID", 0, SettingPath.TimerSrvIniPath); }
public static RecPresetItem LookUpPreset(this RecSettingData data, IEnumerable <RecPresetItem> refdata, bool IsManual = false, bool CopyData = false) { RecPresetItem preset = refdata.FirstOrDefault(p1 => { return(p1.RecPresetData.EqualsSettingTo(data, IsManual)); }); return(preset == null ? new RecPresetItem("登録時", RecPresetItem.CustomID, CopyData == true ? data.Clone() : null) : preset); }
public static void ChangeOnPreset(IEnumerable <IRecSetttingData> dataList, int presetID) { RecSettingData setData = Settings.Instance.RecPreset(presetID).Data; foreach (var data in dataList) { data.RecSettingInfo = setData.DeepClone(); } }
public static double GetTrueMarginForSort(this RecSettingData recSetting, bool start) { if (recSetting == null) { return(0); } // return(recSetting.GetTrueMargin(start) * (start ? -1 : 1) + (recSetting.UseMargineFlag == 1 ? 0.1 : 0)); }
public void SetDefSetting(RecSettingData set) { recSetting = set.DeepClone(); //"登録時"を追加する。既存があれば追加前に削除する。検索ダイアログの上下ボタンの移動用のコード。 comboBox_preSet.Items.Remove(preEdit.FindPreset(RecPresetItem.CustomID)); comboBox_preSet.Items.Add(new RecPresetItem("登録時", RecPresetItem.CustomID, recSetting.DeepClone())); SetCustomPresetDisplayName(); //該当するものがあれば選択、無ければ"登録時"。 preEdit.ChangeSelect(MatchPresetOrDefault(recSetting), PresetSelectMode.InitLoad); }
public UInt32 AddPreset(RecSettingData Data, string Name) { uint NextID = Presets.Count == 0 ? 0 : Presets.OrderByDescending(s => s.Key).Last().Key + 1; if (Presets.ContainsKey(NextID)) return 0xFFFFFFFF; RecPresetItem ItemInfo = new RecPresetItem() { DisplayName = Name, ID = NextID }; Presets.Add(NextID, new KeyValuePair<RecPresetItem, RecSettingData>(ItemInfo, Data)); return NextID; }
public ManualAutoAddData() { dataID = 0; dayOfWeekFlag = 0; startTime = 0; durationSecond = 0; title = ""; stationName = ""; originalNetworkID = 0; transportStreamID = 0; serviceID = 0; recSetting = new RecSettingData(); }
private void checkBox_suspendDef_Checked(object sender, RoutedEventArgs e) { RecSettingData recSet = recSetting.DeepClone(); recSet.SetSuspendMode(checkBox_suspendDef.IsChecked == true, recEndMode); if (recSet.SuspendMode == 0 && OnUpdatingView == false) { recEndMode = recEndModeRadioBtns.Value; recSetting.RebootFlag = (byte)(checkBox_reboot.IsChecked == true ? 1 : 0); } recEndModeRadioBtns.Value = recSet.RecEndModeActual; checkBox_reboot.IsChecked = recSet.RebootFlagActual == 1; }
private void checkBox_serviceMode_Checked(object sender, RoutedEventArgs e) { RecSettingData recSet = recSetting.DeepClone(); recSet.ServiceModeIsDefault = checkBox_serviceMode.IsChecked == true; if (recSet.ServiceModeIsDefault == true && OnUpdatingView == false) { recSetting.ServiceCaption = checkBox_serviceCaption.IsChecked == true; recSetting.ServiceData = checkBox_serviceData.IsChecked == true; } checkBox_serviceCaption.IsChecked = recSet.ServiceCaptionActual; checkBox_serviceData.IsChecked = recSet.ServiceDataActual; }
private void checkBox_margineDef_Checked(object sender, RoutedEventArgs e) { RecSettingData recSet = recSetting.DeepClone(); recSet.IsMarginDefault = checkBox_margineDef.IsChecked == true; if (recSet.IsMarginDefault == true && OnUpdatingView == false) { recSetting.StartMargine = GetMargin(textBox_margineStart.Text); recSetting.EndMargine = GetMargin(textBox_margineEnd.Text); } textBox_margineStart.Text = recSet.StartMarginActual.ToString(); textBox_margineEnd.Text = recSet.EndMarginActual.ToString(); }
public void SetDefSetting(RecSettingData set) { RecPresetItem preCust = new RecPresetItem(); preCust.DisplayName = "登録時"; preCust.ID = 0xFFFFFFFF; int index = comboBox_preSet.Items.Add(preCust); setDefSetting = set; comboBox_preSet.SelectedIndex = index; UpdateView(set); }
public RecSettingView() { InitializeComponent(); try { if (CommonManager.Instance.NWMode == true) { preEdit.button_add.IsEnabled = false; preEdit.button_chg.IsEnabled = false; preEdit.button_del.IsEnabled = false; preEdit.button_add.ToolTip = "EpgTimerNWからは変更出来ません"; preEdit.button_chg.ToolTip = preEdit.button_add.ToolTip; preEdit.button_del.ToolTip = preEdit.button_add.ToolTip; } recSetting = Settings.Instance.RecPresetList[0].Data.DeepClone(); comboBox_recMode.ItemsSource = CommonManager.RecModeList; comboBox_tuijyu.ItemsSource = CommonManager.YesNoList; comboBox_pittari.ItemsSource = CommonManager.YesNoList; comboBox_priority.ItemsSource = CommonManager.PriorityList; recEndModeRadioBtns = new RadioBtnSelect(radioButton_non, radioButton_standby, radioButton_suspend, radioButton_shutdown); tunerList.Add(new TunerSelectInfo("自動", 0)); foreach (TunerReserveInfo info in CommonManager.Instance.DB.TunerReserveList.Values) { if (info.tunerID != 0xFFFFFFFF) { tunerList.Add(new TunerSelectInfo(info.tunerName, info.tunerID)); } } comboBox_tuner.ItemsSource = tunerList; comboBox_tuner.SelectedIndex = 0; stackPanel_PresetEdit.Children.Clear(); stackPanel_PresetEdit.Children.Add(preEdit); preEdit.Set(this, PresetSelectChanged, PresetEdited, "録画プリセット", SetRecPresetWindow.SettingWithDialog); comboBox_preSet = preEdit.comboBox_preSet; var bx = new BoxExchangeEdit.BoxExchangeEditor(null, listView_recFolder, true, true, true); bx.TargetBox.KeyDown += ViewUtil.KeyDown_Enter(button_recFolderChg); bx.targetBoxAllowDoubleClick(bx.TargetBox, (sender, e) => button_recFolderChg.RaiseEvent(new RoutedEventArgs(Button.ClickEvent))); button_recFolderDel.Click += new RoutedEventHandler(bx.button_Delete_Click); button_bat.Click += ViewUtil.OpenFileNameDialog(textBox_bat, false, "", ".bat", true); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void SetRecSettingCmbo(RecSettingData set = null) { cmb_recSetting.Items.Clear(); cmb_recSetting.Items.AddItems(Settings.Instance.RecPresetList.DeepClone()); var item = (set ?? Settings.Instance.RecPresetList[0].Data).LookUpPreset(cmb_recSetting.Items.OfType <RecPresetItem>()); if (item == null) { item = new RecPresetItem("登録時", RecPresetItem.CustomID, set.DeepClone()); cmb_recSetting.Items.Add(item); } cmb_recSetting.SelectedItem = item; }
public static List <string> GetRecFolderViewList(this RecSettingData recSetting) { var list = new List <string>(); List <RecFolderInfo> defs = Settings.Instance.DefRecFolders; string def1 = defs.Count == 0 ? "!Default" : defs[0].recFolder; Func <string, string> AdjustName = (f => f == "!Default" ? def1 : f); if (recSetting != null) { recSetting.RecFolderList.ForEach(info => list.Add(AdjustName(info.RecFolder))); recSetting.PartialRecFolder.ForEach(info => list.Add("(ワンセグ) " + AdjustName(info.RecFolder))); } return(list); }
public void SetDefSetting(UInt32 presetID) { Settings.GetDefRecSetting(presetID, ref recSetting); setDefSetting = recSetting; foreach (RecPresetItem info in comboBox_preSet.Items) { if (info.ID == presetID) { comboBox_preSet.SelectedItem = info; break; } } UpdateView(); }
//未使用。プリセット指定で予約追加ダイアログを立ち上げるときに使えると思うが、そのような処理がない。 public void SetDefSetting(UInt32 presetID) { RecPresetItem target = FindPresetItem(presetID); if (target == null) { target = comboBox_preSet.Items[0] as RecPresetItem; } recSetting = target.RecPresetData.Clone(); //強制更新 comboBox_preSet.SelectedItem = null; comboBox_preSet.SelectedItem = target; }
private void PresetSelectChanged(RecPresetItem item, object msg) { var code = (msg as PresetSelectMode?) ?? PresetSelectMode.Normal; if (code != PresetSelectMode.SelectOnly) { if (code != PresetSelectMode.InitLoad) { recSetting = item.Data.DeepClone(); } UpdateView(); } preEdit.button_chg.IsEnabled = !item.IsCustom && CommonManager.Instance.NWMode == false; preEdit.button_del.IsEnabled = preEdit.button_chg.IsEnabled; SelectedPreset_Changed(code == PresetSelectMode.Normal); }
private void MenuItem_Click_ChangeRecMode(object sender, RoutedEventArgs e) { try { List <ReserveData> list = new List <ReserveData>(); foreach (ReserveItem item in listView_reserve.SelectedItems) { ReserveData reserveInfo = item.ReserveInfo; if (item.ReserveInfo.RecSetting.RecMode == 5) { // 無効 => 予約 RecSettingData defSet = new RecSettingData(); Settings.GetDefRecSetting(0, ref defSet); item.ReserveInfo.RecSetting.RecMode = defSet.RecMode; } else { //予約 => 無効 item.ReserveInfo.RecSetting.RecMode = 5; } list.Add(reserveInfo); } if (list.Count > 0) { ErrCode err = (ErrCode)cmd.SendChgReserve(list); if (err == ErrCode.CMD_ERR_CONNECT) { MessageBox.Show("サーバー または EpgTimerSrv に接続できませんでした。"); } if (err == ErrCode.CMD_ERR_TIMEOUT) { MessageBox.Show("EpgTimerSrvとの接続にタイムアウトしました。038"); } if (err != ErrCode.CMD_SUCCESS) { MessageBox.Show("チューナー一覧の取得でエラーが発生しました。"); } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public void CtxmGenerateOpenFolderItems(MenuItem menu, RecSettingData recSetting = null, string additionalPath = null, bool isGestureString = true) { CtxmClearItemMenu(menu); //ツールチップのクリアがあるので先 if (menu.IsEnabled == false) { return; } bool defOutPutted = false; recSetting = recSetting == null ? new RecSettingData() : recSetting.DeepClone(); if (string.IsNullOrEmpty(additionalPath) == false) { recSetting.RecFolderList.Add(new RecFileSetInfo { RecFolder = additionalPath }); } var addFolderList = new Action <List <RecFileSetInfo>, bool, string>((fldrs, recflg, header_exp) => { //ワンセグ出力未チェックでも、フォルダ設定があれば表示する。 //ただし、デフォルトフォルダは1回だけ展開して表示する。 if (defOutPutted == false && (recflg && fldrs.Count == 0 || fldrs.Any(info => info.RecFolder == "!Default"))) { defOutPutted = true; Settings.Instance.DefRecFolders.ForEach(folder => CtxmGenerateOpenFolderItem(menu, folder, header_exp + "(デフォルト) ")); } foreach (var info in fldrs.Where(info => info.RecFolder != "!Default")) { CtxmGenerateOpenFolderItem(menu, info.RecFolder, header_exp); } }); addFolderList(recSetting.RecFolderList, true, ""); addFolderList(recSetting.PartialRecFolder, recSetting.PartialRecFlag != 0, "(ワンセグ) "); //候補が一つの時は直接メニューを実行出来るようにする CtxmPullUpSubMenu(menu); if (isGestureString && MC.WorkCmdOptions[EpgCmds.OpenFolder].IsGestureEnabled) { menu.InputGestureText = MenuBinds.GetInputGestureText(EpgCmds.OpenFolder); } }
public static bool EqualsValue(RecSettingData src, RecSettingData dest) { return src.BatFilePath == dest.BatFilePath && src.ContinueRecFlag == dest.ContinueRecFlag && src.EndMargine == dest.EndMargine && src.PartialRecFlag == dest.PartialRecFlag && src.PartialRecFolder.EqualsTo(dest.PartialRecFolder) //RecFileSetInfo && src.PittariFlag == dest.PittariFlag && src.Priority == dest.Priority && src.RebootFlag == dest.RebootFlag && src.RecFolderList.EqualsTo(dest.RecFolderList) //RecFileSetInfo && src.RecMode == dest.RecMode && src.ServiceMode == dest.ServiceMode && src.StartMargine == dest.StartMargine && src.SuspendMode == dest.SuspendMode && src.TuijyuuFlag == dest.TuijyuuFlag && src.TunerID == dest.TunerID && src.UseMargineFlag == dest.UseMargineFlag; }
private void button_chg_preset_Click(object sender, RoutedEventArgs e) { try { if (comboBox_preSet.SelectedItem != null) { RecPresetItem item = comboBox_preSet.SelectedItem as RecPresetItem; if (item.ID == 0xFFFFFFFF) { MessageBox.Show("このプリセットは変更できません"); return; } AddPresetWindow setting = new AddPresetWindow(); PresentationSource topWindow = PresentationSource.FromVisual(this); if (topWindow != null) { setting.Owner = (Window)topWindow.RootVisual; } setting.SetMode(true); setting.SetName(item.DisplayName); if (setting.ShowDialog() == true) { String name = ""; setting.GetName(ref name); RecSettingData newSet = new RecSettingData(); GetRecSetting(ref newSet); item.DisplayName = name; presetList[item.ID] = newSet; SavePreset(); comboBox_preSet.Items.Refresh(); } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public static bool EqualsSettingTo(this RecSettingData src, RecSettingData dest, bool IsManual = false) { if (src == null || dest == null) return false; return src.BatFilePath == dest.BatFilePath && src.ContinueRecFlag == dest.ContinueRecFlag && (src.EndMargine == dest.EndMargine || src.UseMargineFlag == 0)//マージンデフォルト時 && src.PartialRecFlag == dest.PartialRecFlag && src.PartialRecFolder.EqualsTo(dest.PartialRecFolder) && (src.PittariFlag == dest.PittariFlag || IsManual == true)//プログラム予約時 && src.Priority == dest.Priority && (src.RebootFlag == dest.RebootFlag || src.SuspendMode == 0)//動作後設定デフォルト時 && src.RecFolderList.EqualsTo(dest.RecFolderList) && (src.RecMode == dest.RecMode || src.RecMode == 5 || dest.RecMode == 5) && (src.ServiceMode == dest.ServiceMode || ((src.ServiceMode | dest.ServiceMode) & 0x0F) == 0)//字幕等データ設定デフォルト時 && (src.StartMargine == dest.StartMargine || src.UseMargineFlag == 0)//マージンデフォルト時 && src.SuspendMode == dest.SuspendMode//動作後設定 && (src.TuijyuuFlag == dest.TuijyuuFlag || IsManual == true)//プログラム予約時 && src.TunerID == dest.TunerID && src.UseMargineFlag == dest.UseMargineFlag; }
public RecSettingView() { InitializeComponent(); try { recSetting = Settings.Instance.RecPresetList[0].RecPresetData.Clone(); comboBox_recMode.DataContext = CommonManager.Instance.RecModeDictionary.Values; comboBox_tuijyu.DataContext = CommonManager.Instance.YesNoDictionary.Values; comboBox_pittari.DataContext = CommonManager.Instance.YesNoDictionary.Values; comboBox_priority.DataContext = CommonManager.Instance.PriorityDictionary.Values; tunerList.Add(new TunerSelectInfo("自動", 0)); foreach (TunerReserveInfo info in CommonManager.Instance.DB.TunerReserveList.Values) { if (info.tunerID != 0xFFFFFFFF) { tunerList.Add(new TunerSelectInfo(info.tunerName, info.tunerID)); } } comboBox_tuner.ItemsSource = tunerList; comboBox_tuner.SelectedIndex = 0; Settings.Instance.RecPresetList.ForEach(info => info.LoadRecPresetData());//iniファイルから録画設定をロード Settings.Instance.RecPresetList.ForEach(info => comboBox_preSet.Items.Add(info.Clone()));//現在の処理ならClone()無くても大丈夫 comboBox_preSet.SelectedIndex = 0; var bx = new BoxExchangeEdit.BoxExchangeEditor(null, listView_recFolder, true, true, true); bx.targetBoxAllowDoubleClick(bx.TargetBox, (sender, e) => button_recFolderChg.RaiseEvent(new RoutedEventArgs(Button.ClickEvent))); button_recFolderDel.Click += new RoutedEventHandler(bx.button_Delete_Click); if (IniFileHandler.CanUpdateInifile == false) { button_bat.IsEnabled = false; } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public RecSettingView() { InitializeComponent(); try { recSetting = Settings.Instance.RecPresetList[0].RecPresetData.Clone(); comboBox_recMode.DataContext = CommonManager.Instance.RecModeDictionary.Values; comboBox_tuijyu.DataContext = CommonManager.Instance.YesNoDictionary.Values; comboBox_pittari.DataContext = CommonManager.Instance.YesNoDictionary.Values; comboBox_priority.DataContext = CommonManager.Instance.PriorityDictionary.Values; tunerList.Add(new TunerSelectInfo("自動", 0)); foreach (TunerReserveInfo info in CommonManager.Instance.DB.TunerReserveList.Values) { if (info.tunerID != 0xFFFFFFFF) { tunerList.Add(new TunerSelectInfo(info.tunerName, info.tunerID)); } } comboBox_tuner.ItemsSource = tunerList; comboBox_tuner.SelectedIndex = 0; Settings.Instance.RecPresetList.ForEach(info => info.LoadRecPresetData());//iniファイルから録画設定をロード Settings.Instance.RecPresetList.ForEach(info => comboBox_preSet.Items.Add(info.Clone()));//現在の処理ならClone()無くても大丈夫 comboBox_preSet.SelectedIndex = 0; if (IniFileHandler.CanUpdateInifile == false) { button_bat.IsEnabled = false; } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void button_add_Click(object sender, RoutedEventArgs e) { if (defKey == null) { defKey = new ManualAutoAddData(); } defKey.dayOfWeekFlag = 0; if (checkBox_week0.IsChecked == true) { defKey.dayOfWeekFlag |= 0x01; } if (checkBox_week1.IsChecked == true) { defKey.dayOfWeekFlag |= 0x02; } if (checkBox_week2.IsChecked == true) { defKey.dayOfWeekFlag |= 0x04; } if (checkBox_week3.IsChecked == true) { defKey.dayOfWeekFlag |= 0x08; } if (checkBox_week4.IsChecked == true) { defKey.dayOfWeekFlag |= 0x10; } if (checkBox_week5.IsChecked == true) { defKey.dayOfWeekFlag |= 0x20; } if (checkBox_week6.IsChecked == true) { defKey.dayOfWeekFlag |= 0x40; } defKey.startTime = ((UInt32)comboBox_startHH.SelectedIndex * 60 * 60) + ((UInt32)comboBox_startMM.SelectedIndex * 60) + (UInt32)comboBox_startSS.SelectedIndex; UInt32 endTime = ((UInt32)comboBox_endHH.SelectedIndex * 60 * 60) + ((UInt32)comboBox_endMM.SelectedIndex * 60) + (UInt32)comboBox_endSS.SelectedIndex; if (endTime < defKey.startTime) { defKey.durationSecond = (24 * 60 * 60 + endTime) - defKey.startTime; } else { defKey.durationSecond = endTime - defKey.startTime; } defKey.title = textBox_title.Text; ChSet5Item chItem = comboBox_service.SelectedItem as ChSet5Item; defKey.stationName = chItem.ServiceName; defKey.originalNetworkID = chItem.ONID; defKey.transportStreamID = chItem.TSID; defKey.serviceID = chItem.SID; RecSettingData recSet = new RecSettingData(); recSettingView.GetRecSetting(ref recSet); defKey.recSetting = recSet; List<ManualAutoAddData> val = new List<ManualAutoAddData>(); val.Add(defKey); if (changeModeFlag == true) { cmd.SendChgManualAdd(val); } else { cmd.SendAddManualAdd(val); } DialogResult = true; }
private void MenuItem_Click_ChangeRecMode(object sender, RoutedEventArgs e) { new BlackoutWindow(this).showWindow("予約←→無効"); if (listView_result.SelectedItem != null) { SearchItem item = listView_result.SelectedItem as SearchItem; if (item.IsReserved == true) { ChgReserveWindow dlg = new ChgReserveWindow(); dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual; if (item.ReserveInfo.RecSetting.RecMode == 5) { // 無効 => 予約 RecSettingData defSet = new RecSettingData(); Settings.GetDefRecSetting(0, ref defSet); item.ReserveInfo.RecSetting.RecMode = defSet.RecMode; } else { //予約 => 無効 item.ReserveInfo.RecSetting.RecMode = 5; } dlg.SetReserveInfo(item.ReserveInfo); dlg.button_chg_reserve.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else { AddReserveEpgWindow dlg = new AddReserveEpgWindow(); dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual; dlg.SetEventInfo(item.EventInfo); dlg.button_add_reserve.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } // CommonManager.Instance.DB.SetUpdateNotify((UInt32)UpdateNotifyItem.ReserveInfo); CommonManager.Instance.DB.ReloadReserveInfo(); SearchPg(); // listView_result.SelectedItem = null; } }
private void button_add_reserve_Click(object sender, RoutedEventArgs e) { try { if (listView_result.SelectedItem != null) { SearchItem item = listView_result.SelectedItem as SearchItem; EpgEventInfo eventInfo = item.EventInfo; if (eventInfo.StartTimeFlag == 0) { MessageBox.Show("開始時間未定のため予約できません"); return; } ReserveData reserveInfo = new ReserveData(); if (eventInfo.ShortInfo != null) { reserveInfo.Title = eventInfo.ShortInfo.event_name; } reserveInfo.StartTime = eventInfo.start_time; reserveInfo.StartTimeEpg = eventInfo.start_time; if (eventInfo.DurationFlag == 0) { reserveInfo.DurationSecond = 10 * 60; } else { reserveInfo.DurationSecond = eventInfo.durationSec; } UInt64 key = CommonManager.Create64Key(eventInfo.original_network_id, eventInfo.transport_stream_id, eventInfo.service_id); if (ChSet5.Instance.ChList.ContainsKey(key) == true) { reserveInfo.StationName = ChSet5.Instance.ChList[key].ServiceName; } reserveInfo.OriginalNetworkID = eventInfo.original_network_id; reserveInfo.TransportStreamID = eventInfo.transport_stream_id; reserveInfo.ServiceID = eventInfo.service_id; reserveInfo.EventID = eventInfo.event_id; RecSettingData setInfo = new RecSettingData(); recSettingView.GetRecSetting(ref setInfo); reserveInfo.RecSetting = setInfo; List<ReserveData> list = new List<ReserveData>(); list.Add(reserveInfo); ErrCode err = (ErrCode)cmd.SendAddReserve(list); if (err == ErrCode.CMD_ERR_CONNECT) { MessageBox.Show("サーバー または EpgTimerSrv に接続できませんでした。"); } if (err == ErrCode.CMD_ERR_TIMEOUT) { MessageBox.Show("EpgTimerSrvとの接続にタイムアウトしました。"); } if (err != ErrCode.CMD_SUCCESS) { MessageBox.Show("予約登録でエラーが発生しました。終了時間がすでに過ぎている可能性があります。"); } CommonManager.Instance.DB.SetUpdateNotify((UInt32)UpdateNotifyItem.ReserveInfo); CommonManager.Instance.DB.ReloadReserveInfo(); SearchPg(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
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); } }
public void SetDefSetting(RecSettingData set) { RecPresetItem preCust = new RecPresetItem(); preCust.DisplayName = "登録時"; preCust.ID = 0xFFFFFFFF; int index = comboBox_preSet.Items.Add(preCust); setDefSetting = set; recSetting = set; comboBox_preSet.SelectedIndex = index; UpdateView(); }
public RecSettingView() { InitializeComponent(); try { if (Settings.Instance.NoStyle == 1) { button_add_preset.Style = null; button_chg_preset.Style = null; button_del_preset.Style = null; button_recFolderAdd.Style = null; button_recFolderChg.Style = null; button_recFolderDel.Style = null; button_bat.Style = null; button_recFolderAdd_1seg.Style = null; button_recFolderChg_1seg.Style = null; button_recFolderDel_1seg.Style = null; } Settings.GetDefRecSetting(0, ref recSetting); comboBox_recMode.DataContext = CommonManager.Instance.RecModeDictionary.Values; comboBox_tuijyu.DataContext = CommonManager.Instance.YesNoDictionary.Values; comboBox_pittari.DataContext = CommonManager.Instance.YesNoDictionary.Values; comboBox_priority.DataContext = CommonManager.Instance.PriorityDictionary.Values; tunerList.Add(new TunerSelectInfo("自動", 0)); foreach (TunerReserveInfo info in CommonManager.Instance.DB.TunerReserveList.Values) { if (info.tunerID != 0xFFFFFFFF) { tunerList.Add(new TunerSelectInfo(info.tunerName, info.tunerID)); } } comboBox_tuner.ItemsSource = tunerList; comboBox_tuner.SelectedIndex = 0; RecPresetItem preDef = new RecPresetItem(); preDef.DisplayName = "デフォルト"; preDef.ID = 0; RecSettingData defSet = new RecSettingData(); Settings.GetDefRecSetting(0, ref defSet); presetList.Add(0, defSet); comboBox_preSet.Items.Add(preDef); comboBox_preSet.SelectedIndex = 0; lastSelectIndex = 0; foreach (RecPresetItem info in Settings.Instance.RecPresetList) { if (presetList.ContainsKey(info.ID) == false) { RecSettingData setDatat = new RecSettingData(); Settings.GetDefRecSetting(info.ID, ref setDatat); presetList.Add(info.ID, setDatat); comboBox_preSet.Items.Add(info); } } if (CommonManager.Instance.NWMode == true) { button_bat.IsEnabled = false; } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private static RecSettingData GetPreset(Dictionary<string, string> Arg, RecSettingData Old) { RecSettingData pInfo = Old; pInfo.ServiceMode = (byte)((Arg.ContainsKey("savedata") || Arg.ContainsKey("savecaption")) || Arg.ContainsKey("nousedata") ? 1 : 0); if (Arg.ContainsKey("savecaption")) pInfo.ServiceMode |= 0x10; if (Arg.ContainsKey("savedata")) pInfo.ServiceMode |= 0x20; pInfo.PittariFlag = (byte)(Arg.ContainsKey("usepittari") ? 1 : 0); pInfo.TuijyuuFlag = (byte)(Arg.ContainsKey("usetuijyuu") ? 1 : 0); if (Arg.ContainsKey("suspendmode")) { if (byte.Parse(Arg["suspendmode"]) < 5 && byte.Parse(Arg["suspendmode"]) > 0) pInfo.SuspendMode = byte.Parse(Arg["suspendmode"]); } pInfo.UseMargineFlag = (byte)(Arg.ContainsKey("marginestart") && Arg.ContainsKey("margineend") ? 1 : 0); if (ContainsMultipleKeys(Arg, "marginestart", "margineend")) { int startSec = 0; int startMinus = 1; if (Arg["marginestart"].IndexOf("-") == 0) { startMinus = -1; } string[] startArray = Arg["marginestart"].Split(':'); if (startArray.Length == 2) { startSec = int.Parse(startArray[0]) * 60; startSec += int.Parse(startArray[1]) * startMinus; } else if (startArray.Length == 3) { startSec = int.Parse(startArray[0]) * 60 * 60; startSec += int.Parse(startArray[1]) * 60 * startMinus; startSec += int.Parse(startArray[2]) * startMinus; } else { startSec = int.Parse(startArray[0]); } int endSec = 0; int endMinus = 1; if (Arg["marginend"].IndexOf("-") == 0) { endMinus = -1; } string[] endArray = Arg["margineend"].Split(':'); if (endArray.Length == 2) { endSec = int.Parse(endArray[0]) * 60; endSec += int.Parse(endArray[1]) * endMinus; } else if (endArray.Length == 3) { endSec = int.Parse(endArray[0]) * 60 * 60; endSec += int.Parse(endArray[1]) * 60 * endMinus; endSec += int.Parse(endArray[2]) * endMinus; } else { endSec = int.Parse(endArray[0]); } pInfo.StartMargine = startSec; pInfo.EndMargine = endSec; } if (ContainsMultipleKeys(Arg, "usepartial", "partialdir")) { pInfo.PartialRecFlag = 1; if (Arg["partialdir"].IndexOf("*") > 0) { string[] s = Arg["partialdir"].Split('*'); pInfo.PartialRecFolder.AddRange(s.Select(p => { if (p.Split(':').Length != 3 || p.Split(':').Length != 2) return null; string[] k = p.Split(':'); if (!CommonManager.Instance.DB.WritePlugInList.ContainsValue(k[1])) return null; if (k.Length == 3 && !CommonManager.Instance.DB.RecNamePlugInList.ContainsValue(k[2])) return null; return new RecFileSetInfo() { RecNamePlugIn = k.Length == 3 ? k[2] : "", WritePlugIn = k[1], RecFolder = k[0] }; }).Where(p => p != null)); } else { string p = Arg["partialdir"]; if (p.Split(':').Length != 3 || p.Split(':').Length != 2) throw new ArgumentException(); string[] k = p.Split(':'); if (!CommonManager.Instance.DB.WritePlugInList.ContainsValue(k[1])) throw new ArgumentException(); if (k.Length == 3 && !CommonManager.Instance.DB.RecNamePlugInList.ContainsValue(k[2])) throw new ArgumentException(); pInfo.PartialRecFolder.Add(new RecFileSetInfo() { RecNamePlugIn = k.Length == 3 ? k[2] : "", WritePlugIn = k[1], RecFolder = k[0] }); } if (pInfo.PartialRecFolder.Count == 0) pInfo.PartialRecFlag = 0; } if (Arg.ContainsKey("continuerec")) pInfo.ContinueRecFlag = 1; pInfo.TunerID = 0; if (Arg.ContainsKey("tuner") && CommonManager.Instance.DB.TunerReserveList.Values.Where(s => s.tunerID == uint.Parse(Arg["tuner"])).Count() > 0 && uint.Parse(Arg["tuner"]) != 0xFFFFFFFF) pInfo.TunerID = uint.Parse(Arg["tuner"]); pInfo.Priority = 2; if (Arg.ContainsKey("priority") && byte.Parse(Arg["priority"]) >= 1 && byte.Parse(Arg["priority"]) <= 5) pInfo.Priority = byte.Parse(Arg["priority"]); pInfo.RecMode = 1; if (Arg.ContainsKey("recmode") && byte.Parse(Arg["recmode"]) >= 0 && byte.Parse(Arg["recmode"]) <= 5) pInfo.RecMode = byte.Parse(Arg["recmode"]); return pInfo; }
public bool LoadTVPIDFile(String filePath) { bool ret = false; System.IO.StreamReader reader = null; try { Dictionary<String, String> paramList = new Dictionary<string, string>(); reader = (new System.IO.StreamReader(filePath, System.Text.Encoding.Default)); while (reader.Peek() >= 0) { string buff = reader.ReadLine(); string[] value = buff.Split(':'); if (value.Length > 1) { if (value.Length == 2) { paramList.Add(value[0], value[1].Trim()); } else { string val = ""; for (int i = 1; i < value.Length; i++) { val += value[i]; if (i + 1 < value.Length) { val += ":"; } } paramList.Add(value[0], val.Trim()); } } } if (String.Compare(paramList["version"], "2", true) == 0) { bool find = false; if (paramList["station"].IndexOf("DFS") == 0) { UInt16 sid = Convert.ToUInt16(paramList["station"].Substring(3), 16); foreach (ChSet5Item info in ChSet5.Instance.ChList.Values) { if (0x7880 <= info.ONID && info.ONID <= 0x7FE8 && info.SID == sid) { AddInfo.OriginalNetworkID = info.ONID; AddInfo.TransportStreamID = info.TSID; AddInfo.ServiceID = info.SID; AddInfo.StationName = info.ServiceName; AddInfo.EventID = Convert.ToUInt16(paramList["program-id"]); find = true; break; } } } else if (paramList["station"].IndexOf("BSDT") == 0) { UInt16 sid = Convert.ToUInt16(paramList["station"].Substring(4)); foreach (ChSet5Item info in ChSet5.Instance.ChList.Values) { if (info.ONID == 4 && info.SID == sid) { AddInfo.OriginalNetworkID = info.ONID; AddInfo.TransportStreamID = info.TSID; AddInfo.ServiceID = info.SID; AddInfo.StationName = info.ServiceName; AddInfo.EventID = Convert.ToUInt16(paramList["program-id"]); find = true; break; } } } else if (paramList["station"].IndexOf("CSDT") == 0) { UInt16 sid = Convert.ToUInt16(paramList["station"].Substring(4)); foreach (ChSet5Item info in ChSet5.Instance.ChList.Values) { if ((info.ONID == 6 || info.ONID == 7) && info.SID == sid) { AddInfo.OriginalNetworkID = info.ONID; AddInfo.TransportStreamID = info.TSID; AddInfo.ServiceID = info.SID; AddInfo.StationName = info.ServiceName; AddInfo.EventID = Convert.ToUInt16(paramList["program-id"]); find = true; break; } } } else if (paramList["station"].IndexOf("DOS") == 0) { UInt16 sid = Convert.ToUInt16(paramList["station"].Substring(3), 16); foreach (ChSet5Item info in ChSet5.Instance.ChList.Values) { if (0x7880 <= info.ONID && info.ONID <= 0x7FE8 && info.SID == sid) { AddInfo.OriginalNetworkID = info.ONID; AddInfo.TransportStreamID = info.TSID; AddInfo.ServiceID = info.SID; AddInfo.StationName = info.ServiceName; AddInfo.EventID = 0xFFFF; find = true; break; } } } if (find == false) { throw new Exception(); } AddInfo.Title = paramList["program-title"]; int yy = Convert.ToInt32(paramList["year"]); int mm = Convert.ToInt32(paramList["month"]); int dd = Convert.ToInt32(paramList["date"]); string[] startTime = paramList["start"].Split(':'); int startHH = Convert.ToInt32(startTime[0]); int startMM = Convert.ToInt32(startTime[1]); string[] endTime = paramList["end"].Split(':'); int endHH = Convert.ToInt32(endTime[0]); int endMM = Convert.ToInt32(endTime[1]); DateTime start = new DateTime(yy, mm, dd, startHH, startMM, 0, DateTimeKind.Utc); DateTime end = new DateTime(yy, mm, dd, endHH, endMM, 0, DateTimeKind.Utc); if (end < start) { end = end.AddDays(1); } AddInfo.StartTime = start; AddInfo.StartTimeEpg = start; AddInfo.DurationSecond = (uint)((end - start).TotalSeconds); RecSettingData recSet = new RecSettingData(); Settings.GetDefRecSetting(0, ref recSet); AddInfo.RecSetting = recSet; ret = true; } } catch { } if (reader != null) { reader.Close(); } return ret; }
private void button_chg_reserve_Click(object sender, RoutedEventArgs e) { if (checkBox_program.IsChecked == true) { reserveInfo.Title = textBox_title.Text; ChSet5Item ch = comboBox_service.SelectedItem as ChSet5Item; reserveInfo.StationName = ch.ServiceName; reserveInfo.OriginalNetworkID = ch.ONID; reserveInfo.TransportStreamID = ch.TSID; reserveInfo.ServiceID = ch.SID; reserveInfo.EventID = 0xFFFF; reserveInfo.StartTime = new DateTime(datePicker_start.SelectedDate.Value.Year, datePicker_start.SelectedDate.Value.Month, datePicker_start.SelectedDate.Value.Day, comboBox_sh.SelectedIndex, comboBox_sm.SelectedIndex, comboBox_ss.SelectedIndex, 0, DateTimeKind.Utc ); DateTime endTime = new DateTime(datePicker_end.SelectedDate.Value.Year, datePicker_end.SelectedDate.Value.Month, datePicker_end.SelectedDate.Value.Day, comboBox_eh.SelectedIndex, comboBox_em.SelectedIndex, comboBox_es.SelectedIndex, 0, DateTimeKind.Utc ); if (reserveInfo.StartTime > endTime) { MessageBox.Show("終了日時が開始日時より前です"); return; } TimeSpan duration = endTime - reserveInfo.StartTime; reserveInfo.DurationSecond = (uint)duration.TotalSeconds; RecSettingData setInfo = new RecSettingData(); recSettingView.GetRecSetting(ref setInfo); setInfo.TuijyuuFlag = 0; setInfo.PittariFlag = 0; reserveInfo.RecSetting = setInfo; } else { RecSettingData setInfo = new RecSettingData(); recSettingView.GetRecSetting(ref setInfo); reserveInfo.RecSetting = setInfo; } List<ReserveData> list = new List<ReserveData>(); list.Add(reserveInfo); if (manualAddMode == false) { ErrCode err = (ErrCode)cmd.SendChgReserve(list); if (err == ErrCode.CMD_ERR_CONNECT) { MessageBox.Show("サーバー または EpgTimerSrv に接続できませんでした。"); } if (err == ErrCode.CMD_ERR_TIMEOUT) { MessageBox.Show("EpgTimerSrvとの接続にタイムアウトしました。"); } if (err != ErrCode.CMD_SUCCESS) { MessageBox.Show("予約変更でエラーが発生しました。"); } } else { reserveInfo.StartTimeEpg = reserveInfo.StartTime; ErrCode err = (ErrCode)cmd.SendAddReserve(list); if (err == ErrCode.CMD_ERR_CONNECT) { MessageBox.Show("サーバー または EpgTimerSrv に接続できませんでした。"); } if (err == ErrCode.CMD_ERR_TIMEOUT) { MessageBox.Show("EpgTimerSrvとの接続にタイムアウトしました。"); } if (err != ErrCode.CMD_SUCCESS) { MessageBox.Show("予約追加でエラーが発生しました。"); } } if (this.Visibility == System.Windows.Visibility.Visible) { DialogResult = true; } }
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; }
public ReserveData() { Title = ""; StartTime = new DateTime(); DurationSecond = 0; StationName = ""; OriginalNetworkID = 0; TransportStreamID = 0; ServiceID = 0; EventID = 0; Comment = ""; ReserveID = 0; UnusedRecWaitFlag = 0; OverlapMode = 0; UnusedRecFilePath = ""; StartTimeEpg = new DateTime(); RecSetting = new RecSettingData(); ReserveStatus = 0; RecFileNameList = new List<string>(); UnusedParam1 = 0; }
/// <summary> /// 右クリックメニュー 簡易予約イベント呼び出し /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cm_new_Click(object sender, RoutedEventArgs e) { try { EpgEventInfo eventInfo = new EpgEventInfo(); if (GetProgramItem(clickPos, ref eventInfo) == false) { return; } if (eventInfo.StartTimeFlag == 0) { MessageBox.Show("開始時間未定のため予約できません"); return; } ReserveData reserveInfo = new ReserveData(); if (eventInfo.ShortInfo != null) { reserveInfo.Title = eventInfo.ShortInfo.event_name; } reserveInfo.StartTime = eventInfo.start_time; reserveInfo.StartTimeEpg = eventInfo.start_time; if (eventInfo.DurationFlag == 0) { reserveInfo.DurationSecond = 10 * 60; } else { reserveInfo.DurationSecond = eventInfo.durationSec; } UInt64 key = CommonManager.Create64Key(eventInfo.original_network_id, eventInfo.transport_stream_id, eventInfo.service_id); if (ChSet5.Instance.ChList.ContainsKey(key) == true) { reserveInfo.StationName = ChSet5.Instance.ChList[key].ServiceName; } reserveInfo.OriginalNetworkID = eventInfo.original_network_id; reserveInfo.TransportStreamID = eventInfo.transport_stream_id; reserveInfo.ServiceID = eventInfo.service_id; reserveInfo.EventID = eventInfo.event_id; RecSettingData setInfo = new RecSettingData(); Settings.GetDefRecSetting(0, ref setInfo); // デフォルトをとって来てくれる? reserveInfo.RecSetting = setInfo; List<ReserveData> list = new List<ReserveData>(); list.Add(reserveInfo); ErrCode err = (ErrCode)cmd.SendAddReserve(list); if (err == ErrCode.CMD_ERR_CONNECT) { MessageBox.Show("サーバー または EpgTimerSrv に接続できませんでした。"); } if (err == ErrCode.CMD_ERR_TIMEOUT) { MessageBox.Show("EpgTimerSrvとの接続にタイムアウトしました。"); } if (err != ErrCode.CMD_SUCCESS) { MessageBox.Show("簡易予約でエラーが発生しました。終了時間がすでに過ぎている可能性があります。"); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public void GetRecSetting(ref RecSettingData setInfo) { if (initLoad == false) { setInfo = recSetting; return; } setInfo.RecMode = ((RecModeInfo)comboBox_recMode.SelectedItem).Value; setInfo.Priority = ((PriorityInfo)comboBox_priority.SelectedItem).Value; setInfo.TuijyuuFlag = ((YesNoInfo)comboBox_tuijyu.SelectedItem).Value; if (checkBox_serviceMode.IsChecked == true) { setInfo.ServiceMode = 0; } else { setInfo.ServiceMode = 1; if (checkBox_serviceCaption.IsChecked == true) { setInfo.ServiceMode |= 0x10; } if (checkBox_serviceData.IsChecked == true) { setInfo.ServiceMode |= 0x20; } } setInfo.PittariFlag = ((YesNoInfo)comboBox_pittari.SelectedItem).Value; setInfo.BatFilePath = textBox_bat.Text; setInfo.RecFolderList.Clear(); foreach (RecFileSetInfo info in listView_recFolder.Items) { setInfo.RecFolderList.Add(info); } if (checkBox_suspendDef.IsChecked == true) { setInfo.SuspendMode = 0; setInfo.RebootFlag = 0; } else { setInfo.SuspendMode = 0; if (radioButton_standby.IsChecked == true) { setInfo.SuspendMode = 1; } else if (radioButton_supend.IsChecked == true) { setInfo.SuspendMode = 2; } else if (radioButton_shutdown.IsChecked == true) { setInfo.SuspendMode = 3; } else if (radioButton_non.IsChecked == true) { setInfo.SuspendMode = 4; } if (checkBox_reboot.IsChecked == true) { setInfo.RebootFlag = 1; } else { setInfo.RebootFlag = 0; } } if (checkBox_margineDef.IsChecked == true) { setInfo.UseMargineFlag = 0; } else { setInfo.UseMargineFlag = 1; if (textBox_margineStart.Text.Length == 0 || textBox_margineEnd.Text.Length == 0) { setInfo.StartMargine = 0; setInfo.EndMargine = 0; } else { int startSec = 0; int startMinus = 1; if (textBox_margineStart.Text.IndexOf("-") == 0) { startMinus = -1; } string[] startArray = textBox_margineStart.Text.Split(':'); if (startArray.Length == 2) { startSec = Convert.ToInt32(startArray[0]) * 60; startSec += Convert.ToInt32(startArray[1]) * startMinus; } else if (startArray.Length == 3) { startSec = Convert.ToInt32(startArray[0]) * 60 * 60; startSec += Convert.ToInt32(startArray[1]) * 60 * startMinus; startSec += Convert.ToInt32(startArray[2]) * startMinus; } else { startSec = Convert.ToInt32(startArray[0]); } int endSec = 0; int endMinus = 1; if (textBox_margineEnd.Text.IndexOf("-") == 0) { endMinus = -1; } string[] endArray = textBox_margineEnd.Text.Split(':'); if (endArray.Length == 2) { endSec = Convert.ToInt32(endArray[0]) * 60; endSec += Convert.ToInt32(endArray[1]) * endMinus; } else if (endArray.Length == 3) { endSec = Convert.ToInt32(endArray[0]) * 60 * 60; endSec += Convert.ToInt32(endArray[1]) * 60 * endMinus; endSec += Convert.ToInt32(endArray[2]) * endMinus; } else { endSec = Convert.ToInt32(endArray[0]); } setInfo.StartMargine = startSec; setInfo.EndMargine = endSec; } } if (checkBox_partial.IsChecked == true) { setInfo.PartialRecFlag = 1; } else { setInfo.PartialRecFlag = 0; } setInfo.PartialRecFolder.Clear(); foreach (RecFileSetInfo info in listView_recFolder_1seg.Items) { setInfo.PartialRecFolder.Add(info); } if (checkBox_continueRec.IsChecked == true) { setInfo.ContinueRecFlag = 1; } else { setInfo.ContinueRecFlag = 0; } TunerSelectInfo tuner = comboBox_tuner.SelectedItem as TunerSelectInfo; setInfo.TunerID = tuner.ID; }
public void CtxmGenerateOpenFolderItems(MenuItem menu, RecSettingData recSetting = null) { CtxmClearItemMenu(menu);//ツールチップのクリアがあるので先 if (menu.IsEnabled == false) return; bool defOutPutted = false; recSetting = recSetting == null ? new RecSettingData() : recSetting; var addFolderList = new Action<List<RecFileSetInfo>, bool, string>((fldrs, recflg, header_exp) => { //ワンセグ出力未チェックでも、フォルダ設定があれば表示する。 //ただし、デフォルトフォルダは1回だけ展開して表示する。 if (defOutPutted == false && (recflg && fldrs.Count == 0 || fldrs.Any(info => info.RecFolder == "!Default"))) { defOutPutted = true; Settings.Instance.DefRecFolders.ForEach(folder => CtxmGenerateOpenFolderItem(menu, folder.recFolder, header_exp + "(デフォルト) ")); } foreach (var info in fldrs.Where(info => info.RecFolder != "!Default")) { CtxmGenerateOpenFolderItem(menu, info.RecFolder, header_exp); } }); addFolderList(recSetting.RecFolderList, true, ""); addFolderList(recSetting.PartialRecFolder, recSetting.PartialRecFlag != 0, "(ワンセグ) "); //候補が一つの時は直接メニューを実行出来るようにする CtxmPullUpSubMenu(menu); }
public RecPresetItem(string name, UInt32 id, RecSettingData data = null) { DisplayName = name; ID = id; recPresetData = data; }
public bool LoadTVPIFile(String filePath) { bool ret = false; System.IO.StreamReader reader = null; try { Dictionary<String, String> paramList = new Dictionary<string, string>(); reader = (new System.IO.StreamReader(filePath, System.Text.Encoding.Default)); while (reader.Peek() >= 0) { string buff = reader.ReadLine(); string[] value = buff.Split(':'); if (value.Length > 1) { if (value.Length == 2) { paramList.Add(value[0], value[1].Trim()); } else { string val = ""; for (int i = 1; i < value.Length; i++) { val += value[i]; if (i + 1 < value.Length) { val += ":"; } } paramList.Add(value[0], val.Trim()); } } } if (String.Compare(paramList["version"], "1", true) == 0) { bool find = false; foreach (IEPGStationInfo info in Settings.Instance.IEpgStationList) { if( String.Compare(info.StationName, paramList["station"]) == 0){ if (ChSet5.Instance.ChList.ContainsKey(info.Key) == true) { AddInfo.OriginalNetworkID = ChSet5.Instance.ChList[info.Key].ONID; AddInfo.TransportStreamID = ChSet5.Instance.ChList[info.Key].TSID; AddInfo.ServiceID = ChSet5.Instance.ChList[info.Key].SID; AddInfo.StationName = ChSet5.Instance.ChList[info.Key].ServiceName; AddInfo.EventID = 0xFFFF; find = true; } break; } } if (find == false) { throw new Exception(); } AddInfo.Title = paramList["program-title"]; int yy = Convert.ToInt32(paramList["year"]); int mm = Convert.ToInt32(paramList["month"]); int dd = Convert.ToInt32(paramList["date"]); string[] startTime = paramList["start"].Split(':'); int startHH = Convert.ToInt32(startTime[0]); int startMM = Convert.ToInt32(startTime[1]); string[] endTime = paramList["end"].Split(':'); int endHH = Convert.ToInt32(endTime[0]); int endMM = Convert.ToInt32(endTime[1]); DateTime start = new DateTime(yy, mm, dd, startHH, startMM, 0, DateTimeKind.Utc); DateTime end = new DateTime(yy, mm, dd, endHH, endMM, 0, DateTimeKind.Utc); if (end < start) { end = end.AddDays(1); } AddInfo.StartTime = start; AddInfo.StartTimeEpg = start; AddInfo.DurationSecond = (uint)((end - start).TotalSeconds); RecSettingData recSet = new RecSettingData(); Settings.GetDefRecSetting(0, ref recSet); AddInfo.RecSetting = recSet; AddInfo.RecSetting.TuijyuuFlag = 0; AddInfo.RecSetting.PartialRecFlag = 0; ret = true; } } catch { } if (reader != null) { reader.Close(); } return ret; }
private void MenuItem_Click_ChangeRecMode(object sender, RoutedEventArgs e) { try { List<ReserveData> list = new List<ReserveData>(); foreach (ReserveItem item in listView_reserve.SelectedItems) { ReserveData reserveInfo = item.ReserveInfo; if (item.ReserveInfo.RecSetting.RecMode == 5) { // 無効 => 予約 RecSettingData defSet = new RecSettingData(); Settings.GetDefRecSetting(0, ref defSet); item.ReserveInfo.RecSetting.RecMode = defSet.RecMode; } else { //予約 => 無効 item.ReserveInfo.RecSetting.RecMode = 5; } list.Add(reserveInfo); } if (list.Count > 0) { ErrCode err = (ErrCode)cmd.SendChgReserve(list); if (err == ErrCode.CMD_ERR_CONNECT) { MessageBox.Show("サーバー または EpgTimerSrv に接続できませんでした。"); } if (err == ErrCode.CMD_ERR_TIMEOUT) { MessageBox.Show("EpgTimerSrvとの接続にタイムアウトしました。038"); } if (err != ErrCode.CMD_SUCCESS) { MessageBox.Show("チューナー一覧の取得でエラーが発生しました。"); } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public void SetRecInfoDef(RecSettingData set) { recSettingView.SetDefSetting(set); }
public void AddPreset(String name) { RecSettingData newSet = new RecSettingData(); Settings.GetDefRecSetting(0, ref newSet); RecPresetItem newInfo = new RecPresetItem(); newInfo.DisplayName = name; newInfo.ID = 0; while (presetList.ContainsKey(newInfo.ID) == true) { newInfo.ID++; } presetList.Add(newInfo.ID, newSet); int index = comboBox_preSet.Items.Add(newInfo); SavePreset(); comboBox_preSet.SelectedIndex = index; }
public void SetDefSetting(UInt32 presetID) { Settings.GetDefRecSetting(presetID, ref recSetting); setDefSetting = recSetting; foreach(RecPresetItem info in comboBox_preSet.Items) { if (info.ID == presetID) { comboBox_preSet.SelectedItem = info; break; } } UpdateView(); }