@@ -16,11 +16,12 @@ public class ExternalTool
1616 public string ExecFile { get ; }
1717 public Bitmap IconImage { get ; }
1818
19- public ExternalTool ( string name , string icon , string execFile , Func < string , string > execArgsGenerator = null )
19+ public ExternalTool ( string name , string icon , string execFile , Func < string , string > execArgsGenerator = null , Func < string , List < string > > subOptionsFinder = null )
2020 {
2121 Name = name ;
2222 ExecFile = execFile ;
2323 _execArgsGenerator = execArgsGenerator ?? ( path => path . Quoted ( ) ) ;
24+ _subOptionsFinder = subOptionsFinder ;
2425
2526 try
2627 {
@@ -48,7 +49,16 @@ public void Open(string path)
4849 } ) ;
4950 }
5051
52+ public List < string > FindSubOptions ( string path )
53+ {
54+ if ( _subOptionsFinder == null )
55+ return null ;
56+
57+ return _subOptionsFinder . Invoke ( path ) ;
58+ }
59+
5160 private Func < string , string > _execArgsGenerator = null ;
61+ private Func < string , List < string > > _subOptionsFinder = null ;
5262 }
5363
5464 public class VisualStudioInstance
@@ -130,20 +140,20 @@ public ExternalToolsFinder()
130140 _customization ??= new ExternalToolCustomization ( ) ;
131141 }
132142
133- public void TryAdd ( string name , string icon , Func < string > finder , Func < string , string > execArgsGenerator = null )
143+ public void TryAdd ( string name , string icon , Func < string > finder , Func < string , string > execArgsGenerator = null , Func < string , List < string > > subOptionsFinder = null )
134144 {
135145 if ( _customization . Excludes . Contains ( name ) )
136146 return ;
137147
138148 if ( _customization . Tools . TryGetValue ( name , out var customPath ) && File . Exists ( customPath ) )
139149 {
140- Tools . Add ( new ExternalTool ( name , icon , customPath , execArgsGenerator ) ) ;
150+ Tools . Add ( new ExternalTool ( name , icon , customPath , execArgsGenerator , subOptionsFinder ) ) ;
141151 }
142152 else
143153 {
144154 var path = finder ( ) ;
145155 if ( ! string . IsNullOrEmpty ( path ) && File . Exists ( path ) )
146- Tools . Add ( new ExternalTool ( name , icon , path , execArgsGenerator ) ) ;
156+ Tools . Add ( new ExternalTool ( name , icon , path , execArgsGenerator , subOptionsFinder ) ) ;
147157 }
148158 }
149159
0 commit comments