Ejemplo n.º 1
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;
                    }
                }
            }
Ejemplo n.º 2
0
		/// <summary>
		/// Called after this object finishes visiting a <see cref="YamlDocument"/>.
		/// </summary>
		/// <param name="document">
		/// The <see cref="YamlDocument"/> that has been visited.
		/// </param>
		protected virtual void Visited (YamlDocument document)
		{
			// Do nothing.
		}
Ejemplo n.º 3
0
		void IYamlVisitor.Visit (YamlDocument document)
		{
			Visit(document);
			VisitChildren(document);
			Visited(document);
		}
Ejemplo n.º 4
0
		/// <summary>
		/// Visits every child of a <see cref="YamlDocument"/>.
		/// </summary>
		/// <param name="document">
		/// The <see cref="YamlDocument"/> that is being visited.
		/// </param>
		protected virtual void VisitChildren(YamlDocument document) {
			if(document.RootNode != null) {
				document.RootNode.Accept(this);
			}
		}
Ejemplo n.º 5
0
 /// <summary>
 /// Called after this object finishes visiting a <see cref="YamlDocument"/>.
 /// </summary>
 /// <param name="document">
 /// The <see cref="YamlDocument"/> that has been visited.
 /// </param>
 protected virtual void Visited(YamlDocument document)
 {
     // Do nothing.
 }
Ejemplo n.º 6
0
 void IYamlVisitor.Visit(YamlDocument document)
 {
     Visit(document);
     VisitChildren(document);
     Visited(document);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Called when this object is visiting a <see cref="YamlDocument"/>.
 /// </summary>
 /// <param name="document">
 /// The <see cref="YamlDocument"/> that is being visited.
 /// </param>
 protected virtual void Visit(YamlDocument document)
 {
     VisitChildren(document);
 }
Ejemplo n.º 8
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;
					}
				}
			}