|
| 1 | +using NuGet.Frameworks; |
| 2 | +using System; |
| 3 | +using System.Collections.Generic; |
| 4 | +using System.Linq; |
| 5 | +using System.Text; |
| 6 | +using System.Threading.Tasks; |
| 7 | + |
| 8 | +namespace NuGetGallery.Frameworks |
| 9 | +{ |
| 10 | + public static class FrameworkFilterHelper |
| 11 | + { |
| 12 | + |
| 13 | + /// <summary> |
| 14 | + /// Each Framework Filter Group represents one of the four Framework generations |
| 15 | + /// represented in the Search Filters. |
| 16 | + /// </summary> |
| 17 | + public class FrameworkFilterGroup |
| 18 | + { |
| 19 | + public FrameworkFilterGroup( |
| 20 | + string shortName, |
| 21 | + string displayName, |
| 22 | + List<string> tfms) { |
| 23 | + ShortName = shortName; |
| 24 | + DisplayName = displayName; |
| 25 | + Tfms = tfms; |
| 26 | + } |
| 27 | + |
| 28 | + public string ShortName { get; set; } |
| 29 | + public string DisplayName { get; set; } |
| 30 | + public List<string> Tfms { get; set; } |
| 31 | + } |
| 32 | + |
| 33 | + public static readonly Dictionary<string, FrameworkFilterGroup> FrameworkFilters = new Dictionary<string, FrameworkFilterGroup>() |
| 34 | + { |
| 35 | + { |
| 36 | + AssetFrameworkHelper.FrameworkGenerationIdentifiers.Net, |
| 37 | + new FrameworkFilterGroup( |
| 38 | + AssetFrameworkHelper.FrameworkGenerationIdentifiers.Net, |
| 39 | + AssetFrameworkHelper.FrameworkGenerationDisplayNames.Net, |
| 40 | + SupportedFrameworks.TfmFilters.NetTfms |
| 41 | + .Select(f => f.GetShortFolderName()) |
| 42 | + .ToList() |
| 43 | + ) |
| 44 | + }, |
| 45 | + { |
| 46 | + AssetFrameworkHelper.FrameworkGenerationIdentifiers.NetCoreApp, |
| 47 | + new FrameworkFilterGroup( |
| 48 | + AssetFrameworkHelper.FrameworkGenerationIdentifiers.NetCoreApp, |
| 49 | + AssetFrameworkHelper.FrameworkGenerationDisplayNames.NetCoreApp, |
| 50 | + SupportedFrameworks.TfmFilters.NetCoreAppTfms |
| 51 | + .Select(f => f.GetShortFolderName()) |
| 52 | + .ToList() |
| 53 | + ) |
| 54 | + }, |
| 55 | + { |
| 56 | + AssetFrameworkHelper.FrameworkGenerationIdentifiers.NetStandard, |
| 57 | + new FrameworkFilterGroup( |
| 58 | + AssetFrameworkHelper.FrameworkGenerationIdentifiers.NetStandard, |
| 59 | + AssetFrameworkHelper.FrameworkGenerationDisplayNames.NetStandard, |
| 60 | + SupportedFrameworks.TfmFilters.NetStandardTfms |
| 61 | + .Select(f => f.GetShortFolderName()) |
| 62 | + .ToList() |
| 63 | + ) |
| 64 | + }, |
| 65 | + { |
| 66 | + AssetFrameworkHelper.FrameworkGenerationIdentifiers.NetFramework, |
| 67 | + new FrameworkFilterGroup( |
| 68 | + AssetFrameworkHelper.FrameworkGenerationIdentifiers.NetFramework, |
| 69 | + AssetFrameworkHelper.FrameworkGenerationDisplayNames.NetFramework, |
| 70 | + SupportedFrameworks.TfmFilters.NetFrameworkTfms |
| 71 | + .Select(f => f.GetShortFolderName()) |
| 72 | + .ToList() |
| 73 | + ) |
| 74 | + } |
| 75 | + }; |
| 76 | + } |
| 77 | +} |
0 commit comments