コード例 #1
0
        private void SetNuGetPackageNameFilter(NuGetPackageReference package)
        {
            ClearFilter();

            Filter.NuGetPackageNameFilter          = UsedNuGetPackageNames.SingleOrDefault(p => p.Name == package.Name);
            Filter.IsNuGetPackageNameFilterEnabled = true;
        }
コード例 #2
0
        private void InitializeFilter()
        {
            Filter.SolutionFilter = AllSolutions.FirstOrDefault();
            Filter.AnalyzeProjectsAndSolutions(AllProjects, AllSolutions);

            UsedProjectReferences.Initialize(AllProjects
                                             .SelectMany(p => p.ProjectReferences)
                                             .DistinctBy(p => p.Path)
                                             .OrderBy(p => p.Name));

            Filter.ProjectReferenceFilter = UsedProjectReferences.FirstOrDefault();

            UsedNuGetPackages.Initialize(AllProjects
                                         .SelectMany(p => p.NuGetReferences)
                                         .DistinctBy(n => n.Name + "-" + n.Version)
                                         .OrderByThenBy(p => p.Name, p => VersionUtilities.FromString(p.Version)));

            UsedNuGetPackageNames.Initialize(UsedNuGetPackages
                                             .OrderByThenBy(p => p.Name, p => p.Version)
                                             .GroupBy(p => p.Name)
                                             .Select(g => new NuGetPackageVersionGroup
            {
                Name     = g.Key,
                Versions = g.Count() == 1 ? g.First().Version : g.First().Version + " - " + g.Last().Version
            }));

            Filter.NuGetPackageFilter     = UsedNuGetPackages.FirstOrDefault();
            Filter.NuGetPackageNameFilter = UsedNuGetPackageNames.FirstOrDefault();
        }