File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22using System . Collections . Generic ;
33using System . Diagnostics . Contracts ;
44using System . IO ;
5+ using System . Linq ;
56using System . Windows . Forms ;
67using ReClassNET . Debugger ;
78using ReClassNET . Extensions ;
@@ -12,15 +13,21 @@ namespace ReClassNET.Core
1213{
1314 public class CoreFunctionsManager : IDisposable
1415 {
15- public readonly Dictionary < string , ICoreProcessFunctions > functionsRegistry = new Dictionary < string , ICoreProcessFunctions > ( ) ;
16-
17- public IEnumerable < string > FunctionProviders => functionsRegistry . Keys ;
18- public ICoreProcessFunctions CurrentFunctions => currentFunctions ;
16+ private readonly Dictionary < string , ICoreProcessFunctions > functionsRegistry = new Dictionary < string , ICoreProcessFunctions > ( ) ;
1917
2018 private readonly InternalCoreFunctions internalCoreFunctions ;
2119
2220 private ICoreProcessFunctions currentFunctions ;
2321
22+ public IEnumerable < string > FunctionProviders => functionsRegistry . Keys ;
23+
24+ public ICoreProcessFunctions CurrentFunctions => currentFunctions ;
25+
26+ public string CurrentFunctionsProvider => functionsRegistry
27+ . Where ( kv => kv . Value == currentFunctions )
28+ . Select ( kv => kv . Key )
29+ . FirstOrDefault ( ) ;
30+
2431 public CoreFunctionsManager ( )
2532 {
2633 internalCoreFunctions = InternalCoreFunctions . Create ( ) ;
Original file line number Diff line number Diff line change @@ -43,13 +43,11 @@ internal PluginForm(PluginManager pluginManager)
4343
4444 UpdatePluginDescription ( ) ;
4545
46- // Native Methods Tab
46+ // Native Methods Tab
4747
48- string [ ] arrayOfFunctions = Program . CoreFunctions . FunctionProviders . ToArray ( ) ;
49- var funcIndexStr = Program . CoreFunctions . functionsRegistry . FirstOrDefault ( p => p . Value == Program . CoreFunctions . CurrentFunctions ) ;
50-
51- functionsProvidersComboBox . Items . AddRange ( arrayOfFunctions ) ;
52- functionsProvidersComboBox . SelectedIndex = funcIndexStr . Value == null ? 0 : Array . IndexOf ( arrayOfFunctions , funcIndexStr . Key ) ;
48+ var providers = Program . CoreFunctions . FunctionProviders . ToArray ( ) ;
49+ functionsProvidersComboBox . Items . AddRange ( providers ) ;
50+ functionsProvidersComboBox . SelectedIndex = Array . IndexOf ( providers , Program . CoreFunctions . CurrentFunctionsProvider ) ;
5351 }
5452
5553 protected override void OnLoad ( EventArgs e )
@@ -69,7 +67,7 @@ protected override void OnFormClosed(FormClosedEventArgs e)
6967 #region Event Handler
7068
7169 private void pluginsDataGridView_SelectionChanged ( object sender , EventArgs e )
72- {
70+ {
7371 UpdatePluginDescription ( ) ;
7472 }
7573
You can’t perform that action at this time.
0 commit comments