@@ -14,6 +14,8 @@ public abstract class AbstractPluginEnvironment
14
14
{
15
15
private static readonly string ClassName = nameof ( AbstractPluginEnvironment ) ;
16
16
17
+ protected readonly IPublicAPI API = PublicApi . Instance ;
18
+
17
19
internal abstract string Language { get ; }
18
20
19
21
internal abstract string EnvName { get ; }
@@ -56,7 +58,7 @@ internal IEnumerable<PluginPair> Setup()
56
58
}
57
59
58
60
var noRuntimeMessage = Localize . runtimePluginInstalledChooseRuntimePrompt ( Language , EnvName , Environment . NewLine ) ;
59
- if ( PublicApi . Instance . ShowMsgBox ( noRuntimeMessage , string . Empty , MessageBoxButton . YesNo ) == MessageBoxResult . No )
61
+ if ( API . ShowMsgBox ( noRuntimeMessage , string . Empty , MessageBoxButton . YesNo ) == MessageBoxResult . No )
60
62
{
61
63
var msg = Localize . runtimePluginChooseRuntimeExecutable ( EnvName ) ;
62
64
@@ -74,7 +76,7 @@ internal IEnumerable<PluginPair> Setup()
74
76
// Let users select valid path or choose to download
75
77
while ( string . IsNullOrEmpty ( selectedFile ) )
76
78
{
77
- if ( PublicApi . Instance . ShowMsgBox ( forceDownloadMessage , string . Empty , MessageBoxButton . YesNo ) == MessageBoxResult . Yes )
79
+ if ( API . ShowMsgBox ( forceDownloadMessage , string . Empty , MessageBoxButton . YesNo ) == MessageBoxResult . Yes )
78
80
{
79
81
// Continue select file
80
82
selectedFile = GetFileFromDialog ( msg , FileDialogFilter ) ;
@@ -107,8 +109,8 @@ internal IEnumerable<PluginPair> Setup()
107
109
}
108
110
else
109
111
{
110
- PublicApi . Instance . ShowMsgBox ( Localize . runtimePluginUnableToSetExecutablePath ( Language ) ) ;
111
- PublicApi . Instance . LogError ( ClassName ,
112
+ API . ShowMsgBox ( Localize . runtimePluginUnableToSetExecutablePath ( Language ) ) ;
113
+ API . LogError ( ClassName ,
112
114
$ "Not able to successfully set { EnvName } path, setting's plugin executable path variable is still an empty string.",
113
115
$ "{ Language } Environment") ;
114
116
@@ -122,7 +124,7 @@ private void EnsureLatestInstalled(string expectedPath, string currentPath, stri
122
124
{
123
125
if ( expectedPath == currentPath ) return ;
124
126
125
- FilesFolders . RemoveFolderIfExists ( installedDirPath , ( s ) => PublicApi . Instance . ShowMsgBox ( s ) ) ;
127
+ FilesFolders . RemoveFolderIfExists ( installedDirPath , ( s ) => API . ShowMsgBox ( s ) ) ;
126
128
127
129
InstallEnvironment ( ) ;
128
130
}
@@ -235,7 +237,7 @@ private static bool IsUsingRoamingPath(string filePath)
235
237
private static string GetUpdatedEnvironmentPath ( string filePath )
236
238
{
237
239
var index = filePath . IndexOf ( DataLocation . PluginEnvironments ) ;
238
-
240
+
239
241
// get the substring after "Environments" because we can not determine it dynamically
240
242
var executablePathSubstring = filePath [ ( index + DataLocation . PluginEnvironments . Length ) ..] ;
241
243
return $ "{ DataLocation . PluginEnvironmentsPath } { executablePathSubstring } ";
0 commit comments