private void button_addTime_Click(object sender, RoutedEventArgs e) { try { if (comboBox_HH.SelectedItem != null && comboBox_MM.SelectedItem != null) { int hh = comboBox_HH.SelectedIndex; int mm = comboBox_MM.SelectedIndex; String time = hh.ToString("D2") + ":" + mm.ToString("D2"); int wday = comboBox_wday.SelectedIndex; if (1 <= wday && wday <= 7) { // 曜日指定接尾辞(w1=Mon,...,w7=Sun) time += "w" + ((wday + 5) % 7 + 1); } if (listView_time.Items.Cast <EpgCaptime>().Any(info => info.Time.Equals(time, StringComparison.OrdinalIgnoreCase) == true) == true) { return; } var item = new EpgCaptime(); item.IsSelected = true; item.Time = time; item.BSBasicOnly = (bool)checkBox_bs.IsChecked; item.CS1BasicOnly = (bool)checkBox_cs1.IsChecked; item.CS2BasicOnly = (bool)checkBox_cs2.IsChecked; item.SPBasicOnly = (bool)checkBox_sp.IsChecked; listView_time.ScrollIntoViewLast(item); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void button_addTime_Click(object sender, RoutedEventArgs e) { try { if (comboBox_HH.SelectedItem != null && comboBox_MM.SelectedItem != null) { UInt16 hh = (UInt16)comboBox_HH.SelectedItem; UInt16 mm = (UInt16)comboBox_MM.SelectedItem; String time = hh.ToString("D2") + ":" + mm.ToString("D2"); foreach (EpgCaptime info in timeList) { if (String.Compare(info.Time, time, true) == 0) { MessageBox.Show("すでに登録済みです"); return; } } EpgCaptime item = new EpgCaptime(); item.IsSelected = true; item.Time = time; timeList.Add(item); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void button_addTime_Click(object sender, RoutedEventArgs e) { try { if (comboBox_HH.SelectedItem != null && comboBox_MM.SelectedItem != null) { UInt16 hh = (UInt16)comboBox_HH.SelectedItem; UInt16 mm = (UInt16)comboBox_MM.SelectedItem; String time = hh.ToString("D2") + ":" + mm.ToString("D2"); foreach (EpgCaptime info in timeList) { if (String.Compare(info.Time, time, true) == 0) { MessageBox.Show("すでに登録済みです"); return; } } EpgCaptime item = new EpgCaptime(); item.IsSelected = true; item.Time = time; long wk = 0; string wkState = ""; wk = cmb_Sunday.SelectedIndex; wkState = wk.ToString(); wk = cmb_Monday.SelectedIndex; wkState += wk.ToString(); wk = cmb_Tuesday.SelectedIndex; wkState += wk.ToString(); wk = cmb_Wednesday.SelectedIndex; wkState += wk.ToString(); wk = cmb_Thursday.SelectedIndex; wkState += wk.ToString(); wk = cmb_Friday.SelectedIndex; wkState += wk.ToString(); wk = cmb_Saturday.SelectedIndex; wkState += wk.ToString(); if (wkState.Equals("0000000")) { MessageBox.Show("全曜日を無効に指定出来ません。"); return; } item.IsBasicOnly = wkState; timeList.Add(item); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void button_delTime_Click(object sender, RoutedEventArgs e) { try { if (ListView_time.SelectedItem != null) { EpgCaptime item = ListView_time.SelectedItem as EpgCaptime; timeList.Remove(item); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void button_addTime_Click(object sender, RoutedEventArgs e) { try { if (comboBox_HH.SelectedItem != null && comboBox_MM.SelectedItem != null) { UInt16 hh = (UInt16)comboBox_HH.SelectedItem; UInt16 mm = (UInt16)comboBox_MM.SelectedItem; String time = hh.ToString("D2") + ":" + mm.ToString("D2"); int wday = comboBox_wday.SelectedIndex; if (1 <= wday && wday <= 7) { // 曜日指定接尾辞(w1=Mon,...,w7=Sun) time += "w" + ((wday + 5) % 7 + 1); } foreach (EpgCaptime info in timeList) { if (String.Compare(info.Time, time, true) == 0) { MessageBox.Show("すでに登録済みです"); return; } } EpgCaptime item = new EpgCaptime(); item.IsSelected = true; item.Time = time; item.BSBasicOnly = checkBox_bs.IsChecked == true; item.CS1BasicOnly = checkBox_cs1.IsChecked == true; item.CS2BasicOnly = checkBox_cs2.IsChecked == true; item.CS3BasicOnly = checkBox_cs3.IsChecked == true; timeList.Add(item); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public SetBasicView() { InitializeComponent(); try { if (Settings.Instance.NoStyle == 1) { button_setPath.Style = null; button_exe.Style = null; button_rec_up.Style = null; button_rec_down.Style = null; button_rec_del.Style = null; button_rec_open.Style = null; button_rec_add.Style = null; button_shortCut.Style = null; button_bon_up.Style = null; button_bon_down.Style = null; button_allChk.Style = null; button_videoChk.Style = null; button_allClear.Style = null; button_addTime.Style = null; button_delTime.Style = null; } StringBuilder buff = new StringBuilder(512); buff.Clear(); IniFileHandler.GetPrivateProfileString("SET", "DataSavePath", SettingPath.DefSettingFolderPath, buff, 512, SettingPath.CommonIniPath); textBox_setPath.Text = buff.ToString(); string defRecExe = System.IO.Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]) + "\\EpgDataCap_Bon.exe"; buff.Clear(); IniFileHandler.GetPrivateProfileString("SET", "RecExePath", defRecExe, buff, 512, SettingPath.CommonIniPath); textBox_exe.Text = buff.ToString(); int num = IniFileHandler.GetPrivateProfileInt("SET", "RecFolderNum", 0, SettingPath.CommonIniPath); if (num == 0) { listBox_recFolder.Items.Add(SettingPath.DefSettingFolderPath); } else { for (uint i = 0; i < num; i++) { string key = "RecFolderPath" + i.ToString(); buff.Clear(); IniFileHandler.GetPrivateProfileString("SET", key, "", buff, 512, SettingPath.CommonIniPath); if (buff.Length > 0) { listBox_recFolder.Items.Add(buff.ToString()); } } } string[] files = Directory.GetFiles(SettingPath.SettingFolderPath, "*.ChSet4.txt"); SortedList <Int32, TunerInfo> tunerInfo = new SortedList <Int32, TunerInfo>(); foreach (string info in files) { try { TunerInfo item = new TunerInfo(); String fileName = System.IO.Path.GetFileName(info); item.BonDriver = GetBonFileName(fileName); item.BonDriver += ".dll"; item.TunerNum = IniFileHandler.GetPrivateProfileInt(item.BonDriver, "Count", 0, SettingPath.TimerSrvIniPath).ToString(); if (IniFileHandler.GetPrivateProfileInt(item.BonDriver, "GetEpg", 1, SettingPath.TimerSrvIniPath) == 0) { item.IsEpgCap = false; } else { item.IsEpgCap = true; } int priority = IniFileHandler.GetPrivateProfileInt(item.BonDriver, "Priority", 0xFFFF, SettingPath.TimerSrvIniPath); while (true) { if (tunerInfo.ContainsKey(priority) == true) { priority++; } else { tunerInfo.Add(priority, item); break; } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } } foreach (TunerInfo info in tunerInfo.Values) { listBox_bon.Items.Add(info); } if (listBox_bon.Items.Count > 0) { listBox_bon.SelectedIndex = 0; } comboBox_HH.DataContext = CommonManager.Instance.HourDictionary.Values; comboBox_HH.SelectedIndex = 0; comboBox_MM.DataContext = CommonManager.Instance.MinDictionary.Values; comboBox_MM.SelectedIndex = 0; serviceList = new List <ServiceItem2>(); try { foreach (ChSet5Item info in ChSet5.Instance.ChList.Values) { ServiceItem2 item = new ServiceItem2(); item.ServiceInfo = info; if (info.EpgCapFlag == 1) { item.IsSelected = true; } else { item.IsSelected = false; } serviceList.Add(item); } } catch { } listView_service.DataContext = serviceList; if (IniFileHandler.GetPrivateProfileInt("SET", "BSBasicOnly", 1, SettingPath.CommonIniPath) == 1) { checkBox_bs.IsChecked = true; } else { checkBox_bs.IsChecked = false; } if (IniFileHandler.GetPrivateProfileInt("SET", "CS1BasicOnly", 1, SettingPath.CommonIniPath) == 1) { checkBox_cs1.IsChecked = true; } else { checkBox_cs1.IsChecked = false; } if (IniFileHandler.GetPrivateProfileInt("SET", "CS2BasicOnly", 1, SettingPath.CommonIniPath) == 1) { checkBox_cs2.IsChecked = true; } else { checkBox_cs2.IsChecked = false; } buff.Clear(); timeList = new ObservableCollection <EpgCaptime>(); int capCount = IniFileHandler.GetPrivateProfileInt("EPG_CAP", "Count", 0, SettingPath.TimerSrvIniPath); if (capCount == 0) { EpgCaptime item = new EpgCaptime(); item.IsSelected = true; item.Time = "23:00"; timeList.Add(item); } else { for (int i = 0; i < capCount; i++) { buff.Clear(); EpgCaptime item = new EpgCaptime(); IniFileHandler.GetPrivateProfileString("EPG_CAP", i.ToString(), "", buff, 512, SettingPath.TimerSrvIniPath); item.Time = buff.ToString(); if (IniFileHandler.GetPrivateProfileInt("EPG_CAP", i.ToString() + "Select", 0, SettingPath.TimerSrvIniPath) == 1) { item.IsSelected = true; } else { item.IsSelected = false; } timeList.Add(item); } } ListView_time.DataContext = timeList; textBox_ngCapMin.Text = IniFileHandler.GetPrivateProfileInt("SET", "NGEpgCapTime", 20, SettingPath.TimerSrvIniPath).ToString(); textBox_ngTunerMin.Text = IniFileHandler.GetPrivateProfileInt("SET", "NGEpgCapTunerTime", 20, SettingPath.TimerSrvIniPath).ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public void SaveSetting() { try { System.IO.Directory.CreateDirectory(textBox_setPath.Text); IniFileHandler.WritePrivateProfileString("SET", "DataSavePath", textBox_setPath.Text, SettingPath.CommonIniPath); IniFileHandler.WritePrivateProfileString("SET", "RecExePath", textBox_exe.Text, SettingPath.CommonIniPath); IniFileHandler.WritePrivateProfileString("SET", "RecFolderNum", listBox_recFolder.Items.Count.ToString(), SettingPath.CommonIniPath); for (int i = 0; i < listBox_recFolder.Items.Count; i++) { string key = "RecFolderPath" + i.ToString(); string val = listBox_recFolder.Items[i] as string; IniFileHandler.WritePrivateProfileString("SET", key, val, SettingPath.CommonIniPath); } for (int i = 0; i < listBox_bon.Items.Count; i++) { TunerInfo info = listBox_bon.Items[i] as TunerInfo; IniFileHandler.WritePrivateProfileString(info.BonDriver, "Count", info.TunerNum, SettingPath.TimerSrvIniPath); if (info.IsEpgCap == true) { IniFileHandler.WritePrivateProfileString(info.BonDriver, "GetEpg", "1", SettingPath.TimerSrvIniPath); } else { IniFileHandler.WritePrivateProfileString(info.BonDriver, "GetEpg", "0", SettingPath.TimerSrvIniPath); } IniFileHandler.WritePrivateProfileString(info.BonDriver, "Priority", i.ToString(), SettingPath.TimerSrvIniPath); } if (checkBox_bs.IsChecked == true) { IniFileHandler.WritePrivateProfileString("SET", "BSBasicOnly", "1", SettingPath.CommonIniPath); } else { IniFileHandler.WritePrivateProfileString("SET", "BSBasicOnly", "0", SettingPath.CommonIniPath); } if (checkBox_cs1.IsChecked == true) { IniFileHandler.WritePrivateProfileString("SET", "CS1BasicOnly", "1", SettingPath.CommonIniPath); } else { IniFileHandler.WritePrivateProfileString("SET", "CS1BasicOnly", "0", SettingPath.CommonIniPath); } if (checkBox_cs2.IsChecked == true) { IniFileHandler.WritePrivateProfileString("SET", "CS2BasicOnly", "1", SettingPath.CommonIniPath); } else { IniFileHandler.WritePrivateProfileString("SET", "CS2BasicOnly", "0", SettingPath.CommonIniPath); } foreach (ServiceItem2 info in serviceList) { UInt64 key = ((UInt64)info.ServiceInfo.ONID) << 32 | ((UInt64)info.ServiceInfo.TSID) << 16 | ((UInt64)info.ServiceInfo.SID); try { if (info.IsSelected == true) { ChSet5.Instance.ChList[key].EpgCapFlag = 1; } else { ChSet5.Instance.ChList[key].EpgCapFlag = 0; } } catch { } } IniFileHandler.WritePrivateProfileString("EPG_CAP", "Count", timeList.Count.ToString(), SettingPath.TimerSrvIniPath); for (int i = 0; i < timeList.Count; i++) { EpgCaptime item = timeList[i] as EpgCaptime; IniFileHandler.WritePrivateProfileString("EPG_CAP", i.ToString(), item.Time, SettingPath.TimerSrvIniPath); if (item.IsSelected == true) { IniFileHandler.WritePrivateProfileString("EPG_CAP", i.ToString() + "Select", "1", SettingPath.TimerSrvIniPath); } else { IniFileHandler.WritePrivateProfileString("EPG_CAP", i.ToString() + "Select", "0", SettingPath.TimerSrvIniPath); } } IniFileHandler.WritePrivateProfileString("SET", "NGEpgCapTime", textBox_ngCapMin.Text, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString("SET", "NGEpgCapTunerTime", textBox_ngTunerMin.Text, SettingPath.TimerSrvIniPath); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public void LoadSetting() { textBox_setPath.Text = SettingPath.SettingFolderPath; textBox_exe.Text = SettingPath.EdcbExePath; textBox_cmdBon.Text = IniFileHandler.GetPrivateProfileString("APP_CMD_OPT", "Bon", "-d", SettingPath.ViewAppIniPath); textBox_cmdMin.Text = IniFileHandler.GetPrivateProfileString("APP_CMD_OPT", "Min", "-min", SettingPath.ViewAppIniPath); textBox_cmdViewOff.Text = IniFileHandler.GetPrivateProfileString("APP_CMD_OPT", "ViewOff", "-noview", SettingPath.ViewAppIniPath); listBox_recFolder.Items.Clear(); listBox_recFolder.Items.AddItems(settings.DefRecFolders); textBox_recInfoFolder.Text = IniFileHandler.GetPrivateProfileFolder("SET", "RecInfoFolder", SettingPath.CommonIniPath); listBox_bon.Items.Clear(); listBox_bon.Items.AddItems(CommonManager.GetBonFileList().Select(fileName => { var item = new TunerInfo(fileName); item.TunerNum = IniFileHandler.GetPrivateProfileInt(item.BonDriver, "Count", 0, SettingPath.TimerSrvIniPath).ToString(); bool isEpgCap = IniFileHandler.GetPrivateProfileBool(item.BonDriver, "GetEpg", true, SettingPath.TimerSrvIniPath); int epgNum = IniFileHandler.GetPrivateProfileInt(item.BonDriver, "EPGCount", 0, SettingPath.TimerSrvIniPath); item.EPGNum = (isEpgCap == true && epgNum == 0) ? "すべて" : epgNum.ToString(); item.Priority = IniFileHandler.GetPrivateProfileInt(item.BonDriver, "Priority", 0xFFFF, SettingPath.TimerSrvIniPath); return(item); }).OrderBy(item => item.Priority)); listBox_bon.SelectedIndex = 0; listView_service.ItemsSource = ChSet5.ChListSorted.Select(info => new ServiceViewItem(info) { IsSelected = info.EpgCapFlag }); checkBox_bs.IsChecked = IniFileHandler.GetPrivateProfileBool("SET", "BSBasicOnly", true, SettingPath.CommonIniPath); checkBox_cs1.IsChecked = IniFileHandler.GetPrivateProfileBool("SET", "CS1BasicOnly", true, SettingPath.CommonIniPath); checkBox_cs2.IsChecked = IniFileHandler.GetPrivateProfileBool("SET", "CS2BasicOnly", true, SettingPath.CommonIniPath); checkBox_sp.IsChecked = IniFileHandler.GetPrivateProfileBool("SET", "CS3BasicOnly", false, SettingPath.CommonIniPath); textBox_EpgCapTimeOut.Text = IniFileHandler.GetPrivateProfileInt("EPGCAP", "EpgCapTimeOut", 10, SettingPath.BonCtrlIniPath).ToString(); checkBox_EpgCapSaveTimeOut.IsChecked = IniFileHandler.GetPrivateProfileBool("EPGCAP", "EpgCapSaveTimeOut", false, SettingPath.BonCtrlIniPath); checkBox_timeSync.IsChecked = IniFileHandler.GetPrivateProfileBool("SET", "TimeSync", false, SettingPath.TimerSrvIniPath); listView_time.Items.Clear(); int capCount = IniFileHandler.GetPrivateProfileInt("EPG_CAP", "Count", int.MaxValue, SettingPath.TimerSrvIniPath); if (capCount == int.MaxValue) { var item = new EpgCaptime(); item.IsSelected = true; item.Time = "23:00"; item.BSBasicOnly = (bool)checkBox_bs.IsChecked; item.CS1BasicOnly = (bool)checkBox_cs1.IsChecked; item.CS2BasicOnly = (bool)checkBox_cs2.IsChecked; item.SPBasicOnly = (bool)checkBox_sp.IsChecked; listView_time.Items.Add(item); } else { for (int i = 0; i < capCount; i++) { var item = new EpgCaptime(); item.Time = IniFileHandler.GetPrivateProfileString("EPG_CAP", i.ToString(), "", SettingPath.TimerSrvIniPath); item.IsSelected = IniFileHandler.GetPrivateProfileBool("EPG_CAP", i.ToString() + "Select", false, SettingPath.TimerSrvIniPath); // 取得種別(bit0(LSB)=BS,bit1=CS1,bit2=CS2,bit3=スカパー)。負値のときは共通設定に従う int flags = IniFileHandler.GetPrivateProfileInt("EPG_CAP", i.ToString() + "BasicOnlyFlags", -1, SettingPath.TimerSrvIniPath); item.BSBasicOnly = flags >= 0 ? (flags & 1) != 0 : (bool)checkBox_bs.IsChecked; item.CS1BasicOnly = flags >= 0 ? (flags & 2) != 0 : (bool)checkBox_cs1.IsChecked; item.CS2BasicOnly = flags >= 0 ? (flags & 4) != 0 : (bool)checkBox_cs2.IsChecked; item.SPBasicOnly = flags >= 0 ? (flags & 8) != 0 : (bool)checkBox_sp.IsChecked; listView_time.Items.Add(item); } } textBox_ngCapMin.Text = IniFileHandler.GetPrivateProfileInt("SET", "NGEpgCapTime", 20, SettingPath.TimerSrvIniPath).ToString(); textBox_ngTunerMin.Text = IniFileHandler.GetPrivateProfileInt("SET", "NGEpgCapTunerTime", 20, SettingPath.TimerSrvIniPath).ToString(); // ネットワーク checkBox_tcpServer.IsChecked = IniFileHandler.GetPrivateProfileBool("SET", "EnableTCPSrv", false, SettingPath.TimerSrvIniPath); checkBox_tcpIPv6.IsChecked = IniFileHandler.GetPrivateProfileBool("SET", "TCPIPv6", false, SettingPath.TimerSrvIniPath); textBox_tcpPort.Text = IniFileHandler.GetPrivateProfileInt("SET", "TCPPort", 4510, SettingPath.TimerSrvIniPath).ToString(); textBox_tcpAcl.Text = IniFileHandler.GetPrivateProfileString("SET", "TCPAccessControlList", "+127.0.0.1,+192.168.0.0/16", SettingPath.TimerSrvIniPath); textBox_tcpResTo.Text = IniFileHandler.GetPrivateProfileInt("SET", "TCPResponseTimeoutSec", 120, SettingPath.TimerSrvIniPath).ToString(); int enableHttpSrv = IniFileHandler.GetPrivateProfileInt("SET", "EnableHttpSrv", 0, SettingPath.TimerSrvIniPath); checkBox_httpServer.IsChecked = enableHttpSrv != 0; checkBox_httpLog.IsChecked = enableHttpSrv == 2; textBox_httpPort.Text = IniFileHandler.GetPrivateProfileString("SET", "HttpPort", "5510", SettingPath.TimerSrvIniPath); textBox_httpAcl.Text = IniFileHandler.GetPrivateProfileString("SET", "HttpAccessControlList", "+127.0.0.1,+::1,+::ffff:127.0.0.1", SettingPath.TimerSrvIniPath); textBox_httpTimeout.Text = IniFileHandler.GetPrivateProfileInt("SET", "HttpRequestTimeoutSec", 120, SettingPath.TimerSrvIniPath).ToString(); textBox_httpThreads.Text = IniFileHandler.GetPrivateProfileInt("SET", "HttpNumThreads", 5, SettingPath.TimerSrvIniPath).ToString(); textBox_docrootPath.Text = IniFileHandler.GetPrivateProfileString("SET", "HttpPublicFolder", SettingPath.DefHttpPublicPath, SettingPath.TimerSrvIniPath); checkBox_dlnaServer.IsChecked = IniFileHandler.GetPrivateProfileBool("SET", "EnableDMS", false, SettingPath.TimerSrvIniPath); }
public void SaveSetting() { try { // tabItem1 if (textBox_setPath.IsEnabled) { string setPath = textBox_setPath.Text.Trim(); setPath = setPath == "" ? SettingPath.DefSettingFolderPath : setPath; System.IO.Directory.CreateDirectory(setPath); IsChangeSettingPath = SettingPath.SettingFolderPath.TrimEnd('\\') != setPath.TrimEnd('\\'); SettingPath.SettingFolderPath = setPath; } if (textBox_recInfoFolder.IsEnabled) { IniFileHandler.WritePrivateProfileString("SET", "RecInfoFolder", textBox_recInfoFolder.Text.Trim() == "" ? null : textBox_recInfoFolder.Text, SettingPath.CommonIniPath); } if (textBox_exe.IsEnabled) { IniFileHandler.WritePrivateProfileString("SET", "RecExePath", textBox_exe.Text, SettingPath.CommonIniPath); } string viewAppIniPath = SettingPath.ModulePath.TrimEnd('\\') + "\\ViewApp.ini"; if (textBox_cmdBon.IsEnabled) { if (IniFileHandler.GetPrivateProfileString("APP_CMD_OPT", "Bon", "-d", viewAppIniPath) != textBox_cmdBon.Text) { IniFileHandler.WritePrivateProfileString("APP_CMD_OPT", "Bon", textBox_cmdBon.Text, viewAppIniPath); } } if (textBox_cmdMin.IsEnabled) { if (IniFileHandler.GetPrivateProfileString("APP_CMD_OPT", "Min", "-min", viewAppIniPath) != textBox_cmdMin.Text) { IniFileHandler.WritePrivateProfileString("APP_CMD_OPT", "Min", textBox_cmdMin.Text, viewAppIniPath); } } if (textBox_cmdViewOff.IsEnabled) { if (IniFileHandler.GetPrivateProfileString("APP_CMD_OPT", "ViewOff", "-noview", viewAppIniPath) != textBox_cmdViewOff.Text) { IniFileHandler.WritePrivateProfileString("APP_CMD_OPT", "ViewOff", textBox_cmdViewOff.Text, viewAppIniPath); } } if (listBox_recFolder.IsEnabled) { int recFolderCount = listBox_recFolder.Items.Count; IniFileHandler.WritePrivateProfileString("SET", "RecFolderNum", recFolderCount.ToString(), SettingPath.CommonIniPath); for (int i = 0; i < recFolderCount; i++) { string key = "RecFolderPath" + i.ToString(); string val = listBox_recFolder.Items[i].ToString(); IniFileHandler.WritePrivateProfileString("SET", key, val, SettingPath.CommonIniPath); } } // tabItem2 if (listBox_bon.IsEnabled) { for (int i = 0; i < listBox_bon.Items.Count; i++) { TunerInfo info = listBox_bon.Items[i] as TunerInfo; IniFileHandler.WritePrivateProfileString(info.BonDriver, "Count", info.TunerNum, SettingPath.TimerSrvIniPath); if (info.IsEpgCap == true) { IniFileHandler.WritePrivateProfileString(info.BonDriver, "GetEpg", "1", SettingPath.TimerSrvIniPath); } else { IniFileHandler.WritePrivateProfileString(info.BonDriver, "GetEpg", "0", SettingPath.TimerSrvIniPath); } IniFileHandler.WritePrivateProfileString(info.BonDriver, "EPGCount", info.EPGNum, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(info.BonDriver, "Priority", i.ToString(), SettingPath.TimerSrvIniPath); } } // tabItem3 if (checkBox_bs.IsEnabled) { if (checkBox_bs.IsChecked == true) { IniFileHandler.WritePrivateProfileString("SET", "BSBasicOnly", "1", SettingPath.CommonIniPath); } else { IniFileHandler.WritePrivateProfileString("SET", "BSBasicOnly", "0", SettingPath.CommonIniPath); } } if (checkBox_cs1.IsEnabled) { if (checkBox_cs1.IsChecked == true) { IniFileHandler.WritePrivateProfileString("SET", "CS1BasicOnly", "1", SettingPath.CommonIniPath); } else { IniFileHandler.WritePrivateProfileString("SET", "CS1BasicOnly", "0", SettingPath.CommonIniPath); } } if (checkBox_cs2.IsEnabled) { if (checkBox_cs2.IsChecked == true) { IniFileHandler.WritePrivateProfileString("SET", "CS2BasicOnly", "1", SettingPath.CommonIniPath); } else { IniFileHandler.WritePrivateProfileString("SET", "CS2BasicOnly", "0", SettingPath.CommonIniPath); } } if (checkBox_cs3.IsEnabled) { if (checkBox_cs3.IsChecked == true) { IniFileHandler.WritePrivateProfileString("SET", "CS3BasicOnly", "1", SettingPath.CommonIniPath); } else { IniFileHandler.WritePrivateProfileString("SET", "CS3BasicOnly", "0", SettingPath.CommonIniPath); } } foreach (ServiceViewItem info in serviceList) { UInt64 key = info.ServiceInfo.Key; try { if (info.IsSelected == true) { ChSet5.ChList[key].EpgCapFlag = 1; } else { ChSet5.ChList[key].EpgCapFlag = 0; } } catch { } } if (ListView_time.IsEnabled) { IniFileHandler.WritePrivateProfileString("EPG_CAP", "Count", timeList.Count.ToString(), SettingPath.TimerSrvIniPath); for (int i = 0; i < timeList.Count; i++) { EpgCaptime item = timeList[i] as EpgCaptime; IniFileHandler.WritePrivateProfileString("EPG_CAP", i.ToString(), item.Time, SettingPath.TimerSrvIniPath); if (item.IsSelected == true) { IniFileHandler.WritePrivateProfileString("EPG_CAP", i.ToString() + "Select", "1", SettingPath.TimerSrvIniPath); } else { IniFileHandler.WritePrivateProfileString("EPG_CAP", i.ToString() + "Select", "0", SettingPath.TimerSrvIniPath); } int flags = (item.BSBasicOnly ? 1 : 0) | (item.CS1BasicOnly ? 2 : 0) | (item.CS2BasicOnly ? 4 : 0) | (item.CS3BasicOnly ? 8 : 0); IniFileHandler.WritePrivateProfileString("EPG_CAP", i.ToString() + "BasicOnlyFlags", flags.ToString(), SettingPath.TimerSrvIniPath); } } if (textBox_ngCapMin.IsEnabled) { IniFileHandler.WritePrivateProfileString("SET", "NGEpgCapTime", textBox_ngCapMin.Text, SettingPath.TimerSrvIniPath); } if (textBox_ngTunerMin.IsEnabled) { IniFileHandler.WritePrivateProfileString("SET", "NGEpgCapTunerTime", textBox_ngTunerMin.Text, SettingPath.TimerSrvIniPath); } // tabItem4 SaveSetting_tabItem4(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public SetBasicView() { InitializeComponent(); IsChangeSettingPath = false; listBox_Button_Set(); try { // tabItem1 - 保存フォルダ // 保存できない項目は IsEnabled = false にする if (CommonManager.Instance.NWMode == true) { group_setPath.IsEnabled = false; // 設定関係保存フォルダ group_exePath.IsEnabled = false; // 録画用アプリのexe group_recInfoFolder.IsEnabled = false; // 録画情報保存フォルダ label4.IsEnabled = false; //※ 録画中やEPG取得中に設定を変更すると正常動作しなくなる可能性があります。 button_shortCutSrv.IsEnabled = false; } group_recFolder.IsEnabled = IniFileHandler.CanUpdateInifile; // 録画保存フォルダ // 読める設定のみ項目に反映させる if (IniFileHandler.CanReadInifile) { textBox_setPath.Text = SettingPath.SettingFolderPath; textBox_exe.Text = SettingPath.EdcbExePath; textBox_recInfoFolder.Text = IniFileHandler.GetPrivateProfileString("SET", "RecInfoFolder", "", SettingPath.CommonIniPath); Settings.Instance.DefRecFolders.ForEach(folder => listBox_recFolder.Items.Add(new UserCtrlView.BGBarListBoxItem(folder))); } if (CommonManager.Instance.NWMode == false) { string viewAppIniPath = SettingPath.ModulePath.TrimEnd('\\') + "\\ViewApp.ini"; textBox_cmdBon.Text = IniFileHandler.GetPrivateProfileString("APP_CMD_OPT", "Bon", "-d", viewAppIniPath); textBox_cmdMin.Text = IniFileHandler.GetPrivateProfileString("APP_CMD_OPT", "Min", "-min", viewAppIniPath); textBox_cmdViewOff.Text = IniFileHandler.GetPrivateProfileString("APP_CMD_OPT", "ViewOff", "-noview", viewAppIniPath); } // tabItem2 - チューナー // 保存できない項目は IsEnabled = false にする if (IniFileHandler.CanUpdateInifile == false) { ViewUtil.DisableControlChildren(tabItem2); grid_tuner.IsEnabled = true; ViewUtil.ChangeChildren(grid_tuner, false); } listBox_bon.IsEnabled = IniFileHandler.CanUpdateInifile; // 読める設定のみ項目に反映させる if (IniFileHandler.CanReadInifile) { SortedList <Int32, TunerInfo> tunerInfo = new SortedList <Int32, TunerInfo>(); foreach (string fileName in CommonManager.Instance.GetBonFileList()) { try { TunerInfo item = new TunerInfo(fileName); item.TunerNum = IniFileHandler.GetPrivateProfileInt(item.BonDriver, "Count", 0, SettingPath.TimerSrvIniPath).ToString(); item.IsEpgCap = (IniFileHandler.GetPrivateProfileInt(item.BonDriver, "GetEpg", 1, SettingPath.TimerSrvIniPath) != 0); item.EPGNum = IniFileHandler.GetPrivateProfileInt(item.BonDriver, "EPGCount", 0, SettingPath.TimerSrvIniPath).ToString(); int priority = IniFileHandler.GetPrivateProfileInt(item.BonDriver, "Priority", 0xFFFF, SettingPath.TimerSrvIniPath); while (true) { if (tunerInfo.ContainsKey(priority) == true) { priority++; } else { tunerInfo.Add(priority, item); break; } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } } foreach (TunerInfo info in tunerInfo.Values) { listBox_bon.Items.Add(info); } if (listBox_bon.Items.Count > 0) { listBox_bon.SelectedIndex = 0; } } button_shortCut.Content = SettingPath.ModuleName + ".exe" + (File.Exists( System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), SettingPath.ModuleName + ".lnk")) ? "を解除" : ""); button_shortCutSrv.Content = (string)button_shortCutSrv.Content + (File.Exists( System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "EpgTimerSrv.lnk")) ? "を解除" : ""); // tabItem3 - EPG取得 // 保存できない項目は IsEnabled = false にする if (IniFileHandler.CanUpdateInifile == false) { ViewUtil.DisableControlChildren(tabItem3); } listView_service.IsEnabled = IniFileHandler.CanUpdateInifile; // 読める設定のみ項目に反映させる serviceList = new List <ServiceViewItem>(); if (IniFileHandler.CanReadInifile) { comboBox_HH.DataContext = CommonManager.Instance.HourDictionary.Values; comboBox_HH.SelectedIndex = 0; comboBox_MM.DataContext = CommonManager.Instance.MinDictionary.Values; comboBox_MM.SelectedIndex = 0; try { foreach (ChSet5Item info in ChSet5.ChList.Values) { ServiceViewItem item = new ServiceViewItem(info); if (info.EpgCapFlag == 1) { item.IsSelected = true; } else { item.IsSelected = false; } serviceList.Add(item); } } catch { } listView_service.DataContext = serviceList; if (IniFileHandler.GetPrivateProfileInt("SET", "BSBasicOnly", 1, SettingPath.CommonIniPath) == 1) { checkBox_bs.IsChecked = true; } else { checkBox_bs.IsChecked = false; } if (IniFileHandler.GetPrivateProfileInt("SET", "CS1BasicOnly", 1, SettingPath.CommonIniPath) == 1) { checkBox_cs1.IsChecked = true; } else { checkBox_cs1.IsChecked = false; } if (IniFileHandler.GetPrivateProfileInt("SET", "CS2BasicOnly", 1, SettingPath.CommonIniPath) == 1) { checkBox_cs2.IsChecked = true; } else { checkBox_cs2.IsChecked = false; } if (IniFileHandler.GetPrivateProfileInt("SET", "CS3BasicOnly", 0, SettingPath.CommonIniPath) == 1) { checkBox_cs3.IsChecked = true; } else { checkBox_cs3.IsChecked = false; } int capCount = IniFileHandler.GetPrivateProfileInt("EPG_CAP", "Count", 0, SettingPath.TimerSrvIniPath); if (capCount == 0) { EpgCaptime item = new EpgCaptime(); item.IsSelected = true; item.Time = "23:00"; item.BSBasicOnly = checkBox_bs.IsChecked == true; item.CS1BasicOnly = checkBox_cs1.IsChecked == true; item.CS2BasicOnly = checkBox_cs2.IsChecked == true; item.CS3BasicOnly = checkBox_cs3.IsChecked == true; timeList.Add(item); } else { for (int i = 0; i < capCount; i++) { EpgCaptime item = new EpgCaptime(); item.Time = IniFileHandler.GetPrivateProfileString("EPG_CAP", i.ToString(), "", SettingPath.TimerSrvIniPath); if (IniFileHandler.GetPrivateProfileInt("EPG_CAP", i.ToString() + "Select", 0, SettingPath.TimerSrvIniPath) == 1) { item.IsSelected = true; } else { item.IsSelected = false; } // 取得種別(bit0(LSB)=BS,bit1=CS1,bit2=CS2,bit3=CS3)。負値のときは共通設定に従う int flags = IniFileHandler.GetPrivateProfileInt("EPG_CAP", i.ToString() + "BasicOnlyFlags", -1, SettingPath.TimerSrvIniPath); if (flags >= 0) { item.BSBasicOnly = (flags & 1) != 0; item.CS1BasicOnly = (flags & 2) != 0; item.CS2BasicOnly = (flags & 4) != 0; item.CS3BasicOnly = (flags & 8) != 0; } else { item.BSBasicOnly = checkBox_bs.IsChecked == true; item.CS1BasicOnly = checkBox_cs1.IsChecked == true; item.CS2BasicOnly = checkBox_cs2.IsChecked == true; item.CS3BasicOnly = checkBox_cs3.IsChecked == true; } timeList.Add(item); } } ListView_time.DataContext = timeList; textBox_ngCapMin.Text = IniFileHandler.GetPrivateProfileInt("SET", "NGEpgCapTime", 20, SettingPath.TimerSrvIniPath).ToString(); textBox_ngTunerMin.Text = IniFileHandler.GetPrivateProfileInt("SET", "NGEpgCapTunerTime", 20, SettingPath.TimerSrvIniPath).ToString(); } SetBasicView_tabItem4(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }