Accept() public method

Accepts the specified visitor by calling the appropriate Visit method on it.
public Accept ( IYamlVisitor visitor ) : void
visitor IYamlVisitor /// A . ///
return void
Exemplo n.º 1
0
            public void AssignAnchors(YamlDocument document)
            {
                existingAnchors.Clear();
                visitedNodes.Clear();
                document.Accept(this);
                Random random = new Random();

                foreach (KeyValuePair <YamlNode, bool> visitedNode in visitedNodes)
                {
                    if (visitedNode.Value)
                    {
                        string text;
                        if (string.IsNullOrEmpty(visitedNode.Key.Anchor) || existingAnchors.Contains(visitedNode.Key.Anchor))
                        {
                            do
                            {
                                text = random.Next().ToString(CultureInfo.InvariantCulture);
                            }while (existingAnchors.Contains(text));
                        }
                        else
                        {
                            text = visitedNode.Key.Anchor;
                        }
                        existingAnchors.Add(text);
                        visitedNode.Key.Anchor = text;
                    }
                }
            }
Exemplo n.º 2
0
            public void AssignAnchors(YamlDocument document)
            {
                existingAnchors.Clear();
                visitedNodes.Clear();

                document.Accept(this);

                var random = new Random();

                foreach (var visitedNode in visitedNodes)
                {
                    if (visitedNode.Value)
                    {
                        string anchor;
                        // If the existing anchor is not already used, we can have it
                        if (!string.IsNullOrEmpty(visitedNode.Key.Anchor) && !existingAnchors.Contains(visitedNode.Key.Anchor))
                        {
                            anchor = visitedNode.Key.Anchor;
                        }
                        else
                        {
                            do
                            {
                                anchor = random.Next().ToString(CultureInfo.InvariantCulture);
                            } while (existingAnchors.Contains(anchor));
                        }

                        existingAnchors.Add(anchor);
                        visitedNode.Key.Anchor = anchor;
                    }
                }
            }
Exemplo n.º 3
0
            public void AssignAnchors(YamlDocument document)
            {
                existingAnchors.Clear();
                visitedNodes.Clear();

                document.Accept(this);

                Random random = new Random();

                foreach (var visitedNode in visitedNodes)
                {
                    if (visitedNode.Value)
                    {
                        string anchor;
                        do
                        {
                            anchor = random.Next().ToString(CultureInfo.InvariantCulture);
                        } while (existingAnchors.Contains(anchor));
                        existingAnchors.Add(anchor);

                        visitedNode.Key.Anchor = anchor;
                    }
                }
            }
Exemplo n.º 4
0
            public void AssignAnchors(YamlDocument document)
            {
                this.existingAnchors.Clear();
                this.visitedNodes.Clear();
                document.Accept(this);
                Random random = new Random();

                foreach (KeyValuePair <YamlNode, bool> pair in this.visitedNodes)
                {
                    if (pair.Value)
                    {
                        while (true)
                        {
                            string item = random.Next().ToString(CultureInfo.InvariantCulture);
                            if (!this.existingAnchors.Contains(item))
                            {
                                this.existingAnchors.Add(item);
                                pair.Key.Anchor = item;
                                break;
                            }
                        }
                    }
                }
            }
Exemplo n.º 5
0
            public void AssignAnchors(YamlDocument document)
            {
                existingAnchors.Clear();
                visitedNodes.Clear();

                document.Accept(this);

                var random = new Random();
                foreach (var visitedNode in visitedNodes)
                {
                    if (visitedNode.Value)
                    {
                        string anchor;
                        // If the existing anchor is not already used, we can have it
                        if (!string.IsNullOrEmpty(visitedNode.Key.Anchor) && !existingAnchors.Contains(visitedNode.Key.Anchor))
                        {
                            anchor = visitedNode.Key.Anchor;
                        }
                        else
                        {
                            do
                            {
                                anchor = random.Next().ToString(CultureInfo.InvariantCulture);
                            } while (existingAnchors.Contains(anchor));
                        }

                        existingAnchors.Add(anchor);
                        visitedNode.Key.Anchor = anchor;
                    }
                }
            }
Exemplo n.º 6
0
			public void AssignAnchors(YamlDocument document)
			{
				existingAnchors.Clear();
				visitedNodes.Clear();

				document.Accept(this);

				Random random = new Random();
				foreach (var visitedNode in visitedNodes)
				{
					if (visitedNode.Value)
					{
						string anchor;
						do
						{
							anchor = random.Next().ToString(CultureInfo.InvariantCulture);
						} while (existingAnchors.Contains(anchor));
						existingAnchors.Add(anchor);

						visitedNode.Key.Anchor = anchor;
					}
				}
			}
Exemplo n.º 7
0
 /// <summary>
 /// Converts a <see cref="YamlDocument"/> to <see cref="XmlDocument"/>.
 /// </summary>
 /// <param name="document">The YAML document to convert.</param>
 /// <returns></returns>
 public XmlDocument ToXml(YamlDocument document)
 {
     YamlToXmlDocumentVisitor visitor = new YamlToXmlDocumentVisitor(options);
     document.Accept(visitor);
     return visitor.Document;
 }