static IEnumerable<string> ReplaceAppSettingOrConnectionString(XNode document, string xpath, string keyAttributeName, string keyAttributeValue, string valueAttributeName, VariableDictionary variables)
        {
            var changes = new List<string>();
            var settings = (
                from element in document.XPathSelectElements(xpath)
                let keyAttribute = element.Attribute(keyAttributeName)
                where keyAttribute != null
                where string.Equals(keyAttribute.Value, keyAttributeValue, StringComparison.InvariantCultureIgnoreCase)
                select element).ToList();

            if (settings.Count == 0)
                return changes;

            var value = variables.Get(keyAttributeValue) ?? string.Empty;

            foreach (var setting in settings)
            {
                changes.Add(string.Format("Setting '{0}' = '{1}'", keyAttributeValue, value));

                var valueAttribute = setting.Attribute(valueAttributeName);
                if (valueAttribute == null)
                {
                    setting.Add(new XAttribute(valueAttributeName, value));
                }
                else
                {
                    valueAttribute.SetValue(value);
                }
            }

            return changes;
        }
Esempio n. 2
0
        private void WriteElement(XNode node, XmlWriter writer)
        {
            writer.WriteStartElement(node.Name);

            foreach (var attr in node.Attributes)
            {
                if (attr.Match == MatchType.Change || attr.Match == MatchType.NoMatch)
                    writer.WriteAttributeString(attr.Name, attr.XmlNode.Value);
            }

            foreach (var text in node.Texts)
            {
                if (text.Match == MatchType.Change || text.Match == MatchType.NoMatch)
                    writer.WriteValue(text.XmlNode.Value);
            }

            foreach (var element in node.Elements)
            {
                if (element.Match == MatchType.Change)
                    WriteElement(element, writer);

                if (element.Match == MatchType.NoMatch)
                    writer.WriteRaw(element.XmlNode.OuterXml);
            }

            writer.WriteEndElement();
        }
Esempio n. 3
0
        public AdjacencyGraph<Node, Edge<Node>> CreateGraphFromXml(string xmlFilePath)
        {
            XDocument xDocument = XDocument.Load(xmlFilePath);
            ModelChildrenNode = xDocument.XPathSelectElement(_modelChildrenPath);
            var graph = CreateGraphFromNode(xDocument, ModelChildrenNode);

            return graph;
        }
Esempio n. 4
0
 static IEnumerable<XElement> SelectWithRootNamespace(XNode container, string namespaceName, IEnumerable<Traversal> traversals)
 {
     var nav = container.CreateNavigator();
     var xPath = traversals.ToXPath("x");
     var manager = new XmlNamespaceManager(nav.NameTable);
     manager.AddNamespace("x", namespaceName);
     return container.XPathSelectElements(xPath, manager);
 }
Esempio n. 5
0
File: deBSP.cs Progetto: 4D4B/deBSP
 public deBSP()
 {
     this.Buffer = null;
     this.MapName = null;
     this.Header = null;
     this.Entities = null;
     this.Textures = null;
 }
Esempio n. 6
0
 private void LoadModules(XNode configRoot)
 {
     var elements = configRoot.XPathSelectElements("modules/module");
     _moduleInstancesInstances = new List<ModuleInstance>(elements.Count());
     elements.ForEachItem(m =>
     {
         var type = m.Attribute("Type").Value;
         var active = m.Attribute("Active")?.Value.ToBoolean() ?? true;
         _moduleInstancesInstances.Add(new ModuleInstance(type, active));
     });
 }
 public XElement Merge(XElement masterElement, XNode sourceElement)
 {
     var masterElementsWithIds = masterElement.XPathSelectElements("//*[@id]");
     foreach (var masterElementWithId in masterElementsWithIds)
     {
         // ReSharper disable PossibleNullReferenceException
         var childElementWithSameId = sourceElement.XPathSelectElement("//*[@id='" + masterElementWithId.Attribute("id").Value + "']");
         // ReSharper restore PossibleNullReferenceException
         if (childElementWithSameId != null)
             masterElementWithId.ReplaceWith(childElementWithSameId);
     }
     return masterElement;
 }
        static List<string> ApplyChanges(XNode doc, VariableDictionary variables)
        {
            var changes = new List<string>();

            foreach (var variable in variables.GetNames())
            {
                changes.AddRange(
                    ReplaceAppSettingOrConnectionString(doc, "//*[local-name()='appSettings']/*[local-name()='add']", "key", variable, "value", variables).Concat(
                    ReplaceAppSettingOrConnectionString(doc, "//*[local-name()='connectionStrings']/*[local-name()='add']", "name", variable, "connectionString", variables).Concat(
                    ReplaceStonglyTypeApplicationSetting(doc, "//*[local-name()='applicationSettings']//*[local-name()='setting']", "name", variable, variables))));
            }
            return changes;
        }
		new void SelectNode (XNode n)
		{
			MonoDevelop.Projects.Dom.DomRegion region = n.Region;
			
			XElement el = n as XElement;
			if (el != null && el.IsClosed && el.ClosingTag.Region.End > region.End) {
				region.End = el.ClosingTag.Region.End;
			}
			
			int s = Editor.Document.LocationToOffset (region.Start.Line, region.Start.Column );
			int e = Editor.Document.LocationToOffset (region.End.Line, region.End.Column);
			if (e > s && s > -1)
				Editor.SetSelection (s, e);
		}
		void SelectNode (XNode n)
		{
			MonoDevelop.Projects.Dom.DomRegion region = n.Region;
			
			XElement el = n as XElement;
			if (el != null && el.IsClosed && el.ClosingTag.Region.End > region.End) {
				region.End = el.ClosingTag.Region.End;
			}
			
			int s = Editor.GetPositionFromLineColumn (region.Start.Line, region.Start.Column);
			int e = Editor.GetPositionFromLineColumn (region.End.Line, region.End.Column);
			if (e > s && s > -1)
				Editor.Select (s, e);
		}
    private static object TransformEnvironmentNewLineToParagraph(XNode node)
    {
        var element = node as XElement;
        if (element != null)
        {
            if (element.Name == W.p)
            {

            }

            return new XElement(element.Name,
                element.Attributes(),
                element.Nodes().Select(n => TransformEnvironmentNewLineToParagraph(n)));
        }
        return node;
    }
        public static new void Parse(XNode node, DefinitionFile file)
        {
            UiView.Parse(node, file);

            var parser = new DefinitionParser(node);

            file["AutomataGrid"] = parser.ParseDelegate("AutomataGrid");
            file["EditEnabled"] = parser.ParseBoolean("EditEnabled");

            file["Zoom"] = parser.ParseDouble("Zoom");
            file["StateToPaint"] = parser.ParseInt("StateToPaint");

            file["Colors"] = parser.ParseDelegate("Colors");

            file["GridColor"] = parser.ParseColor("GridColor");
        }
Esempio n. 13
0
        private AdjacencyGraph<Node, Edge<Node>> CreateGraphFromNode(XDocument xDocument, XNode parent)
        {
            var graph = new AdjacencyGraph<Node, Edge<Node>>();

            var nodes = xDocument.Descendants().Where(x => x.Parent != null && (x.Parent.Parent != null && (x.Parent != null && x.Parent.Parent.Parent == parent)));

            var fromList = nodes.Where(x => x.Parent != null && (x.Name.LocalName == "ControlFlow" && x.Parent.Name.LocalName =="FromSimpleRelationships") );
            var toList = nodes.Where(x => x.Parent != null && (x.Name.LocalName == "ControlFlow" && x.Parent.Name.LocalName =="ToSimpleRelationships") );
            foreach (var fromNode in fromList)
            {
                var xNode1 = fromNode.Parent.Parent;

                string idref = fromNode.Attribute("Idref").Value;
                var xNode2 =
                    toList.Where(x => x.Parent != null && (x.Attribute("Idref").Value.ToString() == idref))
                        .Select(x => x.Parent.Parent).FirstOrDefault();

                if (xNode1 == null || xNode2 == null)
                    continue;

                Node node1 = new Node(xNode1.Attribute("Name").Value, GetNodeType(xNode1));
                Node node2 = new Node(xNode2.Attribute("Name").Value, GetNodeType(xNode2));

                if (!graph.Vertices.Any(x => x.Name==node1.Name && x.Type==node1.Type))
                {
                    graph.AddVertex(node1);
                }
                else
                {
                    node1 = graph.Vertices.FirstOrDefault(x => x.Name == node1.Name && x.Type == node1.Type);
                }
                if (!graph.Vertices.Any(x => x.Name == node2.Name && x.Type == node2.Type))
                {
                    graph.AddVertex(node2);
                }
                else
                {
                    node2 = graph.Vertices.FirstOrDefault(x => x.Name == node2.Name && x.Type == node2.Type);
                }
                var newEdge = new Edge<Node>(node1, node2);
                if(!graph.ContainsEdge(newEdge))
                    graph.AddEdge(newEdge);

            }

            return graph;
        }
Esempio n. 14
0
        //public static XElement XPathElement(XElement xe, string xpath)
        public static XElement XPathElement(XNode node, string xpath)
        {
            if (node == null)
                return null;

            object xpathResult = node.XPathEvaluate(xpath);
            if (xpathResult is IEnumerable)
            {
                object xpathResult2 = XPathResultGetFirstValue(xpathResult as IEnumerable);
                if (xpathResult2 != null)
                    xpathResult = xpathResult2;
            }
            if (xpathResult is XElement)
                return (XElement)xpathResult;
            else
                return null;
        }
Esempio n. 15
0
        //public static string XPathValue(XElement xe, string xpath, string defaultValue = null)
        public static string XPathValue(XNode node, string xpath, string defaultValue = null)
        {
            if (node == null)
                return defaultValue;

            object xpathResult = node.XPathEvaluate(xpath);
            if (xpathResult is IEnumerable)
            {
                object xpathResult2 = XPathResultGetFirstValue(xpathResult as IEnumerable);
                if (xpathResult2 != null)
                    xpathResult = xpathResult2;
            }
            string value = XPathResultGetValue(xpathResult);
            if (value != null)
                return value;
            else
                return defaultValue;
        }
Esempio n. 16
0
        private void LoadAppDomain(XNode configRoot)
        {
            var mde = configRoot.XPathSelectElement("appdomain");
            var deleteShadowOnStartup = mde.Attribute("DeleteShadowDirectoryOnStartup")?.Value.ToBoolean() ?? true;
            var moduleDirectory = configRoot.XPathSelectElement("appdomain/modules")?.Attribute("Directory")?.Value ??
                                  "ModuleInstances";
            var moduleShadowCopyDirectory =
                configRoot.XPathSelectElement("appdomain/modules")?.Attribute("ShadowCopyDirectory")?.Value ??
                @"ModuleInstances\bin";
            var pluginsDirectory = configRoot.XPathSelectElement("appdomain/plugins")?.Attribute("Directory")?.Value ??
                                   "Plugins";
            var pluginsShadowCopyDirectory =
                configRoot.XPathSelectElement("appdomain/plugins")?.Attribute("ShadowCopyDirectory")?.Value ??
                @"Plugins\bin";

            AppDomainLoadData = new AppDomainLoadData(deleteShadowOnStartup,
                new DynamicLoadingData(pluginsDirectory, pluginsShadowCopyDirectory),
                new DynamicLoadingData(moduleDirectory, moduleShadowCopyDirectory));
        }
Esempio n. 17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CSF.Zpt.DocumentProviders.ZptXmlLinqElement"/> class.
        /// </summary>
        /// <param name="node">The source XML Node.</param>
        /// <param name="sourceFile">Information about the element's source file.</param>
        /// <param name="isRoot">Whether or not this is the root element.</param>
        /// <param name="isImported">Whether or not this element is imported.</param>
        /// <param name="ownerDocument">The ZPT document which owns the element.</param>
        public ZptXmlLinqElement(XNode node,
                             ISourceInfo sourceFile,
                             IZptDocument ownerDocument,
                             bool isRoot = false,
                             bool isImported = false)
            : base(sourceFile, isRoot, isImported, ownerDocument)
        {
            if(node == null)
              {
            throw new ArgumentNullException(nameof(node));
              }

              _node = node as XElement;

              if(_node.NodeType == XmlNodeType.Document)
              {
            _node = node.Document.Root;
              }

              EnforceNodeType("XML", XmlNodeType.Element, _node.NodeType);
        }
Esempio n. 18
0
File: deBSP.cs Progetto: 4D4B/deBSP
        public bool Load(String file)
        {
            if (!System.IO.File.Exists(file))
                return false;

            this.MapName = System.IO.Path.GetFileNameWithoutExtension(file);
            this.Buffer = System.IO.File.ReadAllBytes(file);
            this.Header = new BSP_HEADER();
            this.Header.Version = System.BitConverter.ToUInt32(this.Buffer, 0);
            if (this.Header.Version != 30)
                return false;

            for (int i = 0; i < this.Header.Lumps.Length; i++)
            {
                this.Header.Lumps[i] = new BSP_LUMP();
                this.Header.Lumps[i].Offset = System.BitConverter.ToUInt32(this.Buffer, sizeof(UInt32) + (i * 2 * sizeof(UInt32)));
                this.Header.Lumps[i].Size = System.BitConverter.ToUInt32(this.Buffer, sizeof(UInt32) + (i * 2 * sizeof(UInt32)) + sizeof(UInt32));
            }

            String ES = System.Text.ASCIIEncoding.ASCII.GetString(this.Buffer, (int)this.Header.Lumps[(int)BSP_LUMP_TYPE.ENTITIES].Offset, (int)this.Header.Lumps[(int)BSP_LUMP_TYPE.ENTITIES].Size-1);

            this.Entities = new XNode();
            ParseEntitiesString(ES, this.Entities);

            UInt32 NumberTextures = System.BitConverter.ToUInt32(this.Buffer, (int)this.Header.Lumps[(int)BSP_LUMP_TYPE.TEXTURES].Offset);
            this.Textures = new BSP_TEXTURE_HEADER[NumberTextures];

            for (int i = 0; i < this.Textures.Length; i++)
            {
                this.Textures[i] = new BSP_TEXTURE_HEADER();
                Int32 Offset = (int)this.Header.Lumps[(int)BSP_LUMP_TYPE.TEXTURES].Offset + System.BitConverter.ToInt32(this.Buffer, (int)this.Header.Lumps[(int)BSP_LUMP_TYPE.TEXTURES].Offset + sizeof(Int32) + (i * sizeof(UInt32)));
                this.Textures[i].Name = System.Text.ASCIIEncoding.ASCII.GetString(this.Buffer, Offset, 16).Split('\0')[0];
                this.Textures[i].Width = System.BitConverter.ToUInt32(this.Buffer, Offset + 16);
                this.Textures[i].Height = System.BitConverter.ToUInt32(this.Buffer, Offset + 16 + sizeof(UInt32));
                for (int j = 0; j < this.Textures[i].Offsets.Length; j++)
                    this.Textures[i].Offsets[j] = System.BitConverter.ToUInt32(this.Buffer, Offset + 16 + sizeof(UInt32) + sizeof(UInt32) + (j * sizeof(UInt32)));
            }

            return true;
        }
Esempio n. 19
0
        // traverse to first child
        private void firstChildButton_Click( object sender, EventArgs e )
        {
            // try to convert to an XContainer
             var container = current as XContainer;

             // if container has children, move to first child
             if ( container != null && container.Nodes().Any() )
             {
            current = container.Nodes().First(); // first child

            // create new TreeNode for this node with correct label
            var newNode = new TreeNode( NodeText( current ) );
            tree.Nodes.Add( newNode ); // add node to TreeNode Nodes list
            tree = newNode; // move current selection to newNode
            TreeRefresh(); // reset the tree display
             } // end if
             else
             {
            // current is not a container or has no children
            MessageBox.Show( "Current node has no children.", "Warning",
               MessageBoxButtons.OK, MessageBoxIcon.Information );
             } // end else
        }
Esempio n. 20
0
 private static Interface10 smethod_1(XNode xnode_0)
 {
     return(smethod_0(xnode_0));
 }
Esempio n. 21
0
        public static SPSymbolDef XNodeToSPSymbolDef(XNode node)
        {
            SPSymbolDef spsd       = null;
            XElement    element    = null;
            XElement    subElement = null;
            //XAttribute attribute = null;
            XNode nextNode = null;

            try
            {
                if (node is XElement)
                {
                    element = (XElement)node;

                    if (element.HasElements)
                    {
                        spsd       = new SPSymbolDef();
                        subElement = null;
                        if (element.FirstNode is XElement)
                        {
                            subElement = (XElement)element.FirstNode;
                        }
                        while (subElement != null)
                        {
                            if (subElement.Name == "DESCRIPTION")
                            {
                                spsd._strDescription = subElement.FirstNode.ToString();  //get element value
                                //spsd._strDescription = spsd._strDescription.Replace("&amp;", "&");
                            }
                            if (subElement.Name.LocalName == "SYMBOLID")
                            {
                                spsd._strBasicSymbolId = subElement.FirstNode.ToString();
                                //if (spsd.BasicSymbolCode == "S*A*MFQH--*****")
                                //{
                                //    Console.WriteLine("");
                                //}
                            }
                            if (subElement.Name.LocalName == "MAPPING")
                            {
                                spsd._intMapping = int.Parse(subElement.FirstNode.ToString());
                            }
                            //////////////////////////////////////////
                            //hopefully get rid of these 4 values soon and turn them into height & width
                            if (subElement.Name.LocalName == "ULX")
                            {
                                spsd._intUpperleftX = int.Parse(subElement.FirstNode.ToString());
                            }
                            if (subElement.Name.LocalName == "ULY")
                            {
                                spsd._intUpperleftY = int.Parse(subElement.FirstNode.ToString());
                            }
                            if (subElement.Name.LocalName == "LRX")
                            {
                                spsd._intLowerrightX = int.Parse(subElement.FirstNode.ToString());
                            }
                            if (subElement.Name.LocalName == "LRY")
                            {
                                spsd._intLowerrightY = int.Parse(subElement.FirstNode.ToString());
                            }
                            spsd._intWidth  = spsd._intLowerrightX - spsd._intUpperleftX;
                            spsd._intHeight = spsd._intLowerrightY - spsd._intUpperleftY;
                            //////////////////////////////
                            if (subElement.Name.LocalName == "WIDTH")
                            {
                                spsd._intWidth = int.Parse(subElement.FirstNode.ToString());
                            }
                            if (subElement.Name.LocalName == "HEIGHT")
                            {
                                spsd._intHeight = int.Parse(subElement.FirstNode.ToString());
                            }

                            nextNode   = subElement.NextNode;
                            subElement = null;
                            while (subElement == null && nextNode != null)
                            {
                                if (nextNode is XElement)
                                {
                                    subElement = (XElement)nextNode;
                                }
                                else
                                {
                                    nextNode = nextNode.NextNode;
                                }
                            }
                        }
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (System.Xml.XmlException xe)
            {
                Console.WriteLine(xe.Message);
                Console.WriteLine(xe.StackTrace);
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.Message);
                Console.WriteLine(exc.StackTrace);
            }
            if (spsd.getBasicSymbolId() != null && spsd.getBasicSymbolId() != "")
            {
                return(spsd);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 22
0
 /// <summary>
 /// Renders the specified XNode.
 /// </summary>
 /// <param name="xNode">The <see cref="XNode">XNode</see>.</param>
 /// <returns></returns>
 public IHtmlString Markup(XNode xNode)
 {
     return(Html.C1().Markup(xNode));
 }
Esempio n. 23
0
 public Compile(XNode node) : base(node)
 {
     _link = Element.Attribute("Link")?.Value;
 }
Esempio n. 24
0
 public DynamicXmlMetaObject(Expression expression, XNode node)
     : base(expression, BindingRestrictions.GetInstanceRestriction(expression, node), node)
 {
 }
Esempio n. 25
0
        public async Task PushChangeAsync(BuildManifestChange change)
        {
            await Retry.RunAsync(async attempt =>
            {
                BuildManifestLocation location = change.Location;

                // Get the current commit. Use this throughout to ensure a clean transaction.
                GitReference remoteRef = await _github.GetReferenceAsync(
                    location.GitHubProject,
                    location.GitHubRef);

                string remoteCommit = remoteRef.Object.Sha;

                Trace.TraceInformation($"Creating update on remote commit: {remoteCommit}");

                XElement remoteModelXml = await FetchModelXmlAsync(
                    location.GitHubProject,
                    remoteCommit,
                    location.GitHubBasePath);

                OrchestratedBuildModel remoteModel = OrchestratedBuildModel.Parse(remoteModelXml);

                // This is a subsequent publish step: make sure a new build hasn't happened already.
                if (change.OrchestratedBuildId != remoteModel.Identity.BuildId)
                {
                    throw new ManifestChangeOutOfDateException(
                        change.OrchestratedBuildId,
                        remoteModel.Identity.BuildId);
                }

                OrchestratedBuildModel modifiedModel = OrchestratedBuildModel.Parse(remoteModelXml);
                change.ApplyModelChanges(modifiedModel);

                if (modifiedModel.Identity.BuildId != change.OrchestratedBuildId)
                {
                    throw new ArgumentException(
                        "Change action shouldn't modify BuildId. Changed from " +
                        $"'{change.OrchestratedBuildId}' to '{modifiedModel.Identity.BuildId}'.",
                        nameof(change));
                }

                XElement modifiedModelXml = modifiedModel.ToXml();

                string[] changedSemaphorePaths = change.SemaphorePaths.ToArray();

                // Check if any join groups are completed by this change.
                var joinCompleteCheckTasks = change.JoinSemaphoreGroups.NullAsEmpty()
                                             .Select(async g => new
                {
                    Group    = g,
                    Joinable = await IsGroupJoinableAsync(
                        location,
                        remoteCommit,
                        change.OrchestratedBuildId,
                        changedSemaphorePaths,
                        g)
                });

                var completeJoinedSemaphores = (await Task.WhenAll(joinCompleteCheckTasks))
                                               .Where(g => g.Joinable)
                                               .Select(g => g.Group.JoinSemaphorePath)
                                               .ToArray();

                IEnumerable <SupplementaryUploadRequest> semaphoreUploads = completeJoinedSemaphores
                                                                            .Concat(changedSemaphorePaths)
                                                                            .Select(p => new SupplementaryUploadRequest
                {
                    Path     = p,
                    Contents = new SemaphoreModel
                    {
                        BuildId = change.OrchestratedBuildId
                    }.ToFileContent()
                });

                IEnumerable <SupplementaryUploadRequest> uploads =
                    semaphoreUploads.Concat(change.SupplementaryUploads.NullAsEmpty());

                if (!XNode.DeepEquals(modifiedModelXml, remoteModelXml))
                {
                    uploads = uploads.Concat(new[]
                    {
                        new SupplementaryUploadRequest
                        {
                            Path     = BuildManifestXmlName,
                            Contents = modifiedModelXml.ToString()
                        }
                    });
                }

                return(await PushUploadsAsync(
                           location,
                           change.CommitMessage,
                           remoteCommit,
                           uploads));
            });
        }
Esempio n. 26
0
 private void _printXml(XNode node)
 {
     Debug.WriteLine(node.ToString());
 }
Esempio n. 27
0
        public void CreateModel(int numElementsX, int numElementsY, double jIntegralRadiusRatio)
        {
            var model = new XModel();

            model.Subdomains[subdomainID] = new XSubdomain(subdomainID);
            this.Model = model;

            // Mesh generation
            var meshGenerator = new UniformMeshGenerator2D <XNode>(0.0, 0.0, beamLength, beamHeight, numElementsX, numElementsY);

            (IReadOnlyList <XNode> nodes, IReadOnlyList <CellConnectivity <XNode> > elementConnectivities) =
                meshGenerator.CreateMesh((id, x, y, z) => new XNode(id, x, y, z));

            // Nodes
            foreach (XNode node in nodes)
            {
                model.Nodes.Add(node);
            }

            // Elements
            var factory = new XContinuumElement2DFactory(integration, jIntegration, material);
            var cells   = new XContinuumElement2D[elementConnectivities.Count];

            for (int e = 0; e < elementConnectivities.Count; ++e)
            {
                XContinuumElement2D element = factory.CreateElement(e, CellType.Quad4, elementConnectivities[e].Vertices);
                cells[e] = element;
                model.Elements.Add(element);
                model.Subdomains[subdomainID].Elements.Add(model.Elements[e]);
            }

            // Mesh
            var mesh = new BidirectionalMesh2D <XNode, XContinuumElement2D>(model.Nodes,
                                                                            model.Elements.Select(e => (XContinuumElement2D)e).ToArray(), beamBoundary);

            // Boundary conditions
            double tol         = 1E-6;
            double L           = DoubleCantileverBeam.beamLength;
            double H           = DoubleCantileverBeam.beamHeight;
            XNode  topRight    = model.Nodes.Where(n => Math.Abs(n.X - L) <= tol && Math.Abs(n.Y - H) <= tol).First();
            XNode  bottomRight = model.Nodes.Where(n => Math.Abs(n.X - L) <= tol && Math.Abs(n.Y) <= tol).First();

            topRight.Constraints.Add(new Constraint()
            {
                DOF = StructuralDof.TranslationY, Amount = +0.05
            });
            bottomRight.Constraints.Add(new Constraint()
            {
                DOF = StructuralDof.TranslationY, Amount = -0.05
            });
            foreach (XNode node in model.Nodes.Where(n => Math.Abs(n.X) <= tol))
            {
                node.Constraints.Add(new Constraint()
                {
                    DOF = StructuralDof.TranslationX, Amount = 0.0
                });
                node.Constraints.Add(new Constraint()
                {
                    DOF = StructuralDof.TranslationY, Amount = 0.0
                });
            }

            // Create crack
            double elementSizeX = beamLength / numElementsX;
            double elementSizeY = beamHeight / numElementsY;

            CreateCrack(Math.Max(elementSizeX, elementSizeY), model, mesh, jIntegralRadiusRatio);
        }
Esempio n. 28
0
        public static void DumpNode(XNode node)
        {
            switch (node.NodeType)
            {
            case XmlNodeType.Document:
                XDocument document = (XDocument)node;
                Console.WriteLine("StartDocument");
                XDeclaration declaration = document.Declaration;
                if (declaration != null)
                {
                    Console.WriteLine("XmlDeclaration: {0} {1} {2}", declaration.Version, declaration.Encoding, declaration.Standalone);
                }
                foreach (XNode n in document.Nodes())
                {
                    DumpNode(n);
                }
                Console.WriteLine("EndDocument");
                break;

            case XmlNodeType.Element:
                XElement element = (XElement)node;
                Console.WriteLine("StartElement: {0}", element.Name);
                if (element.HasAttributes)
                {
                    foreach (XAttribute attribute in element.Attributes())
                    {
                        Console.WriteLine("Attribute: {0} = {1}", attribute.Name, attribute.Value);
                    }
                }
                if (!element.IsEmpty)
                {
                    foreach (XNode n in element.Nodes())
                    {
                        DumpNode(n);
                    }
                }
                Console.WriteLine("EndElement: {0}", element.Name);
                break;

            case XmlNodeType.Text:
                XText text = (XText)node;
                Console.WriteLine("Text: {0}", text.Value);
                break;

            case XmlNodeType.ProcessingInstruction:
                XProcessingInstruction pi = (XProcessingInstruction)node;
                Console.WriteLine("ProcessingInstruction: {0} {1}", pi.Target, pi.Data);
                break;

            case XmlNodeType.Comment:
                XComment comment = (XComment)node;
                Console.WriteLine("Comment: {0}", comment.Value);
                break;

            case XmlNodeType.DocumentType:
                XDocumentType documentType = (XDocumentType)node;
                Console.WriteLine("DocumentType: {0} {1} {2} {3}", documentType.Name, documentType.PublicId, documentType.SystemId, documentType.InternalSubset);
                break;

            default:
                break;
            }
        }
        internal void ClearOldLinkedCode()
        {
            Log.WriteLine("Housekeeping old Linked Code.", ConsoleColor.White, ConsoleColor.DarkGray);
            if (RootXelement != null)
            {
                if (StartPlaceHolder != null && EndPlaceHolder != null)
                {
                    try
                    {
                        string oldXml = "<root>" + OldLinkedXml + "</root>";

                        if (oldXml.Contains("ItemGroup"))
                        {
                            XElement keeperElements = XElement.Parse(oldXml); // http://stackoverflow.com/a/11644640/492

                            foreach (XElement descendant in keeperElements.DescendantsAndSelf().Where(e => (e.Attribute("Include") ?? e.Attribute("Exclude")) != null))
                            {
                                XAttribute xAttribute = descendant.Attribute("Include") ?? descendant.Attribute("Exclude");
                                if (xAttribute != null)
                                {
                                    Keepers.Add(descendant); // keep stray code that is not a relative link. VS *may* have added it here.
                                }
                            }

                            if (Keepers.Any())
                            {
                                Log.WriteLine($"Found {Keepers.Count} potential Project Items in the Linked Zone to rescue.", ConsoleColor.Cyan);
                            }
                        }

                        if (StartPlaceHolder != null && EndPlaceHolder != null && StartPlaceHolder.IsBefore(EndPlaceHolder))
                        {
                            XNode startNode = StartPlaceHolder;
                            while (startNode.NextNode != EndPlaceHolder)
                            {
                                startNode.NextNode.Remove();
                            }
                        }

                        foreach (XElement itemGroup in ItemGroups)
                        {
                            if (itemGroup.IsEmpty || (!itemGroup.Descendants().Any() && string.IsNullOrEmpty(itemGroup.Value)))
                            {
                                itemGroup.Remove();
                            }

                            /*else if (itemGroup.IsAfter(StartPlaceHolder) && itemGroup.IsBefore(EndPlaceHolder))
                             *  itemGroup.Remove();*/
                            //  System.InvalidOperationException: A common ancestor is missing.
                        }

                        ItemGroups = RootXelement?.Elements(Settings.MSBuild + "ItemGroup").ToList();
                    }
                    catch (Exception e)
                    {
                        App.Crash(e, $"FAILed clearing old linked code from: {DestProjAbsolutePath}");
                    }
                }
                Log.WriteLine("finished clearing old linked XML from source project", ConsoleColor.Gray);
            }
        }
Esempio n. 30
0
 public CommunicationBusModule()
 {
     XmlRequest       = null;
     sqlQueryExecutor = new SqlQueryExecutor();
 }
 protected override VisualElement Create(XNode node)
 {
     _view = new GeocortexMobileElementsXamlView();
     return(_view);
 }
Esempio n. 32
0
        /// <summary>
        /// Raises the DOMNodeRemovedFromDocument event for the specified node.
        /// </summary>
        /// <param name="node"></param>
        void OnNodeRemovedFromDocument(XNode node)
        {
            Contract.Requires <ArgumentNullException>(node != null);

            DispatchEvent(node, Events.DOMNodeRemovedFromDocument);
        }
Esempio n. 33
0
 /// <summary>
 /// Execute it in the given document with current position at the given node.
 /// </summary>
 /// <param name="dom">Document</param>
 /// <param name="cursor">Nodes we're currently at</param>
 /// <param name="stack">Execution stack</param>
 /// <returns>New current nodes</returns>
 public ICursor Exec(XNode dom, ICursor cursor, IStack stack)
 {
     return(stack.Pop());
 }
Esempio n. 34
0
        public DropdownModel GetTheme()
        {
            using (var client = new System.Net.Http.HttpClient())
            {
                var env      = ConfigurationManager.AppSettings["Enviroment"];
                var settings = "";
                var uri      = new Uri("https://api.evolutionrevolutionoflove.com/api/theme");


                if (env == "Dev")
                {
                    settings = ConfigurationManager.AppSettings["LocalWebApi"];
                    uri      = new Uri("http://localhost:18760/api/theme/");
                }
                else
                {
                    settings = ConfigurationManager.AppSettings["ProductionWebApi"];
                    uri      = new Uri("https://api.evolutionrevolutionoflove.com/api/theme");
                }



                var response = client.GetAsync(uri).Result;

                var responseContent = response.Content;
                var responseString  = responseContent.ReadAsStringAsync().Result;


                var x = JObject.Parse(responseString);

                XNode node = JsonConvert.DeserializeXNode(x.ToString(), "data");

                string a     = node.ToString();
                string trima = a.Replace("\r\n", "");
                trima = a.Replace("{", "");
                trima = a.Replace("}", "");


                DropdownModel model = new DropdownModel();
                model.items.Add(new SelectListItem {
                    Text = "Please Select ", Value = "0"
                });

                XDocument xml = XDocument.Parse(trima);

                foreach (var el in xml.Descendants("categoryLists"))
                {
                    string ID         = el.Element("ID").Value;
                    string AnimalType = el.Element("Category").Value;
                    model.items.Add(new SelectListItem {
                        Text = AnimalType, Value = ID
                    });
                }

                var animalType = "";

                foreach (SelectListItem s in model.items)
                {
                    if (s.Value == animalType)
                    {
                        s.Selected = true;
                    }
                }

                return(model);
                //ViewData["animalTypeData"] = model.items;
            }
        }
Esempio n. 35
0
        public void Create3x1Model()
        {
            double elementSize = 20.0;
            var    model       = new XModel();

            model.Subdomains[subdomainID] = new XSubdomain(subdomainID);
            this.Model = model;

            //Nodes
            model.Nodes.Add(new XNode(0, 0.0, 0.0));
            model.Nodes.Add(new XNode(1, elementSize, 0.0));
            model.Nodes.Add(new XNode(2, elementSize, elementSize));
            model.Nodes.Add(new XNode(3, 0.0, elementSize));
            model.Nodes.Add(new XNode(4, 2 * elementSize, 0.0));
            model.Nodes.Add(new XNode(5, 3 * elementSize, 0.0));
            model.Nodes.Add(new XNode(6, 3 * elementSize, elementSize));
            model.Nodes.Add(new XNode(7, 2 * elementSize, elementSize));

            // Elements
            XNode[][] connectivity = new XNode[3][];
            connectivity[0] = new XNode[] { model.Nodes[0], model.Nodes[1], model.Nodes[2], model.Nodes[3] };
            connectivity[1] = new XNode[] { model.Nodes[1], model.Nodes[4], model.Nodes[7], model.Nodes[2] };
            connectivity[2] = new XNode[] { model.Nodes[4], model.Nodes[5], model.Nodes[6], model.Nodes[7] };

            var factory = new XContinuumElement2DFactory(integration, jIntegration, material);
            var cells   = new XContinuumElement2D[3];

            for (int e = 0; e < 3; ++e)
            {
                XContinuumElement2D element = factory.CreateElement(e, CellType.Quad4, connectivity[e]);
                cells[e] = element;
                model.Elements.Add(element);
                model.Subdomains[subdomainID].Elements.Add(model.Elements[e]);
            }

            // Mesh
            var mesh = new BidirectionalMesh2D <XNode, XContinuumElement2D>(model.Nodes,
                                                                            model.Elements.Select(e => (XContinuumElement2D)e).ToArray(), beamBoundary);

            // Boundary conditions
            model.Nodes[0].Constraints.Add(new Constraint()
            {
                DOF = StructuralDof.TranslationX, Amount = 0.0
            });
            model.Nodes[0].Constraints.Add(new Constraint()
            {
                DOF = StructuralDof.TranslationY, Amount = 0.0
            });
            model.Nodes[3].Constraints.Add(new Constraint()
            {
                DOF = StructuralDof.TranslationX, Amount = 0.0
            });
            model.Nodes[3].Constraints.Add(new Constraint()
            {
                DOF = StructuralDof.TranslationY, Amount = 0.0
            });
            model.Nodes[5].Constraints.Add(new Constraint()
            {
                DOF = StructuralDof.TranslationY, Amount = -0.05
            });
            model.Nodes[6].Constraints.Add(new Constraint()
            {
                DOF = StructuralDof.TranslationY, Amount = +0.05
            });

            // Create crack
            CreateCrack(elementSize, model, mesh, 2.0);
        }
Esempio n. 36
0
 public PropertyGroup(XNode node) : base(node)
 {
 }
Esempio n. 37
0
 public ElementAtom(XNode content)
 {
     element = content as XElement;
 }
Esempio n. 38
0
 /// <summary>
 /// Converts an XNode into an XElement via XElement.Parse.
 /// Source pulled and modified from:
 /// http://codesnippets.fesslersoft.de/how-to-convert-xnode-to-xelement-in-c-and-vb-net/
 /// </summary>
 /// <param name="xNode">The XNode to convert into an XElement.</param>
 /// <returns>Returns an XElement form of the current XNode.</returns>
 public static XElement GetXElement(this XNode xNode)
 {
     return(XElement.Parse(xNode.ToString()));
 }
Esempio n. 39
0
        public override double[] EvaluateFunctionsAt(XNode node)
        {
            double signedDistance = Discontinuity.SignedDistanceOf(node);

            return(new double[] { enrichmentFunction.EvaluateAt(signedDistance) });
        }
Esempio n. 40
0
        /// <summary>
        /// Write out the given XML Node as Markdown. Recursive function used internally.
        /// </summary>
        /// <param name="node">The xml node to write out.</param>
        /// <param name="ConversionContext">The Conversion Context that will be passed around and manipulated over the course of the translation.</param>
        /// <returns>The converted markdown text.</returns>
        public static string ToMarkDown(this XNode node, ConversionContext context)
        {
            if (node is XDocument)
            {
                node = ((XDocument)node).Root;
            }

            string name;

            if (node.NodeType == XmlNodeType.Element)
            {
                var el = (XElement)node;
                name = el.Name.LocalName;
                if (name == "member")
                {
                    string expandedName = null;
                    if (!_MemberNamePrefixDict.TryGetValue(el.Attribute("name").Value.Substring(0, 2), out expandedName))
                    {
                        expandedName = "none";
                    }
                    name = expandedName.ToLowerInvariant();
                }
                if (name == "see")
                {
                    var anchor = el.Attribute("cref") != null && el.Attribute("cref").Value.StartsWith("!:#");
                    name = anchor ? "seeAnchor" : "seePage";
                }
                //treat first Param element separately to add table headers.
                if (name.EndsWith("param") &&
                    node
                    .ElementsBeforeSelf()
                    .LastOrDefault()
                    ?.Name
                    ?.LocalName != "param")
                {
                    name = "firstparam";
                }

                try {
                    var vals = TagRenderer.Dict[name].ValueExtractor(el, context).ToArray();
                    return(string.Format(TagRenderer.Dict[name].FormatString, args: vals));
                }
                catch (KeyNotFoundException ex)
                {
                    var lineInfo = (IXmlLineInfo)node;
                    switch (context.UnexpectedTagAction)
                    {
                    case UnexpectedTagActionEnum.Error:
                        throw new XmlException($@"Unknown element type ""{ name }""", ex, lineInfo.LineNumber, lineInfo.LinePosition);

                    case UnexpectedTagActionEnum.Warn:
                        context.WarningLogger.LogWarning($@"Unknown element type ""{ name }"" on line {lineInfo.LineNumber}, pos {lineInfo.LinePosition}");
                        break;

                    case UnexpectedTagActionEnum.Accept:
                        //do nothing;
                        break;

                    default:
                        throw new InvalidOperationException($"Unexpected {nameof(UnexpectedTagActionEnum)}");
                    }
                }
            }


            if (node.NodeType == XmlNodeType.Text)
            {
                return(Regex.Replace(((XText)node).Value.Replace('\n', ' '), @"\s+", " "));
            }

            return("");
        }
Esempio n. 41
0
        /// <summary>
        /// Raises the DOMNodeInsertedIntoDocument event for the given node.
        /// </summary>
        /// <param name="node"></param>
        void OnNodeAddedToDocument(XNode node)
        {
            Contract.Requires <ArgumentNullException>(node != null);

            DispatchEvent(node, Events.DOMNodeInsertedIntoDocument);
        }
Esempio n. 42
0
 public NameUnit(XNode sender, object name)
 {
     _sender = sender;
     _name   = name;
 }
Esempio n. 43
0
 public static XAttribute first_attribute(XNode element, string name)
 {
     return((element as XElement).Attributes().FirstOrDefault(x => x.Name == name));
 }
Esempio n. 44
0
            private void Parse(XNode node)
            {
                if (node.NodeType == XmlNodeType.Comment)
                {
                    return;
                }

                if (node is XText text)
                {
                    AppendParts(_provider.CreatePart(SymbolDisplayPartKind.Text, Normalize(text.Value)).Enumerate());
                    return;
                }

                var element = (node as XDocument)?.Root ?? (XElement)node;

                var name = element.Name.LocalName;

                if (name == XmlNames.SummaryElement)
                {
                    // TODO: does changing description effect on a line breaking?
                    var oldDescription = currentDescription;
                    currentDescription = SymbolDescriptionKind.Additional;

                    foreach (var childNode in element.Nodes())
                    {
                        Parse(childNode);
                    }

                    currentDescription = oldDescription;
                    return;
                }

                if (name == XmlNames.ParaElement)
                {
                    _lineBrokenCount = 2;
                    foreach (var childNode in element.Nodes())
                    {
                        Parse(childNode);
                    }
                    _lineBrokenCount = 2;
                    return;
                }

                if (name == XmlNames.ExceptionElement)
                {
                    AppendExceptionParts(element);
                    return;
                }

                if (name == XmlNames.SeeElement || name == XmlNames.SeeAlsoElement)
                {
                    foreach (var attribute in element.Attributes())
                    {
                        AppendAttributeParts(name, attribute, XmlNames.CrefAttribute);
                    }
                    return;
                }

                if (name == XmlNames.ParameterRefElement || name == XmlNames.TypeParameterRefElement)
                {
                    foreach (var attribute in element.Attributes())
                    {
                        AppendAttributeParts(name, attribute, XmlNames.NameAttribute);
                    }
                    return;
                }

                foreach (var childNode in element.Nodes())
                {
                    Parse(childNode);
                }
            }
Esempio n. 45
0
 internal DynamicXmlReaderDmoVersion(XNode node)
 {
     _internalNode = node;
 }
Esempio n. 46
0
        /// <summary>
        /// Processes a GPX file, invoking callbacks on a <see cref="GpxVisitorBase"/> instance as
        /// elements are observed.
        /// </summary>
        /// <param name="reader">
        /// The <see cref="XmlReader"/> to read from.
        /// </param>
        /// <param name="settings">
        /// The <see cref="GpxReaderSettings"/> instance to use to control how GPX instances get
        /// read in, or <c>null</c> to use a general-purpose default.
        /// </param>
        /// <param name="visitor">
        /// The <see cref="GpxVisitorBase"/> instance that will receive callbacks.
        /// </param>
        /// <remarks>
        /// This method is the "core" reading method; everything else builds off of this.
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        /// Thrown when <paramref name="reader"/> or <paramref name="visitor"/> is
        /// <see langword="null"/>.
        /// </exception>
        /// <exception cref="XmlException">
        /// Thrown when <paramref name="reader"/> does not specify a valid GPX file (i.e., cases
        /// where XSD schema validation would fail, and/or some values are <b>well</b> outside of
        /// the slightly stricter, but still completely reasonable, limits imposed by the idiomatic
        /// .NET data types above and beyond the XSD limits).
        /// </exception>
        public static void Read(XmlReader reader, GpxReaderSettings settings, GpxVisitorBase visitor)
        {
            if (reader is null)
            {
                throw new ArgumentNullException(nameof(reader));
            }

            if (visitor is null)
            {
                throw new ArgumentNullException(nameof(visitor));
            }

            settings = settings ?? new GpxReaderSettings();
            while (reader.ReadToFollowing("gpx", Helpers.GpxNamespace))
            {
                string version = null;
                string creator = settings.DefaultCreatorIfMissing;
                for (bool hasAttribute = reader.MoveToFirstAttribute(); hasAttribute; hasAttribute = reader.MoveToNextAttribute())
                {
                    switch (reader.Name)
                    {
                    case "version":
                        version = reader.Value;
                        break;

                    case "creator":
                        creator = reader.Value;
                        break;
                    }
                }

                if (version != "1.1" && !settings.IgnoreVersionAttribute)
                {
                    throw new XmlException("'version' must be '1.1'");
                }

                if (creator is null)
                {
                    throw new XmlException("'creator' must be specified");
                }

                if (!ReadTo(reader, XmlNodeType.Element, XmlNodeType.EndElement))
                {
                    visitor.VisitMetadata(new GpxMetadata(creator));
                    break;
                }

                bool expectingMetadata   = true;
                bool expectingExtensions = true;
                do
                {
                    if (expectingMetadata)
                    {
                        expectingMetadata = false;
                        if (reader.Name == "metadata")
                        {
                            ReadMetadata(reader, settings, creator, visitor);
                            if (!ReadTo(reader, XmlNodeType.Element, XmlNodeType.EndElement))
                            {
                                break;
                            }
                        }
                        else
                        {
                            visitor.VisitMetadata(new GpxMetadata(creator));
                        }
                    }

                    switch (reader.Name)
                    {
                    // ideally, it should all be in this order, since the XSD validation
                    // would fail otherwise, but whatever.
                    case "wpt":
                        ReadWaypoint(reader, settings, visitor);
                        break;

                    case "rte":
                        ReadRoute(reader, settings, visitor);
                        break;

                    case "trk":
                        ReadTrack(reader, settings, visitor);
                        break;

                    case "extensions" when expectingExtensions:
                        expectingExtensions = false;
                        var    extensionElement = (XElement)XNode.ReadFrom(reader);
                        object extensions       = settings.ExtensionReader.ConvertGpxExtensionElement(extensionElement.Elements());
                        if (!(extensions is null))
                        {
                            visitor.VisitExtensions(extensions);
                        }

                        break;

                    case string _ when settings.IgnoreUnexpectedChildrenOfTopLevelElement:
                        reader.Skip();
                        break;

                    default:
                        throw new XmlException($"Unexpected xml node '{reader.Name}'");
                    }
                }while (ReadTo(reader, XmlNodeType.Element, XmlNodeType.EndElement));
            }
        }
Esempio n. 47
0
 private DynamicXmlMetaObject(Expression expression, BindingRestrictions bindingRestrictions, XNode node)
     : base(expression, bindingRestrictions, node)
 {
 }
        private TreeViewItemEx ProcessTreeBranch(XElement branch, XNode types, string selectedType, int selectedId, ref TreeViewItemEx selectedNode)
        {
            TreeViewItemEx returnVal = null;
            // Get the text, id, type and hasChildren attributes
            string theText = branch.GetAttribute("text");

            if (isSinglePopulate)
            {
                theText = branch.GetAttribute("value");
            }
            int theId = 0;

            int.TryParse(branch.GetAttribute(Common.IDAttrib), out theId);
            string tooltip = branch.GetAttribute("tooltip");
            string theType = branch.GetAttribute(Common.Data.RowType);

            // Determine if the node is to have children (display a + sign)
            bool hasChildren = false;

            if (isSinglePopulate)
            {
                hasChildren = branch.HasElements;
            }
            else
            {
                hasChildren = Common.boolValue(branch.GetAttribute("hasChildren"));
            }

            // If no children, just add a single node.
            // If there are to be children (but none passed in the XML), create a dummy child.
            // Otherwise, process each child separately and add as a child to this node.
            if (!hasChildren)
            {
                returnVal = new TreeViewItemEx(this, theId, theType, theText, tooltip, false);
            }
            else
            {
                if (!isSinglePopulate && (branch.FirstNode == null || !(branch.FirstNode is XElement)))
                {
                    returnVal = new TreeViewItemEx(this, theId, theType, theText, tooltip, false);
                }
                else
                {
                    returnVal = new TreeViewItemEx(this, theId, theType, theText, tooltip, true);

                    XElement leaf = (XElement)branch.FirstNode;
                    while (leaf != null)
                    {
                        TreeViewItemEx treeBranch = ProcessTreeBranch(leaf, types, selectedType, selectedId, ref selectedNode);
                        returnVal.Items.Add(treeBranch);
                        ItemList.Add(treeBranch.ID, treeBranch);
                        leaf = (XElement)leaf.NextNode;
                    }
                    returnVal.ChildrenFetched = true;
                }
            }

            // Set the selectedNode if it's a match
            if (theType == selectedType && theId == selectedId)
            {
                selectedNode = returnVal;
            }
            return(returnVal);
        }
Esempio n. 49
0
 internal override bool DeepEquals(XNode node)
 {
     XProcessingInstruction other = node as XProcessingInstruction;
     return other != null && target == other.target && data == other.data;
 }
Esempio n. 50
0
 static string valueOrEmpty( XNode node, string xpath )
 {
     XElement element = node.XPathSelectElement( xpath ) ;
     return element != null ? element.Value : string.Empty ;
 }
Esempio n. 51
0
 /// <summary>
 /// Create an appropriate IAtom wrapper of the given node.
 /// </summary>
 /// <param name="node">An XElement or XText node</param>
 /// <returns></returns>
 public static IAtom MakeAtom(XNode node)
 {
     return(node.NodeType == XmlNodeType.Text
                         ? new TextAtom(node) as IAtom
                         : new ElementAtom(node));
 }
		public XNodeNavigator (XNode node, XmlNameTable nameTable)
		{
			this.node = node;
			this.name_table = nameTable;
		}
		public XNodeNavigator (XNodeNavigator other)
		{
			this.node = other.node;
			this.attr = other.attr;
			this.name_table = other.name_table;
		}
		public override bool MoveToPrevious ()
		{
			if (node.PreviousNode == null)
				return false;
			node = node.PreviousNode;
			attr = null;
			return true;
		}
		public override void MoveToRoot ()
		{
			node = node.Owner;
			attr = null;
		}
		public override bool MoveToParent ()
		{
			if (attr != null) {
				attr = null;
				return true;
			}
			if (node.Parent == null)
				return false;
			node = node.Parent;
			return true;
		}
		public override bool MoveToNext ()
		{
			if (node.NextNode == null)
				return false;
			node = node.NextNode;
			attr = null;
			return true;
		}
		public override bool MoveToFirstChild ()
		{
			XContainer c = node as XContainer;
			if (c == null)
				return false;
			node = c.FirstNode;
			attr = null;
			return true;
		}
		public override bool MoveTo (XPathNavigator other)
		{
			XNodeNavigator nav = other as XNodeNavigator;
			if (nav == null || nav.node.Owner != node.Owner)
				return false;
			node = nav.node;
			attr = nav.attr;
			return true;
		}
Esempio n. 60
-1
        //public static IEnumerable<string> XPathValues(XElement xe, string xpath)
        public static IEnumerable<string> XPathValues(XNode node, string xpath)
        {
            if (node == null)
                return new string[0];

            return XPathResultGetValues(node.XPathEvaluate(xpath));
        }