diff --git a/ElectronNET.API/BrowserWindow.cs b/ElectronNET.API/BrowserWindow.cs index 36bb5d6..546c046 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"); @@ -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.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.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; } 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); 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 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