Skip to content

Commit 372ec72

Browse files
committed
- Integration with the external .NET Tools CS-Script and Syntaxer is now the only integration option.
- `Auto-Detect` button of the Config dialog is replaced with the `Detect and Integrate` command. - The .NET Tools manager is made the default deployment option for CS-Script and Syntaxer
1 parent b08b449 commit 372ec72

File tree

8 files changed

+508
-239
lines changed

8 files changed

+508
-239
lines changed

src/CSScriptNpp/CSScriptNpp/CSScriptHelper.cs

Lines changed: 241 additions & 92 deletions
Large diffs are not rendered by default.

src/CSScriptNpp/CSScriptNpp/Config.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public string GetFileName()
4141
public bool DistributeScriptAsDll = false;
4242
public bool InterceptConsole = true;
4343
public bool InterceptConsoleByCharacter = false;
44-
public bool UseEmbeddedEngine = true;
44+
public bool UseEmbeddedEngine = false;
4545
public string CustomEngineAsm = "";
4646
public bool QuickViewAutoRefreshAvailable = false;
4747
public bool NavigateToRawCodeOnDblClickInOutput = false;
@@ -119,7 +119,8 @@ public void Save()
119119
SetValue(Section, nameof(QuickViewAutoRefreshAvailable), QuickViewAutoRefreshAvailable);
120120
SetValue(Section, nameof(InterceptConsole), InterceptConsole);
121121
SetValue(Section, nameof(InterceptConsoleByCharacter), InterceptConsoleByCharacter);
122-
SetValue(Section, nameof(UseEmbeddedEngine), UseEmbeddedEngine);
122+
// is hard-codded and not to be controlled by the file any mor
123+
// SetValue(Section, nameof(UseEmbeddedEngine), UseEmbeddedEngine);
123124
SetValue(Section, nameof(CustomEngineAsm), CustomEngineAsm);
124125
SetValue(Section, nameof(ReleaseNotesViewedFor), ReleaseNotesViewedFor);
125126
SetValue(Section, nameof(ScriptHistory), ScriptHistory);
@@ -196,7 +197,8 @@ public void Open()
196197
NavigateToRawCodeOnDblClickInOutput = GetValue(Section, nameof(NavigateToRawCodeOnDblClickInOutput), NavigateToRawCodeOnDblClickInOutput);
197198
InterceptConsole = GetValue(Section, nameof(InterceptConsole), InterceptConsole);
198199
InterceptConsoleByCharacter = GetValue(Section, nameof(InterceptConsoleByCharacter), InterceptConsoleByCharacter);
199-
UseEmbeddedEngine = GetValue(Section, nameof(UseEmbeddedEngine), UseEmbeddedEngine);
200+
// is hard-codded and not to be controlled by the file any mor
201+
// UseEmbeddedEngine = GetValue(Section, nameof(UseEmbeddedEngine), UseEmbeddedEngine);
200202
CustomEngineAsm = GetValue(Section, nameof(CustomEngineAsm), CustomEngineAsm);
201203
LocalDebug = GetValue(Section, nameof(LocalDebug), LocalDebug);
202204
CsSConsoleEncoding = GetValue(Section, nameof(CsSConsoleEncoding), CsSConsoleEncoding);

src/CSScriptNpp/Dialogs/ConfigForm.Designer.cs

Lines changed: 180 additions & 104 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/CSScriptNpp/Dialogs/ConfigForm.cs

Lines changed: 49 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -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 += "\nYou 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
}

src/CSScriptNpp/Dialogs/ConfigForm.resx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@
120120
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
121121
<value>17, 17</value>
122122
</metadata>
123+
<data name="textBox1.Text" xml:space="preserve">
124+
<value>The plugin requires CS-Script tools at runtime.
125+
You can detect and intehgrate them by pressing the 'Detect and Integrate' button.
126+
127+
The tools are managed by the .NET Tools package manager (part of .NET SDK).
128+
You can installed or updated the tools from the 'Update' tab.</value>
129+
</data>
123130
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
124131
<value>57</value>
125132
</metadata>

src/CSScriptNpp/ProjectPanel.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,23 @@ void LoadReleaseNotes()
103103
{
104104
whatsNewTxt.Text = CSScriptNpp.Resources.Resources.WhatsNew;
105105
whatsNewPanel.Visible = true;
106+
107+
if (!CSScriptHelper.Integration.IsCssIntegrated())
108+
{
109+
Task.Factory.StartNew(() =>
110+
{
111+
try
112+
{
113+
CSScriptHelper.Integration.IntegrateCSScript();
114+
if (CSScriptHelper.Integration.IsCssIntegrated())
115+
CSScriptHelper.Integration.ShowIntegrationInfo();
116+
else
117+
CSScriptHelper.Integration.ShowIntegrationWarning();
118+
}
119+
catch { }
120+
});
121+
}
122+
106123
Config.Instance.ReleaseNotesViewedFor = pluginVersion;
107124
Config.Instance.Save();
108125
}

src/CSScriptNpp/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// Build Number
3333
// Revision
3434
//
35-
[assembly: AssemblyVersion("2.0.5.0")]
36-
[assembly: AssemblyFileVersion("2.0.5.0")]
35+
[assembly: AssemblyVersion("2.0.6.0")]
36+
[assembly: AssemblyFileVersion("2.0.6.0")]
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
Release v2.0.5.0
1+
Release v2.0.6.0
22
----
3-
- Embedded CS-Script engine is updated to v4.8.16.0
4-
- Configuration Dialog: Added support for installing external CS-Script engine from WinGet and NuGet.
5-
- Updated plugin hosting solution to address the Scintilla .NET Interface issue (#74).
6-
3+
- Integration with the external .NET Tools CS-Script and Syntaxer is now the only integration option.
4+
This change is to ensure the plugin is always integrated with the latest internally compatible CS-Script tools.
5+
- You can always integrate the plugin with the latest CS-Script tools by running the `Detect and Integrate` command from plugin's Config Dialog.
6+
- If you do not have CS-Script tools installed you can single-click deploy them form the 'Update' tab of the Confog dialog.
7+
- The .NET Tools manager is made the default deployment option for CS-Script and Syntaxer
8+
- Embedded CS-Script engine is no longer distributed with the plugin.

0 commit comments

Comments
 (0)