public static bool mcs_DeleteCheckDelFile(IEnumerable <RecFileInfo> list) { if (Settings.Instance.ConfirmDelRecInfoFileDelete && list.Any(info => info.RecFilePath.Length > 0) && IniFileHandler.GetPrivateProfileInt("SET", "RecInfoDelFile", 0, SettingPath.CommonIniPath) == 1) { return(MessageBox.Show("録画ファイルが存在する場合は一緒に削除されます。\r\nよろしいですか?", "ファイル削除", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK); } return(true); }
private void SaveSetting_tabItem2() { string setValue; if (checkBox_back_priority.IsEnabled) { setValue = (checkBox_back_priority.IsChecked == true ? "1" : "0"); IniFileHandler.WritePrivateProfileString("SET", "BackPriority", setValue, SettingPath.TimerSrvIniPath); } if (checkBox_autoDel.IsEnabled) { setValue = (checkBox_autoDel.IsChecked == true ? "1" : "0"); IniFileHandler.WritePrivateProfileString("SET", "AutoDel", setValue, SettingPath.TimerSrvIniPath); } if (checkBox_recname.IsEnabled) { setValue = (checkBox_recname.IsChecked == true ? "1" : "0"); IniFileHandler.WritePrivateProfileString("SET", "RecNamePlugIn", setValue, SettingPath.TimerSrvIniPath); } if (comboBox_recname.IsEnabled) { setValue = (comboBox_recname.SelectedItem != null ? (string)comboBox_recname.SelectedItem : ""); IniFileHandler.WritePrivateProfileString("SET", "RecNamePlugInFile", setValue, SettingPath.TimerSrvIniPath); } if (checkBox_noChkYen.IsEnabled) { IniFileHandler.WritePrivateProfileString("SET", "NoChkYen", checkBox_noChkYen.IsChecked == true ? "1" : "0", SettingPath.TimerSrvIniPath); } if (IniFileHandler.CanUpdateInifile) { // button_autoDel IniFileHandler.WritePrivateProfileString("DEL_EXT", "Count", extList.Count.ToString(), SettingPath.TimerSrvIniPath); for (int i = 0; i < extList.Count; i++) { IniFileHandler.WritePrivateProfileString("DEL_EXT", i.ToString(), extList[i], SettingPath.TimerSrvIniPath); } IniFileHandler.WritePrivateProfileString("DEL_CHK", "Count", delChkFolderList.Count.ToString(), SettingPath.TimerSrvIniPath); for (int i = 0; i < delChkFolderList.Count; i++) { IniFileHandler.WritePrivateProfileString("DEL_CHK", i.ToString(), delChkFolderList[i], SettingPath.TimerSrvIniPath); } } Settings.Instance.CautionOnRecChange = (checkBox_cautionOnRecChange.IsChecked != false); Settings.Instance.CautionOnRecMarginMin = MenuUtil.MyToNumerical(textBox_cautionOnRecMarginMin, Convert.ToInt32, Settings.Instance.CautionOnRecMarginMin); Settings.Instance.SyncResAutoAddChange = (checkBox_SyncResAutoAddChange.IsChecked != false); Settings.Instance.SyncResAutoAddDelete = (checkBox_SyncResAutoAddDelete.IsChecked != false); Settings.Instance.SyncResAutoAddChgNewRes = (checkBox_SyncResAutoAddChgNewRes.IsChecked != false); }
/// <summary> /// INIファイルから読み込む /// </summary> /// <param name="iSection">セクション</param> /// <param name="iKey">キー</param> /// <param name="iDefault">デフォルト文字列</param> /// <returns>INIファイルから読み込んだ値を返す</returns> public string GetIniValue(string iSection, string iKey, string iDefault) { StringBuilder sb = new StringBuilder(BufferLength); IniFileHandler.GetPrivateProfileString(iSection, iKey, iDefault, sb, (uint)sb.Capacity, FileName); if (sb.Equals(null)) { return(null); } return(sb.ToString());; }
//アカウント削除 private void accountdelete_Click(object sender, EventArgs e) { DialogResult c = MessageBox.Show("本当に削除してもよろしいですか?", "確認", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2); if (c == DialogResult.Yes) { IniFileHandler.WritePrivateProfileString(((ToolStripMenuItem)sender).Text, null, null, "./data/token.ini"); DialogResult result = MessageBox.Show("削除されました(X3)", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2); Application.Restart(); } }
void ThreadFunction() { try { long TimeOut = (long)IniFileHandler.GetPrivateProfileInt("SET", "Baloon", 0, SettingPath.TimerSrvIniPath); if (TimeOut == 0) { return; } while (_sw.IsRunning) { // 10秒以上経っていたら if (_sw.ElapsedMilliseconds > TimeOut * 1000) { EnumWindows(new EnumWindowsDelegate(delegate(IntPtr hWnd, int lParam) { StringBuilder sb = new StringBuilder(0x1024); if (IsWindowVisible(hWnd) != 0) { //GetWindowText(hWnd, sb, sb.Capacity); //string title = sb.ToString(); //int pid; //GetWindowThreadProcessId(hWnd, out pid); //Process p = Process.GetProcessById(pid); sb = new StringBuilder(0x1024); SendMessage(hWnd, WM_GETTEXT, sb.Capacity, sb); string title2 = sb.ToString(); Debug.Print("check : " + title2); if (title2.Equals(notifyIcon.BalloonTipText)) { SendMessage(hWnd, WM_LBUTTONDOWN, 0, 0); return(0); } } return(1); }), 0); _sw.Stop(); break; } } } catch (ThreadAbortException) { // スレッドを中止した時の例外を無視する } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void button_opensslPath_Click(object sender, RoutedEventArgs e) { string path = CommonManager.GetFileNameByDialog(textBox_opensslPath.Text, "openssl.exe の場所", ".exe"); if (path != null) { textBox_opensslPath.Text = path; // クローズ時 TextBox が IsEnabled=false の場合があるためここで保存しておく IniFileHandler.WritePrivateProfileString("SET", "OpensslExeFile", textBox_opensslPath.Text, SettingPath.TimerSrvIniPath); } }
public void SaveRecPresetData() { if (recPresetData == null) { return; } 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(); } IniFileHandler.WritePrivateProfileString(defName, "SetName", DisplayName, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "RecMode", recPresetData.RecMode.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "Priority", recPresetData.Priority.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "TuijyuuFlag", recPresetData.TuijyuuFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "ServiceMode", recPresetData.ServiceMode.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "PittariFlag", recPresetData.PittariFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "BatFilePath", recPresetData.BatFilePath, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "RecTag", recPresetData.RecTag, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolderName, "Count", recPresetData.RecFolderList.Count.ToString(), SettingPath.TimerSrvIniPath); for (int j = 0; j < recPresetData.RecFolderList.Count; j++) { IniFileHandler.WritePrivateProfileString(defFolderName, j.ToString(), recPresetData.RecFolderList[j].RecFolder, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolderName, "WritePlugIn" + j.ToString(), recPresetData.RecFolderList[j].WritePlugIn, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolderName, "RecNamePlugIn" + j.ToString(), recPresetData.RecFolderList[j].RecNamePlugIn, SettingPath.TimerSrvIniPath); } IniFileHandler.WritePrivateProfileString(defFolder1SegName, "Count", recPresetData.PartialRecFolder.Count.ToString(), SettingPath.TimerSrvIniPath); for (int j = 0; j < recPresetData.PartialRecFolder.Count; j++) { IniFileHandler.WritePrivateProfileString(defFolder1SegName, j.ToString(), recPresetData.PartialRecFolder[j].RecFolder, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolder1SegName, "WritePlugIn" + j.ToString(), recPresetData.PartialRecFolder[j].WritePlugIn, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolder1SegName, "RecNamePlugIn" + j.ToString(), recPresetData.PartialRecFolder[j].RecNamePlugIn, SettingPath.TimerSrvIniPath); } IniFileHandler.WritePrivateProfileString(defName, "SuspendMode", recPresetData.SuspendMode.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "RebootFlag", recPresetData.RebootFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "UseMargineFlag", recPresetData.UseMargineFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "StartMargine", recPresetData.StartMargine.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "EndMargine", recPresetData.EndMargine.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "ContinueRec", recPresetData.ContinueRecFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "PartialRec", recPresetData.PartialRecFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "TunerID", recPresetData.TunerID.ToString(), SettingPath.TimerSrvIniPath); }
public RecInfoDescWindow(RecFileInfo info = null) { InitializeComponent(); try { base.SetParam(false, checkBox_windowPinned, checkBox_dataReplace); //最初にコマンド集の初期化 mc = new CmdExeRecinfo(this); mc.SetFuncGetDataList(isAll => recInfo.IntoList()); //コマンド集に無いもの,変更するもの mc.AddReplaceCommand(EpgCmds.Play, (sender, e) => CommonManager.Instance.FilePlay(recInfo.RecFilePath), (sender, e) => e.CanExecute = recInfo.ID != 0); mc.AddReplaceCommand(EpgCmds.Cancel, (sender, e) => this.Close()); mc.AddReplaceCommand(EpgCmds.BackItem, (sender, e) => MoveViewNextItem(-1)); mc.AddReplaceCommand(EpgCmds.NextItem, (sender, e) => MoveViewNextItem(1)); mc.AddReplaceCommand(EpgCmds.Search, (sender, e) => MoveViewRecinfoTarget(), (sender, e) => e.CanExecute = DataView is EpgViewBase); mc.AddReplaceCommand(EpgCmds.DeleteInDialog, info_del, (sender, e) => e.CanExecute = recInfo.ID != 0 && recInfo.ProtectFlag == 0); mc.AddReplaceCommand(EpgCmds.ChgOnOffCheck, (sender, e) => EpgCmds.ProtectChange.Execute(null, this)); //コマンド集からコマンドを登録 mc.ResetCommandBindings(this); //ボタンの設定 mBinds.View = CtxmCode.RecInfoView; mBinds.SetCommandToButton(button_play, EpgCmds.Play); mBinds.SetCommandToButton(button_cancel, EpgCmds.Cancel); mBinds.SetCommandToButton(button_up, EpgCmds.BackItem); mBinds.SetCommandToButton(button_down, EpgCmds.NextItem); mBinds.SetCommandToButton(button_chk, EpgCmds.Search); mBinds.SetCommandToButton(button_del, EpgCmds.DeleteInDialog); mBinds.AddInputCommand(EpgCmds.ProtectChange);//ショートカット登録 RefreshMenu(); button_del.ToolTipOpening += (sender, e) => button_del.ToolTip = (button_del.ToolTip as string + (IniFileHandler.GetPrivateProfileBool("SET", "RecInfoDelFile", false, SettingPath.CommonIniPath) ? "\r\n録画ファイルが存在する場合は一緒に削除されます。" : "")).Trim(); grid_protect.ToolTipOpening += (sender, e) => grid_protect.ToolTip = ("" + MenuBinds.GetInputGestureTextView(EpgCmds.ProtectChange, mBinds.View) + "\r\nプロテクト設定/解除").Trim(); //ステータスバーの設定 this.statusBar.Status.Visibility = Visibility.Collapsed; StatusManager.RegisterStatusbar(this.statusBar, this); ChangeData(info); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void checkBox_serviceMode_Checked(object sender, RoutedEventArgs e) { if (checkBox_serviceMode.IsChecked == true) { checkBox_serviceCaption.IsChecked = IniFileHandler.GetPrivateProfileInt("SET", "Caption", 1, SettingPath.EdcbIniPath) != 0; checkBox_serviceData.IsChecked = IniFileHandler.GetPrivateProfileInt("SET", "Data", 0, SettingPath.EdcbIniPath) != 0; } else { checkBox_serviceCaption.IsChecked = ((recSetting.ServiceMode & 0x10) > 0); checkBox_serviceData.IsChecked = ((recSetting.ServiceMode & 0x20) > 0); } }
static public void LoadSetting() { string iniFile = Application.StartupPath + "/setting.ini"; StringBuilder sb = new StringBuilder(1024); IniFileHandler.GetPrivateProfileString("TSUKASA", "PATH", "ffmpeg.exe", sb, (uint)sb.Capacity, iniFile); tsukasa_path = sb.ToString(); tsukasa_rtmp_ch = IniFileHandler.GetPrivateProfileInt("TSUKASA", "RTMP_C", 0, iniFile); IniFileHandler.GetPrivateProfileString("TSUKASA", "RTMP_LIST", "rtmp://127.0.0.1:1935/live/livestream", sb, (uint)sb.Capacity, iniFile); tsukasa_rtmp = new List <string>(sb.ToString().Split(',')); tsukasa_param_ch = IniFileHandler.GetPrivateProfileInt("TSUKASA", "PARAM_C", 0, iniFile); IniFileHandler.GetPrivateProfileString("TSUKASA", "PARAM_LIST", "H264,HEVC", sb, (uint)sb.Capacity, iniFile); tsukasa_param = new List <string>(sb.ToString().Split(',')); tsukasa_rerun = IniFileHandler.GetPrivateProfileInt("TSUKASA", "RERUN", 0, iniFile) != 0 ? true : false; tsukasa_param_str = new Dictionary <string, string>(); foreach (var param in tsukasa_param) { IniFileHandler.GetPrivateProfileString("TSUKASA", "PARAM_" + param, "", sb, (uint)sb.Capacity, iniFile); if (sb.ToString() == "") { if (param == "H264") { tsukasa_param_str.Add(param, "-hide_banner -itsoffset 300 -listen 1 -i <RTMP> -c copy -bsf:v h264_mp4toannexb -tag:v H264 -f asf_stream -map a -map v -push 1 -wms 1 <KAGAMI>"); } else if (param == "HEVC") { tsukasa_param_str.Add(param, "-hide_banner -itsoffset 300 -listen 1 -i <RTMP> -c copy -bsf:v hevc_mp4toannexb -tag:v HEVC -f asf_stream -map a -map v -push 1 -wms 1 <KAGAMI>"); } } else { tsukasa_param_str.Add(param, sb.ToString()); } } okiba_URL_ch = IniFileHandler.GetPrivateProfileInt("OKIBA", "URL_C", 0, iniFile); IniFileHandler.GetPrivateProfileString("OKIBA", "URL_LIST", "http://127.0.0.1:80/", sb, (uint)sb.Capacity, iniFile); okiba_URL = new List <string>(sb.ToString().Split(',')); okiba_port_ch = IniFileHandler.GetPrivateProfileInt("OKIBA", "PORT_C", 0, iniFile); okiba_port = new Dictionary <string, List <string> >(); foreach (var url in okiba_URL) { IniFileHandler.GetPrivateProfileString("OKIBA", "PORT_" + url, "8100,8200", sb, (uint)sb.Capacity, iniFile); okiba_port.Add(url, new List <string>(sb.ToString().Split(','))); } }
public void LoadSetting() { comboBox_bon.ItemsSource = CommonManager.GetBonFileList(); comboBox_bon.SelectedIndex = 0; listBox_bon.Items.Clear(); int num = IniFileHandler.GetPrivateProfileInt("TVTEST", "Num", 0, SettingPath.TimerSrvIniPath); for (uint i = 0; i < num; i++) { string item = IniFileHandler.GetPrivateProfileString("TVTEST", i.ToString(), "", SettingPath.TimerSrvIniPath); if (item.Length > 0) { listBox_bon.Items.Add(item); } } }
/// <summary> /// /// </summary> /// <param name="pairName">セクション名</param> /// <param name="buy">true=買う、false=売る</param> public Section(string pairName, bool buy) { StringBuilder sb = new StringBuilder(1024 * 100); string dir = Directory.GetCurrentDirectory(); this.BuySwap = IniFileHandler.GetPrivateProfileDouble(pairName, "buyswap", "0", sb, (uint)sb.Capacity, Path.Combine(dir, fileName)); this.SellSwap = IniFileHandler.GetPrivateProfileDouble(pairName, "sellswap", "0", sb, (uint)sb.Capacity, Path.Combine(dir, fileName)); IniFileHandler.GetPrivateProfileString(pairName, "countoryA", "0", sb, (uint)sb.Capacity, Path.Combine(dir, fileName)); CountoryA = sb.ToString(); IniFileHandler.GetPrivateProfileString(pairName, "countoryB", "0", sb, (uint)sb.Capacity, Path.Combine(dir, fileName)); CountoryB = sb.ToString(); HighPosition = IniFileHandler.GetPrivateProfileDouble(pairName, "highposition", "0", sb, (uint)sb.Capacity, Path.Combine(dir, fileName)); LowPosition = IniFileHandler.GetPrivateProfileDouble(pairName, "lowposition", "0", sb, (uint)sb.Capacity, Path.Combine(dir, fileName)); NowPosition = IniFileHandler.GetPrivateProfileDouble(pairName, "nowposition", "0", sb, (uint)sb.Capacity, Path.Combine(dir, fileName)); if (buy) { this.PairName = pairName + "買い"; OtokuRatio = NowPosition / LowPosition - 1; this.Swap = this.BuySwap; } else { this.PairName = pairName + "売り"; OtokuRatio = HighPosition / NowPosition - 1; this.Swap = this.SellSwap; } if (OtokuRatio < 0) { Console.WriteLine(this.PairName + ":nowpositionとhigh-lowpositionの関係がおかしい"); } }
private void setup() { Locations = new TwoKeyDictionary <string, string, string>(); config_files = collectConfigFiles(); foreach (String user in config_files.Keys) { IniFileHandler ini = new IniFileHandler(config_files[user]); foreach (string section in ini.Keys) { if (ini[section].ContainsKey("savepath")) { Locations.Add(user, section, ini[section]["savepath"]); } } } install_path = findInstallPath(); }
//設定の保存 private void saveToolStripMenuItem_Click(object sender, EventArgs e) { string startaccount; int indexStartAppLoginAcount = StartAppLoginAcount.SelectedIndex; startaccount = StartAppLoginAcount.Items[indexStartAppLoginAcount].ToString(); if (!Validation.IsNumeric(StartAppTLLoadTweetCount.Text) || int.Parse(StartAppTLLoadTweetCount.Text) > 200) { //整数じゃないとき DialogResult result = MessageBox.Show("200までの整数値を入力してください(X3)", "エラー:起動時に読み込むツイート数", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2); return; } //iniファイルに保存 IniFileHandler.WritePrivateProfileString("起動時", "LoginAccount", startaccount, "./data/setting.ini"); IniFileHandler.WritePrivateProfileString("起動時", "LoadTweet", StartAppTLLoadTweetCount.Text, "./data/setting.ini"); }
protected void LoadPresetData() { string IDS = ID == 0 ? "" : ID.ToString(); string defName = "REC_DEF" + IDS; Data = new RecSettingData(); Data.RecMode = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "RecMode", 1, SettingPath.TimerSrvIniPath); Data.IsEnable = Data.RecMode / 5 % 2 == 0; if (!Data.IsEnable) { Data.RecMode = (byte)(IniFileHandler.GetPrivateProfileInt(defName, "NoRecMode", 1, SettingPath.TimerSrvIniPath) % 5); } Data.Priority = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "Priority", 2, SettingPath.TimerSrvIniPath); Data.TuijyuuFlag = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "TuijyuuFlag", 1, SettingPath.TimerSrvIniPath); Data.ServiceMode = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "ServiceMode", 16, SettingPath.TimerSrvIniPath); Data.PittariFlag = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "PittariFlag", 0, SettingPath.TimerSrvIniPath); Data.UnPackBatFilePath(IniFileHandler.GetPrivateProfileString(defName, "BatFilePath", "", SettingPath.TimerSrvIniPath)); var GetRecFileSetInfo = new Action <string, List <RecFileSetInfo> >((appName, folderList) => { int count = IniFileHandler.GetPrivateProfileInt(appName, "Count", 0, SettingPath.TimerSrvIniPath); for (int i = 0; i < count; i++) { var folderInfo = new RecFileSetInfo(); folderInfo.RecFolder = IniFileHandler.GetPrivateProfileFolder(appName, i.ToString(), SettingPath.TimerSrvIniPath); folderInfo.WritePlugIn = IniFileHandler.GetPrivateProfileString(appName, "WritePlugIn" + i.ToString(), "Write_Default.dll", SettingPath.TimerSrvIniPath); folderInfo.RecNamePlugIn = IniFileHandler.GetPrivateProfileString(appName, "RecNamePlugIn" + i.ToString(), "", SettingPath.TimerSrvIniPath); folderList.Add(folderInfo); } }); GetRecFileSetInfo("REC_DEF_FOLDER" + IDS, Data.RecFolderList); GetRecFileSetInfo("REC_DEF_FOLDER_1SEG" + IDS, Data.PartialRecFolder); Data.SuspendMode = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "SuspendMode", 0, SettingPath.TimerSrvIniPath); Data.RebootFlag = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "RebootFlag", 0, SettingPath.TimerSrvIniPath); Data.UseMargineFlag = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "UseMargineFlag", 0, SettingPath.TimerSrvIniPath); Data.StartMargine = IniFileHandler.GetPrivateProfileInt(defName, "StartMargine", 5, SettingPath.TimerSrvIniPath); Data.EndMargine = IniFileHandler.GetPrivateProfileInt(defName, "EndMargine", 2, SettingPath.TimerSrvIniPath); Data.ContinueRecFlag = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "ContinueRec", 0, SettingPath.TimerSrvIniPath); Data.PartialRecFlag = (Byte)IniFileHandler.GetPrivateProfileInt(defName, "PartialRec", 0, SettingPath.TimerSrvIniPath); Data.TunerID = (UInt32)IniFileHandler.GetPrivateProfileInt(defName, "TunerID", 0, SettingPath.TimerSrvIniPath); }
private void setting_Load(object sender, EventArgs e) { //token.iniのセクション一覧取得後StartAppLoginAcountに追加 byte[] ac = new byte[1024]; uint resultSize2 = IniFileHandler.GetPrivateProfileStringByByteArray( null, null, "default", ac, (uint)ac.Length, "./data/token.ini"); string result2 = Encoding.Default.GetString( ac, 0, (int)resultSize2 - 1); string[] sections = result2.Split('\0'); int n = 0; foreach (string section in sections) { StartAppLoginAcount.Items.Add(section); } }
protected override void mc_Delete(object sender, ExecutedRoutedEventArgs e) { dataList = dataList.GetNoProtectedList(); if (mcs_DeleteCheck(e) == false) { return; } if (IniFileHandler.GetPrivateProfileInt("SET", "RecInfoDelFile", 0, SettingPath.CommonIniPath) == 1) { if (MessageBox.Show("録画ファイルが存在する場合は一緒に削除されます。\r\nよろしいですか?", "ファイル削除", MessageBoxButton.OKCancel) != MessageBoxResult.OK) { return; } } IsCommandExecuted = MenuUtil.RecinfoDelete(dataList); }
protected void SavePresetData() { if (Data == null) { return; } string IDS = ID == 0 ? "" : ID.ToString(); string defName = "REC_DEF" + IDS; IniFileHandler.WritePrivateProfileString(defName, "SetName", DisplayName, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "RecMode", Data.IsEnable ? Data.RecMode : 5, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "NoRecMode", Data.RecMode, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "Priority", Data.Priority, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "TuijyuuFlag", Data.TuijyuuFlag, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "ServiceMode", Data.ServiceMode, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "PittariFlag", Data.PittariFlag, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "BatFilePath", Data.PackBatFilePath(), SettingPath.TimerSrvIniPath); var WriteRecFileSetInfo = new Action <string, List <RecFileSetInfo> >((appName, folderList) => { IniFileHandler.WritePrivateProfileString(appName, "Count", folderList.Count.ToString(), SettingPath.TimerSrvIniPath); for (int j = 0; j < folderList.Count; j++) { IniFileHandler.WritePrivateProfileString(appName, j.ToString(), folderList[j].RecFolder, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(appName, "WritePlugIn" + j.ToString(), folderList[j].WritePlugIn, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(appName, "RecNamePlugIn" + j.ToString(), folderList[j].RecNamePlugIn, SettingPath.TimerSrvIniPath); } }); WriteRecFileSetInfo("REC_DEF_FOLDER" + IDS, Data.RecFolderList); WriteRecFileSetInfo("REC_DEF_FOLDER_1SEG" + IDS, Data.PartialRecFolder); IniFileHandler.WritePrivateProfileString(defName, "SuspendMode", Data.SuspendMode, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "RebootFlag", Data.RebootFlag, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "UseMargineFlag", Data.UseMargineFlag, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "StartMargine", Data.StartMargine, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "EndMargine", Data.EndMargine, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "ContinueRec", Data.ContinueRecFlag, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "PartialRec", Data.PartialRecFlag, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "TunerID", Data.TunerID, SettingPath.TimerSrvIniPath); }
static public List <RecPresetItem> LoadPresetList() { var list = new List <RecPresetItem> { new RecPresetItem(IniFileHandler.GetPrivateProfileString("REC_DEF", "SetName", "デフォルト", SettingPath.TimerSrvIniPath), 0) }; foreach (string s in IniFileHandler.GetPrivateProfileString("SET", "PresetID", "", SettingPath.TimerSrvIniPath).Split(',')) { int id; int.TryParse(s, out id); if (list.Exists(p => p.ID == id) == false) { string name = IniFileHandler.GetPrivateProfileString("REC_DEF" + id, "SetName", "", SettingPath.TimerSrvIniPath); list.Add(new RecPresetItem(name, id)); } } list.ForEach(item => item.LoadPresetData());//ID=0の読込も忘れない return(list.FixUp()); }
public void SaveSetting() { Settings.Instance.TvTestExe = textBox_exe.Text; Settings.Instance.TvTestCmd = textBox_cmd.Text; if (checkBox_nwTvMode.IsChecked == true) { Settings.Instance.NwTvMode = true; } else { Settings.Instance.NwTvMode = false; } if (checkBox_nwUDP.IsChecked == true) { Settings.Instance.NwTvModeUDP = true; } else { Settings.Instance.NwTvModeUDP = false; } if (checkBox_nwTCP.IsChecked == true) { Settings.Instance.NwTvModeTCP = true; } else { Settings.Instance.NwTvModeTCP = false; } IniFileHandler.WritePrivateProfileString("TVTEST", "Num", listBox_bon.Items.Count.ToString(), SettingPath.TimerSrvIniPath); for (int i = 0; i < listBox_bon.Items.Count; i++) { string val = listBox_bon.Items[i] as string; IniFileHandler.WritePrivateProfileString("TVTEST", i.ToString(), val, SettingPath.TimerSrvIniPath); } Settings.Instance.FilePlayExe = textBox_playExe.Text; Settings.Instance.FilePlayCmd = textBox_playCmd.Text; }
/// <summary> /// /// </summary> /// <param name="dir"></param> /// <param name="knightName"></param> private void Initialize(string dir, string knightName) { this.KnightName = knightName; StringBuilder sb = new StringBuilder(1024 * 100); this.Attack = IniFileHandler.GetPrivateProfileInt(knightName, "attack", 0, Path.Combine(dir, Properties.Resources.INI_FILE_NAME)); this.HitPoint = IniFileHandler.GetPrivateProfileInt(knightName, "hitpoint", 0, Path.Combine(dir, Properties.Resources.INI_FILE_NAME)); this.Force = (Force)IniFileHandler.GetPrivateProfileInt(knightName, "force", 0, Path.Combine(dir, Properties.Resources.INI_FILE_NAME)); this.PrivateForce = (PrivateForce)IniFileHandler.GetPrivateProfileInt(knightName, "privateforce", 0, Path.Combine(dir, Properties.Resources.INI_FILE_NAME)); this.Sex = (Sex)IniFileHandler.GetPrivateProfileInt(knightName, "sex", 0, Path.Combine(dir, Properties.Resources.INI_FILE_NAME)); // 読込失敗したらコスト30ってことで this.Cost = IniFileHandler.GetPrivateProfileInt(knightName, "cost", 30, Path.Combine(dir, Properties.Resources.INI_FILE_NAME)); // HitPointの補正 if (this.Force == MillionArthurApplication.Force.TECHNO) { this.HitPoint = (uint)((double)this.HitPoint * 1.05); } // コスパの算出 Cospa = (double)(this.HitPoint + this.Attack) / (double)Cost; if (Cost == 30 || Cost == 0) { Cospa = 0; } }
public void SaveSetting() { //番組表 int epgArcDay = (int)MenuUtil.MyToNumerical(textBox_epgArchivePeriod, Convert.ToDouble, 20000, 0, 0); IniFileHandler.WritePrivateProfileString("SET", "EpgArchivePeriodHour", epgArcDay * 24, SettingPath.TimerSrvIniPath); settings.CustomEpgTabList = listBox_tab.Items.OfType <CustomEpgTabInfoView>().Select(item => item.Info).ToList(); settings.SetCustomEpgTabInfoID(); //録画済み一覧画面 IniFileHandler.WritePrivateProfileString("SET", "DropSaveThresh", textBox_DropSaveThresh.Text, SettingPath.EdcbIniPath); IniFileHandler.WritePrivateProfileString("SET", "ScrambleSaveThresh", textBox_ScrambleSaveThresh.Text, SettingPath.EdcbIniPath); settings.RecInfoDropExcept = textBox_RecInfoDropExcept.Text.Split(',') .Where(s => string.IsNullOrWhiteSpace(s) == false).Select(s => s.Trim()).ToList(); IsChangeRecInfoDropExcept = settings.RecInfoDropExcept.SequenceEqual(Settings.Instance.RecInfoDropExcept) == false; //予約一覧・共通画面 settings.LaterTimeHour = MenuUtil.MyToNumerical(textBox_LaterTimeHour, Convert.ToInt32, 36, 24, 28) - 24; if (settings.UseLastSearchKey == false) { settings.DefSearchKey = new EpgSearchKeyInfo(); } }
public void SaveSetting() { Settings.Instance.TvTestExe = textBox_exe.Text; Settings.Instance.TvTestCmd = textBox_cmd.Text; Settings.Instance.NwTvMode = (checkBox_nwTvMode.IsChecked == true); Settings.Instance.NwTvModeUDP = (checkBox_nwUDP.IsChecked == true); Settings.Instance.NwTvModeTCP = (checkBox_nwTCP.IsChecked == true); Settings.Instance.TvTestOpenWait = MenuUtil.MyToNumerical(textBox_TvTestOpenWait, Convert.ToInt32, 120000, 0, Settings.Instance.TvTestOpenWait); Settings.Instance.TvTestChgBonWait = MenuUtil.MyToNumerical(textBox_TvTestChgBonWait, Convert.ToInt32, 120000, 0, Settings.Instance.TvTestChgBonWait); if (listBox_bon.IsEnabled) { IniFileHandler.WritePrivateProfileString("TVTEST", "Num", listBox_bon.Items.Count.ToString(), SettingPath.TimerSrvIniPath); for (int i = 0; i < listBox_bon.Items.Count; i++) { string val = listBox_bon.Items[i] as string; IniFileHandler.WritePrivateProfileString("TVTEST", i.ToString(), val, SettingPath.TimerSrvIniPath); } } Settings.Instance.FilePlayExe = textBox_playExe.Text; Settings.Instance.FilePlayCmd = textBox_playCmd.Text; Settings.Instance.FilePlayOnAirWithExe = checkBox_playOnAirWithExe.IsChecked == true; }
protected override bool ReloadInfoData() { checkBox_displayInternal.IsEnabled = IniFileHandler.GetPrivateProfileInt("SET", "SaveNotifyLog", 0, SettingPath.TimerSrvIniPath) != 0; checkBox_displayInternal.ToolTip = checkBox_displayInternal.IsEnabled == true ? null : "未接続または「情報通知ログをファイルに保存する(EpgTimerSrv)」が無効です"; checkBox_displayInternal.IsChecked = checkBox_displayInternal.IsEnabled == false || Settings.Instance.NotifyLogEpgTimer; return(lstCtrl.ReloadInfoData(dataList => { if (checkBox_displayInternal.IsChecked == false) { //サーバに保存されたログを使う string notifyLog = ""; CommonManager.CreateSrvCtrl().SendGetNotifyLog(Math.Max(Settings.Instance.NotifyLogMax, 1), ref notifyLog); dataList.AddRange(notifyLog.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries) .Select(text => new NotifySrvInfoItem(text))); } else { //クライアントで蓄積したログを使う dataList.AddRange(CommonManager.Instance.NotifyLogList.Skip(CommonManager.Instance.NotifyLogList.Count - Settings.Instance.NotifyLogMax) .Select(info => new NotifySrvInfoItem(info))); } return true; })); }
public bool StartTimeShift(UInt32 reserveID) { try { if (Settings.Instance.TvTestExe.Length == 0) { MessageBox.Show("TVTest.exeのパスが設定されていません"); return(false); } if (CommonManager.Instance.NWMode == false) { if (IniFileHandler.GetPrivateProfileInt("SET", "EnableTCPSrv", 0, SettingPath.TimerSrvIniPath) == 0) { MessageBox.Show("追っかけ再生を行うには、動作設定でネットワーク接続を許可する必要があります。"); return(false); } } NWPlayTimeShiftInfo playInfo = new NWPlayTimeShiftInfo(); UInt32 err = cmd.SendNwTimeShiftOpen(reserveID, ref playInfo); if (err == 205) { MessageBox.Show("サーバーに接続できませんでした"); return(false); } else if (err != 1) { MessageBox.Show("まだ録画が開始されていません"); return(false); } if (IsOpenTVTest() == false) { processID = FindTVTestProcess(); if (processID == -1) { Process process; process = System.Diagnostics.Process.Start(Settings.Instance.TvTestExe, Settings.Instance.TvTestCmd); processID = process.Id; System.Threading.Thread.Sleep(1000); } } cmdTvTest.SetPipeSetting("Global\\TvTest_Ctrl_BonConnect_" + processID.ToString(), "\\\\.\\pipe\\TvTest_Ctrl_BonPipe_" + processID.ToString()); cmdTvTest.SetConnectTimeOut(1000); TVTestStreamingInfo sendInfo = new TVTestStreamingInfo(); sendInfo.enableMode = 1; sendInfo.ctrlID = playInfo.ctrlID; if (CommonManager.Instance.NWMode == false) { sendInfo.serverIP = 0x7F000001; string hostname = Dns.GetHostName(); IPAddress[] adrList = Dns.GetHostAddresses(hostname); foreach (IPAddress address in adrList) { if (address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { UInt32 ip = 0; Int32 shift = 24; foreach (string word in address.ToString().Split('.')) { ip |= Convert.ToUInt32(word) << shift; shift -= 8; } sendInfo.serverIP = ip; break; } } sendInfo.serverPort = (UInt32)IniFileHandler.GetPrivateProfileInt("SET", "TCPPort", 4510, SettingPath.TimerSrvIniPath); } else { UInt32 ip = 0; Int32 shift = 24; String srvIP = CommonManager.Instance.NW.ConnectedIP; foreach (IPAddress address in Dns.GetHostAddresses(CommonManager.Instance.NW.ConnectedIP)) { srvIP = address.ToString(); } foreach (string word in srvIP.Split('.')) { ip |= Convert.ToUInt32(word) << shift; shift -= 8; } sendInfo.serverIP = ip; sendInfo.serverPort = CommonManager.Instance.NW.ConnectedPort; } sendInfo.filePath = playInfo.filePath; if (Settings.Instance.NwTvModeUDP == true) { sendInfo.udpSend = 1; } if (Settings.Instance.NwTvModeTCP == true) { sendInfo.tcpSend = 1; } if (cmdTvTest.SendViewSetStreamingInfo(sendInfo) != 1) { System.Threading.Thread.Sleep(5 * 1000); cmdTvTest.SendViewSetStreamingInfo(sendInfo); } WakeupWindow(processID); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } return(true); }
private void SavePreset(object addOrChgTarget, RecSettingData addOrChgInfo) { var saveList = new List <RecSettingData>(); for (int i = 0; i < comboBox_preSet.Items.Count; i++) { RecPresetItem preItem = comboBox_preSet.Items[i] as RecPresetItem; if (preItem == addOrChgTarget) { // 追加または変更 saveList.Add(addOrChgInfo); // IDを振りなおす preItem.ID = (uint)(saveList.Count - 1); } else if (preItem.ID != 0xFFFFFFFF) { // 現在設定を維持 saveList.Add(Settings.CreateRecSetting(preItem.ID)); // IDを振りなおす preItem.ID = (uint)(saveList.Count - 1); } } if (CommonManager.Instance.NWMode) { IniFileHandler.TouchFileAsUnicode(SettingPath.TimerSrvIniPath); } string saveID = ""; for (int i = 0; i < saveList.Count; i++) { String defName = "REC_DEF"; String defFolderName = "REC_DEF_FOLDER"; String defFolder1SegName = "REC_DEF_FOLDER_1SEG"; RecSettingData info = saveList[i]; RecPresetItem preItem = comboBox_preSet.Items.OfType <RecPresetItem>().First(a => a.ID == i); if (preItem.ID != 0) { defName += preItem.ID.ToString(); defFolderName += preItem.ID.ToString(); defFolder1SegName += preItem.ID.ToString(); saveID += preItem.ID.ToString(); saveID += ","; } IniFileHandler.WritePrivateProfileString(defName, "SetName", preItem.DisplayName, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "RecMode", info.RecMode.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "Priority", info.Priority.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "TuijyuuFlag", info.TuijyuuFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "ServiceMode", info.ServiceMode.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "PittariFlag", info.PittariFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "BatFilePath", info.BatFilePath, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolderName, "Count", info.RecFolderList.Count.ToString(), SettingPath.TimerSrvIniPath); for (int j = 0; j < info.RecFolderList.Count; j++) { IniFileHandler.WritePrivateProfileString(defFolderName, j.ToString(), info.RecFolderList[j].RecFolder, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolderName, "WritePlugIn" + j.ToString(), info.RecFolderList[j].WritePlugIn, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolderName, "RecNamePlugIn" + j.ToString(), info.RecFolderList[j].RecNamePlugIn, SettingPath.TimerSrvIniPath); } IniFileHandler.WritePrivateProfileString(defFolder1SegName, "Count", info.PartialRecFolder.Count.ToString(), SettingPath.TimerSrvIniPath); for (int j = 0; j < info.PartialRecFolder.Count; j++) { IniFileHandler.WritePrivateProfileString(defFolder1SegName, j.ToString(), info.PartialRecFolder[j].RecFolder, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolder1SegName, "WritePlugIn" + j.ToString(), info.PartialRecFolder[j].WritePlugIn, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolder1SegName, "RecNamePlugIn" + j.ToString(), info.PartialRecFolder[j].RecNamePlugIn, SettingPath.TimerSrvIniPath); } IniFileHandler.WritePrivateProfileString(defName, "SuspendMode", info.SuspendMode.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "RebootFlag", info.RebootFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "UseMargineFlag", info.UseMargineFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "StartMargine", info.StartMargine.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "EndMargine", info.EndMargine.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "ContinueRec", info.ContinueRecFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "PartialRec", info.PartialRecFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "TunerID", info.TunerID.ToString(), SettingPath.TimerSrvIniPath); } IniFileHandler.WritePrivateProfileString("SET", "PresetID", saveID, SettingPath.TimerSrvIniPath); }
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 bool StartStreamingPlay(string filePath, uint reserveID) { try { if (Settings.Instance.TvTestExe.Length == 0) { MessageBox.Show("TVTest.exeのパスが設定されていません"); return(false); } if (CommonManager.Instance.NWMode == false) { if (IniFileHandler.GetPrivateProfileInt("SET", "EnableTCPSrv", 0, SettingPath.TimerSrvIniPath) == 0) { MessageBox.Show("動作設定でネットワーク接続を許可する必要があります。"); return(false); } } var sendInfo = new TVTestStreamingInfo(); if (filePath == null) { var playInfo = new NWPlayTimeShiftInfo(); ErrCode err = CommonManager.CreateSrvCtrl().SendNwTimeShiftOpen(reserveID, ref playInfo); if (err != ErrCode.CMD_SUCCESS) { MessageBox.Show(CommonManager.GetErrCodeText(err) ?? "まだ録画が開始されていません。"); return(false); } sendInfo.ctrlID = playInfo.ctrlID; sendInfo.filePath = playInfo.filePath; } else { ErrCode err = CommonManager.CreateSrvCtrl().SendNwPlayOpen(filePath, ref sendInfo.ctrlID); if (err != ErrCode.CMD_SUCCESS) { MessageBox.Show(CommonManager.GetErrCodeText(err) ?? "ファイルを開けませんでした。"); return(false); } } OpenTVTest(1000, false); var cmdTvTest = new CtrlCmdUtil(); cmdTvTest.SetPipeSetting("Global\\TvTest_Ctrl_BonConnect_" + process.Id, "TvTest_Ctrl_BonPipe_" + process.Id); cmdTvTest.SetConnectTimeOut(1000); sendInfo.enableMode = 1; if (CommonManager.Instance.NWMode == false) { sendInfo.serverIP = 0x7F000001; // 原作はここで自ホスト名を取得して解決したアドレスを格納している。(ないとは思うが)不具合があれば戻すこと sendInfo.serverPort = (UInt32)IniFileHandler.GetPrivateProfileInt("SET", "TCPPort", 4510, SettingPath.TimerSrvIniPath); } else { sendInfo.serverIP = 0x7F000001; IPAddress srvIP = CommonManager.Instance.NWConnectedIP; if (srvIP != null && srvIP.GetAddressBytes().Length == 4) { byte[] oct = srvIP.GetAddressBytes(); sendInfo.serverIP = (uint)oct[0] << 24 | (uint)oct[1] << 16 | (uint)oct[2] << 8 | oct[3]; } sendInfo.serverPort = CommonManager.Instance.NWConnectedPort; } if (Settings.Instance.NwTvModeUDP == true) { sendInfo.udpSend = 1; } if (Settings.Instance.NwTvModeTCP == true) { sendInfo.tcpSend = 1; } for (int i = 0; i < 10 && cmdTvTest.SendViewSetStreamingInfo(sendInfo) != ErrCode.CMD_SUCCESS; i++) { System.Threading.Thread.Sleep(1000); } WakeupWindow(process.MainWindowHandle); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } return(true); }
public void SavePreset() { Settings.Instance.RecPresetList.Clear(); string saveID = ""; for (int i = 0; i < comboBox_preSet.Items.Count; i++) { RecPresetItem preItem = comboBox_preSet.Items[i] as RecPresetItem; if (preItem.ID == 0xFFFFFFFF) { continue; } String defName = "REC_DEF"; String defFolderName = "REC_DEF_FOLDER"; String defFolder1SegName = "REC_DEF_FOLDER_1SEG"; RecSettingData info = presetList[preItem.ID]; preItem.ID = (UInt32)i; if (preItem.ID != 0) { defName += preItem.ID.ToString(); defFolderName += preItem.ID.ToString(); defFolder1SegName += preItem.ID.ToString(); saveID += preItem.ID.ToString(); saveID += ","; } IniFileHandler.WritePrivateProfileString(defName, "SetName", preItem.DisplayName, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "RecMode", info.RecMode.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "Priority", info.Priority.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "TuijyuuFlag", info.TuijyuuFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "ServiceMode", info.ServiceMode.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "PittariFlag", info.PittariFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "BatFilePath", info.BatFilePath, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolderName, "Count", info.RecFolderList.Count.ToString(), SettingPath.TimerSrvIniPath); for (int j = 0; j < info.RecFolderList.Count; j++) { IniFileHandler.WritePrivateProfileString(defFolderName, j.ToString(), info.RecFolderList[j].RecFolder, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolderName, "WritePlugIn" + j.ToString(), info.RecFolderList[j].WritePlugIn, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolderName, "RecNamePlugIn" + j.ToString(), info.RecFolderList[j].RecNamePlugIn, SettingPath.TimerSrvIniPath); } IniFileHandler.WritePrivateProfileString(defFolder1SegName, "Count", info.PartialRecFolder.Count.ToString(), SettingPath.TimerSrvIniPath); for (int j = 0; j < info.PartialRecFolder.Count; j++) { IniFileHandler.WritePrivateProfileString(defFolder1SegName, j.ToString(), info.PartialRecFolder[j].RecFolder, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolder1SegName, "WritePlugIn" + j.ToString(), info.PartialRecFolder[j].WritePlugIn, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolder1SegName, "RecNamePlugIn" + j.ToString(), info.PartialRecFolder[j].RecNamePlugIn, SettingPath.TimerSrvIniPath); } IniFileHandler.WritePrivateProfileString(defName, "SuspendMode", info.SuspendMode.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "RebootFlag", info.RebootFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "UseMargineFlag", info.UseMargineFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "StartMargine", info.StartMargine.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "EndMargine", info.EndMargine.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "ContinueRec", info.ContinueRecFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "PartialRec", info.PartialRecFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "TunerID", info.TunerID.ToString(), SettingPath.TimerSrvIniPath); Settings.Instance.RecPresetList.Add(preItem); } IniFileHandler.WritePrivateProfileString("SET", "PresetID", saveID, SettingPath.TimerSrvIniPath); Settings.SaveToXmlFile(); }
private void setup() { Locations = new TwoKeyDictionary<string, string, string>(); config_files = collectConfigFiles(); foreach (String user in config_files.Keys) { IniFileHandler ini = new IniFileHandler(config_files[user]); foreach (string section in ini.Keys) { if (ini[section].ContainsKey("savepath")) { Locations.Add(user, section, ini[section]["savepath"]); } } } install_path = findInstallPath(); }