Exemple #1
0
        public MenuItemFeature(ResourceManager resourceManager, XmlNode node, PluginDescriptor plugin, ParentMenuItemFeature parentFeature)
            : base(resourceManager, node, plugin)
        {
            _parentFeature = parentFeature;
            _menu          = Helpers.GetEnumXmlAttribute <PluginMenu>(node, ATT_MENU, PluginMenu.none);
            _contextMenu   = Helpers.GetEnumXmlAttribute <PluginContextMenu>(node, ATT_CONTEXT_MENU, GetContextMenuFromMenu(_menu));
            _serialization = Helpers.GetEnumXmlAttribute <PluginSerializationLevel>(node, ATT_SERIALIZED, PluginSerializationLevel.none);

            foreach (XmlNode child in node.ChildNodes)
            {
                switch (child.Name)
                {
                case TYPE_SHELL:
                    _shellCmd = new ShellCmd(child, paramsFromXML(child));
                    break;

                case TYPE_POWERSHELL:
                    _shellCmd = new PowerShellCmd(child, paramsFromXML(child));
                    break;

                case TYPE_XENSERVER_POWERSHELL:
                    _shellCmd = new XenServerPowershellCmd(child, paramsFromXML(child));
                    break;
                }
                return;
            }
        }
Exemple #2
0
        public override string CheckForError()
        {
            if (_menu == PluginMenu.none)
            {
                return(string.Format(Messages.CANNOT_PARSE_NODE_PARAM, node.Name, ATT_MENU));
            }

            if (node.ChildNodes.Count != 1)
            {
                return(Messages.PLUGINS_MENU_ITEMS_ONLY_ONE_CHILD_ALLOWED);
            }

            foreach (XmlNode child in node.ChildNodes)
            {
                if (!(child.Name == TYPE_SHELL ||
                      child.Name == TYPE_POWERSHELL ||
                      child.Name == TYPE_XENSERVER_POWERSHELL))
                {
                    return(string.Format(Messages.PLUGINS_UNRECOGNISED_XML_NODE, child.Name, node.Name));
                }
            }

            return(ShellCmd.CheckForError() ?? base.CheckForError());
        }
Exemple #3
0
        public MenuItemFeature(ResourceManager resourceManager, XmlNode node, PluginDescriptor plugin, ParentMenuItemFeature parentFeature)
            : base(resourceManager, node, plugin)
        {
            _parentFeature = parentFeature;
            _menu = Helpers.GetEnumXmlAttribute<PluginMenu>(node, ATT_MENU, PluginMenu.none);
            _contextMenu = Helpers.GetEnumXmlAttribute<PluginContextMenu>(node, ATT_CONTEXT_MENU, GetContextMenuFromMenu(_menu));
            _serialization = Helpers.GetEnumXmlAttribute<PluginSerializationLevel>(node, ATT_SERIALIZED, PluginSerializationLevel.none);

            foreach (XmlNode child in node.ChildNodes)
            {   
                switch (child.Name)
                {
                    case TYPE_SHELL:
                        _shellCmd = new ShellCmd(child, paramsFromXML(child));
                        break;
                    case TYPE_POWERSHELL:
                        _shellCmd = new PowerShellCmd(child, paramsFromXML(child));
                        break;
                    case TYPE_XENSERVER_POWERSHELL:
                        _shellCmd = new XenServerPowershellCmd(child, paramsFromXML(child));
                        break;
                }
                return;
            }
        }