public RecSettingData GetRecSetting() { if (initLoad == false) { return(recSetting.Clone()); } var setInfo = new RecSettingData(); setInfo.RecMode = ((RecModeInfo)comboBox_recMode.SelectedItem).Value; setInfo.Priority = ((PriorityInfo)comboBox_priority.SelectedItem).Value; setInfo.TuijyuuFlag = ((YesNoInfo)comboBox_tuijyu.SelectedItem).Value; setInfo.ServiceMode = (uint)(checkBox_serviceMode.IsChecked == true ? 0 : 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.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); } if (checkBox_suspendDef.IsChecked == true) { setInfo.SuspendMode = 0; } else if (radioButton_standby.IsChecked == true) { setInfo.SuspendMode = 1; } else if (radioButton_suspend.IsChecked == true) { setInfo.SuspendMode = 2; } else if (radioButton_shutdown.IsChecked == true) { setInfo.SuspendMode = 3; } else if (radioButton_non.IsChecked == true) { setInfo.SuspendMode = 4; } setInfo.RebootFlag = (byte)(checkBox_reboot.IsChecked == true ? 1 : 0); setInfo.UseMargineFlag = (byte)(checkBox_margineDef.IsChecked == true ? 0 : 1); Func <string, int> GetMargin = (text) => { if (text.Length == 0) { return(0); } int marginSec = 0; int marginMinus = 1; if (text.IndexOf("-") == 0) { marginMinus = -1; text = text.Substring(1); } string[] startArray = text.Split(':'); startArray = startArray.Take(Math.Min(startArray.Length, 3)).Reverse().ToArray(); for (int i = 0; i < startArray.Length; i++) { marginSec += Convert.ToInt32(startArray[i]) * (int)Math.Pow(60, i); } return(marginMinus * marginSec); }; 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); TunerSelectInfo tuner = comboBox_tuner.SelectedItem as TunerSelectInfo; setInfo.TunerID = tuner.ID; return(setInfo); }
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 (RecFileSetInfoView view in listView_recFolder.Items) { setInfo.RecFolderList.Add(view.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 (RecFileSetInfoView view in listView_recFolder_1seg.Items) { setInfo.PartialRecFolder.Add(view.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 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; 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 = (byte)comboBox_pittari.SelectedIndex; setInfo.BatFilePath = textBox_bat.Text; foreach (RecFileSetInfoView view in listView_recFolder.Items) { (view.PartialRec ? setInfo.PartialRecFolder : setInfo.RecFolderList).Add(view.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.StartsWith("-", StringComparison.Ordinal)) { 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.StartsWith("-", StringComparison.Ordinal)) { 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; } if (checkBox_continueRec.IsChecked == true) { setInfo.ContinueRecFlag = 1; } else { setInfo.ContinueRecFlag = 0; } TunerSelectInfo tuner = comboBox_tuner.SelectedItem as TunerSelectInfo; setInfo.TunerID = tuner.ID; return(setInfo); }