Exemplo n.º 1
0
 private void BuildDependenciesFor(PackageDefinition package, ref Queue<string> dependencyQueue)
 {
     foreach (string dependency in package.Dependencies)
     {
         PackageDefinition dependencyDefinition = Nodes.First(p => p.Package == dependency);
         if (dependencyDefinition.Added)
             continue;
         if(dependencyDefinition.Visited)
             throw new InvalidOperationException("Can't have a cycle in installation order");
         dependencyDefinition.MarkAsVisited();
         BuildDependenciesFor(dependencyDefinition,ref dependencyQueue);
     }
     dependencyQueue.Enqueue(package.Package);
     package.MarkAsAdded();
 }
Exemplo n.º 2
0
 private string BuildDependenciesAsStringFor(PackageDefinition package)
 {
     string result = string.Empty;
     foreach (string dependency in package.Dependencies)
     {
         PackageDefinition dependencyDefinition = Nodes.First(p => p.Package == dependency);
         if (dependencyDefinition.Added)
             continue;
         if (dependencyDefinition.Visited)
             throw new InvalidOperationException("Can't have a cycle in installation order");
         dependencyDefinition.MarkAsVisited();
         result += BuildDependenciesAsStringFor(dependencyDefinition) + ", ";
     }
     package.MarkAsAdded();
     return result + package.Package;
 }
Exemplo n.º 3
0
 public void AddPackageDefinition(PackageDefinition package)
 {
     Nodes.Add(package);
 }