Beispiel #1
0
 public void InitializePreference(IPreferenceBuilder builder, IPreferenceFolder folder) {
     _schemeTemplate = builder.DefineFolderArray(folder, this, "scheme");
     _preferenceFolderArray = folder.FindChildFolderArray("scheme");
     Debug.Assert(_preferenceFolderArray != null);
     _namePreference = builder.DefineStringValue(_schemeTemplate, "name", "", null);
     _promptPreference = builder.DefineStringValue(_schemeTemplate, "prompt", GenericShellScheme.DEFAULT_PROMPT_REGEX, null);
     _backspacePreference = builder.DefineStringValue(_schemeTemplate, "backspace", "", null);
     _commandListPreference = builder.DefineStringValue(_schemeTemplate, "commands", "", null);
 }
Beispiel #2
0
 public void InitializePreference(IPreferenceBuilder builder, IPreferenceFolder folder)
 {
     _schemeTemplate        = builder.DefineFolderArray(folder, this, "scheme");
     _preferenceFolderArray = folder.FindChildFolderArray("scheme");
     Debug.Assert(_preferenceFolderArray != null);
     _namePreference        = builder.DefineStringValue(_schemeTemplate, "name", "", null);
     _promptPreference      = builder.DefineStringValue(_schemeTemplate, "prompt", GenericShellScheme.DEFAULT_PROMPT_REGEX, null);
     _backspacePreference   = builder.DefineStringValue(_schemeTemplate, "backspace", "", null);
     _commandListPreference = builder.DefineStringValue(_schemeTemplate, "commands", "", null);
 }
        public void TestFolderArrayRead()
        {
            FolderArraySupplier supplier = new FolderArraySupplier();

            InitPreference(supplier, "unittest {\r\n  foo {\r\n  i=20\r\n  s=vieri\r\n}\r\nfoo {\r\n  i=10\r\n  s=bobo\r\n}\r\n");

            IPreferenceFolder      root  = supplier.RootFolder;
            IPreferenceFolderArray array = root.FindChildFolderArray("foo");

            Assert.AreEqual(2, array.Folders.Length);
            IPreferenceFolder foo1 = array.Folders[0];

            Assert.AreEqual("vieri", ((IStringPreferenceItem)foo1.FindItem("s")).Value);             //ToDo 文字列検索はいやらしい
            IPreferenceFolder foo2 = array.Folders[1];

            Assert.AreEqual("bobo", ((IStringPreferenceItem)foo2.FindItem("s")).Value);
        }
        public void InitializePreference(IPreferenceBuilder builder, IPreferenceFolder folder)
        {
            _originalFolder = folder;
            _adapter        = new CoreServicePreferenceAdapter(folder);
            _adapter.DefineItems(builder);

            AboutBoxUtil.InitPreference(builder, folder);

            _windowTemplatePreference = builder.DefineFolderArray(folder, this, "mainwindow");
            _windowArrayPreference    = folder.FindChildFolderArray("mainwindow");
            Debug.Assert(_windowArrayPreference != null);

            _windowPositionPreference    = builder.DefineStringValue(_windowTemplatePreference, "position", "", null);
            _windowSplitFormatPreference = builder.DefineStringValue(_windowTemplatePreference, "format", "", null);
            _toolBarFormatPreference     = builder.DefineStringValue(_windowTemplatePreference, "toolbar", "", null);
            _tabRowCountPreference       = builder.DefineIntValue(_windowTemplatePreference, "tabrowcount", 1, null);

            //add listener
            folder.AddChangeListener(new ChangeListener(_adapter));
        }
        public void TestFolderArrayWrite()
        {
            FolderArraySupplier supplier = new FolderArraySupplier();

            InitPreference(supplier, "unittest {\r\n}\r\n");

            IPreferenceFolder      root  = supplier.RootFolder;
            IPreferenceFolderArray array = root.FindChildFolderArray("foo");

            IPreferenceFolder foo1 = array.CreateNewFolder();
            IPreferenceFolder foo2 = array.CreateNewFolder();

            //((IStringPreferenceItem)foo2.FindItem("s")).Value = "zlatan";
            //((IIntPreferenceItem)foo1.FindItem("i")).Value = 5;
            array.ConvertItem(foo2, supplier._s).AsString().Value = "zlatan";
            array.ConvertItem(foo1, supplier._i).AsInt().Value    = 5;

            _poderosaApplication.Shutdown();
            Assert.AreEqual("unittest {\r\n  foo {\r\n    i=5\r\n  }\r\n  foo {\r\n    s=zlatan\r\n  }\r\n}\r\n", Dump(_rootNote));
        }
        public void InitializePreference(IPreferenceBuilder builder, IPreferenceFolder folder) {
            _originalFolder = folder;
            _adapter = new CoreServicePreferenceAdapter(folder);
            _adapter.DefineItems(builder);

            AboutBoxUtil.InitPreference(builder, folder);

            _windowTemplatePreference = builder.DefineFolderArray(folder, this, "mainwindow");
            _windowArrayPreference = folder.FindChildFolderArray("mainwindow");
            Debug.Assert(_windowArrayPreference != null);

            _windowPositionPreference = builder.DefineStringValue(_windowTemplatePreference, "position", "", null);
            _windowSplitFormatPreference = builder.DefineStringValue(_windowTemplatePreference, "format", "", null);
            _toolBarFormatPreference = builder.DefineStringValue(_windowTemplatePreference, "toolbar", "", null);
            _tabRowCountPreference = builder.DefineIntValue(_windowTemplatePreference, "tabrowcount", 1, null);

            //add listener
            folder.AddChangeListener(new ChangeListener(_adapter));
        }
Beispiel #7
0
        /// <summary>
        /// 保存
        /// </summary>
        public void SaveToPreference()
        {
            // 一度も読み込まれていない場合は読み込む(フォームが一度も表示されてない場合に設定が消滅してしまう)
            if (this.PreferenceLoaded != true)
            {
                this.LoadFromPreference();
            }
            IPreferenceFolderArray fa = _rootPreference.FindChildFolderArray(_profileDefinition.Id);

            fa.Clear();

            foreach (ConnectProfileStruct prof in ConnectProfilePlugin.Profiles)
            {
                IPreferenceFolder f = fa.CreateNewFolder();

                // パスワード暗号化(キーはPLUGIN_ID)
                string pw   = "";
                string supw = "";
                if (prof.Password != "")
                {
                    pw = EncryptString(prof.Password, ConnectProfilePlugin.PLUGIN_ID);
                }
                if (prof.SUPassword != "")
                {
                    supw = EncryptString(prof.SUPassword, ConnectProfilePlugin.PLUGIN_ID);
                }

                // 値代入
                fa.ConvertItem(f, _hostName).AsString().Value       = prof.HostName;
                fa.ConvertItem(f, _protocol).AsString().Value       = prof.Protocol.ToString();
                fa.ConvertItem(f, _port).AsInt().Value              = prof.Port;
                fa.ConvertItem(f, _authType).AsString().Value       = prof.AuthType.ToString();
                fa.ConvertItem(f, _keyFile).AsString().Value        = prof.KeyFile;
                fa.ConvertItem(f, _userName).AsString().Value       = prof.UserName;
                fa.ConvertItem(f, _password).AsString().Value       = (pw != null) ? pw : "";
                fa.ConvertItem(f, _autoLogin).AsBool().Value        = prof.AutoLogin;
                fa.ConvertItem(f, _loginPrompt).AsString().Value    = prof.LoginPrompt;
                fa.ConvertItem(f, _passwordPrompt).AsString().Value = prof.PasswordPrompt;
                fa.ConvertItem(f, _execCommand).AsString().Value    = prof.ExecCommand;
                fa.ConvertItem(f, _suUserName).AsString().Value     = prof.SUUserName;
                fa.ConvertItem(f, _suPassword).AsString().Value     = (supw != null) ? supw : "";
                fa.ConvertItem(f, _suType).AsString().Value         = prof.SUType;
                fa.ConvertItem(f, _charCode).AsString().Value       = prof.CharCode.ToString();
                fa.ConvertItem(f, _newLine).AsString().Value        = prof.NewLine.ToString();
                fa.ConvertItem(f, _telnetNewLine).AsBool().Value    = prof.TelnetNewLine;
                fa.ConvertItem(f, _terminalType).AsString().Value   = prof.TerminalType.ToString();
                fa.ConvertItem(f, _terminalFontColor.PreferenceItem).AsString().Value = Convert.ToString(prof.RenderProfile.ForeColor.ToArgb(), 16);
                fa.ConvertItem(f, _terminalBGColor.PreferenceItem).AsString().Value   = Convert.ToString(prof.RenderProfile.BackColor.ToArgb(), 16);
                fa.ConvertItem(f, _terminalESCColor0.PreferenceItem).AsString().Value = Convert.ToString(prof.RenderProfile.ESColorSet[0].Color.ToArgb(), 16);
                fa.ConvertItem(f, _terminalESCColor1.PreferenceItem).AsString().Value = Convert.ToString(prof.RenderProfile.ESColorSet[1].Color.ToArgb(), 16);
                fa.ConvertItem(f, _terminalESCColor2.PreferenceItem).AsString().Value = Convert.ToString(prof.RenderProfile.ESColorSet[2].Color.ToArgb(), 16);
                fa.ConvertItem(f, _terminalESCColor3.PreferenceItem).AsString().Value = Convert.ToString(prof.RenderProfile.ESColorSet[3].Color.ToArgb(), 16);
                fa.ConvertItem(f, _terminalESCColor4.PreferenceItem).AsString().Value = Convert.ToString(prof.RenderProfile.ESColorSet[4].Color.ToArgb(), 16);
                fa.ConvertItem(f, _terminalESCColor5.PreferenceItem).AsString().Value = Convert.ToString(prof.RenderProfile.ESColorSet[5].Color.ToArgb(), 16);
                fa.ConvertItem(f, _terminalESCColor6.PreferenceItem).AsString().Value = Convert.ToString(prof.RenderProfile.ESColorSet[6].Color.ToArgb(), 16);
                fa.ConvertItem(f, _terminalESCColor7.PreferenceItem).AsString().Value = Convert.ToString(prof.RenderProfile.ESColorSet[7].Color.ToArgb(), 16);
                fa.ConvertItem(f, _terminalAsciiFont).AsString().Value               = prof.RenderProfile.FontName.ToString();
                fa.ConvertItem(f, _terminalCjkFont).AsString().Value                 = prof.RenderProfile.CJKFontName.ToString();
                fa.ConvertItem(f, _terminalFontSize).AsInt().Value                   = (int)prof.RenderProfile.FontSize;
                fa.ConvertItem(f, _terminalClearType).AsBool().Value                 = prof.RenderProfile.UseClearType;
                fa.ConvertItem(f, _terminalBoldStyle).AsBool().Value                 = prof.RenderProfile.EnableBoldStyle;
                fa.ConvertItem(f, _terminalForceBoldStyle).AsBool().Value            = prof.RenderProfile.ForceBoldStyle;
                fa.ConvertItem(f, _terminalBGImage).AsString().Value                 = prof.RenderProfile.BackgroundImageFileName;
                fa.ConvertItem(f, _terminalBGImagePos).AsString().Value              = prof.RenderProfile.ImageStyle.ToString();
                fa.ConvertItem(f, _commandSendInterval).AsInt().Value                = prof.CommandSendInterval;
                fa.ConvertItem(f, _promptRecvTimeout).AsInt().Value                  = prof.PromptRecvTimeout;
                fa.ConvertItem(f, _profileItemColor.PreferenceItem).AsString().Value = Convert.ToString(prof.ProfileItemColor.ToArgb(), 16);
                fa.ConvertItem(f, _description).AsString().Value = prof.Description;
            }
        }