Confuser.Core/DependencyResolver.cs
/// <summary>
///     Topologically sort the dependency graph.
/// </summary>
/// <param name="roots">The root protections.</param>
/// <param name="edges">The dependency graph edges.</param>
/// <returns>Topological sorted protections.</returns>
// Token: 0x0600013A RID: 314 RVA: 0x0000AD10 File Offset: 0x00008F10
Topologically sort the dependency graph.
Topologically sort the dependency graph .
private IEnumerable<Protection> SortGraph(IEnumerable<Protection> roots, IList<DependencyResolver.DependencyGraphEdge> edges)
		{
			Queue<Protection> queue = new Queue<Protection>(from prot in roots
			orderby prot.FullId
			select prot);
			while (queue.Count > 0)
			{
				Protection root = queue.Dequeue();
				yield return root;
				using (List<DependencyResolver.DependencyGraphEdge>.Enumerator enumerator = (from edge in edges
				where edge.From == root
				select edge).ToList<DependencyResolver.DependencyGraphEdge>().GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						DependencyResolver.DependencyGraphEdge edge = enumerator.Current;
						edges.Remove(edge);
						if (!edges.Any((DependencyResolver.DependencyGraphEdge e) => e.To == edge.To))
						{
							queue.Enqueue(edge.To);
						}
					}
				}
			}
			if (edges.Count != 0)
			{
				throw new CircularDependencyException(edges[0].From, edges[0].To);
			}
			yield break;
		}
private IEnumerable < Protection > SortGraph ( IEnumerable < Protection > roots , IList < DependencyResolver . DependencyGraphEdge > edges ) { Queue < Protection > queue = new Queue < Protection > ( from prot in roots orderby prot . FullId select prot ) ; while ( queue . Count > 0 ) { Protection root = queue . Dequeue ( ) ; yield return root ; using ( List < DependencyResolver . DependencyGraphEdge > . Enumerator enumerator = ( from edge in edges where edge . From == root select edge ) . ToList < DependencyResolver . DependencyGraphEdge > ( ) . GetEnumerator ( ) ) { while ( enumerator . MoveNext ( ) ) { DependencyResolver . DependencyGraphEdge edge = enumerator . Current ; edges . Remove ( edge ) ; if ( ! edges . Any ( ( DependencyResolver . DependencyGraphEdge e ) => e . To == edge . To ) ) { queue . Enqueue ( edge . To ) ; } } } } if ( edges . Count != 0 ) { throw new CircularDependencyException ( edges [ 0 ] . From , edges [ 0 ] . To ) ; } yield break ; }
Topologically sort the dependency graph.
Topologically sort the dependency graph .
Topological sorted protections.
Topological sorted protections .
roots
IEnumerable<Protection>
The root protections.
The root protections .
edges
IList<DependencyResolver.DependencyGraphEdge>
The dependency graph edges.
The dependency graph edges .