Пример #1
0
        public override void InitializePlugin(IPoderosaWorld poderosa) {
            base.InitializePlugin(poderosa);

            _instance = this;
            _stringResource = new StringResource("Poderosa.Usability.strings", typeof(OptionDialogPlugin).Assembly);
            poderosa.Culture.AddChangeListener(this);
            IPluginManager pm = poderosa.PluginManager;
            _coreServices = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));

            IExtensionPoint panel_ext = pm.CreateExtensionPoint(OPTION_PANEL_ID, typeof(IOptionPanelExtension), this);

            ICommandCategory dialogs = _coreServices.CommandManager.CommandCategories.Dialogs;
            _optionDialogCommand = new GeneralCommandImpl("org.poderosa.optiondialog.open", _stringResource, "Command.OptionDialog", dialogs, new ExecuteDelegate(OptionDialogCommand.OpenOptionDialog)).SetDefaultShortcutKey(Keys.Alt | Keys.Control | Keys.T);
            _detailedPreferenceCommand = new GeneralCommandImpl("org.poderosa.preferenceeditor.open", _stringResource, "Command.PreferenceEditor", dialogs, new ExecuteDelegate(OptionDialogCommand.OpenPreferenceEditor));

            IExtensionPoint toolmenu = pm.FindExtensionPoint("org.poderosa.menu.tool");
            _optionDialogMenuGroup = new PoderosaMenuGroupImpl(new IPoderosaMenuItem[] {
                new PoderosaMenuItemImpl(_optionDialogCommand, _stringResource, "Menu.OptionDialog"),
                new PoderosaMenuItemImpl(_detailedPreferenceCommand, _stringResource, "Menu.PreferenceEditor") }).SetPosition(PositionType.Last, null);

            toolmenu.RegisterExtension(_optionDialogMenuGroup);

            //基本のオプションパネルを登録
            panel_ext.RegisterExtension(new DisplayOptionPanelExtension());
            panel_ext.RegisterExtension(new TerminalOptionPanelExtension());
            panel_ext.RegisterExtension(new PeripheralOptionPanelExtension());
            panel_ext.RegisterExtension(new CommandOptionPanelExtension());
            panel_ext.RegisterExtension(new SSHOptionPanelExtension());
            panel_ext.RegisterExtension(new ConnectionOptionPanelExtension());
            panel_ext.RegisterExtension(new GenericOptionPanelExtension());
        }
Пример #2
0
 public InternalPoderosaWorld(PoderosaStartupContext context) {
     _instance = this;
     _startupContext = context;
     _poderosaCulture = new PoderosaCulture();
     _poderosaLog = new PoderosaLog(this);
     _adapterManager = new AdapterManager();
     _stringResource = new StringResource("Poderosa.Plugin.strings", typeof(InternalPoderosaWorld).Assembly);
     _poderosaCulture.AddChangeListener(_stringResource);
     _pluginManager = new PluginManager(this);
     //ルート
     _rootExtension = _pluginManager.CreateExtensionPoint(ExtensionPoint.ROOT, typeof(IRootExtension), null);
 }
        public override void InitializePlugin(IPoderosaWorld poderosa) {
            base.InitializePlugin(poderosa);
            _instance = this;
            _strings = new StringResource("Poderosa.PortForwardingCommand.strings", typeof(PortForwardingCommandPlugin).Assembly);
            poderosa.Culture.AddChangeListener(_strings);

            IPluginManager pm = poderosa.PluginManager;
            _coreServices = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));

            _execPortForwardingCommand = new ExecPortForwardingCommand();
            _coreServices.CommandManager.Register(_execPortForwardingCommand);
            IExtensionPoint toolmenu = pm.FindExtensionPoint("org.poderosa.menu.tool");
            toolmenu.RegisterExtension(new PoderosaMenuGroupImpl(
                new IPoderosaMenu[] { new PoderosaMenuItemImpl(_execPortForwardingCommand, _strings, "Menu.PortForwarding") }, false));
        }
Пример #4
0
        public override void InitializePlugin(IPoderosaWorld poderosa) {
            base.InitializePlugin(poderosa);
            _instance = this;
            _stringResource = new StringResource("Poderosa.XZModem.strings", typeof(XZModemPlugin).Assembly);
            poderosa.Culture.AddChangeListener(_stringResource);

            IPluginManager pm = poderosa.PluginManager;
            _coreServices = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));
            _terminalEmulatorService = (ITerminalEmulatorService)pm.FindPlugin("org.poderosa.terminalemulator", typeof(ITerminalEmulatorService));

            _startXZModemCommand = new StartXZModemCommand();
            _coreServices.CommandManager.Register(_startXZModemCommand);

            IExtensionPoint consolemenu = pm.FindExtensionPoint(TerminalEmulatorConstants.TERMINALSPECIAL_EXTENSIONPOINT);
            consolemenu.RegisterExtension(new XZModemMenuGroup());

        }
        /// <summary>
        /// Set i18n text
        /// </summary>
        private void SetupControls()
        {
            StringResource res = PipePlugin.Instance.Strings;

            this.Text = res.GetString("Form.EnvironmentVariablesDialog.Title");

            _labelDescription.Text = res.GetString("Form.EnvironmentVariablesDialog._labelDescription");

            _columnName.Text  = res.GetString("Form.EnvironmentVariablesDialog._columnName");
            _columnValue.Text = res.GetString("Form.EnvironmentVariablesDialog._columnValue");

            _buttonAdd.Text    = res.GetString("Form.EnvironmentVariablesDialog._buttonAdd");
            _buttonEdit.Text   = res.GetString("Form.EnvironmentVariablesDialog._buttonEdit");
            _buttonDelete.Text = res.GetString("Form.EnvironmentVariablesDialog._buttonDelete");

            _buttonOK.Text     = res.GetString("Common.OK");
            _buttonCancel.Text = res.GetString("Common.Cancel");
        }
Пример #6
0
        private void OnSaveOpenSSHPublicKey(object sender, EventArgs args)
        {
            StringResource sr  = SSHUtilPlugin.Instance.Strings;
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Title      = sr.GetString("Caption.KeyGenWizard.SavePublicInOpenSSH");
            dlg.DefaultExt = "pub";
            dlg.Filter     = "SSH Public Key(*.pub)|*.pub|All Files(*.*)|*.*";
            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                try {
                    _resultKey.WritePublicPartInOpenSSHStyle(new FileStream(dlg.FileName, FileMode.Create, FileAccess.Write));
                }
                catch (Exception ex) {
                    GUtil.Warning(this, String.Format(sr.GetString("Message.KeyGenWizard.KeySaveError"), ex.Message));
                }
            }
        }
Пример #7
0
        private bool VerifyPassphrase()
        {
            StringResource sr = SSHUtilPlugin.Instance.Strings;

            if (_passphraseBox.Text != _confirmBox.Text)
            {
                GUtil.Warning(this, sr.GetString("Message.KeyGenWizard.NotMatch"));
                return(false);
            }
            else if (_passphraseBox.Text.Length == 0)
            {
                return(DialogResult.Yes == GUtil.AskUserYesNo(this, sr.GetString("Message.KeyGenWizard.ConfirmEmptyPassphrase")));
            }
            else
            {
                return(true);
            }
        }
        public override void InitializePlugin(IPoderosaWorld poderosa)
        {
            base.InitializePlugin(poderosa);
            _instance = this;
            _strings  = new StringResource("Poderosa.PortForwardingCommand.strings", typeof(PortForwardingCommandPlugin).Assembly);
            poderosa.Culture.AddChangeListener(_strings);

            IPluginManager pm = poderosa.PluginManager;

            _coreServices = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));

            _execPortForwardingCommand = new ExecPortForwardingCommand();
            _coreServices.CommandManager.Register(_execPortForwardingCommand);
            IExtensionPoint toolmenu = pm.FindExtensionPoint("org.poderosa.menu.tool");

            toolmenu.RegisterExtension(new PoderosaMenuGroupImpl(
                                           new IPoderosaMenu[] { new PoderosaMenuItemImpl(_execPortForwardingCommand, _strings, "Menu.PortForwarding") }, false));
        }
        public override void InitializePlugin(IPoderosaWorld poderosa) {
            base.InitializePlugin(poderosa);

            _instance = this;
            _strings = new StringResource("Poderosa.Usability.strings", typeof(PoderosaLogViewerPlugin).Assembly);
            poderosa.Culture.AddChangeListener(_strings);
            _coreServices = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));
            _viewFactory = new LogViewerFactory();
            poderosa.PluginManager.FindExtensionPoint(WindowManagerConstants.VIEW_FACTORY_ID).RegisterExtension(_viewFactory);
            _session = new PoderosaLogViewerSession();

            ICommandManager cm = _coreServices.CommandManager;
            //Command and Menu
            _command = new GeneralCommandImpl("org.poderosa.poderosalogviewer.show", _strings, "Command.PoderosaLog", cm.CommandCategories.Dialogs,
                new ExecuteDelegate(CmdShowPoderosaLog));
            poderosa.PluginManager.FindExtensionPoint("org.poderosa.menu.tool").RegisterExtension(
                new PoderosaMenuGroupImpl(new PoderosaMenuItemImpl(_command, _strings, "Menu.PoderosaLog")));
        }
Пример #10
0
        public PreferenceEditor(IPreferences pref)
        {
            InitializeComponent();
            _boldFont    = new Font(_listView.Font, _listView.Font.Style | FontStyle.Bold);
            _preferences = pref;

            _filterChangeTimer          = new Timer();
            _filterChangeTimer.Interval = 500;
            _filterChangeTimer.Tick    += new EventHandler(OnFilterChangeTimer);

            StringResource sr = UsabilityPlugin.Strings;

            _filterLabel.Text  = sr.GetString("Form.PreferenceEditor._filterLabel");
            _nameHeader.Text   = sr.GetString("Form.PreferenceEditor._nameHeader");
            _typeHeader.Text   = sr.GetString("Form.PreferenceEditor._typeHeader");
            _valueHeader.Text  = sr.GetString("Form.PreferenceEditor._valueHeader");
            _okButton.Text     = sr.GetString("Common.OK");
            _cancelButton.Text = sr.GetString("Common.Cancel");
            _resetButton.Text  = sr.GetString("Form.PreferenceEditor._resetButton");
            this.Text          = sr.GetString("Form.PreferenceEditor.Text");

            //洗い出し
            _folderTags = new List <FolderTag>();
            _itemTags   = new List <ItemTag>();
            foreach (IPreferenceFolder folder in _preferences.GetAllFolders())
            {
                FolderTag ft = new FolderTag(folder);
                _folderTags.Add(ft);
                int count = ft.Work.ChildCount;
                for (int i = 0; i < count; i++)
                {
                    IPreferenceItem item = ft.Work.ChildAt(i).AsItem();
                    if (item != null)
                    {
                        ItemTag it = new ItemTag(item);
                        _itemTags.Add(it);
                    }
                }
            }
            //ソート
            _itemTags.Sort();

            InitList();
        }
        /// <summary>
        /// Called by Babylon.NET when synchronizing a project with the respective resource files.
        /// </summary>
        /// <param name="projectName">Name of the project whose resources are exported.</param>
        /// <returns></returns>
        public ICollection <StringResource> ImportResourceStrings(string projectName)
        {
            // We use a Dictionary to keep a list of all StringResource object searchable by the key.
            Dictionary <string, StringResource> workingDictionary = new Dictionary <string, StringResource>();

            // convert relative storage location into absolute one
            string baseDirectory = GetBaseDirectory();

            // iterate over the whole folder tree starting from the base directory.
            foreach (var file in Directory.EnumerateFiles(baseDirectory, "*.json", SearchOption.AllDirectories))
            {
                // get locale from file name
                string locale = Path.GetExtension(Path.GetFileNameWithoutExtension(file)).TrimStart(new char[] { '.' });

                using (StreamReader fileStream = File.OpenText(file))
                {
                    Dictionary <string, string> stringDictionary = JsonConvert.DeserializeObject <Dictionary <string, string> >(fileStream.ReadToEnd());
                    foreach (var item in stringDictionary)
                    {
                        StringResource stringRes;
                        string         relativeDirectory = Path.GetDirectoryName(file).Substring(baseDirectory.Length).TrimStart(Path.DirectorySeparatorChar);
                        string         plainFilename     = Path.Combine(relativeDirectory, Path.GetFileNameWithoutExtension(Path.GetFileNameWithoutExtension(Path.GetFileName(file))));

                        // check whether we already have the string
                        if (!workingDictionary.TryGetValue(plainFilename + item.Key, out stringRes))
                        {
                            stringRes = new StringResource(item.Key, "");
                            stringRes.StorageLocation = plainFilename;
                            workingDictionary.Add(plainFilename + item.Key, stringRes);
                        }

                        // add locale text. Babylon.NET uses an empty string as locale for the invariant language. A StringResource is only valid if the invariant language is set.
                        // StringResources without an invariant language text are discared by Babylon.NET.
                        stringRes.SetLocaleText(locale, item.Value);
                    }
                }
            }

            // get collection of stringResources
            List <StringResource> result = new List <StringResource>();

            workingDictionary.ToList().ForEach(i => result.Add(i.Value));
            return(result);
        }
Пример #12
0
        /// <summary>
        /// Called by Babylon.NET when synchronizing a project with the respective resource files.
        /// </summary>
        /// <param name="projectName">Name of the project whose resources are exported.</param>
        /// <returns></returns>
        public ICollection <StringResource> ImportResourceStrings(string projectName)
        {
            // We use a Dictionary to keep a list of all StringResource object searchable by the key.
            Dictionary <string, StringResource> workingDictionary = new Dictionary <string, StringResource>();

            // convert relative storage location into absolute one
            string baseDirectory = GetBaseDirectory();
            Regex  regex         = new Regex(localeRegex);

            // iterate over the whole folder tree starting from the base directory.
            foreach (var file in Directory.EnumerateFiles(baseDirectory, "*.properties", SearchOption.AllDirectories))
            {
                var strings = ReadResourceStrings(file);

                // get locale from file name
                string locale = regex.Match(file).Value.TrimStart(new char[] { '_' });

                foreach (var resourceString in strings)
                {
                    string relativeDirectory = Path.GetDirectoryName(file).Substring(baseDirectory.Length).TrimStart(Path.DirectorySeparatorChar);

                    string plainFilename = Path.Combine(relativeDirectory, regex.Replace(Path.GetFileNameWithoutExtension(Path.GetFileName(file)), ""));

                    // check whether we already have the string
                    StringResource targetResourceString;
                    if (!workingDictionary.TryGetValue(plainFilename + resourceString.Name, out targetResourceString))
                    {
                        targetResourceString           = new StringResource(resourceString.Name, "");
                        resourceString.StorageLocation = plainFilename;
                        workingDictionary.Add(plainFilename + resourceString.Name, resourceString);
                    }

                    // add locale text. Babylon.NET uses an empty string as locale for the invariant language. A StringResource is only valid if the invariant language is set.
                    // StringResources without an invariant language text are discared by Babylon.NET.
                    targetResourceString.SetLocaleText(locale, resourceString.GetLocaleText(locale));
                }
            }

            // get collection of stringResources
            List <StringResource> result = new List <StringResource>();

            workingDictionary.ToList().ForEach(i => result.Add(i.Value));
            return(result);
        }
Пример #13
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);
        }
Пример #14
0
        public nfs(string path, StringResource names)
        {
            this.directory = Path.GetDirectoryName(path) + "/";
            this.filename  = Path.GetFileNameWithoutExtension(path) + ".nfs";
            this.fullpath  = this.directory + this.filename;

            if (names != null)
            {
                this.loadstrings = true;
                this.strings     = names;
            }
            else
            {
                this.loadstrings = false;
            }

            this.check = true;
            this.loadData();
        }
Пример #15
0
        public override void InitializePlugin(IPoderosaWorld poderosa)
        {
            base.InitializePlugin(poderosa);
            _instance       = this;
            _stringResource = new StringResource("Poderosa.XZModem.strings", typeof(XZModemPlugin).Assembly);
            poderosa.Culture.AddChangeListener(_stringResource);

            IPluginManager pm = poderosa.PluginManager;

            _coreServices            = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));
            _terminalEmulatorService = (ITerminalEmulatorService)pm.FindPlugin("org.poderosa.terminalemulator", typeof(ITerminalEmulatorService));

            _startXZModemCommand = new StartXZModemCommand();
            _coreServices.CommandManager.Register(_startXZModemCommand);

            IExtensionPoint consolemenu = pm.FindExtensionPoint(TerminalEmulatorConstants.TERMINALSPECIAL_EXTENSIONPOINT);

            consolemenu.RegisterExtension(new XZModemMenuGroup());
        }
Пример #16
0
        private void InitSample()
        {
            StringResource sr = MacroPlugin.Instance.Strings;
            string         b  = MacroPlugin.Instance.PoderosaApplication.HomeDirectory + "Macro\\Sample\\";

            _entries.Clear();

            MacroModule hello = new MacroModule(0, b + "helloworld.js", sr.GetString("Caption.MacroModule.SampleTitleHelloWorld"));

            _entries.Add(hello);

            MacroModule telnet = new MacroModule(1, b + "telnet.js", sr.GetString("Caption.MacroModule.SampleTitleAutoTelnet"));

            _entries.Add(telnet);

            MacroModule bashrc = new MacroModule(2, b + "bashrc.js", sr.GetString("Caption.MacroModule.SampleTitleOpenBashrc"));

            _entries.Add(bashrc);
        }
Пример #17
0
        /// <summary>
        /// Adds a string resource to the resource file.
        /// </summary>
        /// <param name="stringResource">The object which contains the name, value and comment for the string resource.</param>
        public void AddStringResource(StringResource stringResource)
        {
            if (stringResource == null)
            {
                throw new ArgumentNullException(nameof(stringResource));
            }

            var existingIndex = _resxRoot.Data.FindIndex(x =>
                                                         x.Name.Equals(stringResource.Name, StringComparison.OrdinalIgnoreCase));

            if (existingIndex < 0)
            {
                _resxRoot.Data.Add(new Data(stringResource.Name, stringResource.Value, stringResource.Comment));
            }
            else
            {
                _resxRoot.Data[existingIndex] = new Data(stringResource.Name, stringResource.Value, stringResource.Comment);
            }
        }
        public virtual StringResource InsertStringResource(StringResource entity)
        {
            StringResource other = new StringResource();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into StringResource ( [StringResourceGUID]
				,[StoreID]
				,[Name]
				,[LocaleSetting]
				,[ConfigValue]
				,[Modified]
				,[CreatedOn] )
				Values
				( @StringResourceGUID
				, @StoreID
				, @Name
				, @LocaleSetting
				, @ConfigValue
				, @Modified
				, @CreatedOn );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@StringResourceID", entity.StringResourceId)
                    , new SqlParameter("@StringResourceGUID", entity.StringResourceGuid)
                    , new SqlParameter("@StoreID", entity.StoreId)
                    , new SqlParameter("@Name", entity.Name)
                    , new SqlParameter("@LocaleSetting", entity.LocaleSetting)
                    , new SqlParameter("@ConfigValue", entity.ConfigValue ?? (object)DBNull.Value)
                    , new SqlParameter("@Modified", entity.Modified)
                    , new SqlParameter("@CreatedOn", entity.CreatedOn)
                };
                var identity = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, sql, parameterArray);
                if (identity == DBNull.Value)
                {
                    throw new DataException("Identity column was null as a result of the insert operation.");
                }
                return(GetStringResource(Convert.ToInt32(identity)));
            }
            return(entity);
        }
Пример #19
0
        public void Initialize(AbstractTerminal terminal)
        {
            StringResource sr = XZModemPlugin.Instance.Strings;

            _terminal = terminal;
            this.Text = String.Format(sr.GetString("Caption.XZModemDialog.DialogTitle"), _terminal.TerminalHost.ISession.Caption);

            //ウィンドウのセンタリング
            Rectangle r = terminal.TerminalHost.OwnerWindow.AsForm().DesktopBounds;

            this.Location = new Point(r.Left + r.Width / 2 - this.Width / 2, r.Top + r.Height / 2 - this.Height / 2);

            //TODO 前回の起動時の設定を覚えておくとよい
            _protocolBox.SelectedIndex  = 1;
            _directionBox.SelectedIndex = 0;
#if DEBUG
            //テスト時にはここに初期値を設定
            _fileNameBox.Text = "C:\\P4\\Work\\FF4K_R.bin";
#endif
        }
Пример #20
0
        //UIの調整
        private void SelectScheme(ItemTag tag)
        {
            _current = tag;
            IShellScheme ss = tag.ShellScheme;

            _blockUIEvent = true;
            StringResource sr = TerminalUIPlugin.Instance.Strings;

            _deleteSchemeButton.Enabled = !ss.IsGeneric;
            _currentSchemeGroup.Text    = String.Format(sr.GetString("Form.ShellSchemeEditor._currentSchemeGroup"), ss.Name);
            _nameBox.Enabled            = !ss.IsGeneric;
            _nameBox.Text   = ss.Name;
            _promptBox.Text = ss.PromptExpression;
            _deleteCharBox.SelectedIndex = ss.BackSpaceChar == (char)0x7F ? 1 : 0;
            _alphabeticalSort.Checked    = false;
            InitCommandListBox();

            _blockUIEvent = false;
            _deleteCommandsButton.Enabled = false;
        }
Пример #21
0
        public void Execute(Form parent, MacroModule mod)
        {
            StringResource sr = MacroPlugin.Instance.Strings;

            if (_runningMacro != null)
            {
                GUtil.Warning(parent, sr.GetString("Message.MacroModule.AlreadyRunning"));
                return;
            }

            if (mod.Type == MacroType.Unknown)
            {
                GUtil.Warning(parent, sr.GetString("Message.MacroModule.UnknownModuleType"));
                return;
            }
            else
            {
                _runningMacro = MacroPlugin.Instance.RunMacroModule(mod, null, this);
            }
        }
Пример #22
0
        public override void InitializePlugin(IPoderosaWorld poderosa)
        {
            base.InitializePlugin(poderosa);

            _instance = this;
            _strings  = new StringResource("Poderosa.Usability.strings", typeof(PoderosaLogViewerPlugin).Assembly);
            poderosa.Culture.AddChangeListener(_strings);
            _coreServices = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));
            _viewFactory  = new LogViewerFactory();
            poderosa.PluginManager.FindExtensionPoint(WindowManagerConstants.VIEW_FACTORY_ID).RegisterExtension(_viewFactory);
            _session = new PoderosaLogViewerSession();

            ICommandManager cm = _coreServices.CommandManager;

            //Command and Menu
            _command = new GeneralCommandImpl("org.poderosa.poderosalogviewer.show", _strings, "Command.PoderosaLog", cm.CommandCategories.Dialogs,
                                              new ExecuteDelegate(CmdShowPoderosaLog));
            poderosa.PluginManager.FindExtensionPoint("org.poderosa.menu.tool").RegisterExtension(
                new PoderosaMenuGroupImpl(new PoderosaMenuItemImpl(_command, _strings, "Menu.PoderosaLog")));
        }
        public bool UpdateString(ushort id, string data)
        {
            StringResource sr = new StringResource();
            sr.Language = 1033;
            sr.Name = new ResourceId(StringResource.GetBlockId(id));

            //load the data that was already in file
            ResourceInfo ri = new ResourceInfo();
            ri.Load(file);
            foreach (StringResource rc in ri[Kernel32.ResourceTypes.RT_STRING])
            {
                foreach (KeyValuePair<ushort,string> key in rc.Strings)
                    sr[key.Key] = key.Value;
            }
                
            ri.Unload();
            sr[id] = data;
            sr.SaveTo(file);
            return true;
        }
        public void Init(Type t)
        {
            _strResource = null;
            _assembly    = t.Assembly;

            MemberInfo[] ms = t.GetMembers();
            _descToValue = new Hashtable(ms.Length);
            _nameToValue = new Hashtable(ms.Length);

            ArrayList descriptions = new ArrayList(ms.Length);
            ArrayList names        = new ArrayList(ms.Length);

            int expected = 0;

            foreach (MemberInfo mi in ms)
            {
                FieldInfo fi = mi as FieldInfo;
                if (fi != null && fi.IsStatic && fi.IsPublic)
                {
                    int intVal = (int)fi.GetValue(null);                     //int以外をベースにしているEnum値はサポート外
                    if (intVal != expected)
                    {
                        throw new Exception("unexpected enum value order");
                    }
                    EnumValueAttribute a = (EnumValueAttribute)(fi.GetCustomAttributes(typeof(EnumValueAttribute), false)[0]);

                    string desc = a.Description;
                    descriptions.Add(desc);
                    _descToValue[desc] = intVal;

                    string name = fi.Name;
                    names.Add(name);
                    _nameToValue[name] = intVal;

                    expected++;
                }
            }

            _descriptions = (string[])descriptions.ToArray(typeof(string));
            _names        = (string[])names.ToArray(typeof(string));
        }
Пример #25
0
        private void OnSavePrivateKey(object sender, EventArgs args)
        {
            StringResource sr  = SSHUtilPlugin.Instance.Strings;
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Title = sr.GetString("Caption.KeyGenWizard.SavePrivateKey");
            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                try {
                    string pp = _passphraseBox.Text;
                    if (pp.Length == 0)
                    {
                        pp = null; //空パスフレーズはnull指定
                    }
                    _resultKey.WritePrivatePartInSECSHStyleFile(new FileStream(dlg.FileName, FileMode.Create, FileAccess.Write), "", pp);
                }
                catch (Exception ex) {
                    GUtil.Warning(this, String.Format(sr.GetString("Message.KeyGenWizard.KeySaveError"), ex.Message));
                }
            }
        }
Пример #26
0
        public static CompositableWaiter TryWaitAny(
            TimeSpan timeout,
            params CompositableWaiter[] waiters)
        {
            Validate.ArgumentNotNull(parameter: waiters, parameterName: nameof(waiters));
            var waitHandles = new WaitHandle[waiters.Length];

            for (var index = 0; index < waiters.Length; ++index)
            {
                Validate.ArgumentNotNull(parameter: waiters[index], parameterName: "waiters[count]");
                if (waiters[index].WaitHandle == null)
                {
                    throw new WaiterException(message: StringResource.Get(id: "UnableToWaitAnyOnGivenWaiter"));
                }
                waitHandles[index] = waiters[index].WaitHandle;
            }

            var index1 = WaitHandle.WaitAny(waitHandles: waitHandles, timeout: timeout);

            return(index1 == 258 ? null : waiters[index1]);
        }
Пример #27
0
        private Boolean GetJobInfo(BinaryReader fileReader)
        {
            SPLRecord record  = new SPLRecord(fileReader);
            Int64     recSeek = record.RecSeek;

            if (record.RecType != SPLRecordTypeEnum.SRT_JOB_INFO)
            {
                return(false);
            }

            fileReader.ReadBytes(8);
            Char[] jobDescriptionArray = StringResource.Get(fileReader);
            jobDescription = new String(jobDescriptionArray);
            fileReader.BaseStream.Seek(recSeek, SeekOrigin.Begin);
            if (String.IsNullOrEmpty(jobDescription))
            {
                return(false);
            }

            return(true);
        }
Пример #28
0
        public override void InitializePlugin(IPoderosaWorld poderosa) {
            base.InitializePlugin(poderosa);
            _instance = this;

            _stringResource = new StringResource("Poderosa.SerialPort.strings", typeof(SerialPortPlugin).Assembly);
            poderosa.Culture.AddChangeListener(_stringResource);
            IPluginManager pm = poderosa.PluginManager;
            _coreServices = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));

            IExtensionPoint pt = _coreServices.SerializerExtensionPoint;
            pt.RegisterExtension(new SerialTerminalParamSerializer());
            pt.RegisterExtension(new SerialTerminalSettingsSerializer());

            _openSerialPortCommand = new OpenSerialPortCommand();
            _coreServices.CommandManager.Register(_openSerialPortCommand);

            pm.FindExtensionPoint("org.poderosa.menu.file").RegisterExtension(new SerialPortMenuGroup());
            pm.FindExtensionPoint("org.poderosa.core.window.toolbar").RegisterExtension(new SerialPortToolBarComponent());
            pm.FindExtensionPoint("org.poderosa.termianlsessions.terminalConnectionFactory").RegisterExtension(new SerialConnectionFactory());

        }
Пример #29
0
        public PreferenceItemEditor(IPreferenceItem item)
        {
            InitializeComponent();
            _item = item;

            StringResource sr = UsabilityPlugin.Strings;

            this.Text          = sr.GetString("Form.PreferenceItemEditor.Text");
            _nameLabel.Text    = sr.GetString("Form.PreferenceItemEditor._nameLabel") + " " + item.FullQualifiedId;
            _valueLabel.Text   = sr.GetString("Form.PreferenceItemEditor._valueLabel");
            _resetButton.Text  = sr.GetString("Form.PreferenceItemEditor._resetButton");
            _okButton.Text     = sr.GetString("Common.OK");
            _cancelButton.Text = sr.GetString("Common.Cancel");

            //int/stringどちらかの場合をサポート
            IIntPreferenceItem    intitem = item.AsInt();
            IStringPreferenceItem stritem = item.AsString();

            Debug.Assert(intitem != null || stritem != null);
            _valueBox.Text = intitem != null?intitem.Value.ToString() : stritem.Value;
        }
        public bool Commit(IProtocolOptions options, IKeyAgentOptions agent)
        {
            StringResource sr = OptionDialogPlugin.Instance.Strings;

            //暗号アルゴリズム順序はoptionsを直接いじっているのでここでは何もしなくてよい
            try {
                PublicKeyAlgorithm[] pa = new PublicKeyAlgorithm[2];
                if (_hostKeyBox.SelectedIndex == 0)
                {
                    pa[0] = PublicKeyAlgorithm.DSA;
                    pa[1] = PublicKeyAlgorithm.RSA;
                }
                else
                {
                    pa[0] = PublicKeyAlgorithm.RSA;
                    pa[1] = PublicKeyAlgorithm.DSA;
                }
                options.HostKeyAlgorithmOrder = FormatPublicKeyAlgorithmList(pa);

                try {
                    options.SSHWindowSize = Int32.Parse(_windowSizeBox.Text);
                }
                catch (FormatException) {
                    GUtil.Warning(this, sr.GetString("Message.OptionDialog.InvalidWindowSize"));
                    return(false);
                }

                options.RetainsPassphrase    = _retainsPassphrase.Checked;
                options.SSHCheckMAC          = _sshCheckMAC.Checked;
                options.CipherAlgorithmOrder = _cipherAlgorithmOrder;
                options.LogSSHEvents         = _sshEventLog.Checked;
                agent.EnableKeyAgent         = _enableAgentForward.Checked;

                return(true);
            }
            catch (Exception ex) {
                GUtil.Warning(this, ex.Message);
                return(false);
            }
        }
Пример #31
0
        /// <summary>
        /// Set i18n text.
        /// </summary>
        private void SetupControls()
        {
            StringResource res = PipePlugin.Instance.Strings;

            this.Text = res.GetString("Form.OpenPipeDialog.Title");

            _radioButtonProcess.Text = res.GetString("Form.OpenPipeDialog._radioButtonProcess");
            _radioButtonPipe.Text    = res.GetString("Form.OpenPipeDialog._radioButtonPipe");

            _groupBoxProcess.Text = res.GetString("Form.OpenPipeDialog._groupBoxProcess");
            _groupBoxPipe.Text    = res.GetString("Form.OpenPipeDialog._groupBoxPipe");

            _labelExePath.Text            = res.GetString("Form.OpenPipeDialog._labelExePath");
            _labelCommandLineOptions.Text = res.GetString("Form.OpenPipeDialog._labelCommandLineOptions");
            _labelInputPath.Text          = res.GetString("Form.OpenPipeDialog._labelInputPath");
            _labelOutputPath.Text         = res.GetString("Form.OpenPipeDialog._labelOutputPath");
            _labelLogFile.Text            = res.GetString("Form.OpenPipeDialog._labelLogFile");
            _labelLogType.Text            = res.GetString("Form.OpenPipeDialog._labelLogType");
            _labelEncoding.Text           = res.GetString("Form.OpenPipeDialog._labelEncoding");
            _labelLocalEcho.Text          = res.GetString("Form.OpenPipeDialog._labelLocalEcho");
            _labelNewLine.Text            = res.GetString("Form.OpenPipeDialog._labelNewLine");
            _labelTerminalType.Text       = res.GetString("Form.OpenPipeDialog._labelTerminalType");
            _labelAutoExecMacroPath.Text  = res.GetString("Form.OpenPipeDialog._labelAutoExecMacroPath");

            _checkBoxBidirectinal.Text = res.GetString("Form.OpenPipeDialog._checkBoxBidirectinal");

            _buttonEnvironmentVariables.Text = res.GetString("Form.OpenPipeDialog._buttonEnvironmentVariables");

            _buttonOK.Text     = res.GetString("Common.OK");
            _buttonCancel.Text = res.GetString("Common.Cancel");

            _comboBoxLogType.Items.AddRange(EnumListItem <LogType> .GetListItems());
            _comboBoxEncoding.Items.AddRange(EnumListItem <EncodingType> .GetListItems());
            _comboBoxLocalEcho.Items.AddRange(new object[] {
                res.GetString("Common.DoNot"),
                res.GetString("Common.Do")
            });
            _comboBoxNewLine.Items.AddRange(EnumListItem <NewLine> .GetListItems());
            _comboBoxTerminalType.Items.AddRange(EnumListItem <TerminalType> .GetListItems());
        }
Пример #32
0
        public void GetResourcesByCulture_Should_Fetch_Correct_Resources()
        {
            Mock <IContextProvider> contextProvider = new Mock <IContextProvider>();
            IResourceService        service         = new ResourceService(_fixture.DbContext);
            List <int>     idList = new List <int>();
            StringResource testSr;

            for (int i = 0; i < 10; i++)
            {
                testSr = new StringResource()
                {
                    Name        = "Test" + i.ToString(),
                    Value       = "Test" + i.ToString(),
                    CultureCode = "en-US"
                };
                service.Insert(testSr);
                idList.Add(testSr.Id);
            }
            for (int i = 0; i < 10; i++)
            {
                testSr = new StringResource()
                {
                    Name        = "Test" + i.ToString(),
                    Value       = "Test" + i.ToString(),
                    CultureCode = "tr-TR"
                };
                service.Insert(testSr);
                idList.Add(testSr.Id);
            }
            Assert.Equal(service.FetchAll().Count(s => s.CultureCode == "en-US"), 10);
            service.DeleteById(idList.First());
            idList.RemoveAt(0);
            service.DeleteById(idList.First());
            idList.RemoveAt(0);
            testSr             = service.GetResourceById(idList.First());
            testSr.CultureCode = "de-DE";
            service.Update(testSr);
            Assert.Equal(service.FetchAll().Count(s => s.CultureCode == "en-US"), 7);
        }
Пример #33
0
        public async Task <bool> AddStringResourceAsync(StringResource resource, AdditionPolicy policy)
        {
            Guard.ArgumentNotNull(resource, nameof(resource));
            ThrowIfInvalidResource(resource);
            bool     changed = false;
            Language lang    = await GetLanguageWithoutCacheAsync(resource.Culture, true);

            if (lang == null)
            {
                lang    = AddNotExistingLanguageResource(resource);
                changed = true;
            }
            else
            {
                changed = AddExsitingLanguageResource(resource, policy, lang);
            }

            await _stringResourceLanguageRepository.CommitChangesAsync();

            _cacheManager.Remove(GetLanguageCacheKey(resource.Culture));
            return(changed);
        }
Пример #34
0
        public override void InitializePlugin(IPoderosaWorld poderosa) {
            base.InitializePlugin(poderosa);
            _instance = this;
            _stringResource = new StringResource("Poderosa.Macro.strings", typeof(MacroPlugin).Assembly);
            _instance.PoderosaWorld.Culture.AddChangeListener(_stringResource);

            IPluginManager pm = poderosa.PluginManager;
            _coreServices = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));
            _macroManager = new MacroManager();

            _macroListCommand = new MacroListCommand();
            _coreServices.CommandManager.Register(_macroListCommand);

            pm.FindExtensionPoint("org.poderosa.menu.tool").RegisterExtension(new MacroMenuGroup());

            _coreServices.PreferenceExtensionPoint.RegisterExtension(_macroManager);

            ISessionManager sessionManager = poderosa.PluginManager.FindPlugin("org.poderosa.core.sessions", typeof(ISessionManager)) as ISessionManager;
            if (sessionManager != null) {
                sessionManager.AddSessionListener(_sessionBinder);
            }
        }
Пример #35
0
        /// <summary>
        /// Create single instance from an enum value.
        /// </summary>
        /// <param name="keyText">Text of an instance is a key of the string resource.</param>
        /// <param name="value">an enum value</param>
        /// <returns>new instance</returns>
        private static EnumListItem <T> CreateListItemInternal(bool keyText, T value)
        {
            Type      enumType = typeof(T);
            FieldInfo field    = enumType.GetField(value.ToString(), BindingFlags.Public | BindingFlags.Static);

            if (field == null)
            {
                throw new ArgumentException("Not a member of enum " + enumType.Name, "value");
            }

            string desc = null;

            string descId = GetDescriptionID(field);

            if (descId != null)
            {
                if (keyText)
                {
                    desc = descId;
                }
                else
                {
                    string         textFound;
                    StringResource res = FindStringResource(enumType, descId, out textFound);
                    if (res != null)
                    {
                        desc = textFound;
                    }
                }
            }

            if (desc == null)
            {
                // fallback
                desc = field.Name;
            }

            return(new EnumListItem <T>(value, desc));
        }
Пример #36
0
        public GFontDialog()
        {
            //
            // Windows フォーム デザイナ サポートに必要です。
            //
            InitializeComponent();
            //_language = GApp.Options.Language;
            StringResource sr = TerminalUIPlugin.Instance.Strings;

            this._lAsciiFont.Text          = sr.GetString("Form.GFontDialog._lAsciiFont");
            this._lCJKFont.Text            = sr.GetString("Form.GFontDialog._lCJKFont");
            this._lFontSize.Text           = sr.GetString("Form.GFontDialog._lFontSize");
            this._checkClearType.Text      = sr.GetString("Form.GFontDialog._checkClearType");
            this._checkBoldStyle.Text      = sr.GetString("Form.GFontDialog._checkBoldStyle");
            this._checkForceBoldStyle.Text = sr.GetString("Form.GFontDialog._checkForceBoldStyle");
            this._okButton.Text            = sr.GetString("Common.OK");
            this._cancelButton.Text        = sr.GetString("Common.Cancel");
            this._lASCIISample.Text        = sr.GetString("Common.FontSample");
            this._lCJKSample.Text          = sr.GetString("Common.CJKFontSample");
            this.Text = sr.GetString("Form.GFontDialog.Text");
            InitUI();
        }
        private void OnOK(object sender, EventArgs args)
        {
            StringResource sr = MacroPlugin.Instance.Strings;

            this.DialogResult = DialogResult.None;
            if (!File.Exists(_path.Text))
            {
                GUtil.Warning(this, String.Format(sr.GetString("Message.ModuleProperty.FileNotExist"), _path.Text));
            }
            else if (_title.Text.Length > 30)
            {
                GUtil.Warning(this, sr.GetString("Message.ModuleProperty.TooLongTitle"));
            }
            else
            {
                _module.Title                = _title.Text;
                _module.Path                 = _path.Text;
                _module.DebugMode            = _debugOption.Checked;
                _module.AdditionalAssemblies = ParseAdditionalAssemblies(_additionalAssembly.Text);
                this.DialogResult            = DialogResult.OK;
            }
        }
Пример #38
0
 public void Init() {
     //Core.dllあたりはこれをしとかないとロードできない
     Assembly.LoadFrom(String.Format("{0}\\Plugin.dll", PoderosaAppDir()));
     _stringResource = new StringResource("Plugin.strings", typeof(PluginManifest).Assembly);
 }
Пример #39
0
 public static void ReloadStringResource()
 {
     _stringResource = new StringResource("Poderosa.TerminalSession.strings", typeof(TEnv).Assembly);
     TerminalSessionsPlugin.Instance.PoderosaWorld.Culture.AddChangeListener(_stringResource);
 }
Пример #40
0
 public void Init()
 {
     //Core.dll������͂������Ƃ��Ȃ��ƃ��[�h�ł��Ȃ�
     Assembly.LoadFrom(String.Format("{0}\\Plugin.dll", PoderosaAppDir()));
     _stringResource = new StringResource("Plugin.strings", typeof(PluginManifest).Assembly);
 }
Пример #41
0
 /// <summary>
 /// <ja>カルチャ情報を指定してラベルを作成します。</ja>
 /// <en>Create label specified with culture information</en>
 /// </summary>
 /// <param name="res"><ja>カルチャ情報です</ja><en>Culture information.</en></param>
 /// <param name="text"><ja>ラベルに表示するテキストIDです。</ja><en>The text ID to show on the label.</en></param>
 /// <param name="width"><ja>ラベルの幅です。単位はピクセルです。</ja><en>WIdth of the label. The unit is a pixel.</en></param>
 public ToolBarLabelImpl(StringResource res, string text, int width)
 {
     _res = res;
     _usingStringResource = true;
     _text = text;
     _width = width;
 }
Пример #42
0
 /// <summary>
 /// <ja>
 /// コマンドIDとカルチャ、メニューの表示名を指定してメニュー項目を作成します。
 /// </ja>
 /// <en>
 /// The menu item is made specifying the display name of command ID, culture, and the menu. 
 /// </en>
 /// </summary>
 /// <param name="command_id"><ja>メニューが選択されたときに呼び出したいコマンドIDです。</ja><en>Command ID that wants to call when menu is selected</en></param>
 /// <param name="sr"><ja>カルチャ情報です。</ja><en>Information of culture.</en></param>
 /// <param name="textID"><ja>メニューに表示するテキストIDです。</ja><en>Text ID displayed in menu</en></param>
 /// <remarks>
 /// <ja>
 /// <paramref name="command_id">command_id</paramref>に指定したコマンドIDが見つからないときには、<see cref="AssociatedCommand">AssociatedCommandプロパティ</see>
 /// がnullになります。
 /// </ja>
 /// <en>
 /// When command ID specified for <paramref name="command_id">command_id</paramref> is not found, the <see cref="AssociatedCommand">AssociatedCommand property</see> becomes null. 
 /// </en>
 /// </remarks>
 public PoderosaMenuItemImpl(string command_id, StringResource sr, string textID)
     : this(BindCommand(command_id), sr, textID) {
 }
Пример #43
0
 /// <summary>
 /// <ja>実行するコマンドの<seealso cref="IPoderosaCommand">IPoderosaCommand</seealso>、カルチャ、メニューの表示名を指定してメニュー項目を作成します。</ja>
 /// <en>The menu item is made specifying the display name of executed <seealso cref="IPoderosaCommand">IPoderosaCommand</seealso> of the command, culture, and menu. </en>
 /// </summary>
 /// <param name="command"><ja>メニューが選択されたときに呼び出したいコマンドです。</ja><en>Command that wants to call when menu is selected</en></param>
 /// <param name="sr"><ja>カルチャ情報です。</ja><en>Information of culture.</en></param>
 /// <param name="textID"><ja>メニューに表示するテキストIDです。</ja><en>Text ID displayed in menu</en></param>
 public PoderosaMenuItemImpl(IPoderosaCommand command, StringResource sr, string textID) {
     Debug.Assert(command != null);
     _command = command;
     _usingStringResource = sr != null;
     _strResource = sr;
     _textID = textID;
 }
Пример #44
0
 /// <summary>
 /// <ja>
 /// コマンドID、カルチャ、説明テキスト文、コマンドカテゴリを指定してオブジェクトを作成します。
 /// </ja>
 /// <en>
 /// The object is made specifying command ID, culture, the explanation text sentence, and the command category. 
 /// </en>
 /// </summary>
 /// <param name="commandID">
 /// <ja>
 /// 割り当てるコマンドIDです。ほかのコマンドとは重複しない唯一無二のものを指定しなければなりません。
 /// </ja>
 /// <en>
 /// It is allocated command ID. The unique one that doesn't overlap should be specified other commands. 
 /// </en>
 /// </param>
 /// <param name="sr">
 /// <ja>
 /// カルチャ情報です。
 /// </ja>
 /// <en>
 /// Information of the culture.
 /// </en>
 /// </param>
 /// <param name="descriptionTextID">
 /// <ja>
 /// コマンドの説明文を示すテキストIDです。
 /// </ja>
 /// <en>
 /// Text ID that shows explanation of command.
 /// </en>
 /// </param>
 /// <param name="category">
 /// <ja>
 /// コマンドのカテゴリです。
 /// </ja>
 /// <en>
 /// Category of command.
 /// </en>
 /// </param>
 public GeneralCommandImpl(string commandID, StringResource sr, string descriptionTextID, ICommandCategory category)
     : this(commandID, sr, descriptionTextID, category, null, null) {
 }
Пример #45
0
 /// <summary>
 /// <ja>
 /// コマンドID、カルチャ、説明テキストID、コマンドカテゴリ、コマンドが実行される際に呼び出されるデリゲートを指定してオブジェクトを作成します。
 /// </ja>
 /// <en>
 /// The object is made specifying delegate called when command ID, culture, explanation text ID, the command category, and the command are executed. 
 /// </en>
 /// </summary>
 /// <param name="commandID">
 /// <ja>
 /// 割り当てるコマンドIDです。ほかのコマンドとは重複しない唯一無二のものを指定しなければなりません。
 /// </ja>
 /// <en>
 /// It is allocated command ID. The unique one that doesn't overlap should be specified other commands. 
 /// </en>
 /// </param>
 /// <param name="sr">
 /// <ja>
 /// カルチャ情報です。
 /// </ja>
 /// <en>
 /// Information of the culture.
 /// </en>
 /// </param>
 /// <param name="descriptionTextID">
 /// <ja>
 /// コマンドの説明文を示すテキストIDです。
 /// </ja>
 /// <en>
 /// Text ID that shows explanation of command.
 /// </en>
 /// </param>
 /// <param name="category">
 /// <ja>
 /// コマンドのカテゴリです。
 /// </ja>
 /// <en>
 /// Category of command.
 /// </en></param>
 /// <param name="execute">
 /// <ja>
 /// コマンドが実行されるときに呼び出されるデリゲートです。
 /// </ja>
 /// <en>
 /// Delegate called when command is executed
 /// </en>
 /// </param>
 public GeneralCommandImpl(string commandID, StringResource sr, string descriptionTextID, ICommandCategory category, ExecuteDelegate execute)
     : this(commandID, sr, descriptionTextID, category, execute, null) {
 }
Пример #46
0
 //必須要素を与えるコンストラクタ
 /// <summary>
 /// <ja>
 /// コマンドID、カルチャ、説明テキストID、コマンドカテゴリ、コマンドが実行される際に呼び出されるデリゲート、実行可能かどうかを調べる際に呼び出されるデリゲートを指定してオブジェクトを作成します。
 /// </ja>
 /// <en>
 /// The object is made specifying delegate called when delegate called when command ID, Culture, explanation text ID, the command category, and the command are executed and it is executable is examined. 
 /// </en>
 /// </summary>
 /// <param name="commandID">
 /// <ja>
 /// 割り当てるコマンドIDです。ほかのコマンドとは重複しない唯一無二のものを指定しなければなりません。
 /// </ja>
 /// <en>
 /// It is allocated command ID. The unique one that doesn't overlap should be specified other commands. 
 /// </en>
 /// </param>
 /// <param name="sr">
 /// <ja>
 /// カルチャ情報です。
 /// </ja>
 /// <en>
 /// Information of the culture.
 /// </en>
 /// </param>
 /// <param name="descriptionTextID">
 /// <ja>
 /// コマンドの説明文を示すテキストIDです。
 /// </ja>
 /// <en>
 /// Text ID that shows explanation of command
 /// </en>
 /// </param>
 /// <param name="commandCategory">
 /// <ja>
 /// コマンドのカテゴリです。
 /// </ja>
 /// <en>
 /// Category of command.
 /// </en>
 /// </param>
 /// <param name="exec">
 /// <ja>
 /// コマンドが実行されるときに呼び出されるデリゲートです。
 /// </ja>
 /// <en>
 /// Delegate called when command is executed.
 /// </en>
 /// </param>
 /// <param name="canExecute">
 /// <ja>
 /// コマンドが実行可能かどうかを調べる際に呼び出されるデリゲートです。
 /// </ja>
 /// <en>
 /// Delegate called when it is examined whether command is executable
 /// </en>
 /// </param>
 /// <overloads>
 /// <summary>
 /// <ja>
 /// コマンドオブジェクトを作成します。
 /// </ja>
 /// <en>
 /// Create the command object.
 /// </en>
 /// </summary>
 /// </overloads>
 public GeneralCommandImpl(string commandID, StringResource sr, string descriptionTextID, ICommandCategory commandCategory, ExecuteDelegate exec, CanExecuteDelegate canExecute) {
     _commandID = commandID;
     _usingStringResource = sr != null;
     _strResource = sr;
     _descriptionTextID = descriptionTextID;
     _commandCategory = commandCategory;
     _executeDelegate = exec;
     _canExecuteDelegate = canExecute;
 }
Пример #47
0
 public static void Init(ICoreServices cs)
 {
     cs.PreferenceExtensionPoint.RegisterExtension(ProtocolsPlugin.Instance.ProtocolOptionsSupplier);
     _strings = new StringResource("Poderosa.Protocols.strings", typeof(PEnv).Assembly);
     ProtocolsPlugin.Instance.PoderosaWorld.Culture.AddChangeListener(_strings);
     _windowManager = cs.WindowManager;
 }
Пример #48
0
        /// <summary>
        /// <ja>初期化</ja>
        /// </summary>
        public override void InitializePlugin(IPoderosaWorld poderosa)
        {
            base.InitializePlugin(poderosa);
            _instance = this;

            // 文字列リソース読み込み
            _stringResource = new StringResource("Poderosa.ExtendPaste.strings", typeof(ExtendPastePlugin).Assembly);
            ExtendPastePlugin.Instance.PoderosaWorld.Culture.AddChangeListener(_stringResource);

            // コマンド登録
            IPluginManager pm = poderosa.PluginManager;
            IExtensionPoint extp_cmd = pm.FindExtensionPoint("org.poderosa.terminalsessions.pasteCommand");
            extp_cmd.RegisterExtension(new ExtendPasteCommand());

            // オプションパネル登録
            IExtensionPoint extp_opt = pm.FindExtensionPoint("org.poderosa.optionpanel");
            extp_opt.RegisterExtension(new ExtendPastePanelExtension());

            // オプションクラス登録
            _optionSupplier = new ExtendPasteOptionsSupplier();
            _coreServices = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));
            _coreServices.PreferenceExtensionPoint.RegisterExtension(_optionSupplier);
        }