/// <summary> /// 接続 /// </summary> /// <param name="prof">プロファイル</param> public void ConnectProfile(ConnectProfileStruct prof) { _connectCancelFlg = false; ConnectProfileTerminal terminal = new ConnectProfileTerminal(prof); Thread _connectThread = new Thread((ThreadStart) delegate() { terminal.Connect(); }); _connectThread.IsBackground = true; _connectThread.Start(); // スレッド終了待機(Joinを使用するとフリーズしてしまう) while (true) { Thread.Sleep(10); if (_connectCancelFlg == true) { _connectThread.Abort(); // 接続キャンセル(スレッド終了) } if (_connectThread.IsAlive != true) { break; // スレッド終了後break } System.Windows.Forms.Application.DoEvents(); } }
/// <summary> /// プロファイルをコピーして編集 /// </summary> /// <param name="proflist">プロファイルリスト</param> /// <param name="prof">コピー元プロファイル</param> public void CopyEditProfileCommand(ConnectProfileList proflist, ConnectProfileStruct prof) { ProfileEditForm dlg = new ProfileEditForm(prof); if (dlg.ShowDialog() == DialogResult.OK) { proflist.AddProfile(dlg.ResultProfile); } }
/// <summary> /// プロファイル接続 /// </summary> private void Connect(ConnectProfileStruct prof) { if (prof != null) { // 接続中はダイアログタイトルにホスト名を表示 this.Text = string.Format(ConnectProfilePlugin.Strings.GetString("Caption.ConnectProfile.Connecting"), prof.HostName); _cmd.ConnectProfile(prof); this.Text = ConnectProfilePlugin.Strings.GetString("Caption.ConnectProfile"); } }
/// <summary> /// プロファイルコピー/編集 /// </summary> private void CopyEditProfile() { ConnectProfileStruct prof = GetSelectedProfile(); if (prof != null) { _cmd.CopyEditProfileCommand(ConnectProfilePlugin.Profiles, prof); RefreshAllProfiles(); } }
/// <summary> /// コンストラクタ /// </summary> /// <param name="prof">プロファイル</param> public ProfileEditForm(ConnectProfileStruct prof) { InitializeComponent(); InitializeComponentValue(); // オブジェクト初期値設定 if (prof == null) { // 新規作成時はデフォルト値を設定 _protocolBox.SelectedItem = ConnectionMethod.SSH2; _portBox.Value = ConnectProfileStruct.DEFAULT_SSH_PORT; _authTypeBox.SelectedItem = AuthType.Password; _charCodeBox.SelectedItem = EncodingType.UTF8; _newLineTypeBox.SelectedItem = NewLine.CR; _telnetNewLineCheck.Checked = true; _terminalTypeBox.SelectedItem = TerminalType.XTerm; _commandSendIntBox.Value = ConnectProfileStruct.DEFAULT_CMD_SEND_INTERVAL; _promptRecvTimeoutBox.Value = ConnectProfileStruct.DEFAULT_PROMPT_RECV_TIMEOUT; // コンソール表示オブジェクトはターミナルオプション値を反映 _renderProfile = ConnectProfilePlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions.CreateRenderProfile(); } else { // 編集時は対象プロファイル値を設定 _hostNameBox.Text = prof.HostName; _protocolBox.SelectedItem = prof.Protocol; _portBox.Value = prof.Port; _authTypeBox.SelectedItem = prof.AuthType; _keyFileBox.Text = prof.KeyFile; _userNameBox.Text = prof.UserName; _passwordBox.Text = prof.Password; _autoLoginCheck.Checked = prof.AutoLogin; _loginPromptBox.Text = prof.LoginPrompt; _passwordPromptBox.Text = prof.PasswordPrompt; _execCommandBox.Text = prof.ExecCommand; _suUserNameBox.Text = prof.SUUserName; _suPasswordBox.Text = prof.SUPassword; if (prof.SUType == _suTypeRadio1.Text) _suTypeRadio1.Checked = true; else if (prof.SUType == _suTypeRadio2.Text) _suTypeRadio2.Checked = true; else if (prof.SUType == _suTypeRadio3.Text) _suTypeRadio3.Checked = true; else if (prof.SUType == _suTypeRadio4.Text) _suTypeRadio4.Checked = true; _charCodeBox.SelectedItem = prof.CharCode; _newLineTypeBox.SelectedItem = prof.NewLine; _telnetNewLineCheck.Checked = prof.TelnetNewLine; _terminalTypeBox.SelectedItem = prof.TerminalType; _commandSendIntBox.Value = prof.CommandSendInterval; _promptRecvTimeoutBox.Value = prof.PromptRecvTimeout; _profileItemColorButton.SelectedColor = prof.ProfileItemColor; _descriptionBox.Text = prof.Description; _renderProfile = ConnectProfilePlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions.CreateRenderProfile(); _renderProfile = prof.RenderProfile; } _Initialized = true; EnableValidControls(this, EventArgs.Empty); }
/// <summary> /// プロファイル削除 /// </summary> private void DeleteProfile() { ConnectProfileStruct prof = GetSelectedProfile(); if (prof != null) { if (ConnectProfilePlugin.AskUserYesNoInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.ConfirmProfileDelete"), MessageBoxIcon.Question) == DialogResult.Yes) { _cmd.DeleteProfileCommand(ConnectProfilePlugin.Profiles, prof); RefreshAllProfiles(); RefreshSelectCount(); } } }
/// <summary> /// プロファイルリストチェックステータス変更後イベント /// </summary> private void _profileListView_ItemChecked(object sender, ItemCheckedEventArgs e) { // リスト更新実行中はスキップ(RefreshAllProfiles実行中にも度々イベントが発生してしまうため) if (_refreshingFlg != true) { e.Item.Selected = true; // チェックボックスクリック時は選択状態にならないため明示的に選択状態にする ConnectProfileStruct prof = GetSelectedProfile(); if (prof != null) { prof.Check = e.Item.Checked; RefreshSelectCount(); } } }
/// <summary> /// CSV変換 /// </summary> /// <param name="prof">プロファイル</param> /// <param name="hidepw">パスワードを隠す</param> public string ConvertCSV(ConnectProfileStruct prof, bool hidepw) { return(string.Format( ConnectProfileStruct.FMT_CSV, prof.HostName, prof.Protocol.ToString(), prof.Port.ToString(), prof.AuthType.ToString(), prof.KeyFile, prof.UserName, (hidepw == true) ? "" : prof.Password, prof.AutoLogin.ToString(), prof.LoginPrompt, prof.PasswordPrompt, prof.ExecCommand, prof.SUUserName, (hidepw == true) ? "" : prof.SUPassword, prof.SUType, prof.CharCode.ToString(), prof.NewLine.ToString(), prof.TelnetNewLine.ToString(), prof.TerminalType.ToString(), Convert.ToString(prof.RenderProfile.ForeColor.ToArgb(), 16), Convert.ToString(prof.RenderProfile.BackColor.ToArgb(), 16), Convert.ToString(prof.RenderProfile.ESColorSet[0].Color.ToArgb(), 16), Convert.ToString(prof.RenderProfile.ESColorSet[1].Color.ToArgb(), 16), Convert.ToString(prof.RenderProfile.ESColorSet[2].Color.ToArgb(), 16), Convert.ToString(prof.RenderProfile.ESColorSet[3].Color.ToArgb(), 16), Convert.ToString(prof.RenderProfile.ESColorSet[4].Color.ToArgb(), 16), Convert.ToString(prof.RenderProfile.ESColorSet[5].Color.ToArgb(), 16), Convert.ToString(prof.RenderProfile.ESColorSet[6].Color.ToArgb(), 16), Convert.ToString(prof.RenderProfile.ESColorSet[7].Color.ToArgb(), 16), prof.RenderProfile.FontName, prof.RenderProfile.CJKFontName, prof.RenderProfile.FontSize.ToString(), prof.RenderProfile.UseClearType.ToString(), prof.RenderProfile.EnableBoldStyle.ToString(), prof.RenderProfile.ForceBoldStyle.ToString(), prof.RenderProfile.BackgroundImageFileName, prof.RenderProfile.ImageStyle.ToString(), prof.CommandSendInterval.ToString(), prof.PromptRecvTimeout.ToString(), Convert.ToString(prof.ProfileItemColor.ToArgb(), 16), prof.Description )); }
/// <summary> /// プロファイルを削除 /// </summary> /// <param name="proflist">プロファイルリスト</param> /// <param name="prof">プロファイル</param> public void DeleteProfileCommand(ConnectProfileList proflist, ConnectProfileStruct prof) { proflist.DeleteProfile(prof); }
/// <summary> /// 読み込み /// </summary> public void LoadFromPreference() { IPreferenceFolderArray fa = _rootPreference.FindChildFolderArray(_profileDefinition.Id); foreach (IPreferenceFolder f in fa.Folders) { ConnectProfileStruct prof = new ConnectProfileStruct(); prof.HostName = fa.ConvertItem(f, _hostName).AsString().Value; if (fa.ConvertItem(f, _protocol).AsString().Value == "Telnet") { prof.Protocol = ConnectionMethod.Telnet; } else if (fa.ConvertItem(f, _protocol).AsString().Value == "SSH1") { prof.Protocol = ConnectionMethod.SSH1; } else if (fa.ConvertItem(f, _protocol).AsString().Value == "SSH2") { prof.Protocol = ConnectionMethod.SSH2; } prof.Port = fa.ConvertItem(f, _port).AsInt().Value; if (fa.ConvertItem(f, _authType).AsString().Value == "Password") { prof.AuthType = AuthType.Password; } else if (fa.ConvertItem(f, _authType).AsString().Value == "PublicKey") { prof.AuthType = AuthType.PublicKey; } else if (fa.ConvertItem(f, _authType).AsString().Value == "KeyboardInteractive") { prof.AuthType = AuthType.KeyboardInteractive; } prof.KeyFile = fa.ConvertItem(f, _keyFile).AsString().Value; prof.UserName = fa.ConvertItem(f, _userName).AsString().Value; prof.Password = fa.ConvertItem(f, _password).AsString().Value; prof.AutoLogin = fa.ConvertItem(f, _autoLogin).AsBool().Value; prof.LoginPrompt = fa.ConvertItem(f, _loginPrompt).AsString().Value; prof.PasswordPrompt = fa.ConvertItem(f, _passwordPrompt).AsString().Value; prof.ExecCommand = fa.ConvertItem(f, _execCommand).AsString().Value; prof.SUUserName = fa.ConvertItem(f, _suUserName).AsString().Value; prof.SUPassword = fa.ConvertItem(f, _suPassword).AsString().Value; prof.SUType = fa.ConvertItem(f, _suType).AsString().Value; if (fa.ConvertItem(f, _charCode).AsString().Value == "ISO8859_1") { prof.CharCode = EncodingType.ISO8859_1; } else if (fa.ConvertItem(f, _charCode).AsString().Value == "UTF8") { prof.CharCode = EncodingType.UTF8; } else if (fa.ConvertItem(f, _charCode).AsString().Value == "EUC_JP") { prof.CharCode = EncodingType.EUC_JP; } else if (fa.ConvertItem(f, _charCode).AsString().Value == "SHIFT_JIS") { prof.CharCode = EncodingType.SHIFT_JIS; } else if (fa.ConvertItem(f, _charCode).AsString().Value == "GB2312") { prof.CharCode = EncodingType.GB2312; } else if (fa.ConvertItem(f, _charCode).AsString().Value == "BIG5") { prof.CharCode = EncodingType.BIG5; } else if (fa.ConvertItem(f, _charCode).AsString().Value == "EUC_CN") { prof.CharCode = EncodingType.EUC_CN; } else if (fa.ConvertItem(f, _charCode).AsString().Value == "EUC_KR") { prof.CharCode = EncodingType.EUC_KR; } else if (fa.ConvertItem(f, _charCode).AsString().Value == "UTF8_Latin") { prof.CharCode = EncodingType.UTF8_Latin; } else if (fa.ConvertItem(f, _charCode).AsString().Value == "OEM850") { prof.CharCode = EncodingType.OEM850; } if (fa.ConvertItem(f, _newLine).AsString().Value == "CR") { prof.NewLine = NewLine.CR; } else if (fa.ConvertItem(f, _newLine).AsString().Value == "LF") { prof.NewLine = NewLine.LF; } else if (fa.ConvertItem(f, _newLine).AsString().Value == "CRLF") { prof.NewLine = NewLine.CRLF; } prof.TelnetNewLine = fa.ConvertItem(f, _telnetNewLine).AsBool().Value; if (fa.ConvertItem(f, _terminalType).AsString().Value == "KTerm") { prof.TerminalType = TerminalType.KTerm; } else if (fa.ConvertItem(f, _terminalType).AsString().Value == "VT100") { prof.TerminalType = TerminalType.VT100; } else if (fa.ConvertItem(f, _terminalType).AsString().Value == "XTerm") { prof.TerminalType = TerminalType.XTerm; } prof.CommandSendInterval = fa.ConvertItem(f, _commandSendInterval).AsInt().Value; prof.PromptRecvTimeout = fa.ConvertItem(f, _promptRecvTimeout).AsInt().Value; prof.ProfileItemColor = Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _profileItemColor.PreferenceItem).AsString().Value, Color.Black); prof.Description = fa.ConvertItem(f, _description).AsString().Value; // 表示オプション prof.RenderProfile = ConnectProfilePlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions.CreateRenderProfile(); prof.RenderProfile.ForeColor = Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalFontColor.PreferenceItem).AsString().Value, Color.White); prof.RenderProfile.BackColor = Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalBGColor.PreferenceItem).AsString().Value, Color.Black); prof.RenderProfile.ESColorSet = new EscapesequenceColorSet(); prof.RenderProfile.ESColorSet.ResetToDefault(); prof.RenderProfile.ESColorSet[0] = new ESColor(Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalESCColor0.PreferenceItem).AsString().Value, Color.Black), false); prof.RenderProfile.ESColorSet[1] = new ESColor(Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalESCColor1.PreferenceItem).AsString().Value, Color.Red), false); prof.RenderProfile.ESColorSet[2] = new ESColor(Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalESCColor2.PreferenceItem).AsString().Value, Color.Green), false); prof.RenderProfile.ESColorSet[3] = new ESColor(Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalESCColor3.PreferenceItem).AsString().Value, Color.Yellow), false); prof.RenderProfile.ESColorSet[4] = new ESColor(Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalESCColor4.PreferenceItem).AsString().Value, Color.Blue), false); prof.RenderProfile.ESColorSet[5] = new ESColor(Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalESCColor5.PreferenceItem).AsString().Value, Color.Magenta), false); prof.RenderProfile.ESColorSet[6] = new ESColor(Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalESCColor6.PreferenceItem).AsString().Value, Color.Cyan), false); prof.RenderProfile.ESColorSet[7] = new ESColor(Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalESCColor7.PreferenceItem).AsString().Value, Color.White), false); prof.RenderProfile.FontName = fa.ConvertItem(f, _terminalAsciiFont).AsString().Value; prof.RenderProfile.CJKFontName = fa.ConvertItem(f, _terminalCjkFont).AsString().Value; prof.RenderProfile.FontSize = fa.ConvertItem(f, _terminalFontSize).AsInt().Value; prof.RenderProfile.UseClearType = fa.ConvertItem(f, _terminalClearType).AsBool().Value; prof.RenderProfile.EnableBoldStyle = fa.ConvertItem(f, _terminalBoldStyle).AsBool().Value; prof.RenderProfile.ForceBoldStyle = fa.ConvertItem(f, _terminalForceBoldStyle).AsBool().Value; prof.RenderProfile.BackgroundImageFileName = fa.ConvertItem(f, _terminalBGImage).AsString().Value; if (fa.ConvertItem(f, _terminalBGImagePos).AsString().Value == "Center") { prof.RenderProfile.ImageStyle = ImageStyle.Center; } else if (fa.ConvertItem(f, _terminalBGImagePos).AsString().Value == "TopLeft") { prof.RenderProfile.ImageStyle = ImageStyle.TopLeft; } else if (fa.ConvertItem(f, _terminalBGImagePos).AsString().Value == "TopRight") { prof.RenderProfile.ImageStyle = ImageStyle.TopRight; } else if (fa.ConvertItem(f, _terminalBGImagePos).AsString().Value == "BottomLeft") { prof.RenderProfile.ImageStyle = ImageStyle.BottomLeft; } else if (fa.ConvertItem(f, _terminalBGImagePos).AsString().Value == "BottomRight") { prof.RenderProfile.ImageStyle = ImageStyle.BottomRight; } else if (fa.ConvertItem(f, _terminalBGImagePos).AsString().Value == "Scaled") { prof.RenderProfile.ImageStyle = ImageStyle.Scaled; } else if (fa.ConvertItem(f, _terminalBGImagePos).AsString().Value == "HorizontalFit") { prof.RenderProfile.ImageStyle = ImageStyle.HorizontalFit; } else if (fa.ConvertItem(f, _terminalBGImagePos).AsString().Value == "VerticalFit") { prof.RenderProfile.ImageStyle = ImageStyle.VerticalFit; } // パスワード複合化 if (prof.Password != "") { prof.Password = DecryptString(prof.Password, ConnectProfilePlugin.PLUGIN_ID); } if (prof.SUPassword != "") { prof.SUPassword = DecryptString(prof.SUPassword, ConnectProfilePlugin.PLUGIN_ID); } // プロファイル追加 ConnectProfilePlugin.Profiles.AddProfile(prof); } _preferenceLoaded = true; }
/// <summary> /// CSVインポートクリックイベント /// </summary> private void _csvImportButton_Click(object sender, System.EventArgs e) { ConnectProfileList profList = new ConnectProfileList(); ConnectProfileStruct prof = new ConnectProfileStruct(); StreamReader sr = null; bool appendFlg = false; int lineCnt = 1; if (_openCSVFileDialog.ShowDialog() == DialogResult.OK) { // インポート実行確認 if (ConnectProfilePlugin.AskUserYesNoInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportConfirm"), MessageBoxIcon.Question) == DialogResult.Yes) { // 追加/削除確認 if (ConnectProfilePlugin.AskUserYesNoInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportAppendProfileList"), MessageBoxIcon.Question) == DialogResult.Yes) { appendFlg = true; } // インポート実行 try { sr = new System.IO.StreamReader(_openCSVFileDialog.FileName, System.Text.Encoding.UTF8); while (!sr.EndOfStream) { string line = sr.ReadLine(); // 各種チェック if (lineCnt == 1) { // ヘッダーチェック(1行目固定) if (_cmd.CheckCSVHeader(line) != true) { ConnectProfilePlugin.MessageBoxInvoke(string.Format(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidHeader"), lineCnt.ToString()), MessageBoxIcon.Error); return; } } else if ((line == "") || (line.IndexOf("#") == 0)) { // 空白行/行頭シャープの行はスキップ lineCnt++; continue; } else { // フィールド数チェック if (_cmd.CheckCSVFieldCount(line) != true) { ConnectProfilePlugin.MessageBoxInvoke(string.Format(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidFieldCount"), lineCnt.ToString()), MessageBoxIcon.Error); return; } // 各項目チェック prof = _cmd.CheckCSVData(line); if (prof == null) { ConnectProfilePlugin.MessageBoxInvoke(string.Format(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportFailed"), lineCnt.ToString()), MessageBoxIcon.Error); return; } // プロファイル追加 if (appendFlg == true) { _cmd.AddProfileCommand(ConnectProfilePlugin.Profiles, prof); } else { _cmd.AddProfileCommand(profList, prof); } } lineCnt++; } // プロファイルリスト全置換 if (appendFlg == false) { _cmd.ReplaceAllProfileCommand(ConnectProfilePlugin.Profiles, profList); } RefreshAllProfiles(); RefreshSelectCount(); ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportComplete"), MessageBoxIcon.Information); } catch (Exception ex) { ConnectProfilePlugin.MessageBoxInvoke(ex.Message, MessageBoxIcon.Error); } finally { if (sr != null) { sr.Close(); } } } else { // キャンセル ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportCancel"), MessageBoxIcon.Warning); } } }
/// <summary> /// 読み込み /// </summary> public void LoadFromPreference() { IPreferenceFolderArray fa = _rootPreference.FindChildFolderArray(_profileDefinition.Id); foreach (IPreferenceFolder f in fa.Folders) { ConnectProfileStruct prof = new ConnectProfileStruct(); prof.HostName = fa.ConvertItem(f, _hostName).AsString().Value; if (fa.ConvertItem(f, _protocol).AsString().Value == "Telnet") prof.Protocol = ConnectionMethod.Telnet; else if (fa.ConvertItem(f, _protocol).AsString().Value == "SSH1") prof.Protocol = ConnectionMethod.SSH1; else if (fa.ConvertItem(f, _protocol).AsString().Value == "SSH2") prof.Protocol = ConnectionMethod.SSH2; prof.Port = fa.ConvertItem(f, _port).AsInt().Value; if (fa.ConvertItem(f, _authType).AsString().Value == "Password") prof.AuthType = AuthType.Password; else if (fa.ConvertItem(f, _authType).AsString().Value == "PublicKey") prof.AuthType = AuthType.PublicKey; else if (fa.ConvertItem(f, _authType).AsString().Value == "KeyboardInteractive") prof.AuthType = AuthType.KeyboardInteractive; prof.KeyFile = fa.ConvertItem(f, _keyFile).AsString().Value; prof.UserName = fa.ConvertItem(f, _userName).AsString().Value; prof.Password = fa.ConvertItem(f, _password).AsString().Value; prof.AutoLogin = fa.ConvertItem(f, _autoLogin).AsBool().Value; prof.LoginPrompt = fa.ConvertItem(f, _loginPrompt).AsString().Value; prof.PasswordPrompt = fa.ConvertItem(f, _passwordPrompt).AsString().Value; prof.ExecCommand = fa.ConvertItem(f, _execCommand).AsString().Value; prof.SUUserName = fa.ConvertItem(f, _suUserName).AsString().Value; prof.SUPassword = fa.ConvertItem(f, _suPassword).AsString().Value; prof.SUType = fa.ConvertItem(f, _suType).AsString().Value; if (fa.ConvertItem(f, _charCode).AsString().Value == "ISO8859_1") prof.CharCode = EncodingType.ISO8859_1; else if (fa.ConvertItem(f, _charCode).AsString().Value == "UTF8") prof.CharCode = EncodingType.UTF8; else if (fa.ConvertItem(f, _charCode).AsString().Value == "EUC_JP") prof.CharCode = EncodingType.EUC_JP; else if (fa.ConvertItem(f, _charCode).AsString().Value == "SHIFT_JIS") prof.CharCode = EncodingType.SHIFT_JIS; else if (fa.ConvertItem(f, _charCode).AsString().Value == "GB2312") prof.CharCode = EncodingType.GB2312; else if (fa.ConvertItem(f, _charCode).AsString().Value == "BIG5") prof.CharCode = EncodingType.BIG5; else if (fa.ConvertItem(f, _charCode).AsString().Value == "EUC_CN") prof.CharCode = EncodingType.EUC_CN; else if (fa.ConvertItem(f, _charCode).AsString().Value == "EUC_KR") prof.CharCode = EncodingType.EUC_KR; else if (fa.ConvertItem(f, _charCode).AsString().Value == "UTF8_Latin") prof.CharCode = EncodingType.UTF8_Latin; else if (fa.ConvertItem(f, _charCode).AsString().Value == "OEM850") prof.CharCode = EncodingType.OEM850; if (fa.ConvertItem(f, _newLine).AsString().Value == "CR") prof.NewLine = NewLine.CR; else if (fa.ConvertItem(f, _newLine).AsString().Value == "LF") prof.NewLine = NewLine.LF; else if (fa.ConvertItem(f, _newLine).AsString().Value == "CRLF") prof.NewLine = NewLine.CRLF; prof.TelnetNewLine = fa.ConvertItem(f, _telnetNewLine).AsBool().Value; if (fa.ConvertItem(f, _terminalType).AsString().Value == "KTerm") prof.TerminalType = TerminalType.KTerm; else if (fa.ConvertItem(f, _terminalType).AsString().Value == "VT100") prof.TerminalType = TerminalType.VT100; else if (fa.ConvertItem(f, _terminalType).AsString().Value == "XTerm") prof.TerminalType = TerminalType.XTerm; prof.CommandSendInterval = fa.ConvertItem(f, _commandSendInterval).AsInt().Value; prof.PromptRecvTimeout = fa.ConvertItem(f, _promptRecvTimeout).AsInt().Value; prof.ProfileItemColor = Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _profileItemColor.PreferenceItem).AsString().Value, Color.Black); prof.Description = fa.ConvertItem(f, _description).AsString().Value; // 表示オプション prof.RenderProfile = ConnectProfilePlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions.CreateRenderProfile(); prof.RenderProfile.ForeColor = Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalFontColor.PreferenceItem).AsString().Value, Color.White); prof.RenderProfile.BackColor = Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalBGColor.PreferenceItem).AsString().Value, Color.Black); prof.RenderProfile.ESColorSet = new EscapesequenceColorSet(); prof.RenderProfile.ESColorSet.ResetToDefault(); prof.RenderProfile.ESColorSet[0] = new ESColor(Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalESCColor0.PreferenceItem).AsString().Value, Color.Black), false); prof.RenderProfile.ESColorSet[1] = new ESColor(Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalESCColor1.PreferenceItem).AsString().Value, Color.Red), false); prof.RenderProfile.ESColorSet[2] = new ESColor(Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalESCColor2.PreferenceItem).AsString().Value, Color.Green), false); prof.RenderProfile.ESColorSet[3] = new ESColor(Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalESCColor3.PreferenceItem).AsString().Value, Color.Yellow), false); prof.RenderProfile.ESColorSet[4] = new ESColor(Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalESCColor4.PreferenceItem).AsString().Value, Color.Blue), false); prof.RenderProfile.ESColorSet[5] = new ESColor(Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalESCColor5.PreferenceItem).AsString().Value, Color.Magenta), false); prof.RenderProfile.ESColorSet[6] = new ESColor(Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalESCColor6.PreferenceItem).AsString().Value, Color.Cyan), false); prof.RenderProfile.ESColorSet[7] = new ESColor(Poderosa.ParseUtil.ParseColor(fa.ConvertItem(f, _terminalESCColor7.PreferenceItem).AsString().Value, Color.White), false); prof.RenderProfile.FontName = fa.ConvertItem(f, _terminalAsciiFont).AsString().Value; prof.RenderProfile.CJKFontName = fa.ConvertItem(f, _terminalCjkFont).AsString().Value; prof.RenderProfile.FontSize = fa.ConvertItem(f, _terminalFontSize).AsInt().Value; prof.RenderProfile.UseClearType = fa.ConvertItem(f, _terminalClearType).AsBool().Value; prof.RenderProfile.EnableBoldStyle = fa.ConvertItem(f, _terminalBoldStyle).AsBool().Value; prof.RenderProfile.ForceBoldStyle = fa.ConvertItem(f, _terminalForceBoldStyle).AsBool().Value; prof.RenderProfile.BackgroundImageFileName = fa.ConvertItem(f, _terminalBGImage).AsString().Value; if (fa.ConvertItem(f, _terminalBGImagePos).AsString().Value == "Center") prof.RenderProfile.ImageStyle = ImageStyle.Center; else if (fa.ConvertItem(f, _terminalBGImagePos).AsString().Value == "TopLeft") prof.RenderProfile.ImageStyle = ImageStyle.TopLeft; else if (fa.ConvertItem(f, _terminalBGImagePos).AsString().Value == "TopRight") prof.RenderProfile.ImageStyle = ImageStyle.TopRight; else if (fa.ConvertItem(f, _terminalBGImagePos).AsString().Value == "BottomLeft") prof.RenderProfile.ImageStyle = ImageStyle.BottomLeft; else if (fa.ConvertItem(f, _terminalBGImagePos).AsString().Value == "BottomRight") prof.RenderProfile.ImageStyle = ImageStyle.BottomRight; else if (fa.ConvertItem(f, _terminalBGImagePos).AsString().Value == "Scaled") prof.RenderProfile.ImageStyle = ImageStyle.Scaled; else if (fa.ConvertItem(f, _terminalBGImagePos).AsString().Value == "HorizontalFit") prof.RenderProfile.ImageStyle = ImageStyle.HorizontalFit; else if (fa.ConvertItem(f, _terminalBGImagePos).AsString().Value == "VerticalFit") prof.RenderProfile.ImageStyle = ImageStyle.VerticalFit; // パスワード複合化 if (prof.Password != "") prof.Password = DecryptString(prof.Password, ConnectProfilePlugin.PLUGIN_ID); if (prof.SUPassword != "") prof.SUPassword = DecryptString(prof.SUPassword, ConnectProfilePlugin.PLUGIN_ID); // プロファイル追加 ConnectProfilePlugin.Profiles.AddProfile(prof); } _preferenceLoaded = true; }
/// <summary> /// CSVインポートクリックイベント /// </summary> private void _csvImportButton_Click(object sender, System.EventArgs e) { ConnectProfileList profList = new ConnectProfileList(); ConnectProfileStruct prof = new ConnectProfileStruct(); StreamReader sr = null; bool appendFlg = false; int lineCnt = 1; if (_openCSVFileDialog.ShowDialog() == DialogResult.OK) { // インポート実行確認 if (ConnectProfilePlugin.AskUserYesNoInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportConfirm"), MessageBoxIcon.Question) == DialogResult.Yes) { // 追加/削除確認 if (ConnectProfilePlugin.AskUserYesNoInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportAppendProfileList"), MessageBoxIcon.Question) == DialogResult.Yes) { appendFlg = true; } // インポート実行 try { sr = new System.IO.StreamReader(_openCSVFileDialog.FileName, System.Text.Encoding.UTF8); while (!sr.EndOfStream) { string line = sr.ReadLine(); // 各種チェック if (lineCnt == 1) { // ヘッダーチェック(1行目固定) if (_cmd.CheckCSVHeader(line) != true) { ConnectProfilePlugin.MessageBoxInvoke(string.Format(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidHeader"), lineCnt.ToString()), MessageBoxIcon.Error); return; } } else if ((line == "") || (line.IndexOf("#") == 0)) { // 空白行/行頭シャープの行はスキップ lineCnt++; continue; } else { // フィールド数チェック if (_cmd.CheckCSVFieldCount(line) != true) { ConnectProfilePlugin.MessageBoxInvoke(string.Format(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidFieldCount"), lineCnt.ToString()), MessageBoxIcon.Error); return; } // 各項目チェック prof = _cmd.CheckCSVData(line); if (prof == null) { ConnectProfilePlugin.MessageBoxInvoke(string.Format(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportFailed"), lineCnt.ToString()), MessageBoxIcon.Error); return; } // プロファイル追加 if (appendFlg == true) _cmd.AddProfileCommand(ConnectProfilePlugin.Profiles, prof); else _cmd.AddProfileCommand(profList, prof); } lineCnt++; } // プロファイルリスト全置換 if (appendFlg == false) _cmd.ReplaceAllProfileCommand(ConnectProfilePlugin.Profiles, profList); RefreshAllProfiles(); RefreshSelectCount(); ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportComplete"), MessageBoxIcon.Information); } catch (Exception ex) { ConnectProfilePlugin.MessageBoxInvoke(ex.Message, MessageBoxIcon.Error); } finally { if (sr != null) sr.Close(); } } else { // キャンセル ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportCancel"), MessageBoxIcon.Warning); } } }
/// <summary> /// カレントセッションプロファイルを新規作成 /// </summary> /// <param name="ts">ターミナルセッション</param> public void NewProfileCurrentSessionCommand(ITerminalSession ts) { ISSHLoginParameter ssh = (ISSHLoginParameter)ts.TerminalConnection.Destination.GetAdapter(typeof(ISSHLoginParameter)); ITelnetParameter telnet = (ITelnetParameter)ts.TerminalConnection.Destination.GetAdapter(typeof(ITelnetParameter)); ITCPParameter tcp = null; ConnectProfileStruct prof = new ConnectProfileStruct(); // プロトコルチェック if (telnet != null) { // Telnet tcp = (ITCPParameter)ts.TerminalConnection.Destination.GetAdapter(typeof(ITCPParameter)); prof.Protocol = ConnectionMethod.Telnet; prof.HostName = tcp.Destination; prof.Port = tcp.Port; prof.TelnetNewLine = telnet.TelnetNewLine; } else { // SSH tcp = (ITCPParameter)ssh.GetAdapter(typeof(ITCPParameter)); prof.HostName = tcp.Destination; prof.Port = tcp.Port; prof.UserName = ssh.Account; prof.Password = ssh.PasswordOrPassphrase; prof.KeyFile = ssh.IdentityFileName; prof.AutoLogin = true; if (ssh.Method.ToString() == "SSH1") { prof.Protocol = ConnectionMethod.SSH1; } else if (ssh.Method.ToString() == "SSH2") { prof.Protocol = ConnectionMethod.SSH2; } if (ssh.AuthenticationType.ToString() == "Password") { prof.AuthType = AuthType.Password; } else if (ssh.AuthenticationType.ToString() == "PublicKey") { prof.AuthType = AuthType.PublicKey; } else if (ssh.AuthenticationType.ToString() == "KeyboardInteractive") { prof.AuthType = AuthType.KeyboardInteractive; } } // その他設定 prof.CharCode = ts.TerminalSettings.Encoding; prof.NewLine = ts.TerminalSettings.TransmitNL; prof.TerminalType = ts.TerminalSettings.TerminalType; if (ts.TerminalSettings.RenderProfile == null) { prof.RenderProfile = ConnectProfilePlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions.CreateRenderProfile(); prof.RenderProfile.ESColorSet = new EscapesequenceColorSet(); prof.RenderProfile.ESColorSet.ResetToDefault(); } else { prof.RenderProfile = ts.TerminalSettings.RenderProfile; } prof.CommandSendInterval = ConnectProfileStruct.DEFAULT_CMD_SEND_INTERVAL; prof.PromptRecvTimeout = ConnectProfileStruct.DEFAULT_PROMPT_RECV_TIMEOUT; prof.ProfileItemColor = System.Drawing.Color.Black; // ウィンドウ表示/プロファイル追加 ProfileEditForm dlg = new ProfileEditForm(prof); if (dlg.ShowDialog() == DialogResult.OK) { AddProfileCommand(ConnectProfilePlugin.Profiles, dlg.ResultProfile); } }
/// <summary> /// コンストラクタ /// </summary> /// <param name="prof">プロファイル</param> public ConnectProfileTerminal(ConnectProfileStruct prof) { _prof = prof; }
/// <summary> /// プロファイルを削除 /// </summary> /// <param name="p">プロファイル</param> public void DeleteProfile(ConnectProfileStruct p) { _data.Remove(p); }
/// <summary> /// プロファイルを編集 /// </summary> /// <param name="proflist">プロファイルリスト</param> /// <param name="prof">プロファイル</param> public void EditProfileCommand(ConnectProfileList proflist, ConnectProfileStruct prof) { ProfileEditForm dlg = new ProfileEditForm(prof); if (dlg.ShowDialog() == DialogResult.OK) { proflist.ReplaceProfile(prof, dlg.ResultProfile); } }
/// <summary> /// コンストラクタ /// </summary> /// <param name="prof">プロファイル</param> public ProfileEditForm(ConnectProfileStruct prof) { InitializeComponent(); InitializeComponentValue(); // オブジェクト初期値設定 if (prof == null) { // 新規作成時はデフォルト値を設定 _protocolBox.SelectedItem = ConnectionMethod.SSH2; _portBox.Value = ConnectProfileStruct.DEFAULT_SSH_PORT; _authTypeBox.SelectedItem = AuthType.Password; _charCodeBox.SelectedItem = EncodingType.UTF8; _newLineTypeBox.SelectedItem = NewLine.CR; _telnetNewLineCheck.Checked = true; _terminalTypeBox.SelectedItem = TerminalType.XTerm; _commandSendIntBox.Value = ConnectProfileStruct.DEFAULT_CMD_SEND_INTERVAL; _promptRecvTimeoutBox.Value = ConnectProfileStruct.DEFAULT_PROMPT_RECV_TIMEOUT; // コンソール表示オブジェクトはターミナルオプション値を反映 _renderProfile = ConnectProfilePlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions.CreateRenderProfile(); } else { // 編集時は対象プロファイル値を設定 _hostNameBox.Text = prof.HostName; _protocolBox.SelectedItem = prof.Protocol; _portBox.Value = prof.Port; _authTypeBox.SelectedItem = prof.AuthType; _keyFileBox.Text = prof.KeyFile; _userNameBox.Text = prof.UserName; _passwordBox.Text = prof.Password; _autoLoginCheck.Checked = prof.AutoLogin; _loginPromptBox.Text = prof.LoginPrompt; _passwordPromptBox.Text = prof.PasswordPrompt; _execCommandBox.Text = prof.ExecCommand; _suUserNameBox.Text = prof.SUUserName; _suPasswordBox.Text = prof.SUPassword; if (prof.SUType == _suTypeRadio1.Text) { _suTypeRadio1.Checked = true; } else if (prof.SUType == _suTypeRadio2.Text) { _suTypeRadio2.Checked = true; } else if (prof.SUType == _suTypeRadio3.Text) { _suTypeRadio3.Checked = true; } else if (prof.SUType == _suTypeRadio4.Text) { _suTypeRadio4.Checked = true; } _charCodeBox.SelectedItem = prof.CharCode; _newLineTypeBox.SelectedItem = prof.NewLine; _telnetNewLineCheck.Checked = prof.TelnetNewLine; _terminalTypeBox.SelectedItem = prof.TerminalType; _commandSendIntBox.Value = prof.CommandSendInterval; _promptRecvTimeoutBox.Value = prof.PromptRecvTimeout; _profileItemColorButton.SelectedColor = prof.ProfileItemColor; _descriptionBox.Text = prof.Description; _renderProfile = ConnectProfilePlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions.CreateRenderProfile(); _renderProfile = prof.RenderProfile; } _Initialized = true; EnableValidControls(this, EventArgs.Empty); }
/// <summary> /// プロファイルを追加 /// </summary> /// <param name="proflist">プロファイルリスト</param> /// <param name="prof">プロファイル</param> public void AddProfileCommand(ConnectProfileList proflist, ConnectProfileStruct prof) { proflist.AddProfile(prof); }
/// <summary> /// プロファイルを追加 /// </summary> /// <param name="p">プロファイル</param> public void AddProfile(ConnectProfileStruct p) { _data.Add(p); }
/// <summary> /// プロファイルを置換 /// </summary> /// <param name="p1">置換前プロファイル</param> /// <param name="p2">置換後プロファイル</param> public void ReplaceProfile(ConnectProfileStruct p1, ConnectProfileStruct p2) { _data[_data.IndexOf(p1)] = p2; }
/// <summary> /// CSVデータ整合性チェック /// </summary> /// <param name="data">CSVデータ</param> public ConnectProfileStruct CheckCSVData(string data) { ConnectProfileStruct prof = new ConnectProfileStruct(); ITerminalEmulatorOptions terminalOptions = ConnectProfilePlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions; string[] ary = data.Split(','); int tmp; float tmpfloat; // ホスト名 if (ary[0] != "") prof.HostName = ary[0]; else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidHostName"), MessageBoxIcon.Error); return null; } // プロトコル( if (ary[1].ToLower() == "telnet") prof.Protocol = ConnectionMethod.Telnet; else if (ary[1].ToLower() == "ssh1") prof.Protocol = ConnectionMethod.SSH1; else if (ary[1].ToLower() == "ssh2") prof.Protocol = ConnectionMethod.SSH2; else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidProtocol"), MessageBoxIcon.Error); return null; } // ポート if (int.TryParse(ary[2], out tmp) == true) prof.Port = tmp; else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidPort"), MessageBoxIcon.Error); return null; } // SSH認証方法(空白=Password) if ((ary[3].ToLower() == "password") || (ary[3] == "")) prof.AuthType = AuthType.Password; else if (ary[3].ToLower() == "publickey") prof.AuthType = AuthType.PublicKey; else if (ary[3].ToLower() == "keyboardinteractive") prof.AuthType = AuthType.KeyboardInteractive; else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidAuthType"), MessageBoxIcon.Error); return null; } // 秘密鍵ファイル/ユーザ名/パスワード prof.KeyFile = ary[4]; prof.UserName = ary[5]; prof.Password = ary[6]; // 自動ログイン(空白=false) if (ary[7].ToLower() == "true") prof.AutoLogin = true; else if ((ary[7].ToLower() == "false") || ary[7] == "") prof.AutoLogin = false; else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidAutoLogin"), MessageBoxIcon.Error); return null; } // プロンプト/実行コマンド/SU prof.LoginPrompt = ary[8]; prof.PasswordPrompt = ary[9]; prof.ExecCommand = ary[10]; prof.SUUserName = ary[11]; prof.SUPassword = ary[12]; // SUコマンド if (ary[13].ToLower() == "") prof.SUType = ""; else if (ary[13].ToLower() == ConnectProfilePlugin.Strings.GetString("Form.AddProfile._suTypeRadio1")) prof.SUType = ConnectProfilePlugin.Strings.GetString("Form.AddProfile._suTypeRadio1"); else if (ary[13].ToLower() == ConnectProfilePlugin.Strings.GetString("Form.AddProfile._suTypeRadio2")) prof.SUType = ConnectProfilePlugin.Strings.GetString("Form.AddProfile._suTypeRadio2"); else if (ary[13].ToLower() == ConnectProfilePlugin.Strings.GetString("Form.AddProfile._suTypeRadio3")) prof.SUType = ConnectProfilePlugin.Strings.GetString("Form.AddProfile._suTypeRadio3"); else if (ary[13].ToLower() == ConnectProfilePlugin.Strings.GetString("Form.AddProfile._suTypeRadio4")) prof.SUType = ConnectProfilePlugin.Strings.GetString("Form.AddProfile._suTypeRadio4"); else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidSUType"), MessageBoxIcon.Error); return null; } // 文字コード(空白=UTF8) if (ary[14].ToLower() == "iso8859_1") prof.CharCode = EncodingType.ISO8859_1; else if ((ary[14].ToLower() == "utf8") || (ary[14]) == "") prof.CharCode = EncodingType.UTF8; else if (ary[14].ToLower() == "euc_jp") prof.CharCode = EncodingType.EUC_JP; else if (ary[14].ToLower() == "shift_jis") prof.CharCode = EncodingType.SHIFT_JIS; else if (ary[14].ToLower() == "gb2312") prof.CharCode = EncodingType.GB2312; else if (ary[14].ToLower() == "big5") prof.CharCode = EncodingType.BIG5; else if (ary[14].ToLower() == "euc_cn") prof.CharCode = EncodingType.EUC_CN; else if (ary[14].ToLower() == "euc_kr") prof.CharCode = EncodingType.EUC_KR; else if (ary[14].ToLower() == "utf8_latin") prof.CharCode = EncodingType.UTF8_Latin; else if (ary[14].ToLower() == "oem850") prof.CharCode = EncodingType.OEM850; else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidCharCode"), MessageBoxIcon.Error); return null; } // 改行コード(空白=CR) if ((ary[15].ToLower() == "cr") || (ary[15] == "")) prof.NewLine = NewLine.CR; else if (ary[15].ToLower() == "lf") prof.NewLine = NewLine.LF; else if (ary[15].ToLower() == "crlf") prof.NewLine = NewLine.CRLF; else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidNewLine"), MessageBoxIcon.Error); return null; } // TelnetNewLine(空白=true) if ((ary[16].ToLower() == "true") || (ary[16] == "")) prof.TelnetNewLine = true; else if (ary[16].ToLower() == "false") prof.TelnetNewLine = false; else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidTelnetNewLine"), MessageBoxIcon.Error); return null; } // ターミナル種類(空白=XTerm) if (ary[17].ToLower() == "kterm") prof.TerminalType = TerminalType.KTerm; else if (ary[17].ToLower() == "vt100") prof.TerminalType = TerminalType.VT100; else if ((ary[17].ToLower() == "xterm") || (ary[17] == "")) prof.TerminalType = TerminalType.XTerm; else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidTerminalType"), MessageBoxIcon.Error); return null; } // 表示オプション(背景/フォント/エスケープシーケンス色) prof.RenderProfile = ConnectProfilePlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions.CreateRenderProfile(); prof.RenderProfile.ForeColor = Poderosa.ParseUtil.ParseColor(ary[18].ToLower(), terminalOptions.TextColor); prof.RenderProfile.BackColor = Poderosa.ParseUtil.ParseColor(ary[19].ToLower(), terminalOptions.BGColor); prof.RenderProfile.ESColorSet = new EscapesequenceColorSet(); prof.RenderProfile.ESColorSet.ResetToDefault(); prof.RenderProfile.ESColorSet[0] = new ESColor(Poderosa.ParseUtil.ParseColor(ary[20].ToLower(), terminalOptions.EscapeSequenceColorSet[0].Color), false); prof.RenderProfile.ESColorSet[1] = new ESColor(Poderosa.ParseUtil.ParseColor(ary[21].ToLower(), terminalOptions.EscapeSequenceColorSet[1].Color), false); prof.RenderProfile.ESColorSet[2] = new ESColor(Poderosa.ParseUtil.ParseColor(ary[22].ToLower(), terminalOptions.EscapeSequenceColorSet[2].Color), false); prof.RenderProfile.ESColorSet[3] = new ESColor(Poderosa.ParseUtil.ParseColor(ary[23].ToLower(), terminalOptions.EscapeSequenceColorSet[3].Color), false); prof.RenderProfile.ESColorSet[4] = new ESColor(Poderosa.ParseUtil.ParseColor(ary[24].ToLower(), terminalOptions.EscapeSequenceColorSet[4].Color), false); prof.RenderProfile.ESColorSet[5] = new ESColor(Poderosa.ParseUtil.ParseColor(ary[25].ToLower(), terminalOptions.EscapeSequenceColorSet[5].Color), false); prof.RenderProfile.ESColorSet[6] = new ESColor(Poderosa.ParseUtil.ParseColor(ary[26].ToLower(), terminalOptions.EscapeSequenceColorSet[6].Color), false); prof.RenderProfile.ESColorSet[7] = new ESColor(Poderosa.ParseUtil.ParseColor(ary[27].ToLower(), terminalOptions.EscapeSequenceColorSet[7].Color), false); // 表示オプション(フォント) prof.RenderProfile.FontName = (ary[28] != "") ? ary[28] : terminalOptions.Font.Name; prof.RenderProfile.CJKFontName = (ary[29] != "") ? ary[29] : terminalOptions.CJKFont.Name; if (ary[30] == "") prof.RenderProfile.FontSize = terminalOptions.Font.Size; else if (float.TryParse(ary[30], out tmpfloat) == true) prof.RenderProfile.FontSize = tmpfloat; else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidFontSize"), MessageBoxIcon.Error); return null; } if (ary[31] == "") prof.RenderProfile.UseClearType = terminalOptions.UseClearType; else if (ary[31].ToLower() == "true") prof.RenderProfile.UseClearType = true; else if (ary[31].ToLower() == "false") prof.RenderProfile.UseClearType = false; else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidClearType"), MessageBoxIcon.Error); return null; } if (ary[32] == "") prof.RenderProfile.EnableBoldStyle = terminalOptions.EnableBoldStyle; else if (ary[32].ToLower() == "true") prof.RenderProfile.EnableBoldStyle = true; else if (ary[32].ToLower() == "false") prof.RenderProfile.EnableBoldStyle = false; else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidBoldStyle"), MessageBoxIcon.Error); return null; } if (ary[33] == "") prof.RenderProfile.ForceBoldStyle = terminalOptions.ForceBoldStyle; else if (ary[33].ToLower() == "true") prof.RenderProfile.ForceBoldStyle = true; else if (ary[33].ToLower() == "false") prof.RenderProfile.ForceBoldStyle = false; else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidForceBoldStyle"), MessageBoxIcon.Error); return null; } // 表示オプション(背景画像, ファイルチェックあり) if (ary[34] == "") prof.RenderProfile.BackgroundImageFileName = terminalOptions.BackgroundImageFileName; else prof.RenderProfile.BackgroundImageFileName = ary[34]; if (prof.RenderProfile.BackgroundImageFileName != "") { try { Image.FromFile(prof.RenderProfile.BackgroundImageFileName); } catch (Exception) { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidBackgroundImageFileName"), MessageBoxIcon.Error); return null; } } if (ary[35] == "") prof.RenderProfile.ImageStyle = terminalOptions.ImageStyle; else if (ary[35].ToLower() == "center") prof.RenderProfile.ImageStyle = ImageStyle.Center; else if (ary[35].ToLower() == "topleft") prof.RenderProfile.ImageStyle = ImageStyle.TopLeft; else if (ary[35].ToLower() == "topright") prof.RenderProfile.ImageStyle = ImageStyle.TopRight; else if (ary[35].ToLower() == "bottomleft") prof.RenderProfile.ImageStyle = ImageStyle.BottomLeft; else if (ary[35].ToLower() == "bottomright") prof.RenderProfile.ImageStyle = ImageStyle.BottomRight; else if (ary[35].ToLower() == "scaled") prof.RenderProfile.ImageStyle = ImageStyle.Scaled; else if (ary[35].ToLower() == "horizontalfit") prof.RenderProfile.ImageStyle = ImageStyle.HorizontalFit; else if (ary[35].ToLower() == "verticalfit") prof.RenderProfile.ImageStyle = ImageStyle.VerticalFit; else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidImageStyle"), MessageBoxIcon.Error); return null; } // コマンド発行間隔 if (ary[36] == "") prof.CommandSendInterval = ConnectProfileStruct.DEFAULT_CMD_SEND_INTERVAL; else if (int.TryParse(ary[36], out tmp) == true) prof.CommandSendInterval = tmp; else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidCommandSendInterval"), MessageBoxIcon.Error); return null; } // プロンプト受信タイムアウト if (ary[37] == "") prof.PromptRecvTimeout = ConnectProfileStruct.DEFAULT_PROMPT_RECV_TIMEOUT; else if (int.TryParse(ary[37], out tmp) == true) prof.PromptRecvTimeout = tmp; else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidPromptRecvTimeout"), MessageBoxIcon.Error); return null; } // 項目色 prof.ProfileItemColor = Poderosa.ParseUtil.ParseColor(ary[38].ToLower(), Color.Black); // 説明 prof.Description = ary[39]; return prof; }
/// <summary> /// 接続 /// </summary> /// <param name="prof">プロファイル</param> public void ConnectProfile(ConnectProfileStruct prof) { _connectCancelFlg = false; ConnectProfileTerminal terminal = new ConnectProfileTerminal(prof); Thread _connectThread = new Thread((ThreadStart)delegate() { terminal.Connect(); }); _connectThread.IsBackground = true; _connectThread.Start(); // スレッド終了待機(Joinを使用するとフリーズしてしまう) while (true) { Thread.Sleep(10); if (_connectCancelFlg == true) _connectThread.Abort(); // 接続キャンセル(スレッド終了) if (_connectThread.IsAlive != true) break; // スレッド終了後break System.Windows.Forms.Application.DoEvents(); } }
/// <summary> /// CSV変換 /// </summary> /// <param name="prof">プロファイル</param> /// <param name="hidepw">パスワードを隠す</param> public string ConvertCSV(ConnectProfileStruct prof, bool hidepw) { return string.Format( ConnectProfileStruct.FMT_CSV, prof.HostName, prof.Protocol.ToString(), prof.Port.ToString(), prof.AuthType.ToString(), prof.KeyFile, prof.UserName, (hidepw == true) ? "" : prof.Password, prof.AutoLogin.ToString(), prof.LoginPrompt, prof.PasswordPrompt, prof.ExecCommand, prof.SUUserName, (hidepw == true) ? "" : prof.SUPassword, prof.SUType, prof.CharCode.ToString(), prof.NewLine.ToString(), prof.TelnetNewLine.ToString(), prof.TerminalType.ToString(), Convert.ToString(prof.RenderProfile.ForeColor.ToArgb(), 16), Convert.ToString(prof.RenderProfile.BackColor.ToArgb(), 16), Convert.ToString(prof.RenderProfile.ESColorSet[0].Color.ToArgb(), 16), Convert.ToString(prof.RenderProfile.ESColorSet[1].Color.ToArgb(), 16), Convert.ToString(prof.RenderProfile.ESColorSet[2].Color.ToArgb(), 16), Convert.ToString(prof.RenderProfile.ESColorSet[3].Color.ToArgb(), 16), Convert.ToString(prof.RenderProfile.ESColorSet[4].Color.ToArgb(), 16), Convert.ToString(prof.RenderProfile.ESColorSet[5].Color.ToArgb(), 16), Convert.ToString(prof.RenderProfile.ESColorSet[6].Color.ToArgb(), 16), Convert.ToString(prof.RenderProfile.ESColorSet[7].Color.ToArgb(), 16), prof.RenderProfile.FontName, prof.RenderProfile.CJKFontName, prof.RenderProfile.FontSize.ToString(), prof.RenderProfile.UseClearType.ToString(), prof.RenderProfile.EnableBoldStyle.ToString(), prof.RenderProfile.ForceBoldStyle.ToString(), prof.RenderProfile.BackgroundImageFileName, prof.RenderProfile.ImageStyle.ToString(), prof.CommandSendInterval.ToString(), prof.PromptRecvTimeout.ToString(), Convert.ToString(prof.ProfileItemColor.ToArgb(), 16), prof.Description ); }
/// <summary> /// CSVデータ整合性チェック /// </summary> /// <param name="data">CSVデータ</param> public ConnectProfileStruct CheckCSVData(string data) { ConnectProfileStruct prof = new ConnectProfileStruct(); ITerminalEmulatorOptions terminalOptions = ConnectProfilePlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions; string[] ary = data.Split(','); int tmp; float tmpfloat; // ホスト名 if (ary[0] != "") { prof.HostName = ary[0]; } else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidHostName"), MessageBoxIcon.Error); return(null); } // プロトコル( if (ary[1].ToLower() == "telnet") { prof.Protocol = ConnectionMethod.Telnet; } else if (ary[1].ToLower() == "ssh1") { prof.Protocol = ConnectionMethod.SSH1; } else if (ary[1].ToLower() == "ssh2") { prof.Protocol = ConnectionMethod.SSH2; } else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidProtocol"), MessageBoxIcon.Error); return(null); } // ポート if (int.TryParse(ary[2], out tmp) == true) { prof.Port = tmp; } else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidPort"), MessageBoxIcon.Error); return(null); } // SSH認証方法(空白=Password) if ((ary[3].ToLower() == "password") || (ary[3] == "")) { prof.AuthType = AuthType.Password; } else if (ary[3].ToLower() == "publickey") { prof.AuthType = AuthType.PublicKey; } else if (ary[3].ToLower() == "keyboardinteractive") { prof.AuthType = AuthType.KeyboardInteractive; } else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidAuthType"), MessageBoxIcon.Error); return(null); } // 秘密鍵ファイル/ユーザ名/パスワード prof.KeyFile = ary[4]; prof.UserName = ary[5]; prof.Password = ary[6]; // 自動ログイン(空白=false) if (ary[7].ToLower() == "true") { prof.AutoLogin = true; } else if ((ary[7].ToLower() == "false") || ary[7] == "") { prof.AutoLogin = false; } else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidAutoLogin"), MessageBoxIcon.Error); return(null); } // プロンプト/実行コマンド/SU prof.LoginPrompt = ary[8]; prof.PasswordPrompt = ary[9]; prof.ExecCommand = ary[10]; prof.SUUserName = ary[11]; prof.SUPassword = ary[12]; // SUコマンド if (ary[13].ToLower() == "") { prof.SUType = ""; } else if (ary[13].ToLower() == ConnectProfilePlugin.Strings.GetString("Form.AddProfile._suTypeRadio1")) { prof.SUType = ConnectProfilePlugin.Strings.GetString("Form.AddProfile._suTypeRadio1"); } else if (ary[13].ToLower() == ConnectProfilePlugin.Strings.GetString("Form.AddProfile._suTypeRadio2")) { prof.SUType = ConnectProfilePlugin.Strings.GetString("Form.AddProfile._suTypeRadio2"); } else if (ary[13].ToLower() == ConnectProfilePlugin.Strings.GetString("Form.AddProfile._suTypeRadio3")) { prof.SUType = ConnectProfilePlugin.Strings.GetString("Form.AddProfile._suTypeRadio3"); } else if (ary[13].ToLower() == ConnectProfilePlugin.Strings.GetString("Form.AddProfile._suTypeRadio4")) { prof.SUType = ConnectProfilePlugin.Strings.GetString("Form.AddProfile._suTypeRadio4"); } else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidSUType"), MessageBoxIcon.Error); return(null); } // 文字コード(空白=UTF8) if (ary[14].ToLower() == "iso8859_1") { prof.CharCode = EncodingType.ISO8859_1; } else if ((ary[14].ToLower() == "utf8") || (ary[14]) == "") { prof.CharCode = EncodingType.UTF8; } else if (ary[14].ToLower() == "euc_jp") { prof.CharCode = EncodingType.EUC_JP; } else if (ary[14].ToLower() == "shift_jis") { prof.CharCode = EncodingType.SHIFT_JIS; } else if (ary[14].ToLower() == "gb2312") { prof.CharCode = EncodingType.GB2312; } else if (ary[14].ToLower() == "big5") { prof.CharCode = EncodingType.BIG5; } else if (ary[14].ToLower() == "euc_cn") { prof.CharCode = EncodingType.EUC_CN; } else if (ary[14].ToLower() == "euc_kr") { prof.CharCode = EncodingType.EUC_KR; } else if (ary[14].ToLower() == "utf8_latin") { prof.CharCode = EncodingType.UTF8_Latin; } else if (ary[14].ToLower() == "oem850") { prof.CharCode = EncodingType.OEM850; } else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidCharCode"), MessageBoxIcon.Error); return(null); } // 改行コード(空白=CR) if ((ary[15].ToLower() == "cr") || (ary[15] == "")) { prof.NewLine = NewLine.CR; } else if (ary[15].ToLower() == "lf") { prof.NewLine = NewLine.LF; } else if (ary[15].ToLower() == "crlf") { prof.NewLine = NewLine.CRLF; } else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidNewLine"), MessageBoxIcon.Error); return(null); } // TelnetNewLine(空白=true) if ((ary[16].ToLower() == "true") || (ary[16] == "")) { prof.TelnetNewLine = true; } else if (ary[16].ToLower() == "false") { prof.TelnetNewLine = false; } else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidTelnetNewLine"), MessageBoxIcon.Error); return(null); } // ターミナル種類(空白=XTerm) if (ary[17].ToLower() == "kterm") { prof.TerminalType = TerminalType.KTerm; } else if (ary[17].ToLower() == "vt100") { prof.TerminalType = TerminalType.VT100; } else if ((ary[17].ToLower() == "xterm") || (ary[17] == "")) { prof.TerminalType = TerminalType.XTerm; } else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidTerminalType"), MessageBoxIcon.Error); return(null); } // 表示オプション(背景/フォント/エスケープシーケンス色) prof.RenderProfile = ConnectProfilePlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions.CreateRenderProfile(); prof.RenderProfile.ForeColor = Poderosa.ParseUtil.ParseColor(ary[18].ToLower(), terminalOptions.TextColor); prof.RenderProfile.BackColor = Poderosa.ParseUtil.ParseColor(ary[19].ToLower(), terminalOptions.BGColor); prof.RenderProfile.ESColorSet = new EscapesequenceColorSet(); prof.RenderProfile.ESColorSet.ResetToDefault(); prof.RenderProfile.ESColorSet[0] = new ESColor(Poderosa.ParseUtil.ParseColor(ary[20].ToLower(), terminalOptions.EscapeSequenceColorSet[0].Color), false); prof.RenderProfile.ESColorSet[1] = new ESColor(Poderosa.ParseUtil.ParseColor(ary[21].ToLower(), terminalOptions.EscapeSequenceColorSet[1].Color), false); prof.RenderProfile.ESColorSet[2] = new ESColor(Poderosa.ParseUtil.ParseColor(ary[22].ToLower(), terminalOptions.EscapeSequenceColorSet[2].Color), false); prof.RenderProfile.ESColorSet[3] = new ESColor(Poderosa.ParseUtil.ParseColor(ary[23].ToLower(), terminalOptions.EscapeSequenceColorSet[3].Color), false); prof.RenderProfile.ESColorSet[4] = new ESColor(Poderosa.ParseUtil.ParseColor(ary[24].ToLower(), terminalOptions.EscapeSequenceColorSet[4].Color), false); prof.RenderProfile.ESColorSet[5] = new ESColor(Poderosa.ParseUtil.ParseColor(ary[25].ToLower(), terminalOptions.EscapeSequenceColorSet[5].Color), false); prof.RenderProfile.ESColorSet[6] = new ESColor(Poderosa.ParseUtil.ParseColor(ary[26].ToLower(), terminalOptions.EscapeSequenceColorSet[6].Color), false); prof.RenderProfile.ESColorSet[7] = new ESColor(Poderosa.ParseUtil.ParseColor(ary[27].ToLower(), terminalOptions.EscapeSequenceColorSet[7].Color), false); // 表示オプション(フォント) prof.RenderProfile.FontName = (ary[28] != "") ? ary[28] : terminalOptions.Font.Name; prof.RenderProfile.CJKFontName = (ary[29] != "") ? ary[29] : terminalOptions.CJKFont.Name; if (ary[30] == "") { prof.RenderProfile.FontSize = terminalOptions.Font.Size; } else if (float.TryParse(ary[30], out tmpfloat) == true) { prof.RenderProfile.FontSize = tmpfloat; } else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidFontSize"), MessageBoxIcon.Error); return(null); } if (ary[31] == "") { prof.RenderProfile.UseClearType = terminalOptions.UseClearType; } else if (ary[31].ToLower() == "true") { prof.RenderProfile.UseClearType = true; } else if (ary[31].ToLower() == "false") { prof.RenderProfile.UseClearType = false; } else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidClearType"), MessageBoxIcon.Error); return(null); } if (ary[32] == "") { prof.RenderProfile.EnableBoldStyle = terminalOptions.EnableBoldStyle; } else if (ary[32].ToLower() == "true") { prof.RenderProfile.EnableBoldStyle = true; } else if (ary[32].ToLower() == "false") { prof.RenderProfile.EnableBoldStyle = false; } else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidBoldStyle"), MessageBoxIcon.Error); return(null); } if (ary[33] == "") { prof.RenderProfile.ForceBoldStyle = terminalOptions.ForceBoldStyle; } else if (ary[33].ToLower() == "true") { prof.RenderProfile.ForceBoldStyle = true; } else if (ary[33].ToLower() == "false") { prof.RenderProfile.ForceBoldStyle = false; } else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidForceBoldStyle"), MessageBoxIcon.Error); return(null); } // 表示オプション(背景画像, ファイルチェックあり) if (ary[34] == "") { prof.RenderProfile.BackgroundImageFileName = terminalOptions.BackgroundImageFileName; } else { prof.RenderProfile.BackgroundImageFileName = ary[34]; } if (prof.RenderProfile.BackgroundImageFileName != "") { try { Image.FromFile(prof.RenderProfile.BackgroundImageFileName); } catch (Exception) { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidBackgroundImageFileName"), MessageBoxIcon.Error); return(null); } } if (ary[35] == "") { prof.RenderProfile.ImageStyle = terminalOptions.ImageStyle; } else if (ary[35].ToLower() == "center") { prof.RenderProfile.ImageStyle = ImageStyle.Center; } else if (ary[35].ToLower() == "topleft") { prof.RenderProfile.ImageStyle = ImageStyle.TopLeft; } else if (ary[35].ToLower() == "topright") { prof.RenderProfile.ImageStyle = ImageStyle.TopRight; } else if (ary[35].ToLower() == "bottomleft") { prof.RenderProfile.ImageStyle = ImageStyle.BottomLeft; } else if (ary[35].ToLower() == "bottomright") { prof.RenderProfile.ImageStyle = ImageStyle.BottomRight; } else if (ary[35].ToLower() == "scaled") { prof.RenderProfile.ImageStyle = ImageStyle.Scaled; } else if (ary[35].ToLower() == "horizontalfit") { prof.RenderProfile.ImageStyle = ImageStyle.HorizontalFit; } else if (ary[35].ToLower() == "verticalfit") { prof.RenderProfile.ImageStyle = ImageStyle.VerticalFit; } else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidImageStyle"), MessageBoxIcon.Error); return(null); } // コマンド発行間隔 if (ary[36] == "") { prof.CommandSendInterval = ConnectProfileStruct.DEFAULT_CMD_SEND_INTERVAL; } else if (int.TryParse(ary[36], out tmp) == true) { prof.CommandSendInterval = tmp; } else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidCommandSendInterval"), MessageBoxIcon.Error); return(null); } // プロンプト受信タイムアウト if (ary[37] == "") { prof.PromptRecvTimeout = ConnectProfileStruct.DEFAULT_PROMPT_RECV_TIMEOUT; } else if (int.TryParse(ary[37], out tmp) == true) { prof.PromptRecvTimeout = tmp; } else { ConnectProfilePlugin.MessageBoxInvoke(ConnectProfilePlugin.Strings.GetString("Message.ConnectProfile.CSVImportInvalidPromptRecvTimeout"), MessageBoxIcon.Error); return(null); } // 項目色 prof.ProfileItemColor = Poderosa.ParseUtil.ParseColor(ary[38].ToLower(), Color.Black); // 説明 prof.Description = ary[39]; return(prof); }