Пример #1
0
        public override UIHandleResult OnMouseUp(MouseEventArgs args)
        {
            if (!_control.EnabledEx)
            {
                return(UIHandleResult.Pass);
            }

            if (args.Button == MouseButtons.Right || args.Button == MouseButtons.Middle)
            {
                ITerminalEmulatorOptions opt = TerminalEmulatorPlugin.Instance.TerminalEmulatorOptions;
                MouseButtonAction        act = args.Button == MouseButtons.Right? opt.RightButtonAction : opt.MiddleButtonAction;
                if (act != MouseButtonAction.None)
                {
                    if (Control.ModifierKeys == Keys.Shift ^ act == MouseButtonAction.ContextMenu)                //シフトキーで動作反転
                    {
                        ShowContextMenu(new Point(args.X, args.Y));
                    }
                    else                       //Paste
                    {
                        IGeneralViewCommands vc = (IGeneralViewCommands)_control.GetAdapter(typeof(IGeneralViewCommands));
                        TerminalEmulatorPlugin.Instance.GetCommandManager().Execute(vc.Paste, (ICommandTarget)vc.GetAdapter(typeof(ICommandTarget)));
                        //ペースト後はフォーカス
                        if (!_control.Focused)
                        {
                            _control.Focus();
                        }
                    }

                    return(UIHandleResult.Stop);
                }
            }

            return(UIHandleResult.Pass);
        }
Пример #2
0
        public void Reset(ITerminalEmulatorOptions opt)
        {
            //TODO ������PeripheralPanel�Ƃ��Ԃ��Ă���B�Ȃ�Ƃ�������
            StringBuilder bld = new StringBuilder();
            if (opt.Send0x7FByDel)
                bld.Append("Delete=0x7F");
            if (opt.Send0x7FByBack) {
                if (bld.Length > 0)
                    bld.Append(", ");
                bld.Append("Back=0x7F");
            }

            KeyboardStyle ks = opt.Zone0x1F;
            if (ks != KeyboardStyle.None) {
                string s;
                if (ks == KeyboardStyle.Default)
                    s = "Ctrl+D6=0x1E, Ctrl+Minus=0x1F";
                else //Japanese
                    s = "Ctrl+BackSlash=0x1F";
                if (bld.Length > 0)
                    bld.Append(", ");
                bld.Append(s);
            }

            if (opt.CustomKeySettings.Length > 0) {
                if (bld.Length > 0)
                    bld.Append(", ");
                bld.Append(opt.CustomKeySettings);
            }

            //�d�グ�B�p�[�X�G���[��������ƃA����
            _keyFunction = KeyFunction.Parse(bld.ToString()).ToFixedStyle();
        }
Пример #3
0
 /// <summary>
 /// Starts benchmark thread int the derived class
 /// </summary>
 protected override void StartBenchmarkThread(ITerminalEmulatorOptions options, ITerminalSession session) {
     _options = options;
     _session = session;
     Thread thread = new Thread(new ThreadStart(BenchmarkThread));
     thread.Name = "Poderosa.Benchmark.DataLoadBenchmark";
     thread.Start();
 }
Пример #4
0
        public void InitUI(ITerminalEmulatorOptions options)
        {
            AdjustFontDescription(options.Font, options.CJKFont);
            _fontSample.Font      = options.Font;
            _fontSample.BackColor = options.BGColor;
            _fontSample.ForeColor = options.TextColor;
            _fontSample.ClearType = options.UseClearType;
            _fontSample.Invalidate(true);
            _backgroundImageBox.Text     = options.BackgroundImageFileName;
            _imageStyleBox.SelectedItem  = options.ImageStyle;  // select EnumListItem<T> by T
            _bgColorBox.SelectedColor    = options.BGColor;
            _textColorBox.SelectedColor  = options.TextColor;
            _caretStyleBox.SelectedItem  = options.CaretType;   // select ListItem<T> by T
            _caretSpecifyColor.Checked   = !options.CaretColor.IsEmpty;
            _caretBlink.Checked          = options.CaretBlink;
            _caretColorBox.SelectedColor = options.CaretColor;

            _ESColorSet = options.EscapeSequenceColorSet;
            _darkenEsColorForBackground.Checked = options.DarkenEsColorForBackground;
            _useClearType        = options.UseClearType;
            _enableBoldStyle     = options.EnableBoldStyle;
            _font                = options.Font;
            _cjkFont             = options.CJKFont;
            _forceBoldStyle      = options.ForceBoldStyle;
            _lineSpacingBox.Text = options.LineSpacing.ToString();
        }
Пример #5
0
        public void Reset(ITerminalEmulatorOptions opt)
        {
            //TODO ここはPeripheralPanelとかぶっている。なんとかしたい
            StringBuilder bld = new StringBuilder();
            if (opt.Send0x7FByDel)
                bld.Append("Delete=0x7F");
            if (opt.Send0x7FByBack) {
                if (bld.Length > 0)
                    bld.Append(", ");
                bld.Append("Back=0x7F");
            }

            KeyboardStyle ks = opt.Zone0x1F;
            if (ks != KeyboardStyle.None) {
                string s;
                if (ks == KeyboardStyle.Default)
                    s = "Ctrl+D6=0x1E, Ctrl+Minus=0x1F";
                else //Japanese
                    s = "Ctrl+BackSlash=0x1F";
                if (bld.Length > 0)
                    bld.Append(", ");
                bld.Append(s);
            }

            if (opt.CustomKeySettings.Length > 0) {
                if (bld.Length > 0)
                    bld.Append(", ");
                bld.Append(opt.CustomKeySettings);
            }

            //仕上げ。パースエラーがちょっとアレだ
            _keyFunction = KeyFunction.Parse(bld.ToString()).ToFixedStyle();
        }
Пример #6
0
        /// <summary>
        /// Starts benchmark thread int the derived class
        /// </summary>
        protected override void StartBenchmarkThread(ITerminalEmulatorOptions options, ITerminalSession session)
        {
            _options = options;
            _session = session;
            Thread thread = new Thread(new ThreadStart(BenchmarkThread));

            thread.Name = "Poderosa.Benchmark.DataLoadBenchmark";
            thread.Start();
        }
Пример #7
0
        public LogService(ITerminalParameter param, ITerminalSettings settings)
        {
            _binaryLoggers = new BinaryLoggerList();
            _textLoggers   = new TextLoggerList();
            _xmlLoggers    = new XmlLoggerList();
            ITerminalEmulatorOptions opt = GEnv.Options;

            if (opt.DefaultLogType != LogType.None)
            {
                ApplySimpleLogSetting(new SimpleLogSettings(opt.DefaultLogType, CreateAutoLogFileName(opt, param, settings)));
            }
        }
Пример #8
0
 public void InitUI(ITerminalEmulatorOptions options, ICoreServicePreference window_options)
 {
     _leftAltKeyAction.SelectedIndex   = (int)options.LeftAltKey;
     _rightAltKeyAction.SelectedIndex  = (int)options.RightAltKey;
     _send0x7FByDel.Checked            = options.Send0x7FByDel;
     _send0x7FByBack.Checked           = options.Send0x7FByBack;
     _autoCopyByLeftButton.Checked     = window_options.AutoCopyByLeftButton;
     _rightButtonAction.SelectedIndex  = (int)options.RightButtonAction;
     _middleButtonAction.SelectedIndex = (int)options.MiddleButtonAction;
     _wheelAmount.Text                   = options.WheelAmount.ToString();
     _zone0x1FBox.SelectedIndex          = (int)options.Zone0x1F;
     _viewSplitModifierBox.SelectedIndex = ToViewSplitOptionIndex(window_options.ViewSplitModifier);
     _customKeySettingsBox.Text          = options.CustomKeySettings;
 }
Пример #9
0
        public void Reset(ITerminalEmulatorOptions opt)
        {
            //TODO ここはPeripheralPanelとかぶっている。なんとかしたい
            StringBuilder bld = new StringBuilder();

            if (opt.Send0x7FByDel)
            {
                bld.Append("Delete=0x7F");
            }
            if (opt.Send0x7FByBack)
            {
                if (bld.Length > 0)
                {
                    bld.Append(", ");
                }
                bld.Append("Back=0x7F");
            }

            KeyboardStyle ks = opt.Zone0x1F;

            if (ks != KeyboardStyle.None)
            {
                string s;
                if (ks == KeyboardStyle.Default)
                {
                    s = "Ctrl+D6=0x1E, Ctrl+Minus=0x1F";
                }
                else //Japanese
                {
                    s = "Ctrl+BackSlash=0x1F";
                }
                if (bld.Length > 0)
                {
                    bld.Append(", ");
                }
                bld.Append(s);
            }

            if (opt.CustomKeySettings.Length > 0)
            {
                if (bld.Length > 0)
                {
                    bld.Append(", ");
                }
                bld.Append(opt.CustomKeySettings);
            }

            //仕上げ。パースエラーがちょっとアレだ
            _keyFunction = KeyFunction.Parse(bld.ToString()).ToFixedStyle();
        }
Пример #10
0
        public CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args)
        {
            IPoderosaView    view;
            ITerminalSession session;

            if (!GetViewAndSession(target, out view, out session))
            {
                return(CommandResult.Ignored);
            }
            var clipboardData = Clipboard.GetDataObject();

            if (!clipboardData.GetDataPresent("Text"))
            {
                return(CommandResult.Ignored);
            }

            string data = clipboardData.GetData("Text") as string;

            if (data == null)
            {
                return(CommandResult.Ignored);
            }

            ITerminalEmulatorOptions options = TerminalSessionsPlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions;

            if (options.AlertOnPasteNewLineChar)
            {
                // Data will be split by CR, LF, CRLF or Environment.NewLine by TextReader.ReadLine,
                // So we check the data about CR, LF and Environment.NewLine.
                if (data.IndexOfAny(new char[] { '\r', '\n' }) >= 0 || data.Contains(Environment.NewLine))
                {
                    IPoderosaForm form = view.ParentForm;
                    if (form != null)
                    {
                        DialogResult res = form.AskUserYesNo(TEnv.Strings.GetString("Message.AskPasteNewLineChar"));
                        if (res != DialogResult.Yes)
                        {
                            return(CommandResult.Ignored);
                        }
                    }
                }
            }

            StringReader         reader = new StringReader(data);
            TerminalTransmission output = session.TerminalTransmission;

            output.SendTextStream(reader, data[data.Length - 1] == '\n');
            return(CommandResult.Succeeded);
        }
Пример #11
0
 public void ApplyTerminalOptions(ITerminalEmulatorOptions opt)
 {
     if (this.EnabledEx)
     {
         if (GetTerminalSettings().UsingDefaultRenderProfile)
         {
             using (RenderProfile profile = opt.CreateRenderProfile())
                 ApplyRenderProfile(profile);
         }
         _caret.Style = opt.CaretType;
         _caret.Blink = opt.CaretBlink;
         _caret.Color = opt.CaretColor;
         _caret.Reset();
     }
 }
Пример #12
0
        public bool Commit(ITerminalEmulatorOptions options)
        {
            StringResource sr         = OptionDialogPlugin.Instance.Strings;
            string         itemname   = null;
            bool           successful = false;

            try {
                if (_backgroundImageBox.Text.Length > 0)
                {
                    try {
                        Image.FromFile(_backgroundImageBox.Text);
                    }
                    catch (Exception) {
                        GUtil.Warning(this, String.Format(sr.GetString("Message.OptionDialog.InvalidPictureFile"), _backgroundImageBox.Text));
                        return(false);
                    }
                }
                options.BackgroundImageFileName = _backgroundImageBox.Text;
                options.ImageStyle = ((EnumListItem <ImageStyle>)_imageStyleBox.SelectedItem).Value;

                options.BGColor   = _bgColorBox.SelectedColor;
                options.TextColor = _textColorBox.SelectedColor;

                options.CaretColor             = _caretSpecifyColor.Checked ? _caretColorBox.SelectedColor : Color.Empty;
                options.CaretType              = ((ListItem <CaretType>)_caretStyleBox.SelectedItem).Value;
                options.CaretBlink             = _caretBlink.Checked;
                options.EscapeSequenceColorSet = _ESColorSet;

                options.UseClearType    = _useClearType;
                options.EnableBoldStyle = _enableBoldStyle;
                options.ForceBoldStyle  = this._forceBoldStyle;
                options.LineSpacing     = int.Parse(this._lineSpacingBox.Text);
                options.Font            = _font;
                options.CJKFont         = _cjkFont;

                options.DarkenEsColorForBackground = _darkenEsColorForBackground.Checked;

                successful = true;
            }
            catch (FormatException) {
                GUtil.Warning(this, String.Format(sr.GetString("Message.OptionDialog.InvalidItem"), itemname));
            }
            catch (InvalidOptionException ex) {
                GUtil.Warning(this, ex.Message);
            }

            return(successful);
        }
Пример #13
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public void InitializePreference(IPreferenceBuilder builder, IPreferenceFolder folder)
        {
            ITerminalEmulatorOptions terminalOptions = ConnectProfilePlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions;

            _rootPreference    = folder;
            _profileDefinition = builder.DefineFolderArray(folder, this, "profile");
            _hostName          = builder.DefineStringValue(_profileDefinition, "hostName", "", null);
            _protocol          = builder.DefineStringValue(_profileDefinition, "protocol", "", null);
            _port                   = builder.DefineIntValue(_profileDefinition, "port", 0, null);
            _authType               = builder.DefineStringValue(_profileDefinition, "authType", "", null);
            _keyFile                = builder.DefineStringValue(_profileDefinition, "keyFile", "", null);
            _userName               = builder.DefineStringValue(_profileDefinition, "userName", "", null);
            _password               = builder.DefineStringValue(_profileDefinition, "password", "", null);
            _autoLogin              = builder.DefineBoolValue(_profileDefinition, "autoLogin", false, null);
            _loginPrompt            = builder.DefineStringValue(_profileDefinition, "loginPrompt", "", null);
            _passwordPrompt         = builder.DefineStringValue(_profileDefinition, "passwordPrompt", "", null);
            _execCommand            = builder.DefineStringValue(_profileDefinition, "execCommand", "", null);
            _suUserName             = builder.DefineStringValue(_profileDefinition, "suUserName", "", null);
            _suPassword             = builder.DefineStringValue(_profileDefinition, "suPassword", "", null);
            _suType                 = builder.DefineStringValue(_profileDefinition, "suType", "", null);
            _charCode               = builder.DefineStringValue(_profileDefinition, "charCode", "", null);
            _newLine                = builder.DefineStringValue(_profileDefinition, "newLine", "", null);
            _telnetNewLine          = builder.DefineBoolValue(_profileDefinition, "telnetNewLine", true, null);
            _terminalType           = builder.DefineStringValue(_profileDefinition, "terminalType", "", null);
            _terminalFontColor      = new ColorPreferenceItem(builder.DefineStringValue(_profileDefinition, "terminalFontColor", terminalOptions.TextColor.Name, null), KnownColor.White);
            _terminalBGColor        = new ColorPreferenceItem(builder.DefineStringValue(_profileDefinition, "terminalBGColor", terminalOptions.BGColor.Name, null), KnownColor.Black);
            _terminalESCColor0      = new ColorPreferenceItem(builder.DefineStringValue(_profileDefinition, "terminalESCColor0", terminalOptions.EscapeSequenceColorSet[0].Color.Name, null), KnownColor.Black);
            _terminalESCColor1      = new ColorPreferenceItem(builder.DefineStringValue(_profileDefinition, "terminalESCColor1", terminalOptions.EscapeSequenceColorSet[1].Color.Name, null), KnownColor.Red);
            _terminalESCColor2      = new ColorPreferenceItem(builder.DefineStringValue(_profileDefinition, "terminalESCColor2", terminalOptions.EscapeSequenceColorSet[2].Color.Name, null), KnownColor.Green);
            _terminalESCColor3      = new ColorPreferenceItem(builder.DefineStringValue(_profileDefinition, "terminalESCColor3", terminalOptions.EscapeSequenceColorSet[3].Color.Name, null), KnownColor.Yellow);
            _terminalESCColor4      = new ColorPreferenceItem(builder.DefineStringValue(_profileDefinition, "terminalESCColor4", terminalOptions.EscapeSequenceColorSet[4].Color.Name, null), KnownColor.Blue);
            _terminalESCColor5      = new ColorPreferenceItem(builder.DefineStringValue(_profileDefinition, "terminalESCColor5", terminalOptions.EscapeSequenceColorSet[5].Color.Name, null), KnownColor.Magenta);
            _terminalESCColor6      = new ColorPreferenceItem(builder.DefineStringValue(_profileDefinition, "terminalESCColor6", terminalOptions.EscapeSequenceColorSet[6].Color.Name, null), KnownColor.Cyan);
            _terminalESCColor7      = new ColorPreferenceItem(builder.DefineStringValue(_profileDefinition, "terminalESCColor7", terminalOptions.EscapeSequenceColorSet[7].Color.Name, null), KnownColor.White);
            _terminalAsciiFont      = builder.DefineStringValue(_profileDefinition, "terminalAsciiFont", terminalOptions.Font.Name, null);
            _terminalCjkFont        = builder.DefineStringValue(_profileDefinition, "terminalCjkFont", terminalOptions.CJKFont.Name, null);
            _terminalFontSize       = builder.DefineIntValue(_profileDefinition, "terminalFontSize", (int)terminalOptions.Font.Size, null);
            _terminalClearType      = builder.DefineBoolValue(_profileDefinition, "terminalClearType", terminalOptions.UseClearType, null);
            _terminalBoldStyle      = builder.DefineBoolValue(_profileDefinition, "terminalBoldStyle", terminalOptions.EnableBoldStyle, null);
            _terminalForceBoldStyle = builder.DefineBoolValue(_profileDefinition, "terminalForceBoldStyle", terminalOptions.ForceBoldStyle, null);
            _terminalBGImage        = builder.DefineStringValue(_profileDefinition, "terminalBGImage", terminalOptions.BackgroundImageFileName, null);
            _terminalBGImagePos     = builder.DefineStringValue(_profileDefinition, "terminalBGImagePos", terminalOptions.ImageStyle.ToString(), null);
            _commandSendInterval    = builder.DefineIntValue(_profileDefinition, "commandSendInterval", ConnectProfileStruct.DEFAULT_CMD_SEND_INTERVAL, null);
            _promptRecvTimeout      = builder.DefineIntValue(_profileDefinition, "promptRecvTimeout", ConnectProfileStruct.DEFAULT_PROMPT_RECV_TIMEOUT, null);
            _profileItemColor       = new ColorPreferenceItem(builder.DefineStringValue(_profileDefinition, "profileItemColor", "Black", null), KnownColor.Black);
            _description            = builder.DefineStringValue(_profileDefinition, "description", "", null);
        }
Пример #14
0
        public bool Commit(ITerminalEmulatorOptions options)
        {
            StringResource sr = OptionDialogPlugin.Instance.Strings;
            string itemname = null;
            bool successful = false;
            try {
                if (_backgroundImageBox.Text.Length > 0) {
                    try {
                        Image.FromFile(_backgroundImageBox.Text);
                    }
                    catch (Exception) {
                        GUtil.Warning(this, String.Format(sr.GetString("Message.OptionDialog.InvalidPictureFile"), _backgroundImageBox.Text));
                        return false;
                    }
                }
                options.BackgroundImageFileName = _backgroundImageBox.Text;
                options.ImageStyle = ((EnumListItem<ImageStyle>)_imageStyleBox.SelectedItem).Value;

                options.BGColor = _bgColorBox.SelectedColor;
                options.TextColor = _textColorBox.SelectedColor;

                options.CaretColor = _caretSpecifyColor.Checked ? _caretColorBox.SelectedColor : Color.Empty;
                options.CaretType = ((ListItem<CaretType>)_caretStyleBox.SelectedItem).Value;
                options.CaretBlink = _caretBlink.Checked;
                options.EscapeSequenceColorSet = _ESColorSet;

                options.UseClearType = _useClearType;
                options.EnableBoldStyle = _enableBoldStyle;
                options.ForceBoldStyle = this._forceBoldStyle;
                options.LineSpacing = int.Parse(this._lineSpacingBox.Text);
                options.Font = _font;
                options.CJKFont = _cjkFont;

                options.DarkenEsColorForBackground = _darkenEsColorForBackground.Checked;

                successful = true;
            }
            catch (FormatException) {
                GUtil.Warning(this, String.Format(sr.GetString("Message.OptionDialog.InvalidItem"), itemname));
            }
            catch (InvalidOptionException ex) {
                GUtil.Warning(this, ex.Message);
            }

            return successful;
        }
Пример #15
0
        private string CreateAutoLogFileName(ITerminalEmulatorOptions opt, ITerminalParameter param, ITerminalSettings settings)
        {
            string filebody;
            //if(fmts.Length==0) {
            DateTime now = DateTime.Now;

            this._logFileName = ReplaceCharForLogFile(settings.Caption);
            if (opt.DefaultLogDirectory.EndsWith("\\"))
            {
                filebody = String.Format("{0}{1}_{2}{3,2:D2}{4,2:D2}", opt.DefaultLogDirectory, ReplaceCharForLogFile(settings.Caption), now.Year, now.Month, now.Day);
            }
            else
            {
                filebody = String.Format("{0}\\{1}_{2}{3,2:D2}{4,2:D2}", opt.DefaultLogDirectory, ReplaceCharForLogFile(settings.Caption), now.Year, now.Month, now.Day);
            }
            //}
            //else
            //    filebody = fmts[0].FormatFileName(opt.DefaultLogDirectory, param, settings);


            int n = 1;

            do
            {
                string filename;
                if (n == 1)
                {
                    filename = String.Format("{0}.log", filebody);
                }
                else
                {
                    filename = String.Format("{0}_{1}.log", filebody, n);
                }

                if (!File.Exists(filename))
                {
                    return(filename);
                }
                else
                {
                    n++;
                }
            } while(true);
        }
Пример #16
0
        public bool Commit(ITerminalEmulatorOptions options, ICoreServicePreference window_options)
        {
            StringResource sr         = OptionDialogPlugin.Instance.Strings;
            bool           successful = false;
            string         itemname   = null;

            try {
                //Win9xでは、左右のAltの区別ができないので別々の設定にすることを禁止する
                if (System.Environment.OSVersion.Platform == PlatformID.Win32Windows &&
                    ((EnumListItem <AltKeyAction>)_leftAltKeyAction.SelectedItem).Value
                    != ((EnumListItem <AltKeyAction>)_rightAltKeyAction.SelectedItem).Value)
                {
                    GUtil.Warning(this, sr.GetString("Message.OptionDialog.AltKeyOnWin9x"));
                    return(false);
                }

                options.LeftAltKey     = ((EnumListItem <AltKeyAction>)_leftAltKeyAction.SelectedItem).Value;
                options.RightAltKey    = ((EnumListItem <AltKeyAction>)_rightAltKeyAction.SelectedItem).Value;
                options.Send0x7FByDel  = _send0x7FByDel.Checked;
                options.Send0x7FByBack = _send0x7FByBack.Checked;
                options.Zone0x1F       = ((EnumListItem <KeyboardStyle>)_zone0x1FBox.SelectedItem).Value;
                itemname = "Custom Key Setting";
                KeyFunction.Parse(_customKeySettingsBox.Text); //パースできればOK
                options.CustomKeySettings           = _customKeySettingsBox.Text;
                window_options.AutoCopyByLeftButton = _autoCopyByLeftButton.Checked;
                options.RightButtonAction           = ((EnumListItem <MouseButtonAction>)_rightButtonAction.SelectedItem).Value;
                options.MiddleButtonAction          = ((EnumListItem <MouseButtonAction>)_middleButtonAction.SelectedItem).Value;

                itemname            = sr.GetString("Caption.OptionDialog.MousewheelAmount");
                options.WheelAmount = Int32.Parse(_wheelAmount.Text);

                window_options.ViewSplitModifier = ((ListItem <Keys>)_viewSplitModifierBox.SelectedItem).Value;

                successful = true;
            }
            catch (FormatException) {
                GUtil.Warning(this, String.Format(sr.GetString("Message.OptionDialog.InvalidItem"), itemname));
            }
            catch (InvalidOptionException ex) {
                GUtil.Warning(this, ex.Message);
            }
            return(successful);
        }
Пример #17
0
        public CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args)
        {
            if (!CanExecute(target))
            {
                return(CommandResult.Ignored);
            }
            TerminalTransmission output = GetSession().TerminalTransmission;

            //string data = Clipboard.GetDataObject().GetData("Text") as string;
            string data = Clipboard.GetText();

            if (data == null || data.Length == 0)
            {
                return(CommandResult.Ignored);
            }

            ITerminalEmulatorOptions options = TerminalSessionsPlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions;

            if (options.AlertOnPasteNewLineChar)
            {
                // Data will be split by CR, LF, CRLF or Environment.NewLine by TextReader.ReadLine,
                // So we check the data about CR, LF and Environment.NewLine.
                if (data.IndexOfAny(new char[] { '\r', '\n' }) >= 0 || data.Contains(Environment.NewLine))
                {
                    IPoderosaView view = (IPoderosaView)_control.GetAdapter(typeof(IPoderosaView));
                    IPoderosaForm form = view.ParentForm;
                    if (form != null)
                    {
                        DialogResult res = form.AskUserYesNo(TEnv.Strings.GetString("Message.AskPasteNewLineChar"));
                        if (res != DialogResult.Yes)
                        {
                            return(CommandResult.Ignored);
                        }
                    }
                }
            }

            //TODO 長文のときにダイアログを出して中途キャンセル可能に
            StringReader reader = new StringReader(data);

            output.SendTextStream(reader, data[data.Length - 1] == '\n');
            return(CommandResult.Succeeded);
        }
Пример #18
0
        public void Attach(ITerminalControlHost session)
        {
            _session = session;
            SetContent(session.Terminal.GetDocument());

            ITerminalEmulatorOptions opt = TerminalEmulatorPlugin.Instance.TerminalEmulatorOptions;

            _caret.Blink = opt.CaretBlink;
            _caret.Color = opt.CaretColor;
            _caret.Style = opt.CaretType;
            _caret.Reset();

            //KeepAliveタイマ起動は最も遅らせた場合でココ
            TerminalEmulatorPlugin.Instance.KeepAlive.Refresh(opt.KeepAliveInterval);

            //ASCIIWordBreakTable : 今は共有設定だが、Session固有にデータを持つようにするかもしれない含みを持たせて。
            ASCIIWordBreakTable table = ASCIIWordBreakTable.Default;

            table.Reset();
            foreach (char ch in opt.AdditionalWordElement)
            {
                table.Set(ch, ASCIIWordBreakTable.LETTER);
            }

            lock (GetDocument()) {
                _ignoreValueChangeEvent = true;
                _session.Terminal.CommitScrollBar(_VScrollBar, false);
                _ignoreValueChangeEvent = false;

                if (!IsConnectionClosed())
                {
                    Size ts = CalcTerminalSize(GetRenderProfile());

                    //TODO ネゴ開始前はここを抑制したい
                    if (ts.Width != GetDocument().TerminalWidth || ts.Height != GetDocument().TerminalHeight)
                    {
                        ResizeTerminal(ts.Width, ts.Height);
                    }
                }
            }
            Invalidate(true);
        }
Пример #19
0
        public void InitUI(ITerminalEmulatorOptions options, ICoreServicePreference window_options)
        {
            _constructing = true;

            _leftAltKeyAction.SelectedItem   = options.LeftAltKey;          // select EnumListItem<T> by T
            _rightAltKeyAction.SelectedItem  = options.RightAltKey;         // select EnumListItem<T> by T
            _send0x7FByDel.Checked           = options.Send0x7FByDel;
            _send0x7FByBack.Checked          = options.Send0x7FByBack;
            _autoCopyByLeftButton.Checked    = window_options.AutoCopyByLeftButton;
            _rightButtonAction.SelectedItem  = options.RightButtonAction;                                  // select EnumListItem<T> by T
            _middleButtonAction.SelectedItem = options.MiddleButtonAction;                                 // select EnumListItem<T> by T
            _wheelAmount.Text                  = options.WheelAmount.ToString();
            _zone0x1FBox.SelectedItem          = options.Zone0x1F;                                         // select EnumListItem<T> by T
            _viewSplitModifierBox.SelectedItem = FixupViewSplitModifier(window_options.ViewSplitModifier); // select EnumListItem<T> by T
            _customKeySettingsBox.Text         = options.CustomKeySettings;

            _constructing = false;

            AdjustAutoKeySettings(null, null);
        }
Пример #20
0
 public void InitUI(ITerminalEmulatorOptions options)
 {
     _bufferSize.Text                           = options.TerminalBufferSize.ToString();
     _closeOnDisconnect.Checked                 = options.CloseOnDisconnect;
     _disconnectNotification.SelectedItem       = options.DisconnectNotification;  // select EnumListItem<T> by T
     _beepOnBellChar.Checked                    = options.BeepOnBellChar;
     _charDecodeErrorBehaviorBox.SelectedItem   = options.CharDecodeErrorBehavior; // select EnumListItem<T> by T
     _allowsScrollInAppMode.Checked             = options.AllowsScrollInAppMode;
     _keepAliveCheck.Checked                    = options.KeepAliveInterval != 0;
     _keepAliveIntervalBox.Enabled              = _keepAliveCheck.Checked;
     _keepAliveIntervalBox.Text                 = (options.KeepAliveInterval / 60000).ToString();
     _autoLogCheckBox.Checked                   = options.DefaultLogType != LogType.None;
     _defaultLogTypeBox.SelectedItem            = options.DefaultLogType;        // select EnumListItem<T> by T
     _defaultLogDirectory.Text                  = options.DefaultLogDirectory;
     _additionalWordElementBox.Text             = options.AdditionalWordElement;
     _enableComplementForNewConnections.Checked = options.EnableComplementForNewConnections;
     _commandPopupAlwaysOnTop.Checked           = options.CommandPopupAlwaysOnTop;
     _commandPopupInTaskBar.Checked             = options.CommandPopupInTaskBar;
     _alertOnPasteNewLineCharCheck.Checked      = options.AlertOnPasteNewLineChar;
 }
Пример #21
0
        public bool Commit(ITerminalEmulatorOptions options, ICoreServicePreference window_options)
        {
            StringResource sr = OptionDialogPlugin.Instance.Strings;
            bool successful = false;
            string itemname = null;
            try {
                //Win9xでは、左右のAltの区別ができないので別々の設定にすることを禁止する
                if (System.Environment.OSVersion.Platform == PlatformID.Win32Windows &&
                        ((EnumListItem<AltKeyAction>)_leftAltKeyAction.SelectedItem).Value
                            != ((EnumListItem<AltKeyAction>)_rightAltKeyAction.SelectedItem).Value) {
                    GUtil.Warning(this, sr.GetString("Message.OptionDialog.AltKeyOnWin9x"));
                    return false;
                }

                options.LeftAltKey = ((EnumListItem<AltKeyAction>)_leftAltKeyAction.SelectedItem).Value;
                options.RightAltKey = ((EnumListItem<AltKeyAction>)_rightAltKeyAction.SelectedItem).Value;
                options.Send0x7FByDel = _send0x7FByDel.Checked;
                options.Send0x7FByBack = _send0x7FByBack.Checked;
                options.Zone0x1F = ((EnumListItem<KeyboardStyle>)_zone0x1FBox.SelectedItem).Value;
                itemname = "Custom Key Setting";
                KeyFunction.Parse(_customKeySettingsBox.Text); //パースできればOK
                options.CustomKeySettings = _customKeySettingsBox.Text;
                window_options.AutoCopyByLeftButton = _autoCopyByLeftButton.Checked;
                options.RightButtonAction = ((EnumListItem<MouseButtonAction>)_rightButtonAction.SelectedItem).Value;
                options.MiddleButtonAction = ((EnumListItem<MouseButtonAction>)_middleButtonAction.SelectedItem).Value;

                itemname = sr.GetString("Caption.OptionDialog.MousewheelAmount");
                options.WheelAmount = Int32.Parse(_wheelAmount.Text);

                window_options.ViewSplitModifier = ((ListItem<Keys>)_viewSplitModifierBox.SelectedItem).Value;

                successful = true;
            }
            catch (FormatException) {
                GUtil.Warning(this, String.Format(sr.GetString("Message.OptionDialog.InvalidItem"), itemname));
            }
            catch (InvalidOptionException ex) {
                GUtil.Warning(this, ex.Message);
            }
            return successful;
        }
Пример #22
0
        private static string CreateAutoLogFileName(ITerminalEmulatorOptions opt, ITerminalParameter param, ITerminalSettings settings)
        {
            IAutoLogFileFormatter[] fmts = TerminalEmulatorPlugin.Instance.AutoLogFileFormatter;
            string filebody;

            if (fmts.Length == 0)
            {
                DateTime now = DateTime.Now;
                filebody = String.Format("{0}\\{1}_{2}{3,2:D2}{4,2:D2}", opt.DefaultLogDirectory, ReplaceCharForLogFile(settings.Caption), now.Year, now.Month, now.Day);
            }
            else
            {
                filebody = fmts[0].FormatFileName(opt.DefaultLogDirectory, param, settings);
            }


            int n = 1;

            do
            {
                string filename;
                if (n == 1)
                {
                    filename = String.Format("{0}.log", filebody);
                }
                else
                {
                    filename = String.Format("{0}_{1}.log", filebody, n);
                }

                if (!File.Exists(filename))
                {
                    return(filename);
                }
                else
                {
                    n++;
                }
            } while (true);
        }
Пример #23
0
        //必ずimportされるという前提なのでちょっと危険
        public void OnPreferenceImport(IPreferenceFolder oldvalues, IPreferenceFolder newvalues)
        {
            ITerminalEmulatorOptions opt = (ITerminalEmulatorOptions)newvalues.QueryAdapter(typeof(ITerminalEmulatorOptions));

            //DefaultRenderProfile
            GEnv.DefaultRenderProfile = opt.CreateRenderProfile();

            //必要なTerminalSessionにApplyTerminalOptions
            ISessionManager sm = TerminalEmulatorPlugin.Instance.GetSessionManager();

            foreach (ISession session in sm.AllSessions)
            {
                IAbstractTerminalHost ts = (IAbstractTerminalHost)session.GetAdapter(typeof(IAbstractTerminalHost));
                if (ts != null)
                {
                    TerminalControl tc = ts.TerminalControl;
                    if (tc != null)
                    {
                        tc.ApplyTerminalOptions(opt);
                    }
                }
            }

            //ASCIIWordBreakTable
            ASCIIWordBreakTable table = ASCIIWordBreakTable.Default;

            table.Reset();
            foreach (char ch in opt.AdditionalWordElement)
            {
                table.Set(ch, ASCIIWordBreakTable.LETTER);
            }

            //キーバインド系をリセット
            TerminalEmulatorPlugin.Instance.CustomKeySettings.Reset(opt);

            //KeepAliveのリフレッシュ
            TerminalEmulatorPlugin.Instance.KeepAlive.Refresh(opt.KeepAliveInterval);

            _originalOptions.ResetParseKeyFlag();
        }
        /// <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);
        }
Пример #25
0
 public void InitUI(ITerminalEmulatorOptions options) {
     _bufferSize.Text = options.TerminalBufferSize.ToString();
     _closeOnDisconnect.Checked = options.CloseOnDisconnect;
     _disconnectNotification.SelectedItem = options.DisconnectNotification;      // select EnumListItem<T> by T
     _beepOnBellChar.Checked = options.BeepOnBellChar;
     _charDecodeErrorBehaviorBox.SelectedItem = options.CharDecodeErrorBehavior; // select EnumListItem<T> by T
     _allowsScrollInAppMode.Checked = options.AllowsScrollInAppMode;
     _keepAliveCheck.Checked = options.KeepAliveInterval != 0;
     _keepAliveIntervalBox.Enabled = _keepAliveCheck.Checked;
     _keepAliveIntervalBox.Text = (options.KeepAliveInterval / 60000).ToString();
     _autoLogCheckBox.Checked = options.DefaultLogType != LogType.None;
     _defaultLogTypeBox.SelectedItem = options.DefaultLogType;                   // select EnumListItem<T> by T
     _defaultLogDirectory.Text = options.DefaultLogDirectory;
     _additionalWordElementBox.Text = options.AdditionalWordElement;
     _enableComplementForNewConnections.Checked = options.EnableComplementForNewConnections;
     _commandPopupAlwaysOnTop.Checked = options.CommandPopupAlwaysOnTop;
     _commandPopupInTaskBar.Checked = options.CommandPopupInTaskBar;
     _alertOnPasteNewLineCharCheck.Checked = options.AlertOnPasteNewLineChar;
 }
 public void ApplyTerminalOptions(ITerminalEmulatorOptions opt)
 {
     if (this.EnabledEx) {
         if (GetTerminalSettings().UsingDefaultRenderProfile) {
             ApplyRenderProfile(opt.CreateRenderProfile());
         }
         _caret.Style = opt.CaretType;
         _caret.Blink = opt.CaretBlink;
         _caret.Color = opt.CaretColor;
         _caret.Reset();
     }
 }
Пример #27
0
        public bool Commit(ITerminalEmulatorOptions options) {
            StringResource sr = OptionDialogPlugin.Instance.Strings;
            bool successful = false;
            string itemname = null;
            try {
                options.CloseOnDisconnect = _closeOnDisconnect.Checked;
                options.BeepOnBellChar = _beepOnBellChar.Checked;
                options.AllowsScrollInAppMode = _allowsScrollInAppMode.Checked;
                itemname = sr.GetString("Caption.OptionDialog.BufferLineCount");
                options.TerminalBufferSize = Int32.Parse(_bufferSize.Text);
                itemname = sr.GetString("Caption.OptionDialog.MRUCount");
                options.CharDecodeErrorBehavior = ((EnumListItem<WarningOption>)_charDecodeErrorBehaviorBox.SelectedItem).Value;
                options.DisconnectNotification = ((EnumListItem<WarningOption>)_disconnectNotification.SelectedItem).Value;
                if (_keepAliveCheck.Checked) {
                    itemname = sr.GetString("Caption.OptionDialog.KeepAliveInterval");
                    options.KeepAliveInterval = Int32.Parse(_keepAliveIntervalBox.Text) * 60000;
                }
                else
                    options.KeepAliveInterval = 0;

                foreach (char ch in _additionalWordElementBox.Text) {
                    if (ch >= 0x100) {
                        GUtil.Warning(this, sr.GetString("Message.OptionDialog.InvalidAdditionalWordElement"));
                        return false;
                    }
                }
                options.AdditionalWordElement = _additionalWordElementBox.Text;


                if (_autoLogCheckBox.Checked) {
                    if (_defaultLogDirectory.Text.Length == 0) {
                        GUtil.Warning(this, sr.GetString("Message.OptionDialog.EmptyLogDirectory"));
                        return false;
                    }
                    options.DefaultLogType = ((EnumListItem<LogType>)_defaultLogTypeBox.SelectedItem).Value;
                    if (!Directory.Exists(_defaultLogDirectory.Text)) {
                        if (GUtil.AskUserYesNo(this, String.Format(sr.GetString("Message.OptionDialog.AskCreateDirectory"), _defaultLogDirectory.Text)) == DialogResult.Yes) {
                            try {
                                System.IO.Directory.CreateDirectory(_defaultLogDirectory.Text);
                            }
                            catch (Exception) {
                                GUtil.Warning(this, String.Format(sr.GetString("Message.OptionDialog.FailedCreateDirectory")));
                            }
                        }
                        else
                            return false;
                    }
                    options.DefaultLogDirectory = _defaultLogDirectory.Text;
                }
                else
                    options.DefaultLogType = LogType.None;


                options.EnableComplementForNewConnections = _enableComplementForNewConnections.Checked;
                options.CommandPopupAlwaysOnTop = _commandPopupAlwaysOnTop.Checked;
                options.CommandPopupInTaskBar = _commandPopupInTaskBar.Checked;
                options.AlertOnPasteNewLineChar = _alertOnPasteNewLineCharCheck.Checked;

                successful = true;
            }
            catch (InvalidOptionException ex) {
                GUtil.Warning(this, ex.Message);
            }
            catch (Exception) {
                GUtil.Warning(this, String.Format(sr.GetString("Message.OptionDialog.InvalidItem"), itemname));
            }
            return successful;
        }
Пример #28
0
        public bool Commit(ITerminalEmulatorOptions options)
        {
            StringResource sr         = OptionDialogPlugin.Instance.Strings;
            bool           successful = false;
            string         itemname   = null;

            try {
                options.CloseOnDisconnect     = _closeOnDisconnect.Checked;
                options.BeepOnBellChar        = _beepOnBellChar.Checked;
                options.AllowsScrollInAppMode = _allowsScrollInAppMode.Checked;
                itemname = sr.GetString("Caption.OptionDialog.BufferLineCount");
                options.TerminalBufferSize = Int32.Parse(_bufferSize.Text);
                itemname = sr.GetString("Caption.OptionDialog.MRUCount");
                options.CharDecodeErrorBehavior = ((EnumListItem <WarningOption>)_charDecodeErrorBehaviorBox.SelectedItem).Value;
                options.DisconnectNotification  = ((EnumListItem <WarningOption>)_disconnectNotification.SelectedItem).Value;
                if (_keepAliveCheck.Checked)
                {
                    itemname = sr.GetString("Caption.OptionDialog.KeepAliveInterval");
                    options.KeepAliveInterval = Int32.Parse(_keepAliveIntervalBox.Text) * 60000;
                }
                else
                {
                    options.KeepAliveInterval = 0;
                }

                foreach (char ch in _additionalWordElementBox.Text)
                {
                    if (ch >= 0x100)
                    {
                        GUtil.Warning(this, sr.GetString("Message.OptionDialog.InvalidAdditionalWordElement"));
                        return(false);
                    }
                }
                options.AdditionalWordElement = _additionalWordElementBox.Text;


                if (_autoLogCheckBox.Checked)
                {
                    if (_defaultLogDirectory.Text.Length == 0)
                    {
                        GUtil.Warning(this, sr.GetString("Message.OptionDialog.EmptyLogDirectory"));
                        return(false);
                    }
                    options.DefaultLogType = ((EnumListItem <LogType>)_defaultLogTypeBox.SelectedItem).Value;
                    if (!Directory.Exists(_defaultLogDirectory.Text))
                    {
                        if (GUtil.AskUserYesNo(this, String.Format(sr.GetString("Message.OptionDialog.AskCreateDirectory"), _defaultLogDirectory.Text)) == DialogResult.Yes)
                        {
                            try {
                                System.IO.Directory.CreateDirectory(_defaultLogDirectory.Text);
                            }
                            catch (Exception) {
                                GUtil.Warning(this, String.Format(sr.GetString("Message.OptionDialog.FailedCreateDirectory")));
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    options.DefaultLogDirectory = _defaultLogDirectory.Text;
                }
                else
                {
                    options.DefaultLogType = LogType.None;
                }


                options.EnableComplementForNewConnections = _enableComplementForNewConnections.Checked;
                options.CommandPopupAlwaysOnTop           = _commandPopupAlwaysOnTop.Checked;
                options.CommandPopupInTaskBar             = _commandPopupInTaskBar.Checked;
                options.AlertOnPasteNewLineChar           = _alertOnPasteNewLineCharCheck.Checked;

                successful = true;
            }
            catch (InvalidOptionException ex) {
                GUtil.Warning(this, ex.Message);
            }
            catch (Exception) {
                GUtil.Warning(this, String.Format(sr.GetString("Message.OptionDialog.InvalidItem"), itemname));
            }
            return(successful);
        }
Пример #29
0
 /// <summary>
 /// Starts benchmark thread in the derived class
 /// </summary>
 protected abstract void StartBenchmarkThread(ITerminalEmulatorOptions options, ITerminalSession session);
Пример #30
0
        public void InitUI(ITerminalEmulatorOptions options, ICoreServicePreference window_options) {
            _constructing = true;

            _leftAltKeyAction.SelectedItem = options.LeftAltKey;            // select EnumListItem<T> by T
            _rightAltKeyAction.SelectedItem = options.RightAltKey;          // select EnumListItem<T> by T
            _send0x7FByDel.Checked = options.Send0x7FByDel;
            _send0x7FByBack.Checked = options.Send0x7FByBack;
            _autoCopyByLeftButton.Checked = window_options.AutoCopyByLeftButton;
            _rightButtonAction.SelectedItem = options.RightButtonAction;    // select EnumListItem<T> by T
            _middleButtonAction.SelectedItem = options.MiddleButtonAction;  // select EnumListItem<T> by T
            _wheelAmount.Text = options.WheelAmount.ToString();
            _zone0x1FBox.SelectedItem = options.Zone0x1F;                   // select EnumListItem<T> by T
            _viewSplitModifierBox.SelectedItem = FixupViewSplitModifier(window_options.ViewSplitModifier);  // select EnumListItem<T> by T
            _customKeySettingsBox.Text = options.CustomKeySettings;

            _constructing = false;

            AdjustAutoKeySettings(null, null);
        }
Пример #31
0
 /// <summary>
 /// Starts benchmark thread in the derived class
 /// </summary>
 protected abstract void StartBenchmarkThread(ITerminalEmulatorOptions options, ITerminalSession session);
Пример #32
0
        public void InitUI(ITerminalEmulatorOptions options) {
            AdjustFontDescription(options.Font, options.CJKFont);
            _fontSample.Font = options.Font;
            _fontSample.BackColor = options.BGColor;
            _fontSample.ForeColor = options.TextColor;
            _fontSample.ClearType = options.UseClearType;
            _fontSample.Invalidate(true);
            _backgroundImageBox.Text = options.BackgroundImageFileName;
            _imageStyleBox.SelectedItem = options.ImageStyle;   // select EnumListItem<T> by T 
            _bgColorBox.SelectedColor = options.BGColor;
            _textColorBox.SelectedColor = options.TextColor;
            _caretStyleBox.SelectedItem = options.CaretType;    // select ListItem<T> by T 
            _caretSpecifyColor.Checked = !options.CaretColor.IsEmpty;
            _caretBlink.Checked = options.CaretBlink;
            _caretColorBox.SelectedColor = options.CaretColor;

            _ESColorSet = options.EscapeSequenceColorSet;
            _darkenEsColorForBackground.Checked = options.DarkenEsColorForBackground;
            _useClearType = options.UseClearType;
            _enableBoldStyle = options.EnableBoldStyle;
            _font = options.Font;
            _cjkFont = options.CJKFont;
            _forceBoldStyle = options.ForceBoldStyle;
            _lineSpacingBox.Text = options.LineSpacing.ToString();
        }