2
2
{
3
3
using System ;
4
4
using System . Collections . Generic ;
5
+ using System . Linq ;
5
6
6
7
internal static class Constants
7
8
{
8
- // Dictionary mapping keywords to ArtifactContentType
9
- public static readonly Dictionary < string , string > ArtifactTypeMap = new Dictionary < string , string > ( StringComparer . OrdinalIgnoreCase )
9
+ public static readonly List < ArtifactType > ArtifactTypeMap = new List < ArtifactType > ( )
10
10
{
11
- { "AS" , "automationscript" } ,
12
- { "C" , "connector" } ,
13
- { "CF" , "companionfile" } ,
14
- { "CHATOPS" , "chatopsextension" } ,
15
- { "D" , "dashboard" } ,
16
- { "DISMACRO" , "dismacro" } ,
17
- { "DOC" , "documentation" } ,
18
- { "F" , "functiondefinition" } ,
19
- { "GQIDS" , "gqidatasource" } ,
20
- { "GQIO" , "gqioperator" } ,
21
- { "LSO" , "lifecycleserviceorchestration" } ,
22
- { "PA" , "processautomation" } ,
23
- { "PLS" , "profileloadscript" } ,
24
- { "S" , "solution" } ,
25
- { "SC" , "scriptedconnector" } ,
26
- { "T" , "testingsolution" } ,
27
- { "UDAPI" , "userdefinedapi" } ,
28
- { "V" , "visio" }
11
+ { new ArtifactType ( new [ ] { "AS" } , "automationscript" , "Automation Script" ) } ,
12
+ { new ArtifactType ( new [ ] { "C" } , "connector" , "Connector" ) } ,
13
+ { new ArtifactType ( new [ ] { "CF" } , "companionfile" , "Companion File" ) } ,
14
+ { new ArtifactType ( new [ ] { "CHATOPS" } , "chatopsextension" , "ChatOps Extension" ) } ,
15
+ { new ArtifactType ( new [ ] { "D" } , "dashboard" , "Dashboard" ) } ,
16
+ { new ArtifactType ( new [ ] { "DISMACRO" } , "dismacro" , "DIS Macro" ) } ,
17
+ { new ArtifactType ( new [ ] { "DOC" } , "documentation" , "Documentation" ) } ,
18
+ { new ArtifactType ( new [ ] { "F" } , "functiondefinition" , "Function Definition" ) } ,
19
+ { new ArtifactType ( new [ ] { "GQIDS" } , "adhocdatasource" , " gqidatasource", "Ad Hoc Data Source" ) } ,
20
+ { new ArtifactType ( new [ ] { "GQIO" } , "gqioperator" , "GQI Operator" ) } ,
21
+ { new ArtifactType ( new [ ] { "LSO" } , "lifecycleserviceorchestration" , "Live Cycle Service Orchestration" ) } ,
22
+ { new ArtifactType ( new [ ] { "PA" } , "processautomation" , "Process Automation" ) } ,
23
+ { new ArtifactType ( new [ ] { "PLS" } , "profileloadscript" , "Profile Load Script" ) } ,
24
+ { new ArtifactType ( new [ ] { "S" } , "solution" , "Solution" ) } ,
25
+ { new ArtifactType ( new [ ] { "SC" } , "scriptedconnector" , "Scriped Connector" ) } ,
26
+ { new ArtifactType ( new [ ] { "T" } , "testingsolution" , "Testing Solution" ) } ,
27
+ { new ArtifactType ( new [ ] { "UDAPI" } , "userdefinedapi" , "User Defined API" ) } ,
28
+ { new ArtifactType ( new [ ] { "V" } , "visio" , "Visio" ) }
29
29
} ;
30
30
}
31
+
32
+ internal class ArtifactType
33
+ {
34
+ public string [ ] GitHubNames { get ; set ; }
35
+
36
+ public string [ ] GitHubAbbreviations { get ; set ; }
37
+
38
+ public string CatalogName { get ; set ; }
39
+
40
+ public ArtifactType ( string [ ] abbreviations , string catalogName , params string [ ] githubNames )
41
+ {
42
+ GitHubAbbreviations = abbreviations ;
43
+
44
+ GitHubNames = githubNames ;
45
+
46
+ CatalogName = catalogName ;
47
+ }
48
+
49
+ public bool IsMatch ( string searchTerm )
50
+ {
51
+ if ( searchTerm . Equals ( CatalogName , StringComparison . OrdinalIgnoreCase ) ||
52
+ GitHubAbbreviations . Contains ( searchTerm , StringComparer . InvariantCultureIgnoreCase ) ||
53
+ GitHubNames . Contains ( searchTerm , StringComparer . InvariantCultureIgnoreCase ) )
54
+ {
55
+ return true ;
56
+ }
57
+
58
+ return false ;
59
+ }
60
+ }
61
+
31
62
}
0 commit comments