/// <summary> /// Generates the PackageReference Section of the DOT Graph. /// </summary> /// <param name="anonymizer">The Anonymizer (if used) to anonymize names</param> /// <param name="packageReferences">The Dictionary from <see cref="ResolvePackageReferenceDependencies(IEnumerable{string})"/></param> /// <returns>An <see cref="IEnumerable{T}"/> that contains the lines to add to the DOT Graph</returns> internal static IEnumerable <string> GeneratePackageReferenceSection(Anonymizer <string> anonymizer, Dictionary <string, IEnumerable <string> > packageReferences) { // First we need to create the nodes for each of the Packages IEnumerable <string> distinctPackageReferences = packageReferences.SelectMany(kvp => kvp.Value).Distinct(); foreach (string distinctPackageReference in distinctPackageReferences) { string packageReference = distinctPackageReference; if (anonymizer != null) { packageReference = anonymizer.Anonymoize(packageReference); } yield return($"\"{packageReference}\" [style = filled, fillcolor = goldenrod, fontname=\"consolas\", fontcolor=black]"); } // Now Create the Connections foreach (KeyValuePair <string, IEnumerable <string> > kvp in packageReferences) { string projectName = Path.GetFileName(kvp.Key); if (anonymizer != null) { projectName = anonymizer.Anonymoize(projectName); } IEnumerable <string> packageReferencesForCurrentProject = kvp.Value; foreach (string packageReference in packageReferencesForCurrentProject) { string packageReferenceName = packageReference; if (anonymizer != null) { packageReferenceName = anonymizer.Anonymoize(packageReferenceName); } yield return($"\"{projectName}\" -> \"{packageReferenceName}\""); } } }
/// <summary> /// Generates the AssemblyReference Section of the DOT Graph. /// </summary> /// <param name="anonymizer">The Anonymizer (if used) to anonymize names</param> /// <param name="assemblyReferences">The Dictionary from <see cref="ResolveAssemblyReferenceDependencies(IEnumerable{string})"/></param> /// <returns>An <see cref="IEnumerable{T}"/> that contains the lines to add to the DOT Graph</returns> internal static IEnumerable <string> GenerateAssemblyReferenceSection(Anonymizer <string> anonymizer, Dictionary <string, IEnumerable <string> > assemblyReferences) { // First we need to create nodes for each of the Assemblies IEnumerable <string> distinctAssemblyReferences = assemblyReferences.SelectMany(kvp => kvp.Value).Distinct(); foreach (string distinctAssemblyReference in distinctAssemblyReferences) { string assemblyName = distinctAssemblyReference; if (anonymizer != null) { assemblyName = anonymizer.Anonymoize(assemblyName); } yield return($"\"{assemblyName}\" [class=\"AssemblyReference\"]"); } // Now Create the Connections foreach (KeyValuePair <string, IEnumerable <string> > kvp in assemblyReferences) { string projectName = Path.GetFileName(kvp.Key); if (anonymizer != null) { projectName = anonymizer.Anonymoize(projectName); } IEnumerable <string> assemblyReferencesForCurrentProject = kvp.Value; foreach (string assemblyReference in assemblyReferencesForCurrentProject) { string assemblyReferenceName = assemblyReference; if (anonymizer != null) { assemblyReferenceName = anonymizer.Anonymoize(assemblyReferenceName); } yield return($"\"{projectName}\" -> \"{assemblyReferenceName}\""); } } }