@@ -37,27 +37,34 @@ public ConfigForm(Config data)
3737
3838 scriptsDir . Text = data . ScriptsDir ;
3939
40- embeddedEngine . Checked = data . UseEmbeddedEngine ;
41- customLocationBtn . Checked = ! embeddedEngine . Checked ;
40+ // embeddedEngine.Checked = data.UseEmbeddedEngine;
41+ // customLocationBtn.Checked = !embeddedEngine.Checked;
4242
4343 restorePanels . Checked = data . RestorePanelsAtStartup ;
4444
4545 customEngineLocation . Text = data . CustomEngineAsm ;
4646 customSyntaxerExe . Text = data . CustomSyntaxerAsm ;
4747 syntaxerPort . Text = data . CustomSyntaxerPort . ToString ( ) ;
4848
49- if ( customEngineLocation . Text . IsEmpty ( ) && CSScriptHelper . IsCSScriptInstalled )
50- customEngineLocation . Text = CSScriptHelper . SystemCSScriptDir . PathJoin ( "cscs.dll" ) ;
49+ // if (customEngineLocation.Text.IsEmpty() && CSScriptHelper.IsCSScriptInstalled)
50+ // customEngineLocation.Text = CSScriptHelper.SystemCSScriptDir.PathJoin("cscs.dll");
5151
52- if ( customSyntaxerExe . Text . IsEmpty ( ) && CSScriptHelper . IsCSSyntaxerInstalled )
53- customSyntaxerExe . Text = CSScriptHelper . SystemCSSyntaxerDir . PathJoin ( "syntaxer.dll" ) ;
52+ // if (customSyntaxerExe.Text.IsEmpty() && CSScriptHelper.IsCSSyntaxerInstalled)
53+ // customSyntaxerExe.Text = CSScriptHelper.SystemCSSyntaxerDir.PathJoin("syntaxer.dll");
5454
55- cssInstallCmd . Text = CSScriptHelper . InstallCssCmd ;
55+ cssInstallCmd . Text = CSScriptHelper . InstallCssDotnetCmd ;
5656 deployCSScript . Text = CSScriptHelper . IsCSScriptInstalled ? "Update" : "Install" ;
57- cssyntaxerInstallCmd . Text = CSScriptHelper . InstallCsSyntaxerCmd ;
57+ cssyntaxerInstallCmd . Text = CSScriptHelper . InstallCsSyntaxerDotnetCmd ;
5858 deploySyntaxer . Text = CSScriptHelper . IsCSSyntaxerInstalled ? "Update" : "Install" ;
5959
60- customLocationBtn_CheckedChanged ( null , null ) ;
60+ UpdateStatus ( ) ;
61+
62+ // customLocationBtn_CheckedChanged(null, null);
63+ }
64+
65+ void UpdateStatus ( )
66+ {
67+ statusLbl . Text = CSScriptHelper . Integration . IsCssIntegrated ( ) ? "Status: integrated" : "Status: not integrated" ;
6168 }
6269
6370 bool skipSavingConfig = false ;
@@ -155,49 +162,54 @@ void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
155162 catch { }
156163 }
157164
158- static void InstallDependencies ( bool engineOnly = false )
165+ static void InstallDependencies ( string command )
159166 {
160167 var batchFileContent = new List < string > ( ) ;
161- if ( ! CSScriptHelper . IsChocoInstalled )
162- {
163- batchFileContent . Add ( "powershell Set-ExecutionPolicy Bypass -Scope Process -Force;" ) ;
164- batchFileContent . Add ( "powershell iex((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" ) ;
165- }
166168
167- if ( engineOnly )
168- batchFileContent . Add ( $ "powershell { CSScriptHelper . InstallCssCmd } ") ;
169- else
170- // installing syntaxer will auto-install cs-script as a dependency
171- batchFileContent . Add ( $ "powershell { CSScriptHelper . InstallCsSyntaxerCmd } ") ;
169+ // if (!CSScriptHelper.IsChocoInstalled)
170+ // {
171+ // batchFileContent.Add("powershell Set-ExecutionPolicy Bypass -Scope Process -Force;");
172+ // batchFileContent.Add("powershell iex((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))");
173+ // }
174+
175+ batchFileContent . Add ( $ "powershell { command } ") ;
172176
173177 if ( batchFileContent . Count == 1 )
174178 InstallDependenciesDialog . Execute ( batchFileContent . First ( ) ) ;
175179 else
176180 InstallDependenciesDialog . ShowDialog ( string . Join ( Environment . NewLine , batchFileContent ) ) ;
177181 }
178182
179- public void deployCSScript_Click ( object sender , EventArgs e ) => InstallDependencies ( engineOnly : true ) ;
183+ public void deployCSScript_Click ( object sender , EventArgs e ) => InstallDependencies ( CSScriptHelper . InstallCssDotnetCmd ) ;
180184
181- void deploySyntaxer_Click ( object sender , EventArgs e ) => InstallDependencies ( engineOnly : false ) ;
185+ void deploySyntaxer_Click ( object sender , EventArgs e ) => InstallDependencies ( CSScriptHelper . InstallCsSyntaxerDotnetCmd ) ;
182186
183187 void autodetectCSS_Click ( object sender , EventArgs e )
184188 {
185- if ( CSScriptHelper . IsCSScriptInstalled )
186- customEngineLocation . Text = CSScriptHelper . SystemCSScriptDir . PathJoin ( "cscs.dll" ) ;
189+ Cursor . Current = Cursors . WaitCursor ;
190+ CSScriptHelper . Integration . IntegrateCSScript ( ) ;
191+ Cursor . Current = Cursors . Default ;
192+ // if (CSScriptHelper.IsCSScriptInstalled)
193+ // customEngineLocation.Text = CSScriptHelper.SystemCSScriptDir.PathJoin("cscs.dll");
187194
188- if ( CSScriptHelper . IsCSSyntaxerInstalled )
189- customSyntaxerExe . Text = CSScriptHelper . SystemCSSyntaxerDir . PathJoin ( "syntaxer.dll" ) ;
195+ // if (CSScriptHelper.IsCSSyntaxerInstalled)
196+ // customSyntaxerExe.Text = CSScriptHelper.SystemCSSyntaxerDir.PathJoin("syntaxer.dll");
190197
191- if ( ! CSScriptHelper . IsCSScriptInstalled || ! CSScriptHelper . IsCSSyntaxerInstalled )
198+ if ( CSScriptHelper . Integration . IsCssIntegrated ( ) )
192199 {
193- string error = "The following dependencies could not be found:\n \n " ;
194- if ( ! CSScriptHelper . IsCSScriptInstalled )
195- error += "CS-Script\n " ;
196- if ( ! CSScriptHelper . IsCSSyntaxerInstalled )
197- error += "Syntaxer\n " ;
198-
200+ customSyntaxerExe . Text = Runtime . syntaxer_asm ;
201+ customEngineLocation . Text = Runtime . cscs_asm ;
202+ UpdateStatus ( ) ;
203+ CSScriptHelper . Integration . ShowIntegrationInfo ( ) ;
204+ Close ( ) ;
205+ }
206+ else
207+ {
208+ string error = "Could not find some CS-Script tools (script engine or syntaxer).\n " ;
199209 error += "\n You can try to install them from the `Update` tab of this dialog" ;
200210 MessageBox . Show ( error , "CS-Script" ) ;
211+ CSScriptHelper . Integration . ShowIntegrationWarning ( ) ;
212+ Close ( ) ;
201213 }
202214 }
203215
@@ -234,5 +246,9 @@ void autodetectSyntaxer_Click(object sender, EventArgs e)
234246 private void customEngineLocation_TextChanged ( object sender , EventArgs e )
235247 {
236248 }
249+
250+ private void label8_Click ( object sender , EventArgs e )
251+ {
252+ }
237253 }
238254}
0 commit comments