From 2a9c0e1d60daef8412141a38024ee63025b8ed19 Mon Sep 17 00:00:00 2001 From: Kevin Gaden Date: Thu, 4 Apr 2019 15:08:10 +0200 Subject: [PATCH 1/5] Fix BrowserWindow::SetMenu --- ElectronNET.API/BrowserWindow.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ElectronNET.API/BrowserWindow.cs b/ElectronNET.API/BrowserWindow.cs index 36bb5d6..23b49cc 100644 --- a/ElectronNET.API/BrowserWindow.cs +++ b/ElectronNET.API/BrowserWindow.cs @@ -1929,7 +1929,7 @@ namespace ElectronNET.API public void SetMenu(MenuItem[] menuItems) { menuItems.AddMenuItemsId(); - BridgeConnector.Socket.Emit("browserWindowSetMenu", JArray.FromObject(menuItems, _jsonSerializer)); + BridgeConnector.Socket.Emit("browserWindowSetMenu", Id, JArray.FromObject(menuItems, _jsonSerializer)); _items.AddRange(menuItems); BridgeConnector.Socket.Off("windowMenuItemClicked"); From a5cee6e6d5086e9a64bdb3e5284f185d0b57aab2 Mon Sep 17 00:00:00 2001 From: Adam Newgas Date: Sat, 27 Apr 2019 19:05:26 +0100 Subject: [PATCH 2/5] Reduce chance of detecting false positives when scanning subprocesses for errors. Fixes #160 --- ElectronNET.CLI/ProcessHelper.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ElectronNET.CLI/ProcessHelper.cs b/ElectronNET.CLI/ProcessHelper.cs index 2eff1a2..11c55c6 100644 --- a/ElectronNET.CLI/ProcessHelper.cs +++ b/ElectronNET.CLI/ProcessHelper.cs @@ -1,11 +1,14 @@ using System; using System.Diagnostics; using System.Runtime.InteropServices; +using System.Text.RegularExpressions; namespace ElectronNET.CLI { public class ProcessHelper { + private readonly static Regex ErrorRegex = new Regex(@"\berror\b", RegexOptions.IgnoreCase | RegexOptions.Compiled); + public static int CmdExecute(string command, string workingDirectoryPath, bool output = true, bool waitForExit = true) { using (Process cmd = new Process()) @@ -44,7 +47,7 @@ namespace ElectronNET.CLI // 1 if something fails if (e != null && string.IsNullOrWhiteSpace(e.Data) == false) { - if (e.Data.ToLowerInvariant().Contains("error")) + if (ErrorRegex.IsMatch(e.Data)) { returnCode = 1; } @@ -63,7 +66,7 @@ namespace ElectronNET.CLI // 1 if something fails if (e != null && string.IsNullOrWhiteSpace(e.Data) == false) { - if (e.Data.ToLowerInvariant().Contains("error")) + if (ErrorRegex.IsMatch(e.Data)) { returnCode = 1; } From eda9b08cac02f88a397212119a54d96aff910472 Mon Sep 17 00:00:00 2001 From: Adam Newgas Date: Sun, 5 May 2019 18:30:07 +0100 Subject: [PATCH 3/5] Updates the C# API to accept floating point as in JS. Also adds supports for progress bar options. Fixes #239 --- ElectronNET.API/BrowserWindow.cs | 4 ++-- ElectronNET.Host/api/browserWindows.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ElectronNET.API/BrowserWindow.cs b/ElectronNET.API/BrowserWindow.cs index 36bb5d6..c17488d 100644 --- a/ElectronNET.API/BrowserWindow.cs +++ b/ElectronNET.API/BrowserWindow.cs @@ -1950,7 +1950,7 @@ namespace ElectronNET.API /// assumed. /// /// - public void SetProgressBar(int progress) + public void SetProgressBar(double progress) { BridgeConnector.Socket.Emit("browserWindowSetProgressBar", Id, progress); } @@ -1967,7 +1967,7 @@ namespace ElectronNET.API /// /// /// - public void SetProgressBar(int progress, ProgressBarOptions progressBarOptions) + public void SetProgressBar(double progress, ProgressBarOptions progressBarOptions) { BridgeConnector.Socket.Emit("browserWindowSetProgressBar", Id, progress, JObject.FromObject(progressBarOptions, _jsonSerializer)); } diff --git a/ElectronNET.Host/api/browserWindows.js b/ElectronNET.Host/api/browserWindows.js index 358ea4a..663f495 100644 --- a/ElectronNET.Host/api/browserWindows.js +++ b/ElectronNET.Host/api/browserWindows.js @@ -437,8 +437,8 @@ module.exports = (socket, app) => { } }); } - socket.on('browserWindowSetProgressBar', (id, progress) => { - getWindowById(id).setProgressBar(progress); + socket.on('browserWindowSetProgressBar', (id, progress, options) => { + getWindowById(id).setProgressBar(progress, options); }); socket.on('browserWindowSetHasShadow', (id, hasShadow) => { getWindowById(id).setHasShadow(hasShadow); From 8a3c86abc0eec8f63dbdafcda3332bb881a3df39 Mon Sep 17 00:00:00 2001 From: Adam Newgas Date: Sun, 5 May 2019 18:33:26 +0100 Subject: [PATCH 4/5] buildReleaseNuGetPackages should leave you in the same directory you started in. --- buildReleaseNuGetPackages.cmd | 1 + 1 file changed, 1 insertion(+) diff --git a/buildReleaseNuGetPackages.cmd b/buildReleaseNuGetPackages.cmd index 8a2c091..43e9ea1 100644 --- a/buildReleaseNuGetPackages.cmd +++ b/buildReleaseNuGetPackages.cmd @@ -10,3 +10,4 @@ cd ElectronNet.CLI dotnet restore dotnet build --configuration Release --force /property:Version=0.0.11 dotnet pack /p:Version=0.0.11 --configuration Release --force --output "%~dp0artifacts" +cd .. \ No newline at end of file From 4235aa46777bc7b28ecf24686962d18ef4c537d2 Mon Sep 17 00:00:00 2001 From: grbd Date: Wed, 8 May 2019 19:31:29 +0100 Subject: [PATCH 5/5] Calls electronize from the Path instead of via dotnet --- ElectronNET.CLI/Commands/InitCommand.cs | 13 +++++++------ ElectronNET.WebApp/Properties/launchSettings.json | 12 +++++++----- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ElectronNET.CLI/Commands/InitCommand.cs b/ElectronNET.CLI/Commands/InitCommand.cs index 0d17e1e..2d63fde 100644 --- a/ElectronNET.CLI/Commands/InitCommand.cs +++ b/ElectronNET.CLI/Commands/InitCommand.cs @@ -100,15 +100,16 @@ namespace ElectronNET.CLI.Commands string launchSettingText = File.ReadAllText(launchSettingFile); - if (launchSettingText.Contains("electronize start") == false) + if (launchSettingText.Contains("\"executablePath\": \"electronize\"") == false) { StringBuilder debugProfileBuilder = new StringBuilder(); debugProfileBuilder.AppendLine("profiles\": {"); - debugProfileBuilder.AppendLine("\"Electron.NET App\": {"); - debugProfileBuilder.AppendLine("\"commandName\": \"Executable\","); - debugProfileBuilder.AppendLine("\"executablePath\": \"C:\\\\Program Files\\\\dotnet\\\\dotnet.exe\","); - debugProfileBuilder.AppendLine("\"commandLineArgs\": \"electronize start\""); - debugProfileBuilder.AppendLine("},"); + debugProfileBuilder.AppendLine(" \"Electron.NET App\": {"); + debugProfileBuilder.AppendLine(" \"commandName\": \"Executable\","); + debugProfileBuilder.AppendLine(" \"executablePath\": \"electronize\","); + debugProfileBuilder.AppendLine(" \"commandLineArgs\": \"start\","); + debugProfileBuilder.AppendLine(" \"workingDirectory\": \".\""); + debugProfileBuilder.AppendLine(" },"); launchSettingText = launchSettingText.Replace("profiles\": {", debugProfileBuilder.ToString()); File.WriteAllText(launchSettingFile, launchSettingText); diff --git a/ElectronNET.WebApp/Properties/launchSettings.json b/ElectronNET.WebApp/Properties/launchSettings.json index efcfd39..9c1d8f4 100644 --- a/ElectronNET.WebApp/Properties/launchSettings.json +++ b/ElectronNET.WebApp/Properties/launchSettings.json @@ -8,6 +8,13 @@ } }, "profiles": { + "Electron.NET App": { + "commandName": "Executable", + "executablePath": "electronize", + "commandLineArgs": "start", + "workingDirectory": "." + }, + "IIS Express": { "commandName": "IISExpress", "environmentVariables": { @@ -22,10 +29,5 @@ }, "applicationUrl": "http://localhost:50395/" }, - "Electron.NET App": { - "commandName": "Executable", - "executablePath": "C:\\Program Files\\dotnet\\dotnet.exe", - "commandLineArgs": "electronize start" - } } } \ No newline at end of file