Skip to content
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
c6b9de2
Update .gitignore
softworkz Oct 13, 2025
f634dc4
Update NuGet.config
softworkz Oct 13, 2025
0f3f29e
global.json: Pin .net SDK
softworkz Oct 13, 2025
74b80b3
Add ElectronNET project (all build functionality)
softworkz Oct 13, 2025
d6e39fe
Add ElectronNET.Build project (dll with custom MSBuild tasks)
softworkz Oct 13, 2025
14722e1
Remove ElectronNET.CLI project
softworkz Oct 13, 2025
c0c3aae
ElectronNET.Host: Remove build-helper and manifest (no longer needed)
softworkz Oct 13, 2025
0dca0e9
ElectronNET.Host: Update build configuration - changes:
softworkz Oct 13, 2025
5ea368b
ElectronNET.Host: Update main.js with these changes:
softworkz Oct 13, 2025
77efea5
ElectronNET.Host: Fix TS compilation error in tray.js
softworkz Oct 13, 2025
1e93d91
ElectronNET.Host: Fix TS compilation error webcontents.ts
softworkz Oct 13, 2025
e4ce61c
ElectronNET.Host: Update compiled files
softworkz Oct 13, 2025
feddf5f
ElectronNET.API: Move API code to subfolder
softworkz Oct 13, 2025
9275f2a
ElectronNET.API: Add WebRequest API
softworkz Oct 13, 2025
3811b7e
ElectronNET.API: Re-add moved types
softworkz Oct 13, 2025
b06d204
ElectronNET.API: Add ProcessRunner (for running electron from dotnet)
softworkz Oct 13, 2025
d1db928
ElectronNET.API: Add new runtime code (for launch, lifecycle and serv…
softworkz Oct 13, 2025
c6c73a7
ElectronNET.API: Update project file
softworkz Oct 13, 2025
3a42c47
Add ElectronNET.AspNet project (ASP.Net specific runtime code)
softworkz Oct 13, 2025
bcde103
ElectronNET.AspNet: Add WebApplicationBuilderExtensions (new ASP.Net …
softworkz Oct 13, 2025
69129a6
ElectronNET.WebApp: nav.js and demo-btns.js: Increase timeouts
softworkz Oct 13, 2025
7fcb2f0
ElectronNET.WebApp: HostHook: Add missing deps, update same like Host…
softworkz Oct 13, 2025
f814249
ElectronNET.WebApp: HostHook: Make it compile properly
softworkz Oct 13, 2025
c5d9ba0
ElectronNET.WebApp: Remove invalid property in appSettings
softworkz Oct 13, 2025
667a1b2
ElectronNET.WebApp: Remove manifest file (not needed anymore)
softworkz Oct 13, 2025
78b59f6
ElectronNET.WebApp: Adjust controllers for API changes
softworkz Oct 13, 2025
2a26b46
ElectronNET.WebApp: Add builder.json, launchsettings and publish prof…
softworkz Oct 13, 2025
ae12eb4
ElectronNET.WebApp: Adjust startup to use new onAppReady callback
softworkz Oct 13, 2025
40d6558
ElectronNET.WebApp: Update project file with these changes:
softworkz Oct 13, 2025
43ce20d
Add ElectronNET.ConsoleApp test project
softworkz Oct 13, 2025
d0d214c
Introduce a common.props file, which provides version and other packa…
softworkz Oct 13, 2025
4712898
Check in version 0.0.18 packages for convenient testing
softworkz Oct 13, 2025
96063bb
ElectronNET.Core: Update solution file
softworkz Oct 13, 2025
2e05176
Fix typos
softworkz Oct 13, 2025
2d626ab
Reduce pinned dotnet version to 8.0.305 and rollForward to 'feature'
softworkz Oct 13, 2025
5d5e0b8
Reset changelog
softworkz Oct 13, 2025
1ea4c13
Add nuke project to solution
softworkz Oct 13, 2025
0b05b2f
Add solution ElectronNET.Lean for building core projects/packages only
softworkz Oct 13, 2025
cf87904
Mark ElectronNET.Build as non-packable
softworkz Oct 13, 2025
50b4906
Add VersionPostFix to common.props
softworkz Oct 13, 2025
bef7a42
Update nuke build with the following changes:
softworkz Oct 13, 2025
8684514
Move global.json to repo root
softworkz Oct 14, 2025
6060e35
Fix warnings
softworkz Oct 14, 2025
bf3e149
Add changelog entries (AI authored)
softworkz Oct 14, 2025
c914bb8
Draft for a ReadMe update
softworkz Oct 14, 2025
fcb589d
What's new doc page (AI writen)
softworkz Oct 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,4 @@ __pycache__/

# Nuke build tool
.nuke/temp
/publish.cmd
7 changes: 5 additions & 2 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<config>
<add key="repositoryPath" value="artifacts" />
</config>
<packageSources>
<clear />
<add key="LocalDev" value="artifacts" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</packageSources>
</configuration>
Binary file added artifacts/ElectronNET.Core.0.0.18.nupkg
Binary file not shown.
Binary file added artifacts/ElectronNET.Core.API.0.0.18.nupkg
Binary file not shown.
Binary file added artifacts/ElectronNET.Core.API.0.0.18.snupkg
Binary file not shown.
Binary file added artifacts/ElectronNET.Core.AspNet.0.0.18.nupkg
Binary file not shown.
Binary file added artifacts/ElectronNET.Core.AspNet.0.0.18.snupkg
Binary file not shown.
37 changes: 21 additions & 16 deletions src/ElectronNET.API/App.cs → src/ElectronNET.API/API/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public event Func<QuitEventArgs, Task> BeforeQuit
{
BridgeConnector.Socket.On("app-before-quit" + GetHashCode(), async () =>
{
await _beforeQuit(new QuitEventArgs());
await this._beforeQuit(new QuitEventArgs()).ConfigureAwait(false);

if (_preventQuit)
{
Expand All @@ -84,7 +84,7 @@ public event Func<QuitEventArgs, Task> BeforeQuit
}
else if (_willQuit != null)
{
await _willQuit(new QuitEventArgs());
await this._willQuit(new QuitEventArgs()).ConfigureAwait(false);

if (_preventQuit)
{
Expand All @@ -98,14 +98,14 @@ public event Func<QuitEventArgs, Task> BeforeQuit
}
else
{
await _quitting();
await this._quitting().ConfigureAwait(false);
Exit();
}
}
}
else if (_quitting != null)
{
await _quitting();
await this._quitting().ConfigureAwait(false);
Exit();
}
}
Expand Down Expand Up @@ -142,7 +142,7 @@ public event Func<QuitEventArgs, Task> WillQuit
{
BridgeConnector.Socket.On("app-will-quit" + GetHashCode(), async () =>
{
await _willQuit(new QuitEventArgs());
await this._willQuit(new QuitEventArgs()).ConfigureAwait(false);

if (_preventQuit)
{
Expand All @@ -156,7 +156,7 @@ public event Func<QuitEventArgs, Task> WillQuit
}
else
{
await _quitting();
await this._quitting().ConfigureAwait(false);
Exit();
}
}
Expand Down Expand Up @@ -192,7 +192,7 @@ public event Func<Task> Quitting
{
if(_willQuit == null)
{
await _quitting();
await this._quitting().ConfigureAwait(false);
Exit();
}
});
Expand Down Expand Up @@ -567,6 +567,11 @@ public void Exit(int exitCode = 0)
BridgeConnector.Socket.Emit("appExit", exitCode);
}

public void DisposeSocket()
{
BridgeConnector.Socket.DisposeSocket();
}

/// <summary>
/// Relaunches the app when current instance exits. By default the new instance will use the same working directory
/// and command line arguments with current instance.
Expand Down Expand Up @@ -816,7 +821,7 @@ public void ClearRecentDocuments()
/// <returns>Whether the call succeeded.</returns>
public async Task<bool> SetAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default)
{
return await SetAsDefaultProtocolClientAsync(protocol, null, null, cancellationToken);
return await this.SetAsDefaultProtocolClientAsync(protocol, null, null, cancellationToken).ConfigureAwait(false);
}

/// <summary>
Expand Down Expand Up @@ -847,7 +852,7 @@ public async Task<bool> SetAsDefaultProtocolClientAsync(string protocol, Cancell
/// <returns>Whether the call succeeded.</returns>
public async Task<bool> SetAsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default)
{
return await SetAsDefaultProtocolClientAsync(protocol, path, null, cancellationToken);
return await this.SetAsDefaultProtocolClientAsync(protocol, path, null, cancellationToken).ConfigureAwait(false);
}

/// <summary>
Expand Down Expand Up @@ -906,7 +911,7 @@ public async Task<bool> SetAsDefaultProtocolClientAsync(string protocol, string
/// <returns>Whether the call succeeded.</returns>
public async Task<bool> RemoveAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default)
{
return await RemoveAsDefaultProtocolClientAsync(protocol, null, null, cancellationToken);
return await this.RemoveAsDefaultProtocolClientAsync(protocol, null, null, cancellationToken).ConfigureAwait(false);
}

/// <summary>
Expand All @@ -919,7 +924,7 @@ public async Task<bool> RemoveAsDefaultProtocolClientAsync(string protocol, Canc
/// <returns>Whether the call succeeded.</returns>
public async Task<bool> RemoveAsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default)
{
return await RemoveAsDefaultProtocolClientAsync(protocol, path, null, cancellationToken);
return await this.RemoveAsDefaultProtocolClientAsync(protocol, path, null, cancellationToken).ConfigureAwait(false);
}

/// <summary>
Expand Down Expand Up @@ -966,7 +971,7 @@ public async Task<bool> RemoveAsDefaultProtocolClientAsync(string protocol, stri
/// <returns>Whether the current executable is the default handler for a protocol (aka URI scheme).</returns>
public async Task<bool> IsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default)
{
return await IsDefaultProtocolClientAsync(protocol, null, null, cancellationToken);
return await this.IsDefaultProtocolClientAsync(protocol, null, null, cancellationToken).ConfigureAwait(false);
}

/// <summary>
Expand All @@ -985,7 +990,7 @@ public async Task<bool> IsDefaultProtocolClientAsync(string protocol, Cancellati
/// <returns>Whether the current executable is the default handler for a protocol (aka URI scheme).</returns>
public async Task<bool> IsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default)
{
return await IsDefaultProtocolClientAsync(protocol, path, null, cancellationToken);
return await this.IsDefaultProtocolClientAsync(protocol, path, null, cancellationToken).ConfigureAwait(false);
}

/// <summary>
Expand Down Expand Up @@ -1437,7 +1442,7 @@ public async Task<bool> IsUnityRunningAsync(CancellationToken cancellationToken
/// </summary>
public async Task<LoginItemSettings> GetLoginItemSettingsAsync(CancellationToken cancellationToken = default)
{
return await GetLoginItemSettingsAsync(null, cancellationToken);
return await this.GetLoginItemSettingsAsync(null, cancellationToken).ConfigureAwait(false);
}

/// <summary>
Expand Down Expand Up @@ -1624,7 +1629,7 @@ public void On(string eventName, Action action)
/// <param name="eventName">The event name</param>
/// <param name="action">The handler</param>
public async Task On(string eventName, Action<object> action)
=> await Events.Instance.On(ModuleName, eventName, action);
=> await Events.Instance.On(ModuleName, eventName, action).ConfigureAwait(false);
/// <summary>
/// Subscribe to an unmapped event on the <see cref="App"/> module once.
/// </summary>
Expand All @@ -1638,6 +1643,6 @@ public void Once(string eventName, Action action)
/// <param name="eventName">The event name</param>
/// <param name="action">The handler</param>
public async Task Once(string eventName, Action<object> action)
=> await Events.Instance.Once(ModuleName, eventName, action);
=> await Events.Instance.Once(ModuleName, eventName, action).ConfigureAwait(false);
}
}
File renamed without changes.
67 changes: 67 additions & 0 deletions src/ElectronNET.API/API/Cookies.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using System;
using System.Threading.Tasks;
using ElectronNET.API.Entities;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;

namespace ElectronNET.API
{
/// <summary>
/// Query and modify a session's cookies.
/// </summary>
public class Cookies
{
/// <summary>
/// Gets the identifier.
/// </summary>
/// <value>
/// The identifier.
/// </value>
public int Id { get; private set; }

internal Cookies(int id)
{
Id = id;
}

/// <summary>
/// Emitted when a cookie is changed because it was added, edited, removed, or expired.
/// </summary>
public event Action<Cookie, CookieChangedCause, bool> OnChanged
{
add
{
if (_changed == null)
{
BridgeConnector.Socket.On("webContents-session-cookies-changed" + Id, (args) =>
{
Cookie cookie = ((JArray)args)[0].ToObject<Cookie>();
CookieChangedCause cause = ((JArray)args)[1].ToObject<CookieChangedCause>();
bool removed = ((JArray)args)[2].ToObject<bool>();
_changed(cookie, cause, removed);
});

BridgeConnector.Socket.Emit("register-webContents-session-cookies-changed", Id);
}
_changed += value;
}
remove
{
_changed -= value;

if (_changed == null)
BridgeConnector.Socket.Off("webContents-session-cookies-changed" + Id);
}
}

private event Action<Cookie, CookieChangedCause, bool> _changed;

private JsonSerializer _jsonSerializer = new JsonSerializer()
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
NullValueHandling = NullValueHandling.Ignore,
DefaultValueHandling = DefaultValueHandling.Ignore
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public Task<string> ShowSaveDialogAsync(BrowserWindow browserWindow, SaveDialogO
/// <returns>The API call will be asynchronous and the result will be passed via MessageBoxResult.</returns>
public async Task<MessageBoxResult> ShowMessageBoxAsync(string message)
{
return await ShowMessageBoxAsync(null, new MessageBoxOptions(message));
return await this.ShowMessageBoxAsync(null, new MessageBoxOptions(message)).ConfigureAwait(false);
}

/// <summary>
Expand All @@ -117,7 +117,7 @@ public async Task<MessageBoxResult> ShowMessageBoxAsync(string message)
/// <returns>The API call will be asynchronous and the result will be passed via MessageBoxResult.</returns>
public async Task<MessageBoxResult> ShowMessageBoxAsync(MessageBoxOptions messageBoxOptions)
{
return await ShowMessageBoxAsync(null, messageBoxOptions);
return await this.ShowMessageBoxAsync(null, messageBoxOptions).ConfigureAwait(false);
}

/// <summary>
Expand All @@ -130,7 +130,7 @@ public async Task<MessageBoxResult> ShowMessageBoxAsync(MessageBoxOptions messag
/// <returns>The API call will be asynchronous and the result will be passed via MessageBoxResult.</returns>
public async Task<MessageBoxResult> ShowMessageBoxAsync(BrowserWindow browserWindow, string message)
{
return await ShowMessageBoxAsync(browserWindow, new MessageBoxOptions(message));
return await this.ShowMessageBoxAsync(browserWindow, new MessageBoxOptions(message)).ConfigureAwait(false);
}

/// <summary>
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using Newtonsoft.Json.Converters;
using System.Collections.Generic;
using ElectronNET.API.Converter;
using Newtonsoft.Json;

namespace ElectronNET.API.Entities
{
using ElectronNET.Converter;

/// <summary>
///
/// </summary>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static bool IsElectronActive
{
get
{
return !string.IsNullOrEmpty(BridgeSettings.SocketPort);
return ElectronNetRuntime.RuntimeController != null;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal static IpcMain Instance
/// <param name="listener">Callback Method.</param>
public async Task On(string channel, Action<object> listener)
{
await BridgeConnector.Socket.Emit("registerIpcMainChannel", channel);
await BridgeConnector.Socket.Emit("registerIpcMainChannel", channel).ConfigureAwait(false);
BridgeConnector.Socket.Off(channel);
BridgeConnector.Socket.On(channel, (args) =>
{
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ public class Session
/// </summary>
public Cookies Cookies { get; }

public WebRequest WebRequest { get; private set; }

internal Session(int id)
{
Id = id;
Cookies = new Cookies(id);
WebRequest = new WebRequest(id);
}

/// <summary>
Expand Down
File renamed without changes.
Loading
Loading