DumpModule( System.Text.StringBuilder builder, int depth, char?prefix, Module module, Array <Module> visited) { if (prefix.HasValue) { builder.AppendFormat("{0}{1}{2}", new string(' ', depth), prefix.Value, module.ToString()); } else { builder.AppendFormat("{0}{1}", new string(' ', depth), module.ToString()); } if (visited.Contains(module)) { builder.AppendFormat("*"); builder.AppendLine(); return; } visited.Add(module); if (module is IInputPath) { builder.AppendFormat(" {0}", (module as IInputPath).InputPath.ToString()); } builder.AppendLine(); foreach (var req in module.Requirements) { DumpModule(builder, depth + 1, '-', req, visited); } foreach (var dep in module.Dependents) { DumpModule(builder, depth + 1, '+', dep, visited); } }
InternalDependsOn( Module module) { if (this == module) { throw new Exception("Circular reference. Module {0} cannot depend on itself", this.ToString()); } if (this.DependentsList.Contains(module)) { return; } if (this.DependeesList.Contains(module)) { throw new Exception("Cyclic dependency found between {0} and {1}", this.ToString(), module.ToString()); } this.DependentsList.Add(module); module.DependeesList.Add(this); }