示例#1
0
        private void ConvertTreeToProject(esProjectNode esParentNode, TreeNode node)
        {
            esProjectNode esNode = new esProjectNode();

            esNode.Name = node.Text;

            if (esParentNode == null)
            {
                project.RootNode = esNode;
            }
            else
            {
                esParentNode.Children.Add(esNode);
            }

            if (node.Tag != null)
            {
                ProjectNodeData tag = node.Tag as ProjectNodeData;

                esNode.Template = tag.Template;
                esNode.Settings = tag.Settings;
                esNode.Input    = tag.Input;

                esNode.IsFolder = false;
            }

            foreach (TreeNode childNode in node.Nodes)
            {
                ConvertTreeToProject(esNode, childNode);
            }
        }
示例#2
0
        private void ConvertProjectToTree(TreeNode parentNode, esProjectNode esNode)
        {
            TreeNode node = null;

            if (parentNode == null)
            {
                node = this.projectTree.Nodes.Add(esNode.Name);
            }
            else
            {
                node = parentNode.Nodes.Add(esNode.Name);
            }

            if (!esNode.IsFolder)
            {
                ProjectNodeData tag = new ProjectNodeData();
                tag.Template = esNode.Template;
                tag.Settings = esNode.Settings;
                tag.Input    = esNode.Input;

                node.Tag                = tag;
                node.ImageIndex         = 2;
                node.SelectedImageIndex = 2;
                node.ContextMenuStrip   = menuTemplate;

                node.ToolTipText = esNode.Template.Header.Description + " (" + node.FullPath + ")";
            }

            foreach (esProjectNode childNode in esNode.Children)
            {
                ConvertProjectToTree(node, childNode);
            }
        }
示例#3
0
        private void ExecuteRecordedTemplates(esProjectNode node)
        {
            try
            {
                ExecuteRecordedTemplate(node);

                foreach (esProjectNode childNode in node.Children)
                {
                    ExecuteRecordedTemplates(childNode);
                }
            }
            catch (Exception ex)
            {
                errors.Add(ex);
            }
        }
示例#4
0
        public List <Exception> ExecuteFromNode(string nodeName)
        {
            try
            {
                esProjectNode startNode = project.RootNode;

                if (nodeName != null && startNode.Name != nodeName)
                {
                    string[] nodes = nodeName.Split(new char[] { '\\' });

                    if (startNode.Name != nodes[0])
                    {
                        throw new Exception("Node '" + nodes[0] + "' " + "Not Found in Project File");
                    }

                    for (int i = 1; i < nodes.Length; i++)
                    {
                        esProjectNode nextNode = null;
                        string        node     = nodes[i];

                        foreach (esProjectNode childNode in startNode.Children)
                        {
                            if (node == childNode.Name)
                            {
                                nextNode = childNode;
                                break;
                            }
                        }

                        if (nextNode == null)
                        {
                            throw new Exception("Node '" + node + "' " + "Not Found in Project File");
                        }

                        startNode = nextNode;
                    }
                }

                ExecuteRecordedTemplates(startNode);
            }
            catch (Exception ex)
            {
                errors.Add(ex);
            }

            return(errors);
        }
示例#5
0
        private void ExecuteRecordedTemplate(esProjectNode node)
        {
            try
            {
                if (node != null && !node.IsFolder)
                {
                    Root esMeta = Create(node.Settings as esSettings);
                    esMeta.Input = node.Input;

                    Template template = new Template();
                    template.Execute(esMeta, node.Template.Header.FullFileName);
                }
            }
            catch (Exception ex)
            {
                errors.Add(ex);
            }
        }