Esempio n. 1
0
        public List <ComingledXPathExpressionResult> Calculate(Project project, ElementType elementType, string filterXPath, string valueXPath)
        {
            List <IComingledXPathExpressionPart>  parts   = XmlUtil.ParseComingledXPathExpression(valueXPath);
            List <ComingledXPathExpressionResult> results = XmlUtil.ComputeComingledXPathExpression(project, elementType, filterXPath, parts);

            return(results);
        }
Esempio n. 2
0
        private void UpdatePreview()
        {
            EnumValue <ElementType> elementType = (elementTypeComboBox.SelectedItem as EnumValue <ElementType>);

            previewListView.Items.Clear();
            okButton.Enabled = false;

            if (elementType != null)
            {
                List <ComingledXPathExpressionResult> results = null;

                if (elementTypeComboBox.SelectedIndex < 0 || valueXPathTextBox.Text.IsNullOrEmpty())
                {
                    return;
                }

                try
                {
                    results = XmlUtil.ComputeComingledXPathExpression(ProjectContext.Project, elementType.Value, filterXPathTextBox.Text, valueXPathTextBox.Text);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }

                results.ForEach(o => previewListView.Items.Add(new ListViewItem(new[] { o.ElementName, o.Value })));

                okButton.Enabled = true;
            }
        }
Esempio n. 3
0
        public List <TemplateOutputDefinitionFilenameResult> Compute(Project project, ElementType elementType, string filterXPath, string rootPath)
        {
            string startingPath = rootPath;
            List <ComingledXPathExpressionResult> results = XmlUtil.ComputeComingledXPathExpression(project, elementType, filterXPath, this);

            if (!rootPath.EndsWith(@"\"))
            {
                startingPath += @"\";
            }

            return(results.Select(r => new TemplateOutputDefinitionFilenameResult(r.Element, r.ElementName, "{0}{1}".FormatString(startingPath, r.Value))).ToList());
        }
Esempio n. 4
0
 public ComingledXPathExpressionResult GetValue(XElement element, XmlNamespaceManager nsm, ElementType elementType)
 {
     return(XmlUtil.ComputeComingledXPathExpression(element, nsm, elementType, this.XPathParts));
 }