diff --git a/src/Methods.cs b/src/Methods.cs index 529692b7..df5f5fb9 100644 --- a/src/Methods.cs +++ b/src/Methods.cs @@ -160,15 +160,12 @@ public async Task PrintReferencesAsync(string projectPath, bool uniqueList foreach (var item in projects) { IEnumerable references = this.GetProjectReferences(item); + var currentProjectLicenses = await this.GetNugetInformationAsync(item, references); + licenses.Add(currentProjectLicenses); - if (uniqueList) + if (!uniqueList) { - licenses.Add(await this.GetNugetInformationAsync(item, references)); - } - else - { - licenses.Add(await this.GetNugetInformationAsync(item, references)); - PrintLicenses(licenses); + PrintLicenses(currentProjectLicenses); } result = true; @@ -182,18 +179,14 @@ public async Task PrintReferencesAsync(string projectPath, bool uniqueList return result; } - public void PrintLicenses(List> licenses) + public void PrintLicenses(Dictionary licenses) { if (licenses.Any()) { Console.WriteLine(Environment.NewLine + "References:"); - - foreach (var license in licenses) - { - Console.WriteLine(license.ToStringTable(new[] { "Reference", "Licence", "Version", "LicenceType" }, - a => a.Value.Metadata.Id ?? "---", a => a.Value.Metadata.LicenseUrl ?? "---", - a => a.Value.Metadata.Version ?? "---", a => (a.Value.Metadata.License != null ? a.Value.Metadata.License.Text : "---"))); - } + Console.WriteLine(licenses.ToStringTable(new[] { "Reference", "Licence", "Version", "LicenceType" }, + a => a.Value.Metadata.Id ?? "---", a => a.Value.Metadata.LicenseUrl ?? "---", + a => a.Value.Metadata.Version ?? "---", a => (a.Value.Metadata.License != null ? a.Value.Metadata.License.Text : "---"))); } }