Compare commits

...

127 Commits

Author SHA1 Message Date
Florian Rappl
8df9eff3bc Updated repo 2025-11-01 10:44:49 +01:00
Florian Rappl
14f43f4574 Improved build process 2025-10-31 21:25:18 +01:00
Florian Rappl
d96eebd5ee Added float in SetAspectRatio 2025-10-31 18:25:50 +01:00
Florian Rappl
23fac3263f Updated readme 2025-10-31 18:24:27 +01:00
Florian Rappl
935de8a1a5 Updated packages 2025-10-31 17:56:05 +01:00
Florian Rappl
be1887c930 Merge pull request #895 from softworkz/electronnet_core
Add documentation
2025-10-16 08:44:08 +02:00
softworkz
1852802667 Some more polishing 2025-10-15 23:04:37 +02:00
softworkz
5bdabd94ba Fix typos 2025-10-15 22:29:22 +02:00
softworkz
2bc2b4bb70 Move some parts from ReadMe to Wiki 2025-10-15 22:12:46 +02:00
softworkz
771b1109f7 Add About page 2025-10-15 22:12:46 +02:00
softworkz
56258d1be8 Add API documentation (AI generated) 2025-10-15 22:12:46 +02:00
softworkz
88766adaf6 Update docs after manual review 2025-10-15 16:06:53 +02:00
softworkz
341ebe2bb1 Add .gitkeep file 2025-10-15 16:06:53 +02:00
softworkz
0c5cc3ba9d AI-written docs 2025-10-15 16:06:53 +02:00
softworkz
bb5779a941 Add docs project to solution 2025-10-15 16:06:53 +02:00
softworkz
0dd263e2b8 Docs: add automatic Wiki publishing 2025-10-15 12:54:08 +02:00
softworkz
0a0e26a9dd Add docs 2025-10-15 12:54:08 +02:00
softworkz
7b812bfae7 Remove whatsnew from root 2025-10-15 12:40:02 +02:00
Florian Rappl
82814d91d9 Merge pull request #893 from softworkz/electronnet_core
ElectronNET.Core:: Taking it to the Next Leve
2025-10-14 23:59:42 +02:00
softworkz
fcb589d58e What's new doc page (AI writen) 2025-10-14 06:24:10 +02:00
softworkz
c914bb8f14 Draft for a ReadMe update 2025-10-14 06:24:10 +02:00
softworkz
bf3e149d43 Add changelog entries (AI authored) 2025-10-14 06:24:10 +02:00
softworkz
6060e355bd Fix warnings 2025-10-14 03:48:53 +02:00
softworkz
868451408c Move global.json to repo root 2025-10-14 03:48:03 +02:00
softworkz
bef7a42fbb Update nuke build with the following changes:
- Remove obsolete sample targets
- Restore and build solution (.Lean) instead of projects
- Read version from common.props, compare with latest changelog version
  and fail if not equal
- Keep PostFix separate from version (AssemblyVersion may not have
  a postfix), so the postfix will go into the package version and
  file name as well as the informational version (visible in file
  properties dialog on Windows)
- Add "ElectronNET.Core " as prefix to GitHub release names (to
  disambiguate with earlier versions)
2025-10-14 00:19:50 +02:00
softworkz
50b49068d8 Add VersionPostFix to common.props 2025-10-14 00:19:50 +02:00
softworkz
cf87904210 Mark ElectronNET.Build as non-packable 2025-10-14 00:19:50 +02:00
softworkz
0b05b2f5a4 Add solution ElectronNET.Lean for building core projects/packages only 2025-10-14 00:19:50 +02:00
softworkz
1ea4c1343d Add nuke project to solution 2025-10-14 00:19:50 +02:00
softworkz
5d5e0b848c Reset changelog 2025-10-14 00:19:40 +02:00
softworkz
2d626ab319 Reduce pinned dotnet version to 8.0.305 and rollForward to 'feature' 2025-10-14 00:19:11 +02:00
softworkz
2e051762dd Fix typos 2025-10-13 15:23:59 +02:00
softworkz
96063bbe7d ElectronNET.Core: Update solution file 2025-10-13 14:39:22 +02:00
softworkz
471289813a Check in version 0.0.18 packages for convenient testing 2025-10-13 14:38:58 +02:00
softworkz
d0d214cd24 Introduce a common.props file, which provides version and other package metadata
...in a single place.

There's some special sauce for myself, but we'll find a better way
eventually, so that it can be removed.
2025-10-13 14:36:31 +02:00
softworkz
43ce20d60f Add ElectronNET.ConsoleApp test project 2025-10-13 14:36:31 +02:00
softworkz
40d6558613 ElectronNET.WebApp: Update project file with these changes:
- Add a ElectronNetDevMode property at the top
  This allows switching the project between using the nuget packages
  and consuming the core code directly via project references and
  direct imports or .props and .targets files
- Add the project data which was previously in the manifest file
- Add the Microsoft.TypeScript.MSBuild package
  This overrides the ASP.Net built-in TS support which is currently
  at version 5.6 only. With this package, we get 5.9.3 everywhere, so
  everything is consistent now.
  The only caveat is that it requires exclusion of folders (especially
  node_modules), so that they don't get attempted to be compiled
2025-10-13 14:36:31 +02:00
softworkz
ae12eb49ee ElectronNET.WebApp: Adjust startup to use new onAppReady callback 2025-10-13 14:36:31 +02:00
softworkz
2a26b46f91 ElectronNET.WebApp: Add builder.json, launchsettings and publish profiles 2025-10-13 14:36:31 +02:00
softworkz
78b59f62c9 ElectronNET.WebApp: Adjust controllers for API changes 2025-10-13 14:36:31 +02:00
softworkz
667a1b290e ElectronNET.WebApp: Remove manifest file (not needed anymore) 2025-10-13 14:36:31 +02:00
softworkz
c5d9ba0e43 ElectronNET.WebApp: Remove invalid property in appSettings 2025-10-13 14:36:31 +02:00
softworkz
f81424978e ElectronNET.WebApp: HostHook: Make it compile properly 2025-10-13 14:36:31 +02:00
softworkz
7fcb2f05bd ElectronNET.WebApp: HostHook: Add missing deps, update same like Host code 2025-10-13 14:36:31 +02:00
softworkz
69129a6f02 ElectronNET.WebApp: nav.js and demo-btns.js: Increase timeouts
These were too short when debugging on WSL
2025-10-13 14:36:31 +02:00
softworkz
bcde1032af ElectronNET.AspNet: Add WebApplicationBuilderExtensions (new ASP.Net builders) 2025-10-13 14:36:31 +02:00
softworkz
3a42c479dd Add ElectronNET.AspNet project (ASP.Net specific runtime code) 2025-10-13 14:36:31 +02:00
softworkz
c6c73a7c8a ElectronNET.API: Update project file 2025-10-13 14:36:31 +02:00
softworkz
d1db928222 ElectronNET.API: Add new runtime code (for launch, lifecycle and service orchestration) 2025-10-13 14:36:31 +02:00
softworkz
b06d20450b ElectronNET.API: Add ProcessRunner (for running electron from dotnet) 2025-10-13 14:36:31 +02:00
softworkz
3811b7ea20 ElectronNET.API: Re-add moved types 2025-10-13 14:36:31 +02:00
softworkz
9275f2a765 ElectronNET.API: Add WebRequest API 2025-10-13 14:36:31 +02:00
softworkz
feddf5f8f4 ElectronNET.API: Move API code to subfolder 2025-10-13 14:36:18 +02:00
softworkz
e4ce61c965 ElectronNET.Host: Update compiled files 2025-10-13 14:36:18 +02:00
softworkz
1e93d91e66 ElectronNET.Host: Fix TS compilation error webcontents.ts
The crashed event has been removed in Electron 29 - just let TS ignore
that error
2025-10-13 14:36:18 +02:00
softworkz
77efea50ed ElectronNET.Host: Fix TS compilation error in tray.js
This probably stems from newer ts definition or the newer ts version.
It errored because it cannot determine the event name and so it
considers argv[] as empty.
2025-10-13 14:36:18 +02:00
softworkz
5ea368bb16 ElectronNET.Host: Update main.js with these changes:
- Consume host-hook as a module
- Use package.json instead of electron-manifest.json
- Support new commandline flags:
  - unpackedelectron
    running in debug mode, electron first, so must launch dotnet
  - unpackeddotnet
    running in debug mode, dotnet first, do not launch dotnet
  - dotnetpacked
    running from electron-builder output, dotnet first, do not launch
  - {none of the above flags}
    running from electron-builder output, electron first, launch dotnet
  - electronforcedport
    specified by dotnet when dotnet-first, port is validated to be free
- Removed 'watch' functionality (regular debugging is working now)
- New feature to load a custom_main.js file, if present
- Removed the 'electronWebPort' handling
  When ASP.Net is launched first, then the information which port it
  should use would be coming too late; anyway, there's no need for
  letting the port number round-trip all the way through the manifest
  file, loaded by main.js and then sent to dotnet.
- Reworked handling of 'quit' message
2025-10-13 14:36:18 +02:00
softworkz
0dca0e90f9 ElectronNET.Host: Update build configuration - changes:
- Update all packages to their latest version
- Drop tslint (replaced by eslint)
- Update node types to 22 => nodejs => 22 is minimum now
- Also use latest TypeScript version
- Finally, reference ElectronHostHook has a package dependency
  this avoids conflicts of dependency versions between main code
  and host-hook code, by letting npm resolve them
2025-10-13 13:16:10 +02:00
softworkz
c0c3aaebdc ElectronNET.Host: Remove build-helper and manifest (no longer needed) 2025-10-13 13:08:32 +02:00
softworkz
14722e1f63 Remove ElectronNET.CLI project 2025-10-13 13:06:50 +02:00
softworkz
d6e39fef24 Add ElectronNET.Build project (dll with custom MSBuild tasks) 2025-10-13 13:06:20 +02:00
softworkz
74b80b3177 Add ElectronNET project (all build functionality) 2025-10-13 13:05:34 +02:00
softworkz
0f3f29eae3 global.json: Pin .net SDK 2025-10-13 13:04:24 +02:00
softworkz
f634dc45ed Update NuGet.config 2025-10-13 13:03:53 +02:00
softworkz
c6b9de2afa Update .gitignore 2025-10-13 13:03:36 +02:00
Florian Rappl
4c880cb627 Merge pull request #852 from rs22/update-electron-30
Update Electron version to 30.0.3
2024-06-04 20:51:37 +02:00
Robert Schmid
e46ba98c8d Update version in ElectronNET.WebApp electron manifest 2024-06-04 15:57:22 +02:00
Robert Schmid
4b9fe4656e Add changelog entry 2024-06-04 15:56:47 +02:00
Robert Schmid
fdb8be46b7 Update electron version 2024-05-10 17:34:27 +02:00
Florian Rappl
e361367a95 Merge pull request #849 from gorsheninmv/get-back-net6-support
Get back net6 support
2024-05-01 17:08:29 +02:00
Florian Rappl
7ca40bcaec Merge pull request #848 from gorsheninmv/update-npm-packages
Update node modules packages
2024-05-01 14:37:39 +02:00
Misha Gorshenin
1864c21c10 fix: specify target framework 2024-05-01 13:20:14 +05:00
Misha Gorshenin
0775b91dd4 fix: get back net6 support 2024-05-01 09:49:47 +05:00
Misha Gorshenin
f55dbc14c0 chore: update node modules packages 2024-05-01 09:16:25 +05:00
Florian Rappl
6472f34a75 Merge pull request #847 from gorsheninmv/feat-introduce-new-cli-args
Add /no-restore and SelfContained property support in CLI
2024-04-29 15:40:27 +02:00
Misha Gorshenin
91714f5807 feat: CLI: add /no-restore arg and SelfContained propeprty support 2024-04-29 14:56:57 +05:00
Florian Rappl
6182320003 Merge branch 'main' into develop 2024-04-29 11:45:11 +02:00
Florian Rappl
5125ee0109 Merge pull request #801 from ds5678/primitive-implicit-conversions
Implicit Conversions to System.Drawing structs
2024-04-29 11:42:45 +02:00
Florian Rappl
21c17dc82b Merge pull request #846 from Lemon73-Computing/net8.0
Upgrade to .NET 8.0
2024-04-27 20:11:37 +02:00
Lemon73-Computing
dbcd4ac940 add: setting
self-contained
2024-04-26 19:42:32 +09:00
Lemon73-Computing
286978c523 update: readme.md
.net 6 -> .net 8
2024-04-25 17:27:45 +09:00
Lemon73-Computing
96ae77ceb4 update: workflow 2024-04-25 01:01:22 +09:00
Lemon73-Computing
a893ccd646 fix: debug workflows 2024-04-25 00:58:50 +09:00
Lemon73-Computing
2edad2d329 upgrade: dependencies version 2024-04-25 00:58:27 +09:00
Lemon73-Computing
7be796f77b upgrade: dependency
* nuke 6.2.1 -> 8.0.0
2024-04-25 00:34:38 +09:00
Lemon73-Computing
19da7f47b1 change: target dotnet version 2024-04-24 23:44:10 +09:00
Florian Rappl
d22532488e Updated to 23.6.2 2024-02-15 01:12:33 +01:00
Florian Rappl
30558dea5f Updated changelog 2024-02-15 01:10:48 +01:00
Florian Rappl
464eaca593 Merge branch 'main' of https://github.com/ElectronNET/Electron.NET into develop 2024-02-15 01:04:11 +01:00
Florian Rappl
df3bd122df Merge pull request #813 from softworkz/submit_execjs_domready
WebContents: add executeJavaScript and dom-ready event
2024-02-15 01:01:59 +01:00
Florian Rappl
eabcc3a6b6 Merge pull request #798 from dlanorok/fixes/appSetAccessibilitySupportEnabled
Fixes/app set accessibility support enabled
2024-02-15 01:01:38 +01:00
Florian Rappl
2b5435381f Merge pull request #800 from franpersanchez/main
fix: typo in README.md
2024-02-15 00:59:08 +01:00
Florian Rappl
0d63383899 Merge pull request #833 from Yuvix25/ipc-once-memory
Fix huge memory waste in IpcMain.Once [IMPORTANT]
2024-02-15 00:55:40 +01:00
Florian Rappl
f31fe19652 Merge pull request #828 from Yuvix25/yuvix25/update-display-object
Update Display.cs to current spec
2024-02-15 00:55:33 +01:00
Florian Rappl
0a80367e3e Merge pull request #822 from NickRimmer/features/splash-size
Configurable splash screen size
2024-02-15 00:55:13 +01:00
Florian Rappl
34761456ad Merge pull request #821 from sajmonr/feature/osx-architecture-detection
Added OSX architecture detection
2024-02-15 00:55:05 +01:00
Florian Rappl
e4e96bbcc4 Merge pull request #819 from NickRimmer/features/webContent-additional-events
WebContent additional events
2024-02-15 00:54:42 +01:00
Yuval Rosen
1253df3d9a Fix huge memory waste in IpcMain.Once 2024-02-15 01:06:08 +02:00
Yuval Rosen
b8b634beb3 update display.cs to current spec 2024-01-10 11:10:49 +02:00
Nick Rimmer
94dc82ec62 configurable splash screen size 2023-11-13 01:29:17 +01:00
Adam Simonicek
53ccf4d302 Added OSX architecture detection 2023-11-04 14:09:07 -04:00
Nick Rimmer
bf0bdc8386 did-start-navigation, did-navigate, will-redirect, did-fail-load, did-redirect-navigation events added for WebContents 2023-11-03 00:23:37 +01:00
softworkz
73a3e331dc Add executeJavaScript method to WebContents 2023-09-24 16:37:36 +02:00
softworkz
a15db713ad Add dom-ready event for WebContents 2023-09-24 16:37:36 +02:00
Jeremy Pritts
4be5cef3ef Add implicit conversions to System.Drawing structs. 2023-08-24 21:09:19 -04:00
Fran Pérez
e2d03d6818 fix: typo in README.md 2023-08-24 18:24:15 +02:00
Ronald Ramirez Moran
0dc8369fb3 Method SetAccessibilitySupportEnabled is incorrect. 2023-08-23 18:39:37 -05:00
Florian Rappl
77b7141513 Use explicit version 2023-04-03 14:17:32 +02:00
Florian Rappl
dbf85c6f14 Improved version 2023-04-03 14:02:35 +02:00
Florian Rappl
c67f117bc7 Updated release notes format 2023-04-03 13:59:04 +02:00
Florian Rappl
9746edb936 Updated changelog 2023-04-03 12:19:05 +02:00
Florian Rappl
23f4d39a30 Merge pull request #757 from ElectronNET/feature/gh-actions
Migrated to NUKE
2023-04-03 11:35:20 +02:00
Florian Rappl
05ac4a1886 Merge branch 'main' of https://github.com/ElectronNET/Electron.NET into feature/gh-actions 2023-04-03 11:29:48 +02:00
Gregor Biswanger
33ac4edbe3 Merge pull request #758 from cosmo0/patch-1
Fixes issue #735 - paths are URL escaped
2023-04-03 11:29:26 +02:00
Florian Rappl
e5f9bae64f Merge branch 'main' of https://github.com/ElectronNET/Electron.NET into feature/gh-actions 2023-04-03 11:29:22 +02:00
Gregor Biswanger
437404d6cc Merge pull request #755 from Yuvix25/main
Change WebPreferences.ZoomFactor from int to double
2023-04-03 11:25:21 +02:00
cosmo0
1ae2f1de93 Fixes issue #735 - paths are URL escaped 2023-04-03 10:14:43 +02:00
Florian Rappl
6bfd0c33af Changed permission to execute on Linux 2023-04-03 10:03:59 +02:00
Florian Rappl
6311d55a75 Final cleanup 2023-04-03 09:53:56 +02:00
Florian Rappl
7b522c1779 Adjusted for NUKE 2023-04-03 08:43:42 +02:00
Florian Rappl
b1c08f5865 Prepare for NUKE 2023-04-03 07:47:34 +02:00
Yuval Rosen
a3f19055b9 Change WebPreferences.ZoomFactor from int to double 2023-04-02 15:12:23 +03:00
Florian Rappl
ef9a95d9e9 Removed legacy scripts 2023-04-01 23:44:33 +02:00
Florian Rappl
2367035acd Moved into src folder 2023-04-01 23:44:25 +02:00
Florian Rappl
3470a70572 Removed Travis 2023-04-01 23:44:03 +02:00
Gregor Biswanger
1365918efd Merge pull request #749 from ElectronNET/feature/readme
README Improvements
2023-03-30 12:01:07 +02:00
Florian Rappl
e909de54af Some README cleanup and improvements 2023-03-30 09:38:19 +02:00
535 changed files with 25696 additions and 7259 deletions

2
.github/FUNDING.yml vendored
View File

@@ -1,6 +1,6 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
github: [GregorBiswanger, FlorianRappl]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username

BIN
.github/WikiLinks.exe vendored Normal file

Binary file not shown.

47
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,47 @@
name: CI
on: [push, pull_request]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
- name: Build
run: ./build.sh
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
- name: Build
run: |
if ($env:GITHUB_REF -eq "refs/heads/main") {
.\build.ps1 -Target Publish
} elseif ($env:GITHUB_REF -eq "refs/heads/develop") {
.\build.ps1 -Target PrePublish
} else {
.\build.ps1
}

59
.github/workflows/publish-wiki.yml vendored Normal file
View File

@@ -0,0 +1,59 @@
name: Publish wiki
on:
push:
branches: [electronnet_core, main]
workflow_dispatch:
concurrency:
group: publish-wiki
cancel-in-progress: true
permissions:
contents: write
jobs:
publish-wiki:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Remove level 1 headings from Markdown files
shell: bash
run: |
find docs/ -name '*.md' -exec sed -i '1d' {} \;
- name: Move all files to root folder
shell: bash
run: |
mv docs/*/* docs/
- name: Delete unwanted files
shell: bash
run: |
# rm docs/*.xlsm
# rm docs/*.pptx
rm docs/*.shproj
- name: Stripping file extensions....
uses: softworkz/strip-markdown-extensions-from-links-action@main
with:
path: ./docs/
- name: Copy Changelog
shell: bash
run: |
cp Changelog.md docs/RelInfo/ 2>/dev/null || true
- name: Copy images to wiki/wiki folder
shell: bash
run: |
mkdir docs/wiki
cp docs/*.svg docs/wiki/ 2>/dev/null || true
cp docs/*.png docs/wiki/ 2>/dev/null || true
cp docs/*.jpg docs/wiki/ 2>/dev/null || true
cp docs/*.gif docs/wiki/ 2>/dev/null || true
cp docs/*.mp4 docs/wiki/ 2>/dev/null || true
- name: Commit and push changes
run: |
git config --global user.name "GitHub Action"
git config --global user.email "action@github.com"
git add -A
git commit -m "Automatically update Markdown files" || echo "No changes to commit"
- uses: Andrew-Chen-Wang/github-wiki-action@v4.4.0
with:
path: docs/
ignore: |
'**/*.xlsm'
'**/*.pptx'
'**/*.shproj'

6
.gitignore vendored
View File

@@ -44,7 +44,7 @@ dlldata.c
project.lock.json
project.fragment.lock.json
artifacts/
!/artifacts/readme.md
!/artifacts/.gitkeep
*_i.c
*_p.c
@@ -263,3 +263,7 @@ __pycache__/
# Mac Only settings file
.DS_Store
# Nuke build tool
.nuke/temp
/publish.cmd

136
.nuke/build.schema.json Normal file
View File

@@ -0,0 +1,136 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref": "#/definitions/build",
"title": "Build Schema",
"definitions": {
"build": {
"type": "object",
"properties": {
"CommonPropsFilePath": {
"type": "string",
"description": "common.props file path - to determine the configured version"
},
"Configuration": {
"type": "string",
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
"enum": [
"Debug",
"Release"
]
},
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
},
"Help": {
"type": "boolean",
"description": "Shows the help text for this build assembly"
},
"Host": {
"type": "string",
"description": "Host for execution. Default is 'automatic'",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"Partition": {
"type": "string",
"description": "Partition to use on CI"
},
"Plan": {
"type": "boolean",
"description": "Shows the execution plan (HTML)"
},
"Profile": {
"type": "array",
"description": "Defines the profiles to load",
"items": {
"type": "string"
}
},
"ReleaseNotesFilePath": {
"type": "string",
"description": "ReleaseNotesFilePath - To determine the lates changelog version"
},
"Root": {
"type": "string",
"description": "Root directory during build execution"
},
"Skip": {
"type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"CreatePackages",
"Default",
"Package",
"PrePublish",
"Publish",
"PublishPackages",
"PublishPreRelease",
"PublishRelease",
"Restore",
"RunUnitTests"
]
}
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"CreatePackages",
"Default",
"Package",
"PrePublish",
"Publish",
"PublishPackages",
"PublishPreRelease",
"PublishRelease",
"Restore",
"RunUnitTests"
]
}
},
"Verbosity": {
"type": "string",
"description": "Logging verbosity during build execution. Default is 'Normal'",
"enum": [
"Minimal",
"Normal",
"Quiet",
"Verbose"
]
}
}
}
}
}

4
.nuke/parameters.json Normal file
View File

@@ -0,0 +1,4 @@
{
"$schema": "./build.schema.json",
"Solution": "src/ElectronNET.Lean.sln"
}

View File

@@ -1,8 +0,0 @@
language: csharp
mono: none
dist: xenial
dotnet: 3.1
before_script:
- export PATH="$PATH:/home/travis/.dotnet/tools"
script:
- ./buildAll.sh

4
.vscode/launch.json vendored
View File

@@ -10,9 +10,9 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceRoot}/ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll",
"program": "${workspaceRoot}/src/ElectronNET.CLI/bin/Debug/net8.0/dotnet-electronize.dll",
"args": [],
"cwd": "${workspaceRoot}/ElectronNET.CLI",
"cwd": "${workspaceRoot}/src/ElectronNET.CLI",
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
"console": "internalConsole",
"stopAtEntry": false,

2
.vscode/tasks.json vendored
View File

@@ -7,7 +7,7 @@
"label": "build",
"type": "shell",
"command": "dotnet",
"args": ["build", "${workspaceRoot}/ElectronNET.CLI/ElectronNET.CLI.csproj"],
"args": ["build", "${workspaceRoot}/src/ElectronNET.CLI/ElectronNET.CLI.csproj"],
"problemMatcher": "$msCompile",
"group": {
"_id": "build",

View File

@@ -1,367 +1,70 @@
# Not released
# 0.1.0
# 23.6.2
## ElectronNET.Core
# Released
- Updated `PrintToPDFOptions` to also allow specifying the `PageSize` with an object (#769)
- Added option to provide floating point value as aspect ratios with `SetAspectRatio` (#793)
# 23.6.1
# 0.0.18
ElectronNET.CLI:
## ElectronNET.Core
* New Feature: Upgrade to .NET 6 support
### Highlights
ElectronNET.API:
- **Complete MSBuild Integration**: Eliminated CLI tool dependency, moved all build processes to MSBuild with deep Visual Studio integration
- **Modernized Architecture**: Restructured process lifecycle with .NET launching first and running Electron as child process for better control and reliability
- **Cross-Platform Development**: Build and debug Linux applications directly from Windows Visual Studio via WSL integration
- **Flexible Electron Versioning**: Removed version lock-in, users can now select any Electron version with build-time validation
- **Enhanced Debugging Experience**: ASP.NET-first debugging with Hot Reload support and improved process termination handling
- **Console App Support**: No longer requires ASP.NET - now works with simple console applications for file system or remote server HTML/JS
* New Feature: Native Electron 23.2.0 support, but not all new API features included (we search contributors)
* New Feature: Upgrade to .NET 6 support
* New Feature: Changed Web-Socket .NET Library to [SocketIOClient](https://github.com/doghappy/socket.io-client-csharp)
* Breaking Changes: We removed deprecated API events/methods from ElectronNET.API [(More Details)](https://www.electronjs.org/docs/latest/breaking-changes)
### Build System & Project Structure
# 13.5.1
- Eliminated electron.manifest.json configuration file, replaced with MSBuild project properties
- Introduced new package structure: ElectronNET.Core (main package), ElectronNET.Core.Api (API definitions), ElectronNET.Core.AspNet (ASP.NET integration)
- Added Runtime Identifier (RID) selection as part of project configuration
- Restructured build folder layout to use standard .NET format (bin\net8.0\win-x64) instead of bin\Desktop
- Implemented incremental build support for Electron assets to improve build performance
- Added custom MSBuild tasks for Electron-specific build operations
ElectronNET.CLI:
### Development Experience
* New Feature: Using exit code instead of seek for the term 'error' (thanks [TSrgy](https://github.com/TSrgy)) [\#562](https://github.com/ElectronNET/Electron.NET/pull/562)
* Fixed bug: Allow for property overrides to be passed in (thanks [danatcofo](https://github.com/danatcofo)) [\#531](https://github.com/ElectronNET/Electron.NET/pull/531)
Use `/p:propertyName=value` or `/property:propertyName=value` to pass in property overrides. This is equivalent to the `-p:` option documented here: [https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish)
* Fixed bug: Add ability to pass an argument for "Version" for both the "dotnet publish" and "electron-builder" commands (thanks [tub5](https://github.com/tub5)) [\#546](https://github.com/ElectronNET/Electron.NET/pull/546)
* Fixed bug: Version flag not persisting with the referenced executable (thanks [tub5](https://github.com/tub5)) [\#585](https://github.com/ElectronNET/Electron.NET/pull/585)
* Fixed bug: Changes PublishSingleFile default to false for NET5 compatibility (thanks [cristiangiagante](https://github.com/cristiangiagante)) [\#570](https://github.com/ElectronNET/Electron.NET/pull/570)
ElectronNET.API:
* New Feature: Native Electron 13.1.5 support, but not all new features (we search contributors)
* Breaking API Changes (from native Electron 13.1.5):
- `Shell.MoveItemToTrashAsync` renamed with `Shell.TrashItemAsync`
- The deprecated extension APIs have been removed: `BrowserWindow.GetAllExtensionsAsync()`, `BrowserWindow.RemoveExtension()`, `BrowserWindow.AddExtensionAsync()`. Use the session APIs instead: `Session.GetAllExtensionsAsync()`, `Session.RemoveExtension()`, `Session.LoadExtensionAsync()`.
* New Feature: singleInstance handle command line arguments [\#520](https://github.com/ElectronNET/Electron.NET/issues/520)
* New Feature: Add WebContents [insertCSS](https://www.electronjs.org/docs/api/web-contents#contentsinsertcsscss-options) functionality (thanks [nfichter](https://github.com/nfichter)) [\#559](https://github.com/ElectronNET/Electron.NET/pull/559)
* New Feature: Allow IpcMain to send IPC messages to BrowserViews (thanks [nfichter](https://github.com/nfichter)) [\#560](https://github.com/ElectronNET/Electron.NET/pull/560)
* New Feature: Add support for proxies that require basic username/password authentication (thanks [nfichter](https://github.com/nfichter)) [\#561](https://github.com/ElectronNET/Electron.NET/pull/561)
* New Feature: Add PostData to LoadURLOptions to allow http-posts in LoadURL calls (thanks [Funkrusha](https://github.com/Funkrusha)) [\#547](https://github.com/ElectronNET/Electron.NET/pull/547)
* Fixed bug: Fix splash screen interaction causing crashes, ghost dragging, and resizable behavior #540 (thanks [MiniguyBrendan](https://github.com/MiniguyBrendan)) [\#540](https://github.com/ElectronNET/Electron.NET/pull/540)
* Fixed bug: Vibrancy serialization fix (thanks [tantumalice](https://github.com/tantumalice)) [\#573](https://github.com/ElectronNET/Electron.NET/pull/573)
- Implemented unpackaged run-mode for development using regular .NET builds with unpackaged Electron configuration
- Added support for building Linux packages on Windows via WSL integration
- Enabled running and debugging Linux application outputs on Windows through WSL
- Integrated TypeScript compilation with ASP.NET tooling for consistent builds
- Added process orchestration supporting 8 different launch scenarios (packaged/unpackaged × console/ASP.NET × dotnet-first/electron-first)
# 11.5.1
### Debugging & Runtime
ElectronNET.CLI:
- Dramatically improved debugging experience with ASP.NET-first launch mode
- Added Hot Reload support for ASP.NET code during development
- Implemented proper process termination handling for all exit scenarios
- Minimized startup times through optimized build and launch procedures
* New Feature: Added new build and start commandline options for single exe (thanks [nathanwienand](https://github.com/nathanwienand)) [\#506](https://github.com/ElectronNET/Electron.NET/pull/506)
* New Feature: Set a description of the app in `electron.manifest.json` (thanks [BurtsevC](https://github.com/BurtsevC)) [\#433](https://github.com/ElectronNET/Electron.NET/pull/433)
* New Feature: Set a target for the start command (thanks [gabecook](https://github.com/gabecook)) [\#463](https://github.com/ElectronNET/Electron.NET/pull/463)
* New Feature: `electronize init` support for F# projects (thanks [kojo12228](https://github.com/kojo12228)) [\#457](https://github.com/ElectronNET/Electron.NET/pull/457)
* New Feature: Linux support for the buildAll.sh (thanks [duncanawoods](https://github.com/duncanawoods)) [\#465](https://github.com/ElectronNET/Electron.NET/pull/465)
* Fixed bug: ERR_UNKNOWN_URL_SCHEME by intercepting file:// protocol (thanks [duncanawoods](https://github.com/duncanawoods)) [\#467](https://github.com/ElectronNET/Electron.NET/pull/467)
### Technical Improvements
ElectronNET.API:
- Enhanced splash screen handling with automatic path resolution
- Improved ElectronHostHook integration as proper npm package dependency
- Updated to latest TypeScript version with ESLint configuration
- Added support for custom main.js files in projects
- Implemented version management through common.props file
- Added build-time Electron version compatibility validation
* New Feature: Native Electron 11.1.1 support, but not all new features (we search contributors)
* Breaking API Changes (from native Electron 11.0): - Removed: BrowserView.{destroy, fromId, fromWebContents, getAllViews} and id property of BrowserView
* New Feature: Upgrade to .NET 5 (thanks [scottkuhl](https://github.com/scottkuhl)) [\#509](https://github.com/ElectronNET/Electron.NET/pull/509)
* New Feature: Extension Method for adding the Electron static class members to the standard MS DI Containers, this is a QOL issue only. `services.AddElectron()` (thanks [danatcofo](https://github.com/danatcofo )) [\#528](https://github.com/ElectronNET/Electron.NET/pull/528)
* New Feature: SetMenu completed for the Dock (MacOS) (thanks [danatcofo](https://github.com/danatcofo )) [\#528](https://github.com/ElectronNET/Electron.NET/pull/528)
### Package & Distribution
Example for the Dock Menu
- Integrated MSBuild publishing mechanisms for creating Electron packages
- Added folder publishing support with improved parameter handling
- Implemented automated package.json generation from MSBuild properties
- Added GitHub release automation with proper versioning
- Reduced package sizes by eliminating unnecessary TypeScript dependencies
`Electron.Dock.SetMenu(new [] {
new MenuItem {
Label = "Dock Menu Item",
Click = () => {
// do something
}
},
});`
### Migration & Compatibility
Example for consuming the activate event (MacOs only)
- Maintained backward compatibility for existing ElectronHostHook implementations
- Removed ASP.NET requirement: Now works with simple console applications for file system or remote server HTML/JS scenarios
- Added support for both console and ASP.NET Core application types
- Preserved all existing Electron API functionality while modernizing architecture
- Added migration path for existing projects through updated package structure
`Electron.App.On("activate", obj => {
var hasWindows = (bool)obj;
// do something
});`
* New Feature: On and Once implementations for the App and Tray to cover the plethora of events that are not mapped explicitly in those two modules. (thanks [danatcofo](https://github.com/danatcofo )) [\#528](https://github.com/ElectronNET/Electron.NET/pull/528)
* New Feature: Adding the `EnableRemoteModule` property to the WebPreferences object. As of Electron 10, this property defaulted to false and without it exposed you can't use the remote module within a window. (thanks [danatcofo](https://github.com/danatcofo )) [\#528](https://github.com/ElectronNET/Electron.NET/pull/528)
* New Feature: Adding a configurable default electron port. (thanks [aarong-av](https://github.com/aarong-av)) [\#505](https://github.com/ElectronNET/Electron.NET/pull/505)
* New Feature: Added support for launching the application with a file on MacOS (thanks [dlitty](https://github.com/dlitty)) [\#478](https://github.com/ElectronNET/Electron.NET/pull/478)
* Improved: Avoid Blocking Calls in App and AutoUpdater (thanks [freosc](https://github.com/freosc)) [\#474](https://github.com/ElectronNET/Electron.NET/pull/474)
* Fixed bug: Maintain references between socket.io connection events (thanks [danatcofo](https://github.com/danatcofo )) [\#468](https://github.com/ElectronNET/Electron.NET/pull/486)
* Fixed bug: Set default WebPreferences.DefaultFontSize (thanks [duncanawoods](https://github.com/duncanawoods)) [\#468](https://github.com/ElectronNET/Electron.NET/pull/468)
# 9.31.2
* Electron-Builder fixed for Windows builds.
# 9.31.1
ElectronNET.CLI:
* New Feature: Added config parameter (thanks [konstantingross](https://github.com/konstantingross)) [\#409](https://github.com/ElectronNET/Electron.NET/pull/409)
* New Feature: Set the configuration environment with the electron.manifest.json file.
* Fixed bug: Custom user path removed and replaced by the correct directory with VS macro (When ElectronNET.CLI is the Startup Project, press F5 (Debug) and the ElectronNET.WebApp starts correctly without error!) (thanks [konstantingross](https://github.com/konstantingross)) [\#409](https://github.com/ElectronNET/Electron.NET/pull/409)
ElectronNET.API:
* New Feature: Native Electron 9.0.3 support, but not all new features (we search contributors)
* New Feature: PowerMonitor API Support (thanks [gustavo-lara-molina](https://github.com/gustavo-lara-molina)) [\#399](https://github.com/ElectronNET/Electron.NET/pull/399) [\#423](https://github.com/ElectronNET/Electron.NET/pull/423)
* New Feature: NativeTheme API Support (thanks [konstantingross](https://github.com/konstantingross)) [\#402](https://github.com/ElectronNET/Electron.NET/pull/402)
* New Feature: Cookie API Support (thanks [freosc](https://github.com/freosc)) [\#413](https://github.com/ElectronNET/Electron.NET/pull/413)
* Changed Feature: Removed dock methods from App API and moved to Dock API (thanks [konstantingross](https://github.com/konstantingross)) [\#422](https://github.com/ElectronNET/Electron.NET/pull/422)
* App-Api Enhancement: MenuItems with Submenus need an submenu type workaround [\#412](https://github.com/ElectronNET/Electron.NET/issues/412)
* App-Api Enhancement: Added UserAgentFallback (thanks [Mandrakia](https://github.com/Mandrakia)) [\#406](https://github.com/ElectronNET/Electron.NET/pull/406)
* App-Api Enhancement: Summaries rewritten, new App.IsReady / App.HasSingleInstanceLock property, App.Ready event, App.Focus with force parameter method, many parameters changes (thanks [konstantingross](https://github.com/konstantingross)) [\#415](https://github.com/ElectronNET/Electron.NET/pull/415) [\#422](https://github.com/ElectronNET/Electron.NET/pull/422)
* App-Api Enhancement: New App.IsReady property and App.Ready event (thanks [konstantingross](https://github.com/konstantingross)) [\#415](https://github.com/ElectronNET/Electron.NET/pull/415)
* Shell-Api Enhancement: API fixes for Electron 9.0.0 / Added missing parameters / Summaries rewritten (thanks [konstantingross](https://github.com/konstantingross)) [\#417](https://github.com/ElectronNET/Electron.NET/pull/417) [\#418](https://github.com/ElectronNET/Electron.NET/pull/418)
* Notification-Api Enhancement: Added missing properties in Notifications (thanks [konstantingross](https://github.com/konstantingross)) [\#410](https://github.com/ElectronNET/Electron.NET/pull/410)
* BrowserWindows-Api Enhancement: Add missing API call for SetProgressBar options (thanks [konstantingross](https://github.com/konstantingross)) [\#416](https://github.com/ElectronNET/Electron.NET/pull/416)
* BrowserWindow Enhancement: Add BrowserWindow.GetNativeWindowHandle() (thanks [kdlslyv](https://github.com/kdlslyv)) [\#429](https://github.com/ElectronNET/Electron.NET/pull/429)
* HostHook-Api Enhancement: HostHook.CallAsync should use TaskCompletionSource.SetException instead of throwing exception (thanks [Fre V](https://github.com/freosc)) [\#430](https://github.com/ElectronNET/Electron.NET/pull/430)
* MacOS Enhancement: Application exit logic (thanks [dafergu2](https://github.com/dafergu2)) [\#405](https://github.com/ElectronNET/Electron.NET/pull/405)
* Fixed bug: ElectronNET.API.Entities.WebPreferences.ContextIsolation [DefaultValue(true)] [\#411](https://github.com/ElectronNET/Electron.NET/issues/411)
ElectronNET.WebApp (internal use):
* Improvement debugging and testing new API calls (without install ElectronNET.CLI) (thanks [konstantingross](https://github.com/konstantingross)) [\#425](https://github.com/ElectronNET/Electron.NET/pull/425)
* Fixed bug: Cannot find modules in ElectronHostHook (thanks [konstantingross](https://github.com/konstantingross)) [\#425](https://github.com/ElectronNET/Electron.NET/pull/425)
Thank you for donation [Phil Seeman](https://github.com/mpnow) ❤
# 8.31.2
ElectronNET.CLI:
* New Feature: Deactivate PublishReadyToRun for build or start [\#395](https://github.com/ElectronNET/Electron.NET/issues/395)
`electronize build /target win /PublishReadyToRun false`
`electronize start /PublishReadyToRun false`
* Fixed bug: Application window doesn't open after packaging [\#387](https://github.com/ElectronNET/Electron.NET/issues/387)
ElectronNET.API:
* New Feature: NativeImage Support (thanks [ThrDev](https://github.com/ThrDev)) [\#394](https://github.com/ElectronNET/Electron.NET/pull/394)
* New Feature: Update menu items for context menu and system tray on-the-fly. [\#270](https://github.com/ElectronNET/Electron.NET/pull/270)
# 8.31.1
ElectronNET.CLI:
* New Feature: Set a name and author of the app in `electron.manifest.json` [\#348](https://github.com/ElectronNET/Electron.NET/issues/348#issuecomment-615977950) [\#310](https://github.com/ElectronNET/Electron.NET/issues/310#issuecomment-617361086)
* New Feature: Live reload (thanks [syedadeel2](https://github.com/syedadeel2)) [\#390](https://github.com/ElectronNET/Electron.NET/pull/390)
`electronize start /watch`
* New Feature: Every new window will created with an clear cache [\#273](https://github.com/ElectronNET/Electron.NET/issues/273)
`electronize start /clear-cache`
ElectronNET.API:
* New Feature: Native Electron 8.2.3 support, but not all new features (we search contributors)
* New Feature: We incease the startup time for ~25-36% [\#356](https://github.com/ElectronNET/Electron.NET/issues/356)
* New Feature: Added print capability (thanks [x-xx-o](https://github.com/x-xx-o)) [\#355](https://github.com/ElectronNET/Electron.NET/pull/355)
* New Feature: BrowserView API [\#371](https://github.com/ElectronNET/Electron.NET/issues/371)
* Changed App.GetNameAsync and App.SetNameAsync to the App.Name Property [\#350](https://github.com/ElectronNET/Electron.NET/issues/350)
* Fixed bug: Splash Screen disappearing on click [\#357](https://github.com/ElectronNET/Electron.NET/issues/357)
* Fixed bug: Start MenuRole enum at 1 (thanks [jjuback](https://github.com/jjuback)) [\#369](https://github.com/ElectronNET/Electron.NET/pull/369)
* Fixed bug: BridgeConnector not connected (spam console) [\#347](https://github.com/ElectronNET/Electron.NET/issues/347)
* Fixed bug: BrowserWindowOptions is not setting Width and Height properly [\#373](https://github.com/ElectronNET/Electron.NET/issues/373)
* Fixed bug: IpcMain.Once(string) is not one time use, is not removing listener [\#366](https://github.com/ElectronNET/Electron.NET/issues/366)
* Fixed bug: IpcMain.RemoveAllListeners(string) is not removing the listeners [\#365](https://github.com/ElectronNET/Electron.NET/issues/365)
* Fixed bug: GetLoginItemSettingsAsync does not work [\#352](https://github.com/ElectronNET/Electron.NET/issues/352)
* Fixed bug: Using OnReadyToShow to display the main window in Blazor does not seem to work with Show set to false [\#361](https://github.com/ElectronNET/Electron.NET/issues/361)
* Fixed bug: Unable to disable WebSecurity along with NodeIntegration enabled [\#389](https://github.com/ElectronNET/Electron.NET/issues/389)
# 7.30.2
ElectronNET.CLI:
* New Feature: Different manifest file support [\#340](https://github.com/ElectronNET/Electron.NET/issues/340)
* Create a additional manifest file: `electronize init /manifest test`
* Start the app with your additional manifest file: `electronize start /manifest electron.manifest.test.json`
* Build the app with your additional manifest file: `electronize build /target win /manifest electron.manifest.test.json`.
* New Feature: Command Line support [\#337](https://github.com/ElectronNET/Electron.NET/issues/337)
* You can start the app with: `electronize start /args --dog=woof --test=true`
* Or as binary: `myapp.exe /args --dog=woof --test=true`
* Fixed bug: Start process with listen port 8000 error. [\#308](https://github.com/ElectronNET/Electron.NET/issues/308) (thanks [thecodejedi](https://github.com/thecodejedi))
* Fixed bug: `electronize build` with no arguments would throw a `KeyNotFoundException`. (thanks [jamiebrynes7](https://github.com/jamiebrynes7))
ElectronNET.API:
* New Feature: Electron 7.1.2 support, but not all new features (we search contributors) [\#341](https://github.com/ElectronNET/Electron.NET/issues/341)
* New Feature: Electron.App.CommandLine API [\#337](https://github.com/ElectronNET/Electron.NET/issues/337)
* New Feature: Support of BrowserWindow.AddExtension, BrowserWindow.RemoveExtension, BrowserWindow.GetExtensions (thanks [Daddoon](https://github.com/Daddoon))
Thank you for donation [robertmclaws](https://github.com/robertmclaws) ❤
# 5.30.1
ElectronNET.CLI:
* Move to .NET Core 3.0
* Use npm npx instead of global installations (thanks [jimbuck](https://github.com/jimbuck))
ElectronNET.API:
* Move to .NET Core 3.0
* New Feature: Add BrowserWindow.RemoveMenu() (thanks [hack2root](https://github.com/hack2root))
Thanks to [MaherJendoubi](https://github.com/MaherJendoubi), [kant2002](https://github.com/kant2002), [raz-canva](https://github.com/raz-canva) and [Daddoon](https://github.com/Daddoon) to give .NET Core 3.0 feedback!
# 5.22.14
ElectronNET.CLI:
* Fixed bug: Build fails with latest electron-builder version [\#288](https://github.com/ElectronNET/Electron.NET/issues/288)
ElectronNET.API:
* New Feature: Full support for Auto Updater [(Based on electron-updater - Version 4.0.6)](https://www.electron.build/auto-update)
* New Feature: Support for set a custom static Port to ASP.NET Backend [\#155](https://github.com/ElectronNET/Electron.NET/issues/155)
* Fixed bug: Electron tray icon TypeError ([Electron original issue](https://github.com/electron/electron/issues/7657)) (thanks [Tum4ik](https://github.com/Tum4ik))
* Fixed bug: Wrong tray icon path in the application built via `electronize build` command (thanks [Tum4ik](https://github.com/Tum4ik))
* Fixed bug: fix async issue where same port is considered open [\#261](https://github.com/ElectronNET/Electron.NET/issues/261) (thanks [netpoetica](https://github.com/netpoetica))
ElectronNET.WebApp:
* Fixed usage of the `Electron.Tray.Show` according fixed bugs in the ElectronNET.CLI (thanks [Tum4ik](https://github.com/Tum4ik))
# 5.22.13
ElectronNET.API:
* Fixed bug: Menu Item visibility [\#257](https://github.com/ElectronNET/Electron.NET/issues/257)
* Fixed bug: electron.manifest.json - singleInstance not working [\#258](https://github.com/ElectronNET/Electron.NET/issues/258)
* Fixed security issue: ASP.NET Core process is now bound to 127.0.0.1 instead of the broader localhost [\#258](https://github.com/ElectronNET/Electron.NET/pull/266)
# 5.22.12
ElectronNET.CLI:
* New Feature: Changed from **electron packager** to [**electron builder**](https://www.electron.build/)
* New Feature: 'add hosthook' command for add a ElectronHostHook-Directory
* Fixed bug: 'Unexpected firewall warnings' [\#181](https://github.com/ElectronNET/Electron.NET/issues/181)
* Fixed bug: 'found 8 vulnerabilities (1 low, 5 moderate, 2 high)' [\#199](https://github.com/ElectronNET/Electron.NET/pull/199)
* Merged pull request: Call electronize from the Path instead of via dotnet in launchSettings.json [\#243](https://github.com/ElectronNET/Electron.NET/pull/243) (thanks [grbd](https://github.com/grbd))
ElectronNET.API:
* New Feature: Electron 5.0.1 support, but not all new features
* New Feature: Auto Updater [(Based on electron-updater)](https://www.electron.build/auto-update)
* New Feature: Splashscreen-Support
* New Feature: HostHook-API for execute own TypeScript/JavaScript code on native Electron Main-Process
* New Feature: Session-API functions
* Fixed bug: Node process running after stopping app [\#96](https://github.com/ElectronNET/Electron.NET/issues/96)
* Fixed bug: 'X and Y options to not work on Windows 10' [\#193](https://github.com/ElectronNET/Electron.NET/issues/193)
* Fixed bug: Unable to clear cache [\#66](https://github.com/ElectronNET/Electron.NET/issues/66)
* Merged pull request: Fix BrowserWindow::SetMenu [\#231](https://github.com/ElectronNET/Electron.NET/pull/231) thanks (thanks [CodeKenpachi](https://github.com/CodeKenpachi))
* Merged pull request: FIX application hangs after socket reconnect [\#233](https://github.com/ElectronNET/Electron.NET/pull/233) (thanks [pedromrpinto](https://github.com/pedromrpinto))
* Merged pull request: Reduce chance of detecting false positives when scanning subprocesses for errors. [\#236](https://github.com/ElectronNET/Electron.NET/pull/236) (thanks [BorisTheBrave](https://github.com/BorisTheBrave))
* Merged pull request: Updates the C# API to accept floating point as in JS. [\#240](https://github.com/ElectronNET/Electron.NET/pull/240) (thanks [BorisTheBrave](https://github.com/BorisTheBrave))
* Merged pull request: buildReleaseNuGetPackages should leave you in the same directory you … [\#241](https://github.com/ElectronNET/Electron.NET/pull/241) (thanks [BorisTheBrave](https://github.com/BorisTheBrave))
ElectronNET.WebApp:
* Implemented a sample for the new HostHook-API
* Fixed bug: 'Electron.NET API Demo: unable to copy code?' [\#247](https://github.com/ElectronNET/Electron.NET/issues/247)
# 0.0.11
ElectronNET.CLI:
* Invoke 'npm install' without --prod flag to install needed devDependencies as well.
* Enable SourceLink
* NuGet Package License Information updated (deprecation of licenseUrl)
ElectronNET.API:
* Documentation added for WebContents.GetUrl()
* Enable SourceLink
* NuGet Package License Information updated (deprecation of licenseUrl)
# 0.0.10
ElectronNET.API:
* manifestJsonFilePath fixed (thanks @smack0007)
* Use Electron release 3.0.0 and updated packages (thanks @deinok)
* fixes for Socket interaction (thanks @mojinxun)
* Fixing SingleInstances (thanks @yaofeng)
* Enhance WebContent.GetUrl (thanks @ru-sh)
ElectronNET.CLI:
* Show Resultcode for better debugging when using Build/Start Command
* ElectronNET.CLI is now a global dotnet tool
# 0.0.9
ElectronNET.API:
* Better Async handling - thanks @danielmarbach
ElectronNET.CLI:
* More options on the 'build' command, e.g. for a 32bit debug build with electron prune: build /target custom win7-x86;win32 /dotnet-configuration Debug /electron-arch ia32 /electron-params "--prune=true "
* .NET Core project is now built with Release configuration but can be adjusted with the new params.
* Be aware: "Breaking" (but because of the alpha status of this project, we won't use SemVer)
# 0.0.8
This version was skipped because we unfortunately released a pre-version of this on NuGet.
# 0.0.7
ElectronNET.CLI:
* Fixed electronize start for macos/linux - thanks @yamachu
* Skip NPM install on start when node_modules directory already exists
# 0.0.6
ElectronNET.CLI:
* nuget packages are now release bits and have the correct assembly version
* Version command
* better devCleanup.cmd
* Better Platform Support Issue - thanks to @Petermarcu
* Start Command should now work on OSX/Linux - thanks to @r105m
ElectronNET.API:
* Thread-Safe methods - thanks to @yeskunall
# 0.0.5
ElectronNET.API:
* The last nuget package didn't contain the actual webpreferences settings with defaults - hopefully now.
# 0.0.4
ElectronNET.CLI:
* dotnet electronize start fixed
ElectronNET.API:
* WebPreferences settings with default values
# 0.0.3
ElectronNET.CLI:
* Init with Debug profile
* Build for all platforms (well... for newest OSX/Linux/Windows)
ElectronNET.API:
* Moar XML documentation
* Hybrid support (e.g. running as normal website and electron app)
* Event bugfixing
# 0.0.2
ElectronNET.CLI:
* Added Init to Help page
* Added XML documentation to NuGet output
* Maybe fixed for https://github.com/GregorBiswanger/Electron.NET/issues/2
ElectronNET.API:
* Add XML documentation to NuGet output
* Implemented Notification-, Dialog- & Tray-API
# 0.0.1
* init everything and basic functionality
This represents a comprehensive modernization of Electron.NET, addressing the major pain points around debugging, build complexity, and platform limitations while maintaining full API compatibility.

View File

@@ -1,33 +0,0 @@
namespace ElectronNET.API
{
internal static class BridgeConnector
{
private static SocketIoFacade _socket;
private static readonly object SyncRoot = new();
public static SocketIoFacade Socket
{
get
{
if (_socket == null)
{
lock (SyncRoot)
{
if (_socket == null)
{
string socketUrl = HybridSupport.IsElectronActive
? $"http://localhost:{BridgeSettings.SocketPort}"
: "http://localhost";
_socket = new SocketIoFacade(socketUrl);
_socket.Connect();
}
}
}
return _socket;
}
}
}
}

View File

@@ -1,24 +0,0 @@
namespace ElectronNET.API
{
/// <summary>
///
/// </summary>
public static class BridgeSettings
{
/// <summary>
/// Gets the socket port.
/// </summary>
/// <value>
/// The socket port.
/// </value>
public static string SocketPort { get; internal set; }
/// <summary>
/// Gets the web port.
/// </summary>
/// <value>
/// The web port.
/// </value>
public static string WebPort { get; internal set; }
}
}

View File

@@ -1,154 +0,0 @@
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;
/// <summary>
/// Sends a request to get all cookies matching filter, and resolves a callack with the response.
/// </summary>
/// <param name="filter">
/// </param>
/// <returns>A task which resolves an array of cookie objects.</returns>
public Task<Cookie[]> GetAsync(CookieFilter filter)
{
var taskCompletionSource = new TaskCompletionSource<Cookie[]>();
string guid = Guid.NewGuid().ToString();
BridgeConnector.Socket.On("webContents-session-cookies-get-completed" + guid, (cookies) =>
{
Cookie[] result = ((JArray)cookies).ToObject<Cookie[]>();
BridgeConnector.Socket.Off("webContents-session-cookies-get-completed" + guid);
taskCompletionSource.SetResult(result);
});
BridgeConnector.Socket.Emit("webContents-session-cookies-get", Id, JObject.FromObject(filter, _jsonSerializer), guid);
return taskCompletionSource.Task;
}
/// <summary>
///
/// </summary>
/// <param name="details"></param>
/// <returns></returns>
public Task SetAsync(CookieDetails details)
{
var taskCompletionSource = new TaskCompletionSource<object>();
string guid = Guid.NewGuid().ToString();
BridgeConnector.Socket.On("webContents-session-cookies-set-completed" + guid, () =>
{
BridgeConnector.Socket.Off("webContents-session-cookies-set-completed" + guid);
taskCompletionSource.SetResult(null);
});
BridgeConnector.Socket.Emit("webContents-session-cookies-set", Id, JObject.FromObject(details, _jsonSerializer), guid);
return taskCompletionSource.Task;
}
/// <summary>
/// Removes the cookies matching url and name
/// </summary>
/// <param name="url">The URL associated with the cookie.</param>
/// <param name="name">The name of cookie to remove.</param>
/// <returns>A task which resolves when the cookie has been removed</returns>
public Task RemoveAsync(string url, string name)
{
var taskCompletionSource = new TaskCompletionSource<object>();
string guid = Guid.NewGuid().ToString();
BridgeConnector.Socket.On("webContents-session-cookies-remove-completed" + guid, () =>
{
BridgeConnector.Socket.Off("webContents-session-cookies-remove-completed" + guid);
taskCompletionSource.SetResult(null);
});
BridgeConnector.Socket.Emit("webContents-session-cookies-remove", Id, url, name, guid);
return taskCompletionSource.Task;
}
/// <summary>
/// Writes any unwritten cookies data to disk.
/// </summary>
/// <returns>A task which resolves when the cookie store has been flushed</returns>
public Task FlushStoreAsync()
{
var taskCompletionSource = new TaskCompletionSource<object>();
string guid = Guid.NewGuid().ToString();
BridgeConnector.Socket.On("webContents-session-cookies-flushStore-completed" + guid, () =>
{
BridgeConnector.Socket.Off("webContents-session-cookies-flushStore-completed" + guid);
taskCompletionSource.SetResult(null);
});
BridgeConnector.Socket.Emit("webContents-session-cookies-flushStore", Id, guid);
return taskCompletionSource.Task;
}
private JsonSerializer _jsonSerializer = new JsonSerializer()
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
NullValueHandling = NullValueHandling.Ignore,
DefaultValueHandling = DefaultValueHandling.Ignore
};
}
}

View File

@@ -1,48 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>..\artifacts</PackageOutputPath>
<PackageId>ElectronNET.API</PackageId>
<Authors>Gregor Biswanger, Florian Rappl</Authors>
<Company />
<Product>Electron.NET</Product>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/ElectronNET/Electron.NET/</PackageProjectUrl>
<Description>Building cross platform electron based desktop apps with .NET Core and ASP.NET Core.
This package contains the API to access the "native" electron API.</Description>
<RepositoryUrl>https://github.com/ElectronNET/Electron.NET/</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageTags>electron aspnetcore</PackageTags>
<PackageReleaseNotes>Changelog: https://github.com/ElectronNET/Electron.NET/blob/master/Changelog.md</PackageReleaseNotes>
<PackageIcon>PackageIcon.png</PackageIcon>
<Version>99.0.0.0</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<None Include="PackageIcon.png" Pack="true" PackagePath="\" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(OS)' == 'Windows_NT'">
<Exec Command="$(ProjectDir)devCleanup.cmd" IgnoreExitCode="true" />
</Target>
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(OS)' != 'Windows_NT'">
<Exec Command="$(ProjectDir)devCleanup.sh" IgnoreExitCode="true" />
</Target>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SocketIOClient" Version="3.0.8" />
<PackageReference Include="SocketIOClient.Newtonsoft.Json" Version="3.0.7" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.410601">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>

View File

@@ -1,3 +0,0 @@
// Global using directives
global using System.Web;

View File

@@ -1,41 +0,0 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
namespace ElectronNET.API
{
/// <summary>
/// Base class that reports if ASP.NET Core has fully started.
/// </summary>
internal class LifetimeServiceHost : IHostedService
{
public LifetimeServiceHost(IHostApplicationLifetime lifetime)
{
lifetime.ApplicationStarted.Register(() =>
{
App.Instance.IsReady = true;
Console.WriteLine("ASP.NET Core host has fully started.");
});
}
/// <summary>
/// Triggered when the application host is ready to start the service.
/// </summary>
/// <param name="cancellationToken">Indicates that the start process has been aborted.</param>
public Task StartAsync(CancellationToken cancellationToken)
{
return Task.CompletedTask;
}
/// <summary>
/// Triggered when the application host is performing a graceful shutdown.
/// </summary>
/// <param name="cancellationToken">Indicates that the shutdown process should no longer be graceful.</param>
public Task StopAsync(CancellationToken cancellationToken)
{
return Task.CompletedTask;
}
}
}

View File

@@ -1,33 +0,0 @@
using Microsoft.Extensions.DependencyInjection;
namespace ElectronNET.API
{
/// <summary>
///
/// </summary>
public static class ServiceCollectionExtensions
{
/// <summary>
/// Adds the <see cref="Electron"/> Members to the Service Collection
/// </summary>
public static IServiceCollection AddElectron(this IServiceCollection services)
=> services
// adding in this manner to ensure late binding.
.AddSingleton(provider => IpcMain.Instance)
.AddSingleton(provider => App.Instance)
.AddSingleton(provider => AutoUpdater.Instance)
.AddSingleton(provider => WindowManager.Instance)
.AddSingleton(provider => Menu.Instance)
.AddSingleton(provider => Dialog.Instance)
.AddSingleton(provider => Notification.Instance)
.AddSingleton(provider => Tray.Instance)
.AddSingleton(provider => GlobalShortcut.Instance)
.AddSingleton(provider => Shell.Instance)
.AddSingleton(provider => Screen.Instance)
.AddSingleton(provider => Clipboard.Instance)
.AddSingleton(provider => HostHook.Instance)
.AddSingleton(provider => PowerMonitor.Instance)
.AddSingleton(provider => NativeTheme.Instance)
.AddSingleton(provider => Dock.Instance);
}
}

View File

@@ -1,58 +0,0 @@
using Microsoft.AspNetCore.Hosting;
using System;
using System.IO;
using Microsoft.Extensions.DependencyInjection;
namespace ElectronNET.API
{
/// <summary>
///
/// </summary>
public static class WebHostBuilderExtensions
{
/// <summary>
/// Use a Electron support for this .NET Core Project.
/// </summary>
/// <param name="builder">The builder.</param>
/// <param name="args">The arguments.</param>
/// <returns></returns>
public static IWebHostBuilder UseElectron(this IWebHostBuilder builder, string[] args)
{
foreach (string argument in args)
{
if (argument.ToUpper().Contains("ELECTRONPORT"))
{
BridgeSettings.SocketPort = argument.ToUpper().Replace("/ELECTRONPORT=", "");
Console.WriteLine("Use Electron Port: " + BridgeSettings.SocketPort);
}
else if (argument.ToUpper().Contains("ELECTRONWEBPORT"))
{
BridgeSettings.WebPort = argument.ToUpper().Replace("/ELECTRONWEBPORT=", "");
}
}
if (HybridSupport.IsElectronActive)
{
builder.ConfigureServices(services =>
{
services.AddHostedService<LifetimeServiceHost>();
});
// check for the content folder if its exists in base director otherwise no need to include
// It was used before because we are publishing the project which copies everything to bin folder and contentroot wwwroot was folder there.
// now we have implemented the live reload if app is run using /watch then we need to use the default project path.
if (Directory.Exists($"{AppDomain.CurrentDomain.BaseDirectory}\\wwwroot"))
{
builder.UseContentRoot(AppDomain.CurrentDomain.BaseDirectory)
.UseUrls("http://localhost:" + BridgeSettings.WebPort);
}
else
{
builder.UseUrls("http://localhost:" + BridgeSettings.WebPort);
}
}
return builder;
}
}
}

View File

@@ -1 +0,0 @@
rd /s /q %userprofile%\.nuget\packages\electronnet.api 2>nul

View File

@@ -1 +0,0 @@
rm -rf ~/.nuget/packages/electronnet.api

View File

@@ -1,54 +0,0 @@
using System.IO;
namespace ElectronNET.CLI.Commands.Actions
{
public static class DeployEmbeddedElectronFiles
{
public static void Do(string tempPath)
{
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "main.js");
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package.json");
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "build-helper.js");
string vscodeFolder = Path.Combine(tempPath, ".vscode");
if (Directory.Exists(vscodeFolder) == false)
{
Directory.CreateDirectory(vscodeFolder);
}
EmbeddedFileHelper.DeployEmbeddedFile(vscodeFolder, "launch.json", ".vscode.");
EmbeddedFileHelper.DeployEmbeddedFile(vscodeFolder, "tasks.json", ".vscode.");
string hostApiFolder = Path.Combine(tempPath, "api");
if (Directory.Exists(hostApiFolder) == false)
{
Directory.CreateDirectory(hostApiFolder);
}
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "ipc.js", "api.");
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "app.js", "api.");
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "browserWindows.js", "api.");
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "commandLine.js", "api.");
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "dialog.js", "api.");
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "dock.js", "api.");
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "menu.js", "api.");
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "notification.js", "api.");
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "tray.js", "api.");
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "webContents.js", "api.");
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "globalShortcut.js", "api.");
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "shell.js", "api.");
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "screen.js", "api.");
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "clipboard.js", "api.");
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "autoUpdater.js", "api.");
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "browserView.js", "api.");
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "powerMonitor.js", "api.");
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "nativeTheme.js", "api.");
string splashscreenFolder = Path.Combine(tempPath, "splashscreen");
if (Directory.Exists(splashscreenFolder) == false)
{
Directory.CreateDirectory(splashscreenFolder);
}
EmbeddedFileHelper.DeployEmbeddedFile(splashscreenFolder, "index.html", "splashscreen.");
}
}
}

View File

@@ -1,67 +0,0 @@
using System.Collections.Generic;
using System.IO;
namespace ElectronNET.CLI.Commands.Actions
{
public static class DirectoryCopy
{
public static void Do(string sourceDirName, string destDirName, bool copySubDirs, List<string> ignoredSubDirs)
{
// Get the subdirectories for the specified directory.
DirectoryInfo dir = new DirectoryInfo(sourceDirName);
if (!dir.Exists)
{
throw new DirectoryNotFoundException(
"Source directory does not exist or could not be found: "
+ sourceDirName);
}
DirectoryInfo[] dirs = dir.GetDirectories();
// If the destination directory doesn't exist, create it.
if (!Directory.Exists(destDirName))
{
Directory.CreateDirectory(destDirName);
}
else
{
DirectoryInfo targetDir = new DirectoryInfo(destDirName);
foreach (FileInfo fileDel in targetDir.EnumerateFiles())
{
fileDel.Delete();
}
foreach (DirectoryInfo dirDel in targetDir.EnumerateDirectories())
{
dirDel.Delete(true);
}
}
// Get the files in the directory and copy them to the new location.
FileInfo[] files = dir.GetFiles();
foreach (FileInfo file in files)
{
string temppath = Path.Combine(destDirName, file.Name);
file.CopyTo(temppath, false);
}
// If copying subdirectories, copy them and their contents to new location.
if (copySubDirs)
{
foreach (DirectoryInfo subdir in dirs)
{
if (ignoredSubDirs.Contains(subdir.Name))
{
continue;
}
string temppath = Path.Combine(destDirName, subdir.Name);
Do(subdir.FullName, temppath, copySubDirs, ignoredSubDirs);
}
}
}
}
}

View File

@@ -1,70 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace ElectronNET.CLI.Commands.Actions
{
public static class GetTargetPlatformInformation
{
public struct GetTargetPlatformInformationResult
{
public string NetCorePublishRid { get; set; }
public string ElectronPackerPlatform { get; set; }
}
public static GetTargetPlatformInformationResult Do(string desiredPlatform, string specifiedPlatfromFromCustom)
{
string netCorePublishRid = string.Empty;
string electronPackerPlatform = string.Empty;
switch (desiredPlatform)
{
case "win":
netCorePublishRid = "win-x64";
electronPackerPlatform = "win";
break;
case "osx":
netCorePublishRid = "osx-x64";
electronPackerPlatform = "mac";
break;
case "linux":
netCorePublishRid = "linux-x64";
electronPackerPlatform = "linux";
break;
case "linux-arm":
netCorePublishRid = "linux-arm";
electronPackerPlatform = "linux";
break;
case "custom":
var splittedSpecified = specifiedPlatfromFromCustom.Split(';');
netCorePublishRid = splittedSpecified[0];
electronPackerPlatform = splittedSpecified[1];
break;
default:
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
netCorePublishRid = $"win-x{(Environment.Is64BitOperatingSystem ? "64" : "86")}";
electronPackerPlatform = "win";
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
netCorePublishRid = "osx-x64";
electronPackerPlatform = "mac";
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
netCorePublishRid = "linux-x64";
electronPackerPlatform = "linux";
}
break;
}
return new GetTargetPlatformInformationResult()
{
ElectronPackerPlatform = electronPackerPlatform,
NetCorePublishRid = netCorePublishRid
};
}
}
}

View File

@@ -1,139 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
namespace ElectronNET.CLI.Commands
{
public class AddCommand : ICommand
{
public const string COMMAND_NAME = "add";
public const string COMMAND_DESCRIPTION = "The add command needs to be invoked via 'add hosthook'. This creates a special folder for your custom npm package installation.";
public const string COMMAND_ARGUMENTS = "hosthook";
public static IList<CommandOption> CommandOptions { get; set; } = new List<CommandOption>();
private string[] _args;
public AddCommand(string[] args)
{
_args = args;
}
private static string ElectronHostHookFolderName = "ElectronHostHook";
public Task<bool> ExecuteAsync()
{
return Task.Run(() =>
{
if(_args.Length == 0)
{
Console.WriteLine("Specify 'hosthook' to add custom npm packages.");
return false;
}
if(_args[0].ToLowerInvariant() != "hosthook")
{
Console.WriteLine("Specify 'hosthook' to add custom npm packages.");
return false;
}
string aspCoreProjectPath = "";
// Maybe ToDo: Adding the possiblity to specify a path (like we did in the InitCommand, but this would require a better command args parser)
aspCoreProjectPath = Directory.GetCurrentDirectory();
var currentDirectory = aspCoreProjectPath;
var targetFilePath = Path.Combine(currentDirectory, ElectronHostHookFolderName);
if(Directory.Exists(targetFilePath))
{
Console.WriteLine("ElectronHostHook directory already in place. If you want to start over, delete the folder and invoke this command again.");
return false;
}
Console.WriteLine("Adding the ElectronHostHook folder to your project...");
Directory.CreateDirectory(targetFilePath);
// Deploy related files
EmbeddedFileHelper.DeployEmbeddedFile(targetFilePath, "index.ts", "ElectronHostHook.");
EmbeddedFileHelper.DeployEmbeddedFile(targetFilePath, "connector.ts", "ElectronHostHook.");
EmbeddedFileHelper.DeployEmbeddedFile(targetFilePath, "package.json", "ElectronHostHook.");
EmbeddedFileHelper.DeployEmbeddedFile(targetFilePath, "tsconfig.json", "ElectronHostHook.");
EmbeddedFileHelper.DeployEmbeddedFile(targetFilePath, ".gitignore", "ElectronHostHook.");
// npm for typescript compiler etc.
Console.WriteLine("Start npm install...");
ProcessHelper.CmdExecute("npm install", targetFilePath);
// run typescript compiler
// ToDo: Not sure if this runs under linux/macos
ProcessHelper.CmdExecute(@"npx tsc -p ../../", targetFilePath);
// search .csproj or .fsproj (.csproj has higher precedence)
Console.WriteLine($"Search your .csproj/.fsproj to add configure CopyToPublishDirectory to 'Never'");
var projectFile = Directory.EnumerateFiles(currentDirectory, "*.csproj", SearchOption.TopDirectoryOnly)
.Union(Directory.EnumerateFiles(currentDirectory, "*.fsproj", SearchOption.TopDirectoryOnly))
.FirstOrDefault();
var extension = Path.GetExtension(projectFile);
Console.WriteLine($"Found your {extension}: {projectFile} - check for existing CopyToPublishDirectory setting or update it.");
if (!EditProjectFile(projectFile)) return false;
Console.WriteLine($"Everything done - happy electronizing with your custom npm packages!");
return true;
});
}
// ToDo: Cleanup this copy/past code.
private static bool EditProjectFile(string projectFile)
{
using (var stream = File.Open(projectFile, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
var xmlDocument = XDocument.Load(stream);
var projectElement = xmlDocument.Descendants("Project").FirstOrDefault();
if (projectElement == null || projectElement.Attribute("Sdk")?.Value != "Microsoft.NET.Sdk.Web")
{
Console.WriteLine(
$"Project file is not a compatible type of 'Microsoft.NET.Sdk.Web'. Your project: {projectElement?.Attribute("Sdk")?.Value}");
return false;
}
string itemGroupXmlString = "<ItemGroup>" +
"<Content Update=\"ElectronHostHook\\**\\*.*\">" +
"<CopyToPublishDirectory>Never</CopyToPublishDirectory>" +
"</Content>" +
"</ItemGroup>";
var newItemGroupForConfig = XElement.Parse(itemGroupXmlString);
xmlDocument.Root.Add(newItemGroupForConfig);
stream.SetLength(0);
stream.Position = 0;
var xws = new XmlWriterSettings
{
OmitXmlDeclaration = true,
Indent = true
};
using (XmlWriter xw = XmlWriter.Create(stream, xws))
{
xmlDocument.Save(xw);
}
}
Console.WriteLine($"Publish setting added in csproj/fsproj!");
return true;
}
}
}

View File

@@ -1,255 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using ElectronNET.CLI.Commands.Actions;
namespace ElectronNET.CLI.Commands
{
public class BuildCommand : ICommand
{
public const string COMMAND_NAME = "build";
public const string COMMAND_DESCRIPTION = "Build your Electron Application.";
public static string COMMAND_ARGUMENTS = "Needed: '/target' with params 'win/osx/linux' to build for a typical app or use 'custom' and specify .NET Core build config & electron build config" + Environment.NewLine +
" for custom target, check .NET Core RID Catalog and Electron build target/" + Environment.NewLine +
" e.g. '/target win' or '/target custom \"win7-x86;win\"'" + Environment.NewLine +
"Optional: '/dotnet-configuration' with the desired .NET Core build config e.g. release or debug. Default = Release" + Environment.NewLine +
"Optional: '/electron-arch' to specify the resulting electron processor architecture (e.g. ia86 for x86 builds). Be aware to use the '/target custom' param as well!" + Environment.NewLine +
"Optional: '/electron-params' specify any other valid parameter, which will be routed to the electron-packager." + Environment.NewLine +
"Optional: '/relative-path' to specify output a subdirectory for output." + Environment.NewLine +
"Optional: '/absolute-path to specify and absolute path for output." + Environment.NewLine +
"Optional: '/package-json' to specify a custom package.json file." + Environment.NewLine +
"Optional: '/install-modules' to force node module install. Implied by '/package-json'" + Environment.NewLine +
"Optional: '/Version' to specify the version that should be applied to both the `dotnet publish` and `electron-builder` commands. Implied by '/Version'" + Environment.NewLine +
"Optional: '/p:[property]' or '/property:[property]' to pass in dotnet publish properties. Example: '/property:Version=1.0.0' to override the FileVersion" + Environment.NewLine +
"Full example for a 32bit debug build with electron prune: build /target custom win7-x86;win32 /dotnet-configuration Debug /electron-arch ia32 /electron-params \"--prune=true \"";
public static IList<CommandOption> CommandOptions { get; set; } = new List<CommandOption>();
private string[] _args;
public BuildCommand(string[] args)
{
_args = args;
}
private string _paramTarget = "target";
private string _paramDotNetConfig = "dotnet-configuration";
private string _paramElectronArch = "electron-arch";
private string _paramElectronParams = "electron-params";
private string _paramOutputDirectory = "relative-path";
private string _paramAbsoluteOutput = "absolute-path";
private string _paramPackageJson = "package-json";
private string _paramForceNodeInstall = "install-modules";
private string _manifest = "manifest";
private string _paramPublishReadyToRun = "PublishReadyToRun";
private string _paramPublishSingleFile = "PublishSingleFile";
private string _paramVersion = "Version";
public Task<bool> ExecuteAsync()
{
return Task.Run(() =>
{
Console.WriteLine("Build Electron Application...");
SimpleCommandLineParser parser = new SimpleCommandLineParser();
parser.Parse(_args);
//This version will be shared between the dotnet publish and electron-builder commands
string version = null;
if (parser.Arguments.ContainsKey(_paramVersion))
version = parser.Arguments[_paramVersion][0];
if (!parser.Arguments.ContainsKey(_paramTarget))
{
Console.WriteLine($"Error: missing '{_paramTarget}' argument.");
Console.WriteLine(COMMAND_ARGUMENTS);
return false;
}
var desiredPlatform = parser.Arguments[_paramTarget][0];
string specifiedFromCustom = string.Empty;
if (desiredPlatform == "custom" && parser.Arguments[_paramTarget].Length > 1)
{
specifiedFromCustom = parser.Arguments[_paramTarget][1];
}
string configuration = "Release";
if (parser.Arguments.ContainsKey(_paramDotNetConfig))
{
configuration = parser.Arguments[_paramDotNetConfig][0];
}
var platformInfo = GetTargetPlatformInformation.Do(desiredPlatform, specifiedFromCustom);
Console.WriteLine($"Build ASP.NET Core App for {platformInfo.NetCorePublishRid}...");
string tempPath = Path.Combine(Directory.GetCurrentDirectory(), "obj", "desktop", desiredPlatform);
if (Directory.Exists(tempPath) == false)
{
Directory.CreateDirectory(tempPath);
}
else
{
Directory.Delete(tempPath, true);
Directory.CreateDirectory(tempPath);
}
Console.WriteLine("Executing dotnet publish in this directory: " + tempPath);
string tempBinPath = Path.Combine(tempPath, "bin");
Console.WriteLine($"Build ASP.NET Core App for {platformInfo.NetCorePublishRid} under {configuration}-Configuration...");
var dotNetPublishFlags = GetDotNetPublishFlags(parser);
var command =
$"dotnet publish -r {platformInfo.NetCorePublishRid} -c \"{configuration}\" --output \"{tempBinPath}\" {string.Join(' ', dotNetPublishFlags.Select(kvp => $"{kvp.Key}={kvp.Value}"))} --self-contained";
// output the command
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(command);
Console.ResetColor();
var resultCode = ProcessHelper.CmdExecute(command, Directory.GetCurrentDirectory());
if (resultCode != 0)
{
Console.WriteLine("Error occurred during dotnet publish: " + resultCode);
return false;
}
DeployEmbeddedElectronFiles.Do(tempPath);
var nodeModulesDirPath = Path.Combine(tempPath, "node_modules");
if (parser.Arguments.ContainsKey(_paramPackageJson))
{
Console.WriteLine("Copying custom package.json.");
File.Copy(parser.Arguments[_paramPackageJson][0], Path.Combine(tempPath, "package.json"), true);
}
var checkForNodeModulesDirPath = Path.Combine(tempPath, "node_modules");
if (Directory.Exists(checkForNodeModulesDirPath) == false || parser.Contains(_paramForceNodeInstall) || parser.Contains(_paramPackageJson))
Console.WriteLine("Start npm install...");
ProcessHelper.CmdExecute("npm install --production", tempPath);
Console.WriteLine("ElectronHostHook handling started...");
string electronhosthookDir = Path.Combine(Directory.GetCurrentDirectory(), "ElectronHostHook");
if (Directory.Exists(electronhosthookDir))
{
string hosthookDir = Path.Combine(tempPath, "ElectronHostHook");
DirectoryCopy.Do(electronhosthookDir, hosthookDir, true, new List<string>() { "node_modules" });
Console.WriteLine("Start npm install for hosthooks...");
ProcessHelper.CmdExecute("npm install", hosthookDir);
// ToDo: Not sure if this runs under linux/macos
ProcessHelper.CmdExecute(@"npx tsc -p . --sourceMap false", hosthookDir);
}
Console.WriteLine("Build Electron Desktop Application...");
// Specifying an absolute path supercedes a relative path
string buildPath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "desktop");
if (parser.Arguments.ContainsKey(_paramAbsoluteOutput))
{
buildPath = parser.Arguments[_paramAbsoluteOutput][0];
}
else if (parser.Arguments.ContainsKey(_paramOutputDirectory))
{
buildPath = Path.Combine(Directory.GetCurrentDirectory(), parser.Arguments[_paramOutputDirectory][0]);
}
Console.WriteLine("Executing electron magic in this directory: " + buildPath);
string electronArch = "x64";
if (parser.Arguments.ContainsKey(_paramElectronArch))
{
electronArch = parser.Arguments[_paramElectronArch][0];
}
string electronParams = "";
if (parser.Arguments.ContainsKey(_paramElectronParams))
{
electronParams = parser.Arguments[_paramElectronParams][0];
}
// ToDo: Make the same thing easer with native c# - we can save a tmp file in production code :)
Console.WriteLine("Create electron-builder configuration file...");
string manifestFileName = "electron.manifest.json";
if (parser.Arguments.ContainsKey(_manifest))
{
manifestFileName = parser.Arguments[_manifest].First();
}
ProcessHelper.CmdExecute(
string.IsNullOrWhiteSpace(version)
? $"node build-helper.js {manifestFileName}"
: $"node build-helper.js {manifestFileName} {version}", tempPath);
Console.WriteLine($"Package Electron App for Platform {platformInfo.ElectronPackerPlatform}...");
ProcessHelper.CmdExecute($"npx electron-builder --config=./bin/electron-builder.json --{platformInfo.ElectronPackerPlatform} --{electronArch} -c.electronVersion=23.2.0 {electronParams}", tempPath);
Console.WriteLine("... done");
return true;
});
}
private Dictionary<string, string> GetDotNetPublishFlags(SimpleCommandLineParser parser)
{
var dotNetPublishFlags = new Dictionary<string, string>
{
{"/p:PublishReadyToRun", parser.TryGet(_paramPublishReadyToRun, out var rtr) ? rtr[0] : "true"},
{"/p:PublishSingleFile", parser.TryGet(_paramPublishSingleFile, out var psf) ? psf[0] : "true"},
};
if (parser.Arguments.ContainsKey(_paramVersion))
{
if(parser.Arguments.Keys.All(key => !key.StartsWith("p:Version=") && !key.StartsWith("property:Version=")))
dotNetPublishFlags.Add("/p:Version", parser.Arguments[_paramVersion][0]);
if(parser.Arguments.Keys.All(key => !key.StartsWith("p:ProductVersion=") && !key.StartsWith("property:ProductVersion=")))
dotNetPublishFlags.Add("/p:ProductVersion", parser.Arguments[_paramVersion][0]);
}
foreach (var parm in parser.Arguments.Keys.Where(key => key.StartsWith("p:") || key.StartsWith("property:")))
{
var split = parm.IndexOf('=');
if (split < 0)
{
continue;
}
var key = $"/{parm.Substring(0, split)}";
// normalize the key
if (key.StartsWith("/property:"))
{
key = key.Replace("/property:", "/p:");
}
var value = parm.Substring(split + 1);
if (dotNetPublishFlags.ContainsKey(key))
{
dotNetPublishFlags[key] = value;
}
else
{
dotNetPublishFlags.Add(key, value);
}
}
return dotNetPublishFlags;
}
}
}

View File

@@ -1,53 +0,0 @@
namespace ElectronNET.CLI.Commands
{
/// <summary>
/// The definitionn of an option for a command.
/// </summary>
public class CommandOption
{
/// <summary>
/// An enum for the possible values for an option
/// </summary>
public enum CommandOptionValueType { NoValue, StringValue, BoolValue, IntValue, CommaDelimitedList, KeyValuePairs }
/// <summary>
/// The name of the option.
/// </summary>
public string Name { get; set; }
/// <summary>
/// The short form of the command line switch. This will start with just one dash e.g. -f for framework
/// </summary>
public string ShortSwitch { get; set; }
/// <summary>
/// The full form of the command line switch. This will start with two dashes e.g. --framework
/// </summary>
public string Switch { get; set; }
/// <summary>
/// The description of the option
/// </summary>
public string Description { get; set; }
/// <summary>
/// The type of value that is expected with this command option
/// </summary>
public CommandOptionValueType ValueType { get; set; }
/// <summary>
/// The JSON key used in configuration file.`
/// </summary>
public string ConfigFileKey
{
get
{
var key = this.Switch;
if (key.StartsWith("--"))
key = key.Substring(2);
return key;
}
}
}
}

View File

@@ -1,12 +0,0 @@
using System.Threading.Tasks;
namespace ElectronNET.CLI.Commands
{
/// <summary>
/// Interface for commands to implement.
/// </summary>
public interface ICommand
{
Task<bool> ExecuteAsync();
}
}

View File

@@ -1,214 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
namespace ElectronNET.CLI.Commands
{
public class InitCommand : ICommand
{
public const string COMMAND_NAME = "init";
public const string COMMAND_DESCRIPTION = "Creates the needed Electron.NET config for your Electron Application.";
public const string COMMAND_ARGUMENTS = "<Path> from ASP.NET Core Project.";
public static IList<CommandOption> CommandOptions { get; set; } = new List<CommandOption>();
private static SimpleCommandLineParser _parser = new SimpleCommandLineParser();
private static string ConfigName = "electron.manifest.json";
private const string DefaultConfigFileName = "electron.manifest.json";
public InitCommand(string[] args)
{
_parser.Parse(args);
}
private static string _aspCoreProjectPath = "project-path";
private static string _manifest = "manifest";
public Task<bool> ExecuteAsync()
{
return Task.Run(() =>
{
string aspCoreProjectPath = "";
if (_parser.Arguments.ContainsKey(_aspCoreProjectPath))
{
string projectPath = _parser.Arguments[_aspCoreProjectPath].First();
if (Directory.Exists(projectPath))
{
aspCoreProjectPath = projectPath;
}
}
else
{
aspCoreProjectPath = Directory.GetCurrentDirectory();
}
var currentDirectory = aspCoreProjectPath;
if(_parser.Arguments.ContainsKey(_manifest))
{
ConfigName = "electron.manifest." + _parser.Arguments[_manifest].First() + ".json";
Console.WriteLine($"Adding your custom {ConfigName} config file to your project...");
}
else
{
Console.WriteLine("Adding our config file to your project...");
}
var targetFilePath = Path.Combine(currentDirectory, ConfigName);
if (File.Exists(targetFilePath))
{
Console.WriteLine("Config file already in your project.");
return false;
}
// Deploy config file
EmbeddedFileHelper.DeployEmbeddedFileToTargetFile(currentDirectory, DefaultConfigFileName, ConfigName);
// search .csproj/.fsproj (.csproj has higher precedence)
Console.WriteLine($"Search your .csproj/fsproj to add the needed {ConfigName}...");
var projectFile = Directory.EnumerateFiles(currentDirectory, "*.csproj", SearchOption.TopDirectoryOnly)
.Union(Directory.EnumerateFiles(currentDirectory, "*.fsproj", SearchOption.TopDirectoryOnly))
.FirstOrDefault();
// update config file with the name of the csproj/fsproj
// ToDo: If the csproj/fsproj name != application name, this will fail
string text = File.ReadAllText(targetFilePath);
text = text.Replace("{{executable}}", Path.GetFileNameWithoutExtension(projectFile));
File.WriteAllText(targetFilePath, text);
var extension = Path.GetExtension(projectFile);
Console.WriteLine($"Found your {extension}: {projectFile} - check for existing config or update it.");
if (!EditProjectFile(projectFile)) return false;
// search launchSettings.json
Console.WriteLine($"Search your .launchSettings to add our electron debug profile...");
EditLaunchSettings(currentDirectory);
Console.WriteLine($"Everything done - happy electronizing!");
return true;
});
}
private static void EditLaunchSettings(string currentDirectory)
{
// super stupid implementation, but because there is no nativ way to parse json
// and cli extensions and other nuget packages are buggy
// this is should solve the problem for 80% of the users
// for the other 20% we might fail...
var launchSettingFile = Path.Combine(currentDirectory, "Properties", "launchSettings.json");
if (File.Exists(launchSettingFile) == false)
{
Console.WriteLine("launchSettings.json not found - do nothing.");
return;
}
string launchSettingText = File.ReadAllText(launchSettingFile);
if(_parser.Arguments.ContainsKey(_manifest))
{
string manifestName = _parser.Arguments[_manifest].First();
if(launchSettingText.Contains("start /manifest " + ConfigName) == false)
{
StringBuilder debugProfileBuilder = new StringBuilder();
debugProfileBuilder.AppendLine("profiles\": {");
debugProfileBuilder.AppendLine(" \"Electron.NET App - " + manifestName + "\": {");
debugProfileBuilder.AppendLine(" \"commandName\": \"Executable\",");
debugProfileBuilder.AppendLine(" \"executablePath\": \"electronize\",");
debugProfileBuilder.AppendLine(" \"commandLineArgs\": \"start /manifest " + ConfigName + "\",");
debugProfileBuilder.AppendLine(" \"workingDirectory\": \".\"");
debugProfileBuilder.AppendLine(" },");
launchSettingText = launchSettingText.Replace("profiles\": {", debugProfileBuilder.ToString());
File.WriteAllText(launchSettingFile, launchSettingText);
Console.WriteLine($"Debug profile added!");
}
else
{
Console.WriteLine($"Debug profile already existing");
}
}
else 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\": \"electronize\",");
debugProfileBuilder.AppendLine(" \"commandLineArgs\": \"start\",");
debugProfileBuilder.AppendLine(" \"workingDirectory\": \".\"");
debugProfileBuilder.AppendLine(" },");
launchSettingText = launchSettingText.Replace("profiles\": {", debugProfileBuilder.ToString());
File.WriteAllText(launchSettingFile, launchSettingText);
Console.WriteLine($"Debug profile added!");
}
else
{
Console.WriteLine($"Debug profile already existing");
}
}
private static bool EditProjectFile(string projectFile)
{
using (var stream = File.Open(projectFile, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
var xmlDocument = XDocument.Load(stream);
var projectElement = xmlDocument.Descendants("Project").FirstOrDefault();
if (projectElement == null || projectElement.Attribute("Sdk")?.Value != "Microsoft.NET.Sdk.Web")
{
Console.WriteLine(
$"Project file is not a compatible type of 'Microsoft.NET.Sdk.Web'. Your project: {projectElement?.Attribute("Sdk")?.Value}");
return false;
}
if (xmlDocument.ToString().Contains($"Content Update=\"{ConfigName}\""))
{
Console.WriteLine($"{ConfigName} already in csproj/fsproj.");
return false;
}
Console.WriteLine($"{ConfigName} will be added to csproj/fsproj.");
string itemGroupXmlString = "<ItemGroup>" +
"<Content Update=\"" + ConfigName + "\">" +
"<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>" +
"</Content>" +
"</ItemGroup>";
var newItemGroupForConfig = XElement.Parse(itemGroupXmlString);
xmlDocument.Root.Add(newItemGroupForConfig);
stream.SetLength(0);
stream.Position = 0;
var xws = new XmlWriterSettings
{
OmitXmlDeclaration = true,
Indent = true
};
using (XmlWriter xw = XmlWriter.Create(stream, xws))
{
xmlDocument.Save(xw);
}
}
Console.WriteLine($"{ConfigName} added in csproj/fsproj!");
return true;
}
}
}

View File

@@ -1,185 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using ElectronNET.CLI.Commands.Actions;
namespace ElectronNET.CLI.Commands
{
public class StartElectronCommand : ICommand
{
public const string COMMAND_NAME = "start";
public const string COMMAND_DESCRIPTION = "Start your ASP.NET Core Application with Electron, without package it as a single exe. Faster for development.";
public const string COMMAND_ARGUMENTS = "<Path> from ASP.NET Core Project.";
public static IList<CommandOption> CommandOptions { get; set; } = new List<CommandOption>();
private string[] _args;
public StartElectronCommand(string[] args)
{
_args = args;
}
private string _aspCoreProjectPath = "project-path";
private string _arguments = "args";
private string _manifest = "manifest";
private string _clearCache = "clear-cache";
private string _paramPublishReadyToRun = "PublishReadyToRun";
private string _paramPublishSingleFile = "PublishSingleFile";
private string _paramDotNetConfig = "dotnet-configuration";
private string _paramTarget = "target";
public Task<bool> ExecuteAsync()
{
return Task.Run(() =>
{
Console.WriteLine("Start Electron Desktop Application...");
SimpleCommandLineParser parser = new SimpleCommandLineParser();
parser.Parse(_args);
string aspCoreProjectPath = "";
if (parser.Arguments.ContainsKey(_aspCoreProjectPath))
{
string projectPath = parser.Arguments[_aspCoreProjectPath].First();
if (Directory.Exists(projectPath))
{
aspCoreProjectPath = projectPath;
}
}
else
{
aspCoreProjectPath = Directory.GetCurrentDirectory();
}
string tempPath = Path.Combine(aspCoreProjectPath, "obj", "Host");
if (Directory.Exists(tempPath) == false)
{
Directory.CreateDirectory(tempPath);
}
string tempBinPath = Path.Combine(tempPath, "bin");
var resultCode = 0;
string publishReadyToRun = "/p:PublishReadyToRun=";
if (parser.Arguments.ContainsKey(_paramPublishReadyToRun))
{
publishReadyToRun += parser.Arguments[_paramPublishReadyToRun][0];
}
else
{
publishReadyToRun += "true";
}
string publishSingleFile = "/p:PublishSingleFile=";
if (parser.Arguments.ContainsKey(_paramPublishSingleFile))
{
publishSingleFile += parser.Arguments[_paramPublishSingleFile][0];
}
else
{
publishSingleFile += "true";
}
// If target is specified as a command line argument, use it.
// Format is the same as the build command.
// If target is not specified, autodetect it.
var platformInfo = GetTargetPlatformInformation.Do(string.Empty, string.Empty);
if (parser.Arguments.ContainsKey(_paramTarget))
{
var desiredPlatform = parser.Arguments[_paramTarget][0];
string specifiedFromCustom = string.Empty;
if (desiredPlatform == "custom" && parser.Arguments[_paramTarget].Length > 1)
{
specifiedFromCustom = parser.Arguments[_paramTarget][1];
}
platformInfo = GetTargetPlatformInformation.Do(desiredPlatform, specifiedFromCustom);
}
string configuration = "Debug";
if (parser.Arguments.ContainsKey(_paramDotNetConfig))
{
configuration = parser.Arguments[_paramDotNetConfig][0];
}
if (parser != null && !parser.Arguments.ContainsKey("watch"))
{
resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} -c \"{configuration}\" --output \"{tempBinPath}\" {publishReadyToRun} {publishSingleFile} --no-self-contained", aspCoreProjectPath);
}
if (resultCode != 0)
{
Console.WriteLine("Error occurred during dotnet publish: " + resultCode);
return false;
}
DeployEmbeddedElectronFiles.Do(tempPath);
var nodeModulesDirPath = Path.Combine(tempPath, "node_modules");
Console.WriteLine("node_modules missing in: " + nodeModulesDirPath);
Console.WriteLine("Start npm install...");
ProcessHelper.CmdExecute("npm install", tempPath);
Console.WriteLine("ElectronHostHook handling started...");
string electronhosthookDir = Path.Combine(Directory.GetCurrentDirectory(), "ElectronHostHook");
if (Directory.Exists(electronhosthookDir))
{
string hosthookDir = Path.Combine(tempPath, "ElectronHostHook");
DirectoryCopy.Do(electronhosthookDir, hosthookDir, true, new List<string>() { "node_modules" });
Console.WriteLine("Start npm install for typescript & hosthooks...");
ProcessHelper.CmdExecute("npm install", hosthookDir);
// ToDo: Not sure if this runs under linux/macos
ProcessHelper.CmdExecute(@"npx tsc -p ../../ElectronHostHook", tempPath);
}
string arguments = "";
if (parser.Arguments.ContainsKey(_arguments))
{
arguments = string.Join(' ', parser.Arguments[_arguments]);
}
if (parser.Arguments.ContainsKey(_manifest))
{
arguments += " --manifest=" + parser.Arguments[_manifest].First();
}
if (parser.Arguments.ContainsKey(_clearCache))
{
arguments += " --clear-cache=true";
}
if (parser.Arguments.ContainsKey("watch"))
{
arguments += " --watch=true";
}
string path = Path.Combine(tempPath, "node_modules", ".bin");
bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
if (isWindows)
{
Console.WriteLine("Invoke electron.cmd - in dir: " + path);
ProcessHelper.CmdExecute(@"electron.cmd ""..\..\main.js"" " + arguments, path);
}
else
{
Console.WriteLine("Invoke electron - in dir: " + path);
ProcessHelper.CmdExecute(@"./electron ""../../main.js"" " + arguments, path);
}
return true;
});
}
}
}

View File

@@ -1,35 +0,0 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
namespace ElectronNET.CLI.Commands
{
public class VersionCommand : ICommand
{
public const string COMMAND_NAME = "version";
public const string COMMAND_DESCRIPTION = "Displays the ElectronNET.CLI version";
public const string COMMAND_ARGUMENTS = "";
public static IList<CommandOption> CommandOptions { get; set; } = new List<CommandOption>();
public VersionCommand(string[] args)
{
}
public Task<bool> ExecuteAsync()
{
return Task.Run(() =>
{
var runtimeVersion = typeof(VersionCommand)
.GetTypeInfo()
.Assembly
.GetCustomAttribute<AssemblyFileVersionAttribute>();
Console.WriteLine($"ElectronNET.CLI Version: " + runtimeVersion.Version);
return true;
});
}
}
}

View File

@@ -1,89 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>dotnet-electronize</AssemblyName>
<ToolCommandName>electronize</ToolCommandName>
<PackageType>DotnetCliTool</PackageType>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>..\artifacts</PackageOutputPath>
<PackageId>ElectronNET.CLI</PackageId>
<!-- Version 99 is just set for local development stuff to avoid a conflict with "real" packages on NuGet.org -->
<Version>99.0.0.0</Version>
<Authors>Gregor Biswanger, Florian Rappl</Authors>
<Product>Electron.NET</Product>
<Company />
<Description>
Building cross platform electron based desktop apps with .NET Core and ASP.NET Core.
This package contains the dotnet tooling to electronize your application.
</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/ElectronNET/Electron.NET/</PackageProjectUrl>
<RepositoryUrl>https://github.com/ElectronNET/Electron.NET/</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageTags>electron aspnetcore</PackageTags>
<PackageReleaseNotes>Changelog: https://github.com/ElectronNET/Electron.NET/blob/master/Changelog.md</PackageReleaseNotes>
<PackageIcon>PackageIcon.png</PackageIcon>
<PackAsTool>true</PackAsTool>
<StartupObject>
</StartupObject>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<None Remove="ElectronHost\package-lock.json" />
<None Remove="ElectronHost\package.json" />
</ItemGroup>
<ItemGroup>
<None Include="PackageIcon.png" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\ElectronNET.Host\electron.manifest.json" Link="ElectronHost\electron.manifest.json" />
<EmbeddedResource Include="..\ElectronNET.Host\package.json" Link="ElectronHost\package.json" />
<EmbeddedResource Include="..\ElectronNET.Host\main.js" Link="ElectronHost\main.js" />
<EmbeddedResource Include="..\ElectronNET.Host\build-helper.js" Link="ElectronHost\build-helper.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\ipc.js" Link="ElectronHost\api\ipc.js" />
<EmbeddedResource Include="..\ElectronNET.Host\ElectronHostHook\index.ts" Link="ElectronHost\ElectronHostHook\index.ts" />
<EmbeddedResource Include="..\ElectronNET.Host\ElectronHostHook\connector.ts" Link="ElectronHost\ElectronHostHook\connector.ts" />
<EmbeddedResource Include="..\ElectronNET.Host\ElectronHostHook\tsconfig.json" Link="ElectronHost\ElectronHostHook\tsconfig.json" />
<EmbeddedResource Include="..\ElectronNET.Host\ElectronHostHook\package.json" Link="ElectronHost\ElectronHostHook\package.json" />
<EmbeddedResource Include="..\ElectronNET.Host\ElectronHostHook\.gitignore" Link="ElectronHost\ElectronHostHook\.gitignore" />
<EmbeddedResource Include="..\ElectronNET.Host\splashscreen\index.html" Link="ElectronHost\splashscreen\index.html" />
<EmbeddedResource Include="..\ElectronNET.Host\api\app.js" Link="ElectronHost\api\app.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\browserWindows.js" Link="ElectronHost\api\browserWindows.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\commandLine.js" Link="ElectronHost\api\commandLine.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\dialog.js" Link="ElectronHost\api\dialog.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\dock.js" Link="ElectronHost\api\dock.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\menu.js" Link="ElectronHost\api\menu.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\notification.js" Link="ElectronHost\api\notification.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\tray.js" Link="ElectronHost\api\tray.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\globalShortcut.js" Link="ElectronHost\api\globalShortcut.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\screen.js" Link="ElectronHost\api\screen.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\shell.js" Link="ElectronHost\api\shell.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\webContents.js" Link="ElectronHost\api\webContents.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\clipboard.js" Link="ElectronHost\api\clipboard.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\autoUpdater.js" Link="ElectronHost\api\autoUpdater.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\browserView.js" Link="ElectronHost\api\browserView.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\powerMonitor.js" Link="ElectronHost\api\powerMonitor.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\nativeTheme.js" Link="ElectronHost\api\nativeTheme.js" />
<EmbeddedResource Include="..\ElectronNET.Host\.vscode\launch.json" Link="ElectronHost\.vscode\launch.json" />
<EmbeddedResource Include="..\ElectronNET.Host\.vscode\tasks.json" Link="ElectronHost\.vscode\tasks.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.410601">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(OS)' == 'Windows_NT'">
<Exec Command="$(ProjectDir)devCleanup.cmd" IgnoreExitCode="true" />
</Target>
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(OS)' != 'Windows_NT'">
<Exec Command="$(ProjectDir)devCleanup.sh" IgnoreExitCode="true" />
</Target>
</Project>

View File

@@ -1,47 +0,0 @@
using System;
using System.IO;
using System.Reflection;
namespace ElectronNET.CLI
{
public static class EmbeddedFileHelper
{
private const string ResourcePath = "ElectronNET.CLI.{0}";
private static Stream GetTestResourceFileStream(string folderAndFileInProjectPath)
{
var asm = Assembly.GetExecutingAssembly();
var resource = string.Format(ResourcePath, folderAndFileInProjectPath);
return asm.GetManifestResourceStream(resource);
}
public static void DeployEmbeddedFile(string targetPath, string file, string namespacePath = "")
{
using (var fileStream = File.Create(Path.Combine(targetPath, file)))
{
var streamFromEmbeddedFile = GetTestResourceFileStream("ElectronHost." + namespacePath + file);
if (streamFromEmbeddedFile == null)
{
Console.WriteLine("Error: Couldn't find embedded file: " + file);
}
streamFromEmbeddedFile.CopyTo(fileStream);
}
}
public static void DeployEmbeddedFileToTargetFile(string targetPath, string embeddedFile, string targetFile, string namespacePath = "")
{
using (var fileStream = File.Create(Path.Combine(targetPath, targetFile)))
{
var streamFromEmbeddedFile = GetTestResourceFileStream("ElectronHost." + namespacePath + embeddedFile);
if (streamFromEmbeddedFile == null)
{
Console.WriteLine("Error: Couldn't find embedded file: " + embeddedFile);
}
streamFromEmbeddedFile.CopyTo(fileStream);
}
}
}
}

View File

@@ -1,53 +0,0 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace ElectronNET.CLI
{
public class ProcessHelper
{
public static int CmdExecute(string command, string workingDirectoryPath, bool output = true, bool waitForExit = true)
{
using (Process cmd = new Process())
{
bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
if (isWindows)
{
cmd.StartInfo = new ProcessStartInfo("cmd.exe", "/c " + command);
}
else
{
// works for OSX and Linux (at least on Ubuntu)
var escapedArgs = command.Replace("\"", "\\\"");
cmd.StartInfo = new ProcessStartInfo("bash", $"-c \"{escapedArgs}\"");
}
cmd.StartInfo.RedirectStandardInput = true;
cmd.StartInfo.RedirectStandardOutput = true;
cmd.StartInfo.RedirectStandardError = true;
cmd.StartInfo.CreateNoWindow = true;
cmd.StartInfo.UseShellExecute = false;
cmd.StartInfo.WorkingDirectory = workingDirectoryPath;
if (output)
{
cmd.OutputDataReceived += (s, e) => Console.WriteLine(e.Data);
cmd.ErrorDataReceived += (s, e) => Console.WriteLine(e.Data);
}
Console.WriteLine(command);
cmd.Start();
cmd.BeginOutputReadLine();
cmd.BeginErrorReadLine();
if (waitForExit)
{
cmd.WaitForExit();
}
return cmd.ExitCode;
}
}
}
}

View File

@@ -1,201 +0,0 @@
using ElectronNET.CLI.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace ElectronNET.CLI
{
class Program
{
static void Main(string[] args)
{
if (args.Length == 0)
{
PrintUsageHeader();
PrintUsage();
Environment.Exit(-1);
}
ICommand command = null;
switch (args[0])
{
case StartElectronCommand.COMMAND_NAME:
command = new StartElectronCommand(args.Skip(1).ToArray());
break;
case BuildCommand.COMMAND_NAME:
command = new BuildCommand(args.Skip(1).ToArray());
break;
case InitCommand.COMMAND_NAME:
command = new InitCommand(args.Skip(1).ToArray());
break;
case AddCommand.COMMAND_NAME:
command = new AddCommand(args.Skip(1).ToArray());
break;
case VersionCommand.COMMAND_NAME:
command = new VersionCommand(args.Skip(1).ToArray());
break;
case "--help":
case "--h":
case "help":
PrintUsageHeader();
if (args.Length > 1)
PrintUsage(args[1]);
else
PrintUsage();
break;
default:
Console.Error.WriteLine($"Unknown command {args[0]}");
PrintUsage();
Environment.Exit(-1);
break;
}
if (command != null)
{
var success = command.ExecuteAsync().Result;
if (!success)
{
Environment.Exit(-1);
}
}
}
private static void PrintUsageHeader()
{
var sb = new StringBuilder("Electron.NET Tools");
var version = Version;
if (!string.IsNullOrEmpty(version))
{
sb.Append($" ({version})");
}
Console.WriteLine(sb.ToString());
Console.WriteLine("Project Home: https://github.com/ElectronNET/Electron.NET");
Console.WriteLine("\t");
}
private static void PrintUsage()
{
const int NAME_WIDTH = 23;
Console.WriteLine("\t");
Console.WriteLine("Commands to start the Electron Application:");
Console.WriteLine("\t");
Console.WriteLine($"\t{StartElectronCommand.COMMAND_NAME.PadRight(NAME_WIDTH)} {StartElectronCommand.COMMAND_DESCRIPTION}");
Console.WriteLine("\t");
Console.WriteLine("Command to build the Electron Application:");
Console.WriteLine("\t");
Console.WriteLine($"\t{BuildCommand.COMMAND_NAME.PadRight(NAME_WIDTH)} {BuildCommand.COMMAND_DESCRIPTION}");
Console.WriteLine("\t");
Console.WriteLine("Command to init the Electron Application:");
Console.WriteLine("\t");
Console.WriteLine($"\t{InitCommand.COMMAND_NAME.PadRight(NAME_WIDTH)} {InitCommand.COMMAND_DESCRIPTION}");
Console.WriteLine("\t");
Console.WriteLine("Command to add a custom npm packages to the Electron Application:");
Console.WriteLine("\t");
Console.WriteLine($"\t{AddCommand.COMMAND_NAME.PadRight(NAME_WIDTH)} {AddCommand.COMMAND_DESCRIPTION}");
Console.WriteLine("\t");
Console.WriteLine("Commands to see the current ElectronNET version number:");
Console.WriteLine("\t");
Console.WriteLine($"\t{VersionCommand.COMMAND_NAME.PadRight(NAME_WIDTH)} {VersionCommand.COMMAND_DESCRIPTION}");
Console.WriteLine("\t");
Console.WriteLine("\t");
Console.WriteLine("To get help on individual commands execute:");
Console.WriteLine("\tdotnet electronize help <command>");
}
private static void PrintUsage(string command)
{
switch (command)
{
case StartElectronCommand.COMMAND_NAME:
PrintUsage(StartElectronCommand.COMMAND_NAME, StartElectronCommand.COMMAND_DESCRIPTION, StartElectronCommand.CommandOptions, StartElectronCommand.COMMAND_ARGUMENTS);
break;
case BuildCommand.COMMAND_NAME:
PrintUsage(BuildCommand.COMMAND_NAME, BuildCommand.COMMAND_DESCRIPTION, BuildCommand.CommandOptions, BuildCommand.COMMAND_ARGUMENTS);
break;
case InitCommand.COMMAND_NAME:
PrintUsage(InitCommand.COMMAND_NAME, InitCommand.COMMAND_DESCRIPTION, InitCommand.CommandOptions, InitCommand.COMMAND_ARGUMENTS);
break;
case AddCommand.COMMAND_NAME:
PrintUsage(AddCommand.COMMAND_NAME, AddCommand.COMMAND_DESCRIPTION, AddCommand.CommandOptions, AddCommand.COMMAND_ARGUMENTS);
break;
case VersionCommand.COMMAND_NAME:
PrintUsage(VersionCommand.COMMAND_NAME, VersionCommand.COMMAND_DESCRIPTION, VersionCommand.CommandOptions, VersionCommand.COMMAND_ARGUMENTS);
break;
default:
Console.Error.WriteLine($"Unknown command {command}");
PrintUsage();
break;
}
}
private static void PrintUsage(string command, string description, IList<CommandOption> options, string arguments)
{
const int INDENT = 3;
Console.WriteLine($"{command}: ");
Console.WriteLine($"{new string(' ', INDENT)}{description}");
Console.WriteLine("\t");
if (!string.IsNullOrEmpty(arguments))
{
Console.WriteLine($"{new string(' ', INDENT)}dotnet electronize {command} [arguments] [options]");
Console.WriteLine($"{new string(' ', INDENT)}Arguments:");
Console.WriteLine($"{new string(' ', INDENT * 2)}{arguments}");
}
else
{
Console.WriteLine($"{new string(' ', INDENT)}dotnet electronize {command} [options]");
}
const int SWITCH_COLUMN_WIDTH = 40;
Console.WriteLine($"{new string(' ', INDENT)}Options:");
foreach (var option in options)
{
StringBuilder stringBuilder = new StringBuilder();
if (option.ShortSwitch != null)
{
stringBuilder.Append($"{option.ShortSwitch.PadRight(6)} | ");
}
stringBuilder.Append($"{option.Switch}");
if (stringBuilder.Length < SWITCH_COLUMN_WIDTH)
{
stringBuilder.Append(new string(' ', SWITCH_COLUMN_WIDTH - stringBuilder.Length));
}
stringBuilder.Append(option.Description);
Console.WriteLine($"{new string(' ', INDENT * 2)}{stringBuilder.ToString()}");
}
}
private static string Version
{
get
{
AssemblyInformationalVersionAttribute attribute = null;
try
{
attribute = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>();
}
catch (AmbiguousMatchException)
{
// Catch exception and continue if multiple attributes are found.
}
return attribute?.InformationalVersion;
}
}
}
}

View File

@@ -1,8 +0,0 @@
{
"profiles": {
"ElectronNET.CLI": {
"commandName": "Project",
"commandLineArgs": "start /project-path \"$(SolutionDir)ElectronNET.WebApp\" /watch"
}
}
}

View File

@@ -1,54 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace ElectronNET.CLI
{
public class SimpleCommandLineParser
{
public SimpleCommandLineParser()
{
Arguments = new Dictionary<string, string[]>();
}
public IDictionary<string, string[]> Arguments { get; private set; }
public void Parse(string[] args)
{
var currentName = "";
var values = new List<string>();
foreach (var arg in args)
{
if (arg.StartsWith("/"))
{
if (currentName != "")
Arguments[currentName] = values.ToArray();
values.Clear();
currentName = arg.Substring(1);
}
else if (currentName == "")
Arguments[arg] = new string[0];
else
values.Add(arg);
}
if (currentName != "")
Arguments[currentName] = values.ToArray();
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine($"Arguments: \n\t{string.Join("\n\t",Arguments.Keys.Select(i => $"{i} = {string.Join(" ", Arguments[i])}"))}");
Console.ResetColor();
}
public bool Contains(string name)
{
return Arguments.ContainsKey(name);
}
internal bool TryGet(string key, out string[] value)
{
value = null;
if (!Contains(key)) {
return false;
}
value = Arguments[key];
return true;
}
}
}

View File

@@ -1,3 +0,0 @@
rd /s /q %userprofile%\.nuget\packages\.tools\electronnet.cli
rd /s /q %userprofile%\.nuget\packages\electronnet.cli
del ..\artifacts\ElectronNET.CLI.1.0.0.nupkg

View File

@@ -1 +0,0 @@
rm -rf ~/.nuget/packages/electronnet.cli

View File

@@ -1 +0,0 @@
{"version":3,"file":"connector.js","sourceRoot":"","sources":["connector.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAS;IAClB,YAAoB,MAAuB;IACvC,aAAa;IACN,GAAiB;QAFR,WAAM,GAAN,MAAM,CAAiB;QAEhC,QAAG,GAAH,GAAG,CAAc;IAAI,CAAC;IAEjC,EAAE,CAAC,GAAW,EAAE,cAAwB;QACpC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE;YACnC,MAAM,EAAE,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;YAE9B,IAAI;gBACA,cAAc,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;oBAC7B,IAAI,IAAI,EAAE;wBACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,WAAW,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;qBACjD;gBACL,CAAC,CAAC,CAAC;aACN;YAAC,OAAO,KAAK,EAAE;gBACZ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,EAAE,EAAE,EAAE,qBAAqB,EAAE,KAAK,CAAC,CAAC;aACtE;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AApBD,8BAoBC"}

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAEA,2CAAwC;AAExC,MAAa,WAAY,SAAQ,qBAAS;IACtC,YAAY,MAAuB,EAAS,GAAiB;QACzD,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QADqB,QAAG,GAAH,GAAG,CAAc;IAE7D,CAAC;IAED,WAAW;QACP,8CAA8C;IAClD,CAAC;CACJ;AARD,kCAQC"}

View File

@@ -1,441 +0,0 @@
{
"name": "electron-host-hook",
"version": "1.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "electron-host-hook",
"version": "1.0.0",
"license": "MIT",
"devDependencies": {
"socket.io": "^4.6.1",
"typescript": "^5.0.2"
}
},
"node_modules/@socket.io/component-emitter": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz",
"integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==",
"dev": true
},
"node_modules/@types/cookie": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
"integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==",
"dev": true
},
"node_modules/@types/cors": {
"version": "2.8.13",
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.13.tgz",
"integrity": "sha512-RG8AStHlUiV5ysZQKq97copd2UmVYw3/pRMLefISZ3S1hK104Cwm7iLQ3fTKx+lsUH2CE8FlLaYeEA2LSeqYUA==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/node": {
"version": "18.15.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.5.tgz",
"integrity": "sha512-Ark2WDjjZO7GmvsyFFf81MXuGTA/d6oP38anyxWOL6EREyBKAxKoFHwBhaZxCfLRLpO8JgVXwqOwSwa7jRcjew==",
"dev": true
},
"node_modules/accepts": {
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
"dev": true,
"dependencies": {
"mime-types": "~2.1.34",
"negotiator": "0.6.3"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/base64id": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
"integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==",
"dev": true,
"engines": {
"node": "^4.5.0 || >= 5.9"
}
},
"node_modules/cookie": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz",
"integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==",
"dev": true,
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cors": {
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
"dev": true,
"dependencies": {
"object-assign": "^4",
"vary": "^1"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"dev": true,
"dependencies": {
"ms": "2.1.2"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/engine.io": {
"version": "6.4.1",
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.4.1.tgz",
"integrity": "sha512-JFYQurD/nbsA5BSPmbaOSLa3tSVj8L6o4srSwXXY3NqE+gGUNmmPTbhn8tjzcCtSqhFgIeqef81ngny8JM25hw==",
"dev": true,
"dependencies": {
"@types/cookie": "^0.4.1",
"@types/cors": "^2.8.12",
"@types/node": ">=10.0.0",
"accepts": "~1.3.4",
"base64id": "2.0.0",
"cookie": "~0.4.1",
"cors": "~2.8.5",
"debug": "~4.3.1",
"engine.io-parser": "~5.0.3",
"ws": "~8.11.0"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/engine.io-parser": {
"version": "5.0.6",
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.6.tgz",
"integrity": "sha512-tjuoZDMAdEhVnSFleYPCtdL2GXwVTGtNjoeJd9IhIG3C1xs9uwxqRNEu5WpnDZCaozwVlK/nuQhpodhXSIMaxw==",
"dev": true,
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"dev": true,
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dev": true,
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
},
"node_modules/negotiator": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
"dev": true,
"engines": {
"node": ">= 0.6"
}
},
"node_modules/object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/socket.io": {
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.6.1.tgz",
"integrity": "sha512-KMcaAi4l/8+xEjkRICl6ak8ySoxsYG+gG6/XfRCPJPQ/haCRIJBTL4wIl8YCsmtaBovcAXGLOShyVWQ/FG8GZA==",
"dev": true,
"dependencies": {
"accepts": "~1.3.4",
"base64id": "~2.0.0",
"debug": "~4.3.2",
"engine.io": "~6.4.1",
"socket.io-adapter": "~2.5.2",
"socket.io-parser": "~4.2.1"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/socket.io-adapter": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.2.tgz",
"integrity": "sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA==",
"dev": true,
"dependencies": {
"ws": "~8.11.0"
}
},
"node_modules/socket.io-parser": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.2.tgz",
"integrity": "sha512-DJtziuKypFkMMHCm2uIshOYC7QaylbtzQwiMYDuCKy3OPkjLzu4B2vAhTlqipRHHzrI0NJeBAizTK7X+6m1jVw==",
"dev": true,
"dependencies": {
"@socket.io/component-emitter": "~3.1.0",
"debug": "~4.3.1"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/typescript": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz",
"integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=12.20"
}
},
"node_modules/vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
"dev": true,
"engines": {
"node": ">= 0.8"
}
},
"node_modules/ws": {
"version": "8.11.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz",
"integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==",
"dev": true,
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": "^5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
}
},
"dependencies": {
"@socket.io/component-emitter": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz",
"integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==",
"dev": true
},
"@types/cookie": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
"integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==",
"dev": true
},
"@types/cors": {
"version": "2.8.13",
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.13.tgz",
"integrity": "sha512-RG8AStHlUiV5ysZQKq97copd2UmVYw3/pRMLefISZ3S1hK104Cwm7iLQ3fTKx+lsUH2CE8FlLaYeEA2LSeqYUA==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/node": {
"version": "18.15.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.5.tgz",
"integrity": "sha512-Ark2WDjjZO7GmvsyFFf81MXuGTA/d6oP38anyxWOL6EREyBKAxKoFHwBhaZxCfLRLpO8JgVXwqOwSwa7jRcjew==",
"dev": true
},
"accepts": {
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
"dev": true,
"requires": {
"mime-types": "~2.1.34",
"negotiator": "0.6.3"
}
},
"base64id": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
"integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==",
"dev": true
},
"cookie": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz",
"integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==",
"dev": true
},
"cors": {
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
"dev": true,
"requires": {
"object-assign": "^4",
"vary": "^1"
}
},
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"dev": true,
"requires": {
"ms": "2.1.2"
}
},
"engine.io": {
"version": "6.4.1",
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.4.1.tgz",
"integrity": "sha512-JFYQurD/nbsA5BSPmbaOSLa3tSVj8L6o4srSwXXY3NqE+gGUNmmPTbhn8tjzcCtSqhFgIeqef81ngny8JM25hw==",
"dev": true,
"requires": {
"@types/cookie": "^0.4.1",
"@types/cors": "^2.8.12",
"@types/node": ">=10.0.0",
"accepts": "~1.3.4",
"base64id": "2.0.0",
"cookie": "~0.4.1",
"cors": "~2.8.5",
"debug": "~4.3.1",
"engine.io-parser": "~5.0.3",
"ws": "~8.11.0"
}
},
"engine.io-parser": {
"version": "5.0.6",
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.6.tgz",
"integrity": "sha512-tjuoZDMAdEhVnSFleYPCtdL2GXwVTGtNjoeJd9IhIG3C1xs9uwxqRNEu5WpnDZCaozwVlK/nuQhpodhXSIMaxw==",
"dev": true
},
"mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"dev": true
},
"mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dev": true,
"requires": {
"mime-db": "1.52.0"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
},
"negotiator": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
"dev": true
},
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
"dev": true
},
"socket.io": {
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.6.1.tgz",
"integrity": "sha512-KMcaAi4l/8+xEjkRICl6ak8ySoxsYG+gG6/XfRCPJPQ/haCRIJBTL4wIl8YCsmtaBovcAXGLOShyVWQ/FG8GZA==",
"dev": true,
"requires": {
"accepts": "~1.3.4",
"base64id": "~2.0.0",
"debug": "~4.3.2",
"engine.io": "~6.4.1",
"socket.io-adapter": "~2.5.2",
"socket.io-parser": "~4.2.1"
}
},
"socket.io-adapter": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.2.tgz",
"integrity": "sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA==",
"dev": true,
"requires": {
"ws": "~8.11.0"
}
},
"socket.io-parser": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.2.tgz",
"integrity": "sha512-DJtziuKypFkMMHCm2uIshOYC7QaylbtzQwiMYDuCKy3OPkjLzu4B2vAhTlqipRHHzrI0NJeBAizTK7X+6m1jVw==",
"dev": true,
"requires": {
"@socket.io/component-emitter": "~3.1.0",
"debug": "~4.3.1"
}
},
"typescript": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz",
"integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==",
"dev": true
},
"vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
"dev": true
},
"ws": {
"version": "8.11.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz",
"integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==",
"dev": true,
"requires": {}
}
}
}

View File

@@ -1,11 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"sourceMap": true,
"skipLibCheck": true,
"target": "es2015"
},
"exclude": [
"node_modules"
]
}

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
{"version":3,"file":"browserView.js","sourceRoot":"","sources":["browserView.ts"],"names":[],"mappings":";;;AACA,uCAAuC;AACvC,MAAM,YAAY,GAAkB,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,CAAkB,CAAC;AAC7G,IAAI,WAAwB,EAAE,cAAc,CAAC;AAC7C,MAAM,qBAAqB,GAAgC,CAAC,MAAM,CAAC,uBAAuB,CAAC,GAAG,MAAM,CAAC,uBAAuB,CAAC,IAAI,EAAE,CAAgC,CAAC;AAEpK,MAAM,cAAc,GAAG,CAAC,MAAc,EAAE,EAAE;IACtC,cAAc,GAAG,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,OAAO,EAAE,EAAE;QACvC,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,EAAE;YAChE,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,EAAE,CAAC;SAChG;QAED,WAAW,GAAG,IAAI,sBAAW,CAAC,OAAO,CAAC,CAAC;QACvC,WAAW,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;QAE5C,IAAI,OAAO,CAAC,KAAK,EAAE;YACf,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAC,UAAU,EAAE,OAAO,CAAC,KAAK,EAAC,CAAC,CAAC;SACzE;QAED,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,gBAAgB,EAAE;YAC3C,qBAAqB,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC;SACnE;QAED,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAE/B,cAAc,CAAC,IAAI,CAAC,oBAAoB,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,CAAC,EAAE,EAAE,EAAE;QACtC,MAAM,MAAM,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;QAElD,cAAc,CAAC,IAAI,CAAC,6BAA6B,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE;QAC9C,kBAAkB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE;QACnD,kBAAkB,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gCAAgC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE;QACtD,kBAAkB,CAAC,EAAE,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,UAAU;QACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE;gBAC5C,OAAO,KAAK,CAAC;aAChB;YACD,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;SAC5B;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC,CAAC;AAeO,wCAAc;AAbvB,MAAM,yBAAyB,GAAG,CAAC,aAAqB,EAAe,EAAE;IACrE,OAAO,kBAAkB,CAAC,aAAa,CAAC,CAAC;AAC7C,CAAC,CAAC;AAWuB,8DAAyB;AATlD,SAAS,kBAAkB,CAAC,EAAU;IAClC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACtD,MAAM,eAAe,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QAC5C,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE;YAC9B,OAAO,eAAe,CAAC;SAC1B;KACJ;AACL,CAAC"}

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["dialog.ts"],"names":[],"mappings":";AACA,uCAAiD;AACjD,IAAI,cAAsB,CAAC;AAE3B,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC/D,IAAI,IAAI,IAAI,aAAa,EAAE;YACvB,MAAM,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YAEtD,MAAM,qBAAqB,GAAG,MAAM,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC3E,cAAc,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,EAAE,CAAC,qBAAqB,CAAC,QAAQ,EAAE,qBAAqB,CAAC,eAAe,CAAC,CAAC,CAAC;SACjI;aAAM;YACH,MAAM,EAAE,GAAG,IAAI,IAAI,OAAO,CAAC;YAC3B,MAAM,qBAAqB,GAAG,MAAM,iBAAM,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;YAEzE,cAAc,CAAC,IAAI,CAAC,wBAAwB,GAAG,EAAE,EAAE,CAAC,qBAAqB,CAAC,QAAQ,EAAE,qBAAqB,CAAC,eAAe,CAAC,CAAC,CAAC;SAC/H;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC/D,MAAM,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACtD,MAAM,qBAAqB,GAAG,MAAM,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE3E,cAAc,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,EAAE,qBAAqB,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IAChG,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC/D,MAAM,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACtD,MAAM,qBAAqB,GAAG,MAAM,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE3E,cAAc,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,EAAE,qBAAqB,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;IAC/F,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACzC,iBAAM,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC3E,MAAM,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACtD,MAAM,iBAAM,CAAC,0BAA0B,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAEzD,cAAc,CAAC,IAAI,CAAC,oCAAoC,GAAG,IAAI,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}

View File

@@ -1 +0,0 @@
{"version":3,"file":"menu.js","sourceRoot":"","sources":["menu.ts"],"names":[],"mappings":";AACA,uCAA+C;AAC/C,MAAM,gBAAgB,GAAG,CAAC,MAAM,CAAC,kBAAkB,CAAC,GAAG,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC,CAAC;AACzF,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,eAAe,EAAE,SAAS,EAAE,EAAE;QAC5D,MAAM,IAAI,GAAG,eAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAE/C,gCAAgC,CAAC,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE;YAC3E,cAAc,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,gBAAgB,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,eAAe,KAAK,eAAe,CAAC,CAAC;QAEzG,MAAM,eAAe,GAAG;YACpB,IAAI,EAAE,IAAI;YACV,eAAe,EAAE,eAAe;SACnC,CAAC;QAEF,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACd,gBAAgB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SAC1C;aAAM;YACH,gBAAgB,CAAC,KAAK,CAAC,GAAG,eAAe,CAAC;SAC7C;IACL,CAAC,CAAC,CAAC;IAEH,SAAS,gCAAgC,CAAC,SAAS,EAAE,eAAe,EAAE,QAAQ;QAC1E,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACvB,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC/C,gCAAgC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;aACnF;YAED,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE;gBACzB,IAAI,CAAC,KAAK,GAAG,GAAG,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;aAC9D;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,CAAC,eAAe,EAAE,EAAE;QACnD,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACzB,IAAI,CAAC,CAAC,eAAe,KAAK,eAAe,EAAE;gBACvC,MAAM,aAAa,GAAG,wBAAa,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;gBAC5D,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;aAC/B;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,SAAS,EAAE,EAAE;QAC/C,MAAM,IAAI,GAAG,eAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAE/C,yBAAyB,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE;YACzC,cAAc,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QAEH,eAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,SAAS,yBAAyB,CAAC,SAAS,EAAE,QAAQ;QAClD,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACvB,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC/C,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;aAC3D;YAED,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE;gBACzB,IAAI,CAAC,KAAK,GAAG,GAAG,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aAC7C;QACL,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC"}

View File

@@ -1 +0,0 @@
{"version":3,"file":"notification.js","sourceRoot":"","sources":["notification.ts"],"names":[],"mappings":";AACA,uCAAwC;AACxC,MAAM,aAAa,GAA4B,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,CAA4B,CAAC;AACpI,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,OAAO,EAAE,EAAE;QACxC,MAAM,YAAY,GAAG,IAAI,uBAAY,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,SAAS,GAAG,KAAK,CAAC;QAEtB,IAAI,OAAO,CAAC,MAAM,EAAE;YAChB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;gBACzB,cAAc,CAAC,IAAI,CAAC,uBAAuB,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YACjE,CAAC,CAAC,CAAC;SACN;QAED,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;gBAC1B,cAAc,CAAC,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YACnE,CAAC,CAAC,CAAC;SACN;QAED,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;gBAC1B,cAAc,CAAC,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YACnE,CAAC,CAAC,CAAC;SACN;QAED,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;gBACtC,cAAc,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;YAC5E,CAAC,CAAC,CAAC;SACN;QAED,IAAI,OAAO,CAAC,QAAQ,EAAE;YAClB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;gBACvC,cAAc,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;YAC9E,CAAC,CAAC,CAAC;SACN;QAED,IAAI,SAAS,EAAE;YACX,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SACpC;QAED,YAAY,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACtC,MAAM,WAAW,GAAG,uBAAY,CAAC,WAAW,CAAC;QAC7C,cAAc,CAAC,IAAI,CAAC,iCAAiC,EAAE,WAAW,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}

View File

@@ -1 +0,0 @@
{"version":3,"file":"shell.js","sourceRoot":"","sources":["shell.ts"],"names":[],"mappings":";AACA,uCAAiC;AACjC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,CAAC,QAAQ,EAAE,EAAE;QAC7C,gBAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAEjC,cAAc,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACvC,MAAM,YAAY,GAAG,MAAM,gBAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEhD,cAAc,CAAC,IAAI,CAAC,yBAAyB,EAAE,YAAY,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE;QACnD,IAAI,MAAM,GAAG,EAAE,CAAC;QAEhB,IAAI,OAAO,EAAE;YACT,MAAM,gBAAK,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;gBAC7C,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC;YACvB,CAAC,CAAC,CAAC;SACN;aAAM;YACH,MAAM,gBAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;gBACtC,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC;YACvB,CAAC,CAAC,CAAC;SACN;QAED,cAAc,CAAC,IAAI,CAAC,6BAA6B,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE;QAC1D,IAAI,OAAO,GAAG,KAAK,CAAC;QAEpB,IAAI;YACA,MAAM,gBAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YAChC,OAAO,GAAG,IAAI,CAAC;SAClB;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,GAAG,KAAK,CAAC;SACnB;QAED,cAAc,CAAC,IAAI,CAAC,2BAA2B,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE;QACzB,gBAAK,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;QACtE,MAAM,OAAO,GAAG,gBAAK,CAAC,iBAAiB,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAE1E,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,CAAC,YAAY,EAAE,EAAE;QACjD,MAAM,eAAe,GAAG,gBAAK,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QAE7D,cAAc,CAAC,IAAI,CAAC,iCAAiC,EAAE,eAAe,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}

View File

@@ -1 +0,0 @@
{"version":3,"file":"tray.js","sourceRoot":"","sources":["tray.ts"],"names":[],"mappings":";AACA,uCAAmD;AACnD,IAAI,IAAI,GAA6B,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC3F,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,EAAE,EAAE,EAAE;QACpC,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;gBACrC,cAAc,CAAC,IAAI,CAAC,kBAAkB,GAAG,EAAE,EAAE,CAAO,KAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YACnF,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC1C,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;gBAC3C,cAAc,CAAC,IAAI,CAAC,wBAAwB,GAAG,EAAE,EAAE,CAAO,KAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YACzF,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC3C,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;gBAC5C,cAAc,CAAC,IAAI,CAAC,yBAAyB,GAAG,EAAE,EAAE,CAAO,KAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YAC1F,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC3C,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE;gBAC/B,cAAc,CAAC,IAAI,CAAC,yBAAyB,GAAG,EAAE,CAAC,CAAC;YACxD,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC5C,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,eAAe,EAAE,GAAG,EAAE;gBAChC,cAAc,CAAC,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC,CAAC;YACzD,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC7C,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;gBACjC,cAAc,CAAC,IAAI,CAAC,2BAA2B,GAAG,EAAE,CAAC,CAAC;YAC1D,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;QAC1C,MAAM,QAAQ,GAAG,sBAAW,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAEnD,IAAI,CAAC,KAAK,GAAG,IAAI,eAAI,CAAC,QAAQ,CAAC,CAAC;QAEhC,IAAI,SAAS,EAAE;YACX,MAAM,IAAI,GAAG,eAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;YAE/C,yBAAyB,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE;gBACzC,cAAc,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;YACnD,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;SACnC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE;QAC3B,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;SACxB;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;QACjC,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAC9B;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,sBAAsB,EAAE,CAAC,KAAK,EAAE,EAAE;QACxC,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,MAAM,GAAG,GAAG,sBAAW,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YAC9C,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;SACnC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,OAAO,EAAE,EAAE;QACrC,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;SAClC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;QACjC,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAC9B;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,OAAO,EAAE,EAAE;QACzC,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;SACtC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAC/B,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;YAC7C,cAAc,CAAC,IAAI,CAAC,2BAA2B,EAAE,WAAW,CAAC,CAAC;SACjE;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,EAAE;QAC5D,IAAI,IAAI,CAAC,KAAK,EAAC;YACX,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE;gBACjC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;oBACjB,cAAc,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;iBAC9C;qBAAM;oBACH,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;iBACrC;YACL,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,0BAA0B,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,EAAE;QAC9D,IAAI,IAAI,CAAC,KAAK,EAAC;YACX,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE;gBACnC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;oBACjB,cAAc,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;iBAC9C;qBAAM;oBACH,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;iBACrC;YACL,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IAEH,SAAS,yBAAyB,CAAC,SAAS,EAAE,QAAQ;QAClD,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACvB,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC/C,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;aAC3D;YAED,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE;gBACzB,IAAI,CAAC,KAAK,GAAG,GAAG,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aAC7C;QACL,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC"}

File diff suppressed because one or more lines are too long

View File

@@ -1,53 +0,0 @@
const manifestFileName = process.argv[2];
// @ts-ignore
const manifestFile = require('./bin/' + manifestFileName);
const dasherize = require('dasherize');
const fs = require('fs');
const builderConfiguration = { ...manifestFile.build };
if(process.argv.length > 3) {
builderConfiguration.buildVersion = process.argv[3];
}
if(builderConfiguration.hasOwnProperty('buildVersion')) {
// @ts-ignore
const packageJson = require('./package');
packageJson.name = dasherize(manifestFile.name || 'electron-net');
packageJson.author = manifestFile.author || '';
packageJson.version = builderConfiguration.buildVersion;
packageJson.description = manifestFile.description || '';
fs.writeFile('./package.json', JSON.stringify(packageJson), (error) => {
if(error) {
console.log(error.message);
}
});
try {
// @ts-ignore
const packageLockJson = require('./package-lock');
packageLockJson.name = dasherize(manifestFile.name || 'electron-net');
packageLockJson.author = manifestFile.author || '';
packageLockJson.version = builderConfiguration.buildVersion;
fs.writeFile('./package-lock.json', JSON.stringify(packageLockJson), (error) => {
if(error) {
console.log(error.message);
}
});
} catch (error) {
// ignore missing module
}
}
const builderConfigurationString = JSON.stringify(builderConfiguration);
fs.writeFile('./bin/electron-builder.json', builderConfigurationString, (error) => {
if(error) {
console.log(error.message);
}
});
const manifestContent = JSON.stringify(manifestFile);
fs.writeFile('./bin/electron.manifest.json', manifestContent, (error) => {
if(error) {
console.log(error.message);
}
});

View File

@@ -1,35 +0,0 @@
{
"executable": "{{executable}}",
"splashscreen": {
"imageFile": ""
},
"name": "{{executable}}",
"author": "",
"singleInstance": false,
"environment": "Production",
"build": {
"appId": "com.{{executable}}.app",
"productName": "{{executable}}",
"copyright": "Copyright © 2020",
"buildVersion": "1.0.0",
"compression": "maximum",
"directories": {
"output": "../../../bin/Desktop"
},
"extraResources": [
{
"from": "./bin",
"to": "bin",
"filter": [ "**/*" ]
}
],
"files": [
{
"from": "./ElectronHostHook/node_modules",
"to": "ElectronHostHook/node_modules",
"filter": [ "**/*" ]
},
"**/*"
]
}
}

View File

@@ -1,349 +0,0 @@
const { app } = require('electron');
const { BrowserWindow } = require('electron');
const { protocol } = require('electron');
const path = require('path');
const cProcess = require('child_process').spawn;
const portscanner = require('portscanner');
const { imageSize } = require('image-size');
let io, server, browserWindows, ipc, apiProcess, loadURL;
let appApi, menu, dialogApi, notification, tray, webContents;
let globalShortcut, shellApi, screen, clipboard, autoUpdater;
let commandLine, browserView;
let powerMonitor;
let splashScreen, hostHook;
let mainWindowId, nativeTheme;
let dock;
let launchFile;
let launchUrl;
let manifestJsonFileName = 'electron.manifest.json';
let watchable = false;
if (app.commandLine.hasSwitch('manifest')) {
manifestJsonFileName = app.commandLine.getSwitchValue('manifest');
}
if (app.commandLine.hasSwitch('watch')) {
watchable = true;
}
let currentBinPath = path.join(__dirname.replace('app.asar', ''), 'bin');
let manifestJsonFilePath = path.join(currentBinPath, manifestJsonFileName);
// if watch is enabled lets change the path
if (watchable) {
currentBinPath = path.join(__dirname, '../../'); // go to project directory
manifestJsonFilePath = path.join(currentBinPath, manifestJsonFileName);
}
// handle macOS events for opening the app with a file, etc
app.on('will-finish-launching', () => {
app.on('open-file', (evt, file) => {
evt.preventDefault();
launchFile = file;
});
app.on('open-url', (evt, url) => {
evt.preventDefault();
launchUrl = url;
});
});
const manifestJsonFile = require(manifestJsonFilePath);
if (manifestJsonFile.singleInstance || manifestJsonFile.aspCoreBackendPort) {
const mainInstance = app.requestSingleInstanceLock();
app.on('second-instance', (events, args = []) => {
args.forEach((parameter) => {
const words = parameter.split('=');
if (words.length > 1) {
app.commandLine.appendSwitch(words[0].replace('--', ''), words[1]);
} else {
app.commandLine.appendSwitch(words[0].replace('--', ''));
}
});
const windows = BrowserWindow.getAllWindows();
if (windows.length) {
if (windows[0].isMinimized()) {
windows[0].restore();
}
windows[0].focus();
}
});
if (!mainInstance) {
app.quit();
}
}
app.on('ready', () => {
// Fix ERR_UNKNOWN_URL_SCHEME using file protocol
// https://github.com/electron/electron/issues/23757
protocol.registerFileProtocol('file', (request, callback) => {
const pathname = request.url.replace('file:///', '');
callback(pathname);
});
if (isSplashScreenEnabled()) {
startSplashScreen();
}
// Added default port as configurable for port restricted environments.
let defaultElectronPort = 8000;
if (manifestJsonFile.electronPort) {
defaultElectronPort = manifestJsonFile.electronPort;
}
// hostname needs to be localhost, otherwise Windows Firewall will be triggered.
portscanner.findAPortNotInUse(defaultElectronPort, 65535, 'localhost', function (error, port) {
console.log('Electron Socket IO Port: ' + port);
startSocketApiBridge(port);
});
});
app.on('quit', async (event, exitCode) => {
await server.close();
apiProcess.kill();
});
function isSplashScreenEnabled() {
if (manifestJsonFile.hasOwnProperty('splashscreen')) {
if (manifestJsonFile.splashscreen.hasOwnProperty('imageFile')) {
return Boolean(manifestJsonFile.splashscreen.imageFile);
}
}
return false;
}
function startSplashScreen() {
let imageFile = path.join(currentBinPath, manifestJsonFile.splashscreen.imageFile);
imageSize(imageFile, (error, dimensions) => {
if (error) {
console.log(`load splashscreen error:`);
console.error(error);
throw new Error(error.message);
}
splashScreen = new BrowserWindow({
width: dimensions.width,
height: dimensions.height,
transparent: true,
center: true,
frame: false,
closable: false,
resizable: false,
skipTaskbar: true,
alwaysOnTop: true,
show: true,
});
splashScreen.setIgnoreMouseEvents(true);
app.once('browser-window-created', () => {
splashScreen.destroy();
});
const loadSplashscreenUrl = path.join(__dirname, 'splashscreen', 'index.html') + '?imgPath=' + imageFile;
splashScreen.loadURL('file://' + loadSplashscreenUrl);
splashScreen.once('closed', () => {
splashScreen = null;
});
});
}
function startSocketApiBridge(port) {
// instead of 'require('socket.io')(port);' we need to use this workaround
// otherwise the Windows Firewall will be triggered
server = require('http').createServer();
const { Server } = require('socket.io');
io = new Server({
pingTimeout: 60000, // in ms, default is 5000
pingInterval: 10000, // in ms, default is 25000
});
io.attach(server);
server.listen(port, 'localhost');
server.on('listening', function () {
console.log('Electron Socket started on port %s at %s', server.address().port, server.address().address);
// Now that socket connection is established, we can guarantee port will not be open for portscanner
if (watchable) {
startAspCoreBackendWithWatch(port);
} else {
startAspCoreBackend(port);
}
});
// prototype
app['mainWindowURL'] = '';
app['mainWindow'] = null;
// @ts-ignore
io.on('connection', (socket) => {
socket.on('disconnect', function (reason) {
console.log('Got disconnect! Reason: ' + reason);
try {
if (hostHook) {
const hostHookScriptFilePath = path.join(__dirname, 'ElectronHostHook', 'index.js');
delete require.cache[require.resolve(hostHookScriptFilePath)];
hostHook = undefined;
}
} catch (error) {
console.error(error.message);
}
});
if (global['electronsocket'] === undefined) {
global['electronsocket'] = socket;
global['electronsocket'].setMaxListeners(0);
}
console.log(
'ASP.NET Core Application connected...',
'global.electronsocket',
global['electronsocket'].id,
new Date()
);
if (appApi === undefined) appApi = require('./api/app')(socket, app);
if (browserWindows === undefined) browserWindows = require('./api/browserWindows')(socket, app);
if (commandLine === undefined) commandLine = require('./api/commandLine')(socket, app);
if (autoUpdater === undefined) autoUpdater = require('./api/autoUpdater')(socket);
if (ipc === undefined) ipc = require('./api/ipc')(socket);
if (menu === undefined) menu = require('./api/menu')(socket);
if (dialogApi === undefined) dialogApi = require('./api/dialog')(socket);
if (notification === undefined) notification = require('./api/notification')(socket);
if (tray === undefined) tray = require('./api/tray')(socket);
if (webContents === undefined) webContents = require('./api/webContents')(socket);
if (globalShortcut === undefined) globalShortcut = require('./api/globalShortcut')(socket);
if (shellApi === undefined) shellApi = require('./api/shell')(socket);
if (screen === undefined) screen = require('./api/screen')(socket);
if (clipboard === undefined) clipboard = require('./api/clipboard')(socket);
if (browserView === undefined) browserView = require('./api/browserView').browserViewApi(socket);
if (powerMonitor === undefined) powerMonitor = require('./api/powerMonitor')(socket);
if (nativeTheme === undefined) nativeTheme = require('./api/nativeTheme')(socket);
if (dock === undefined) dock = require('./api/dock')(socket);
socket.on('register-app-open-file-event', (id) => {
global['electronsocket'] = socket;
app.on('open-file', (event, file) => {
event.preventDefault();
global['electronsocket'].emit('app-open-file' + id, file);
});
if (launchFile) {
global['electronsocket'].emit('app-open-file' + id, launchFile);
}
});
socket.on('register-app-open-url-event', (id) => {
global['electronsocket'] = socket;
app.on('open-url', (event, url) => {
event.preventDefault();
global['electronsocket'].emit('app-open-url' + id, url);
});
if (launchUrl) {
global['electronsocket'].emit('app-open-url' + id, launchUrl);
}
});
try {
const hostHookScriptFilePath = path.join(__dirname, 'ElectronHostHook', 'index.js');
if (isModuleAvailable(hostHookScriptFilePath) && hostHook === undefined) {
const { HookService } = require(hostHookScriptFilePath);
hostHook = new HookService(socket, app);
hostHook.onHostReady();
}
} catch (error) {
console.error(error.message);
}
});
}
function isModuleAvailable(name) {
try {
require.resolve(name);
return true;
} catch (e) {}
return false;
}
function startAspCoreBackend(electronPort) {
if (manifestJsonFile.aspCoreBackendPort) {
startBackend(manifestJsonFile.aspCoreBackendPort);
} else {
// hostname needs to be localhost, otherwise Windows Firewall will be triggered.
portscanner.findAPortNotInUse(electronPort + 1, 65535, 'localhost', function (error, electronWebPort) {
startBackend(electronWebPort);
});
}
function startBackend(aspCoreBackendPort) {
console.log('ASP.NET Core Port: ' + aspCoreBackendPort);
loadURL = `http://localhost:${aspCoreBackendPort}`;
const parameters = [
getEnvironmentParameter(),
`/electronPort=${electronPort}`,
`/electronWebPort=${aspCoreBackendPort}`,
];
let binaryFile = manifestJsonFile.executable;
const os = require('os');
if (os.platform() === 'win32') {
binaryFile = binaryFile + '.exe';
}
let binFilePath = path.join(currentBinPath, binaryFile);
var options = { cwd: currentBinPath };
apiProcess = cProcess(binFilePath, parameters, options);
apiProcess.stdout.on('data', (data) => {
console.log(`stdout: ${data.toString()}`);
});
}
}
function startAspCoreBackendWithWatch(electronPort) {
if (manifestJsonFile.aspCoreBackendPort) {
startBackend(manifestJsonFile.aspCoreBackendPort);
} else {
// hostname needs to be localhost, otherwise Windows Firewall will be triggered.
portscanner.findAPortNotInUse(electronPort + 1, 65535, 'localhost', function (error, electronWebPort) {
startBackend(electronWebPort);
});
}
function startBackend(aspCoreBackendPort) {
console.log('ASP.NET Core Watch Port: ' + aspCoreBackendPort);
loadURL = `http://localhost:${aspCoreBackendPort}`;
const parameters = [
'watch',
'run',
getEnvironmentParameter(),
`/electronPort=${electronPort}`,
`/electronWebPort=${aspCoreBackendPort}`,
];
var options = {
cwd: currentBinPath,
env: process.env,
};
apiProcess = cProcess('dotnet', parameters, options);
apiProcess.stdout.on('data', (data) => {
console.log(`stdout: ${data.toString()}`);
});
}
}
function getEnvironmentParameter() {
if (manifestJsonFile.environment) {
return '--environment=' + manifestJsonFile.environment;
}
return '';
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "ES2019",
"sourceMap": true,
"skipLibCheck": true
},
"exclude": [
"node_modules",
"ElectronHostHook"
]
}

View File

@@ -1,129 +0,0 @@
{
"rulesDirectory": [],
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"deprecation": {
"severity": "warn"
},
"eofline": true,
"forin": true,
"import-blacklist": [
true,
"rxjs/Rx"
],
"import-spacing": true,
"indent": [
true,
"spaces"
],
"interface-over-type-literal": true,
"label-position": true,
"max-line-length": [
true,
140
],
"member-access": false,
"member-ordering": [
true,
{
"order": [
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}
],
"no-arg": true,
"no-bitwise": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-super": true,
"no-empty": false,
"no-empty-interface": true,
"no-eval": true,
"no-inferrable-types": [
true,
"ignore-params"
],
"no-misused-new": true,
"no-non-null-assertion": true,
"no-redundant-jsdoc": true,
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unnecessary-initializer": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"prefer-const": true,
"quotemark": [
true,
"single"
],
"radix": true,
"semicolon": [
true,
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"unified-signatures": true,
"variable-name": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"no-output-on-prefix": true,
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
"no-input-rename": true,
"no-output-rename": true,
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true
}
}

View File

@@ -1 +0,0 @@
{"version":3,"file":"connector.js","sourceRoot":"","sources":["connector.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAS;IAClB,YAAoB,MAAuB;IACvC,aAAa;IACN,GAAiB;QAFR,WAAM,GAAN,MAAM,CAAiB;QAEhC,QAAG,GAAH,GAAG,CAAc;IAAI,CAAC;IAEjC,EAAE,CAAC,GAAW,EAAE,cAAwB;QACpC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE;YACnC,MAAM,EAAE,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;YAE9B,IAAI;gBACA,cAAc,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;oBAC7B,IAAI,IAAI,EAAE;wBACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,WAAW,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;qBACjD;gBACL,CAAC,CAAC,CAAC;aACN;YAAC,OAAO,KAAK,EAAE;gBACZ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,EAAE,EAAE,EAAE,qBAAqB,EAAE,KAAK,CAAC,CAAC;aACtE;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AApBD,8BAoBC"}

View File

@@ -1,32 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExcelCreator = void 0;
const Excel = require("exceljs");
class ExcelCreator {
create(path) {
return __awaiter(this, void 0, void 0, function* () {
const workbook = new Excel.Workbook();
const worksheet = workbook.addWorksheet("My Sheet");
worksheet.columns = [
{ header: "Id", key: "id", width: 10 },
{ header: "Name", key: "name", width: 32 },
{ header: "Birthday", key: "birthday", width: 10, outlineLevel: 1 }
];
worksheet.addRow({ id: 1, name: "John Doe", birthday: new Date(1970, 1, 1) });
worksheet.addRow({ id: 2, name: "Jane Doe", birthday: new Date(1965, 1, 7) });
yield workbook.xlsx.writeFile(path + "\\sample.xlsx");
return "Excel file created!";
});
}
}
exports.ExcelCreator = ExcelCreator;
//# sourceMappingURL=excelCreator.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"excelCreator.js","sourceRoot":"","sources":["excelCreator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAiC;AAGjC,MAAa,YAAY;IACf,MAAM,CAAC,IAAY;;YACrB,MAAM,QAAQ,GAAa,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YAChD,MAAM,SAAS,GAAc,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;YAC/D,SAAS,CAAC,OAAO,GAAG;gBAChB,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;gBACtC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;gBAC1C,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE;aACtE,CAAC;YACF,SAAS,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YAC9E,SAAS,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YAE9E,MAAM,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,eAAe,CAAC,CAAC;YAEtD,OAAO,qBAAqB,CAAC;QACjC,CAAC;KAAA;CACJ;AAhBD,oCAgBC"}

View File

@@ -1,30 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HookService = void 0;
const connector_1 = require("./connector");
const excelCreator_1 = require("./excelCreator");
class HookService extends connector_1.Connector {
constructor(socket, app) {
super(socket, app);
this.app = app;
}
onHostReady() {
// execute your own JavaScript Host logic here
this.on("create-excel-file", (path, done) => __awaiter(this, void 0, void 0, function* () {
const excelCreator = new excelCreator_1.ExcelCreator();
const result = yield excelCreator.create(path);
done(result);
}));
}
}
exports.HookService = HookService;
//# sourceMappingURL=index.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,2CAAwC;AACxC,iDAA8C;AAE9C,MAAa,WAAY,SAAQ,qBAAS;IACtC,YAAY,MAAuB,EAAS,GAAiB;QACzD,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QADqB,QAAG,GAAH,GAAG,CAAc;IAE7D,CAAC;IAED,WAAW;QACP,8CAA8C;QAC9C,IAAI,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAO,IAAI,EAAE,IAAI,EAAE,EAAE;YAC9C,MAAM,YAAY,GAAiB,IAAI,2BAAY,EAAE,CAAC;YACtD,MAAM,MAAM,GAAW,MAAM,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAEvD,IAAI,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC,CAAA,CAAC,CAAC;IACP,CAAC;CACJ;AAdD,kCAcC"}

View File

@@ -1,11 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"sourceMap": true,
"skipLibCheck": true,
"target": "es2015"
},
"exclude": [
"node_modules"
]
}

View File

@@ -1,49 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
<AspNetCoreModuleName>AspNetCoreModule</AspNetCoreModuleName>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
<TypeScriptToolsVersion>4.2</TypeScriptToolsVersion>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Controllers\ManageWindowsController.cs" />
</ItemGroup>
<ItemGroup>
<Content Remove="Views\Windows\HandleErrorCrashes.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\assets\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.13" />
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.410601">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.15" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SocketIOClient" Version="3.0.8" />
<PackageReference Include="SocketIOClient.Newtonsoft.Json" Version="3.0.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ElectronNET.API\ElectronNET.API.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="Assets\electron.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Assets\electron_32x32.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Update="ElectronHostHook\**\*.*">
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Update="electron.manifest.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View File

@@ -1,23 +0,0 @@
using ElectronNET.API;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
namespace ElectronNET.WebApp
{
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args)
{
return WebHost.CreateDefaultBuilder(args)
.ConfigureLogging((hostingContext, logging) => { logging.AddConsole(); })
.UseElectron(args)
.UseStartup<Startup>();
}
}
}

View File

@@ -1,32 +0,0 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:50394/",
"sslPort": 0
}
},
"profiles": {
"Electron.NET App": {
"commandName": "Executable",
"executablePath": "$(SolutionDir)ElectronNET.CLI\\bin\\Debug\\netcoreapp3.1\\dotnet-electronize.exe",
"commandLineArgs": "start",
"workingDirectory": "$(SolutionDir)ElectronNET.WebApp"
},
"IIS Express": {
"commandName": "IISExpress",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ElectronNET.WebApp": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:50395/"
}
}
}

View File

@@ -1,49 +0,0 @@
{
"executable": "ElectronNET.WebApp",
"splashscreen": {
"imageFile": "/wwwroot/assets/img/about@2x.png"
},
"environment": "Production",
"singleInstance": false,
"build": {
"appId": "com.electronnetapidemos.app",
"productName": "ElectronNET API Demos",
"copyright": "Copyright <20> 2019-2023",
"buildVersion": "23.6.1",
"compression": "maximum",
"win": {
"icon": "Assets/electron.ico",
"publish": [
{
"provider": "github",
"owner": "ElectronNET",
"repo": "electron.net-api-demos",
"token": ">> Insert GH_TOKEN here! <<"
}
]
},
"directories": {
"output": "../../../bin/Desktop",
"buildResources": "Assets"
},
"extraResources": [
{
"from": "./bin",
"to": "bin",
"filter": [
"**/*"
]
}
],
"files": [
{
"from": "./ElectronHostHook/node_modules",
"to": "ElectronHostHook/node_modules",
"filter": [
"**/*"
]
},
"**/*"
]
}
}

View File

@@ -1,73 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2027
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElectronNET.WebApp", "ElectronNET.WebApp\ElectronNET.WebApp.csproj", "{7C048379-401C-4345-B5E7-BE232DEA8157}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElectronNET.API", "ElectronNET.API\ElectronNET.API.csproj", "{A78157BA-B754-45F1-969F-D6A513CA0E72}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElectronNET.CLI", "ElectronNET.CLI\ElectronNET.CLI.csproj", "{CE3EB0F2-DA39-427A-85D2-E00D660EBFDE}"
EndProject
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "ElectronNET.Host", "ElectronNET.Host\", "{B33E9B82-B6B4-4DB0-B6EE-61CC34641518}"
ProjectSection(WebsiteProperties) = preProject
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
Debug.AspNetCompiler.VirtualPath = "/localhost_56840"
Debug.AspNetCompiler.PhysicalPath = "ElectronNET.Host\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_56840\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/localhost_56840"
Release.AspNetCompiler.PhysicalPath = "ElectronNET.Host\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_56840\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
VWDPort = "56840"
SlnRelativePath = "ElectronNET.Host\"
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2914CCF7-27C2-42AE-849A-2F0C1BC7CDFA}"
ProjectSection(SolutionItems) = preProject
buildAll.cmd = buildAll.cmd
buildAll.sh = buildAll.sh
buildReleaseNuGetPackages.cmd = buildReleaseNuGetPackages.cmd
Changelog.md = Changelog.md
README.md = README.md
start.cmd = start.cmd
start.sh = start.sh
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7C048379-401C-4345-B5E7-BE232DEA8157}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C048379-401C-4345-B5E7-BE232DEA8157}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C048379-401C-4345-B5E7-BE232DEA8157}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C048379-401C-4345-B5E7-BE232DEA8157}.Release|Any CPU.Build.0 = Release|Any CPU
{A78157BA-B754-45F1-969F-D6A513CA0E72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A78157BA-B754-45F1-969F-D6A513CA0E72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A78157BA-B754-45F1-969F-D6A513CA0E72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A78157BA-B754-45F1-969F-D6A513CA0E72}.Release|Any CPU.Build.0 = Release|Any CPU
{CE3EB0F2-DA39-427A-85D2-E00D660EBFDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE3EB0F2-DA39-427A-85D2-E00D660EBFDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE3EB0F2-DA39-427A-85D2-E00D660EBFDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE3EB0F2-DA39-427A-85D2-E00D660EBFDE}.Release|Any CPU.Build.0 = Release|Any CPU
{B33E9B82-B6B4-4DB0-B6EE-61CC34641518}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B33E9B82-B6B4-4DB0-B6EE-61CC34641518}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B33E9B82-B6B4-4DB0-B6EE-61CC34641518}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{B33E9B82-B6B4-4DB0-B6EE-61CC34641518}.Release|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {81A62E71-9E04-4EFE-AD5C-23165375F8EF}
EndGlobalSection
EndGlobal

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2017 Gregor Biswanger, Robert Mühsig
Copyright (c) 2017-2024 Gregor Biswanger, Robert Mühsig
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -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>

362
README.md
View File

@@ -1,325 +1,161 @@
[![Electron.NET Logo](https://github.com/ElectronNET/Electron.NET/blob/master/assets/images/electron.net-logo.png)](https://github.com/ElectronNET/Electron.NET)
[![Electron.NET Logo](https://github.com/ElectronNET/Electron.NET/raw/main/assets/images/electron.net-logo.png)](https://github.com/ElectronNET/Electron.NET)
[![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://donorbox.org/electron-net)
[![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://donorbox.org/electron-net) [![Gitter](https://badges.gitter.im/ElectronNET/community.svg)](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build status](https://github.com/ElectronNET/Electron.NET/actions/workflows/ci.yml/badge.svg)](https://github.com/ElectronNET/Electron.NET/actions/workflows/ci.yml)
# Electron.NET Core is here!
AppVeyor (Win/Linux): [![Build status](https://ci.appveyor.com/api/projects/status/q95h4xt14papwi05/branch/master?svg=true)](https://ci.appveyor.com/project/robertmuehsig/electron-net/branch/master)
## A Complete Transformation
* Checkout AppVeyor Artifacts: Contains the WebApp sample built for Windows & Linux!
`ElectronNET.Core` represents a fundamental modernization of Electron.NET, addressing years of accumulated pain points while preserving full API compatibility. This isn't just an update — it's a complete rethinking of how .NET developers build and debug cross-platform desktop applications with Electron.
Travis-CI (Win/macOS/Linux): [![Build Status](https://travis-ci.org/ElectronNET/Electron.NET.svg?branch=master)](https://travis-ci.org/ElectronNET/Electron.NET)
Read more: [**What's New in `ElectronNET.Core`**](https://github.com/ElectronNET/Electron.NET/wiki/What's-New)
Build cross platform desktop apps with .NET 6 and Blazor, ASP.NET Core (Razor Pages, MVC).
Build cross platform desktop applications with .NET 6/8/10 - from console apps to ASP.NET Core (Razor Pages, MVC) to Blazor.
Electron.NET is a __wrapper__ around a native Electron application with an embedded ASP.NET Core application. Via our Electron.NET IPC bridge we can invoke Electron APIs from .NET.
## Wait - how does that work exactly?
The CLI extensions hosts our toolset to build and start Electron.NET applications.
Well... there are lots of different approaches how to get a X-plat desktop app running. Electron.NET provides a range of ways to build .NET based solutions using Electron at the side of presentation.
## Wait - you host a .NET Core app inside Electron? Why?
While the classic Electron.NET setup, using an ASP.NET host ran by the Electron side is still the primary way, there's more flexibility now: both, dotnet and Electron are now able to launch the other for better lifetime management, and when you don't need a local web server - like when running content from files or remote servers, you can drop the ASP.NET stack altogether and got with a lightweight console app instead.
Well... there are lots of different approaches how to get a X-plat desktop app running. We thought it would be nice for .NET devs to use the ASP.NET Core environment and just embed it inside a pretty robust X-plat enviroment called Electron. Porting Electron to .NET is not a goal of this project, at least we don't have any clue how to do it. We just combine ASP.NET Core & Electron.
## 📦 NuGet
## 📦 NuGet:
* ElectronNET.Core: [![NuGet](https://img.shields.io/nuget/v/ElectronNET.Core.svg?style=flat-square)](https://www.nuget.org/packages/ElectronNET.Core.API/)
* ElectronNET.Core.API: [![NuGet](https://img.shields.io/nuget/v/ElectronNET.Core.API.svg?style=flat-square)](https://www.nuget.org/packages/ElectronNET.Core.API/)
* ElectronNET.Core.AspNet: [![NuGet](https://img.shields.io/nuget/v/ElectronNET.Core.AspNet.svg?style=flat-square)](https://www.nuget.org/packages/ElectronNET.Core.AspNet/)
* API [![NuGet](https://img.shields.io/nuget/v/ElectronNET.API.svg?style=flat-square)](https://www.nuget.org/packages/ElectronNET.API/)
* CLI [![NuGet](https://img.shields.io/nuget/v/ElectronNET.CLI.svg?style=flat-square)](https://www.nuget.org/packages/ElectronNET.CLI/)
## 🛠 Requirements to Run
## 🛠 Requirements to run:
You should have installed:
The current Electron.NET CLI builds Windows/macOS/Linux binaries. Our API uses .NET 6, so our minimum base OS is the same as [.NET 6](https://github.com/dotnet/core/blob/main/release-notes/6.0/supported-os.md).
* .NET 6/8 or later.
* The minimum base OS is the same as [.NET 6](https://github.com/dotnet/core/blob/main/release-notes/6.0/supported-os.md) / [.NET 8](https://github.com/dotnet/core/blob/main/release-notes/8.0/supported-os.md).
* Node.JS using at least [Version 22.x](https://nodejs.org).
Also you should have installed:
## 👩‍🏫 Usage with ASP.NET
* npm [contained in nodejs (at least Version 16.17.1)](https://nodejs.org)
- Create a new ASP.NET Core project
- Install the following two NuGet packages:
## 💬 Community
```ps1
dotnet add package ElectronNET.Core
[![Gitter](https://badges.gitter.im/ElectronNET/community.svg)](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
dotnet add package ElectronNET.Core.AspNet
```
## 🙏 Donate
### Classic ASP.NET Core
We do this open source work in our free time. If you'd like us to invest more time on it, please [donate](https://donorbox.org/electron-net). Donation can be used to increase some issue priority. Thank you!
#### Enable Electron.NET on Startup
[![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://donorbox.org/electron-net)
To do so, use the `UseElectron` extension method on a `WebApplicationBuilder`, an `IWebHostBuilder` or any descendants.
## 👩‍🏫 Usage
> [!NOTE]
> New in Electron.NET Core is that you provide a callback method as an argument to `UseElectron()`, which ensures that you get to know the right moment to set up your application UI.
To activate and communicate with the "native" (sort of native...) Electron API include the [ElectronNET.API NuGet package](https://www.nuget.org/packages/ElectronNET.API/) in your ASP.NET Core app.
````
PM> Install-Package ElectronNET.API
````
## Minimal-API
You start Electron.NET up with an `UseElectron` WebHostBuilder-Extension and open the Electron Window:
### Program.cs
#### Program.cs
```csharp
using ElectronNET.API;
using ElectronNET.API.Entities;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseElectron(args);
public static void Main(string[] args)
{
WebHost.CreateDefaultBuilder(args)
.UseElectron(args, ElectronAppReady)
.UseStartup<Startup>()
.Build()
.Run();
}
// Is optional, but you can use the Electron.NET API-Classes directly with DI (relevant if you wont more encoupled code)
builder.Services.AddElectron();
public static async Task ElectronAppReady()
{
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
new BrowserWindowOptions { Show = false });
browserWindow.OnReadyToShow += () => browserWindow.Show();
}
```
### Minimal API Example
For a minimal API you can use:
```csharp
using ElectronNET;
using ElectronNET.API;
using ElectronNET.API.Entities;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorPages();
builder.Services.AddElectron(); // <- might be useful to set up DI
builder.UseElectron(args, async () =>
{
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
new BrowserWindowOptions { Show = false, AutoHideMenuBar = true });
browserWindow.OnReadyToShow += () => browserWindow.Show();
});
var app = builder.Build();
...
await app.StartAsync();
// Open the Electron-Window here
Task.Run(async () => await Electron.WindowManager.CreateWindowAsync());
app.WaitForShutdown();
```
## Conventional
### Program.cs
You start Electron.NET up with an `UseElectron` WebHostBuilder-Extension.
```csharp
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseElectron(args);
webBuilder.UseStartup<Startup>();
});
```
### Startup.cs
Open the Electron Window in the Startup.cs file:
```csharp
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
...
// Open the Electron-Window here
Task.Run(async () => await Electron.WindowManager.CreateWindowAsync());
app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapRazorPages();
app.Run();
```
## 🚀 Start the Application
## 🚀 Starting and Debugging the Application
To start the application make sure you have installed the "[ElectronNET.CLI](https://www.nuget.org/packages/ElectronNET.CLI/)" packages as global tool:
Just press `F5` in Visual Studio or use dotnet for debugging.
```
dotnet tool install ElectronNET.CLI -g
```
## 📔 Usage of the Electron API
At the first time, you need an Electron.NET project initialization. Type the following command in your ASP.NET Core folder:
```
electronize init
```
* Now a electronnet.manifest.json should appear in your ASP.NET Core project
* Now run the following:
```
electronize start
```
### Note
> Only the first electronize start is slow. The next will go on faster.
## 🔭 Develop Electron.NET apps using a file watcher
The file watcher is included with version 8.31.1 of Electron.NET. For example, a file change can trigger compilation, test execution, or deployment. The Electron.NET window will automatically refresh and new code changes will be visible more quickly. The following Electron.NET CLI command is required:
```
electronize start /watch
```
### Note
> Only the first electronize start is slow. The next will go on faster.
## 🐞 Debug
Start your Electron.NET application with the Electron.NET CLI command. In Visual Studio attach to your running application instance. Go in the __Debug__ Menu and click on __Attach to Process...__. Sort by your projectname on the right and select it on the list.
## 📔 Usage of the Electron-API
A complete documentation will follow. Until then take a look in the source code of the sample application:
[Electron.NET API Demos](https://github.com/ElectronNET/electron.net-api-demos)
A complete documentation is available on the Wiki.
In this YouTube video, we show you how you can create a new project, use the Electron.NET API, debug a application and build an executable desktop app for Windows: [Electron.NET - Getting Started](https://www.youtube.com/watch?v=nuM6AojRFHk)
## ⛏ Build
Here you need the Electron.NET CLI as well. Type the following command in your ASP.NET Core folder:
```
electronize build /target win
```
There are additional platforms available:
```
electronize build /target win
electronize build /target osx
electronize build /target linux
```
Those three "default" targets will produce x64 packages for those platforms.
For certain NuGet packages or certain scenarios you may want to build a pure x86 application. To support those things you can define the desired [.NET Core runtime](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog), the [electron platform](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#platform) and [electron architecture](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#arch) like this:
```
electronize build /target custom "win7-x86;win32" /electron-arch ia32
```
The end result should be an electron app under your __/bin/desktop__ folder.
### Note
> macOS builds can't be created on Windows machines because they require symlinks that aren't supported on Windows (per [this Electron issue](https://github.com/electron-userland/electron-packager/issues/71)). macOS builds can be produced on either Linux or macOS machines.
## 🔄 Update
After an update to the latest Electron.API package, an update to the latest Electron.CLI is always required. In addition, always update the CLI via NuGet:
```
dotnet tool update ElectronNET.CLI -g
```
> [!NOTE]
> The video hasn't been updated for the changes in ElectronNET.Core, so it is partially outdated.
## 👨‍💻 Authors
* **Gregor Biswanger** - (Microsoft MVP, Intel Black Belt and Intel Software Innovator) is a freelance lecturer, consultant, trainer, author and speaker. He is a consultant for large and medium-sized companies, organizations and agencies for software architecture, web- and cross-platform development. You can find Gregor often on the road attending or speaking at international conferences. - [Cross-Platform-Blog](http://www.cross-platform-blog.com) - Twitter [@BFreakout](https://www.twitter.com/BFreakout)
* **Dr. Florian Rappl** - Software Developer - from Munich, Germany. Microsoft MVP & Web Geek. - [Florian Rappl](https://florianrappl.de) - Twitter [@florianrappl](https://twitter.com/florianrappl)
* **Robert Muehsig** - Software Developer - from Dresden, Germany, now living & working in Switzerland. Microsoft MVP & Web Geek. - [codeinside Blog](https://blog.codeinside.eu) - Twitter [@robert0muehsig](https://twitter.com/robert0muehsig)
* **[Gregor Biswanger](https://github.com/GregorBiswanger)** - (Microsoft MVP, Intel Black Belt and Intel Software Innovator) is a freelance lecturer, consultant, trainer, author and speaker. He is a consultant for large and medium-sized companies, organizations and agencies for software architecture, web- and cross-platform development. You can find Gregor often on the road attending or speaking at international conferences. - [Cross-Platform-Blog](http://www.cross-platform-blog.com) - Twitter [@BFreakout](https://www.twitter.com/BFreakout)
* **[Dr. Florian Rappl](https://github.com/FlorianRappl)** - Software Developer - from Munich, Germany. Microsoft MVP & Web Geek. - [The Art of Micro Frontends](https://microfrontends.art) - [Homepage](https://florian-rappl.de) - Twitter [@florianrappl](https://twitter.com/florianrappl)
* **[softworkz](https://github.com/softworkz)** - Full Range Developer - likes to start where others gave up. MS MVP alumni and Munich citizen as well.
* **[Robert Muehsig](https://github.com/robertmuehsig)** - Software Developer - from Dresden, Germany, now living & working in Switzerland. Microsoft MVP & Web Geek. - [codeinside Blog](https://blog.codeinside.eu) - Twitter [@robert0muehsig](https://twitter.com/robert0muehsig)
See also the list of [contributors](https://github.com/ElectronNET/Electron.NET/graphs/contributors) who participated in this project.
## 🙋‍♀️🙋‍♂ Contributing
Feel free to submit a pull request if you find any bugs (to see a list of active issues, visit the [Issues section](https://github.com/ElectronNET/Electron.NET/issues).
Please make sure all commits are properly documented.
## 🧪 Working with this Repo
This video provides an introduction to development for Electron.NET: [Electron.NET - Contributing Getting Started](https://youtu.be/Po-saU_Z6Ws)
This repository consists of the main parts (API & CLI) and it's own "playground" ASP.NET Core application. Both main parts produce local NuGet packages, that are versioned with 99.0.0. The first thing you will need is to run one of the buildAll scripts (.cmd for Windows, the other for macOS/Linux).
If you look for pure __[demo projects](https://github.com/ElectronNET)__ checkout the other repositories.
The problem working with this repository is, that NuGet has a pretty aggressive cache, see [here for further information](https://github.com/ElectronNET/Electron.NET/wiki).
## 🙏 Donate
We do this open source work in our free time. If you'd like us to invest more time on it, please [donate](https://donorbox.org/electron-net). Donation can be used to increase some issue priority. Thank you!
[![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://donorbox.org/electron-net)
Alternatively, consider using a GitHub sponsorship for the core maintainers:
- [Gregor Biswanger](https://github.com/sponsors/GregorBiswanger)
- [Florian Rappl](https://github.com/sponsors/FlorianRappl)
Any support appreciated! 🍻
## 🎉 License
MIT-licensed
MIT-licensed. See [LICENSE](https://github.com/ElectronNET/Electron.NET/blob/main/LICENSE) for details.
**Enjoy!**
## 📝 Important notes
### ElectronNET.API & ElectronNET.CLI Version 9.31.2
Make sure you also have the new Electron.NET API & CLI 9.31.2 version.
```
dotnet tool update ElectronNET.CLI -g
```
This now uses [electron-builder](https://www.electron.build/configuration/configuration) and the necessary configuration to build is made in the **electron.manifest.json** file (on the build part). In addition, own Electron.NET configurations are stored (on the root). Please make sure that your **electron.manifest.json** file has the following new structure:
```
{
"executable": "{{executable}}",
"splashscreen": {
"imageFile": ""
},
"name": "{{executable}}",
"author": "",
"singleInstance": false,
"build": {
"appId": "com.{{executable}}.app",
"productName": "{{executable}}",
"copyright": "Copyright © 2020",
"buildVersion": "1.0.0",
"compression": "maximum",
"directories": {
"output": "../../../bin/Desktop"
},
"extraResources": [
{
"from": "./bin",
"to": "bin",
"filter": ["**/*"]
}
],
"files": [
{
"from": "./ElectronHostHook/node_modules",
"to": "ElectronHostHook/node_modules",
"filter": ["**/*"]
},
"**/*"
]
}
}
```
### ElectronNET.CLI Version 0.0.9
In the Version 0.0.9 the CLI was not a global tool and needed to be registred like this in the .csproj:
```
<ItemGroup>
<DotNetCliToolReference Include="ElectronNET.CLI" Version="0.0.9" />
</ItemGroup>
```
After you edited the .csproj-file, you need to restore your NuGet packages within your Project. Run the following command in your ASP.NET Core folder:
```
dotnet restore
```
If you still use this version you will need to invoke it like this:
```
electronize ...
```
### Node Integration
Electron.NET requires Node Integration to be enabled for IPC to function. If you are not using the IPC functionality you can disable Node Integration like so:
```csharp
WebPreferences wp = new WebPreferences();
wp.NodeIntegration = false;
BrowserWindowOptions browserWindowOptions = new BrowserWindowOptions
{
WebPreferences = wp
}
```
### Dependency Injection
ElectronNET.Api can be added to your DI container within the Startup class. All of the modules available in Electron will be added as Singletons.
```csharp
using ElectronNET.API;
public void ConfigureServices(IServiceCollection services)
{
services.AddElectron()
}
```

View File

@@ -1,9 +0,0 @@
version: 1.0.{build}
image: Visual Studio 2019
build_script:
- cmd: buildAll.cmd
pull_requests:
do_not_increment_build_number: true
artifacts:
- path: ElectronNET.WebApp\bin\desktop
name: Desktop

0
artifacts/.gitkeep Normal file
View File

View File

@@ -1 +0,0 @@
Dummy file to ensure this directory is available after cloning

7
build.cmd Normal file
View File

@@ -0,0 +1,7 @@
:; set -eo pipefail
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
:; ${SCRIPT_DIR}/build.sh "$@"
:; exit $?
@ECHO OFF
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %*

69
build.ps1 Normal file
View File

@@ -0,0 +1,69 @@
[CmdletBinding()]
Param(
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$BuildArguments
)
Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)"
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 }
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
###########################################################################
# CONFIGURATION
###########################################################################
$BuildProjectFile = "$PSScriptRoot\nuke\_build.csproj"
$TempDirectory = "$PSScriptRoot\\.nuke\temp"
$DotNetGlobalFile = "$PSScriptRoot\\global.json"
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
$DotNetChannel = "Current"
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
$env:DOTNET_MULTILEVEL_LOOKUP = 0
###########################################################################
# EXECUTION
###########################################################################
function ExecSafe([scriptblock] $cmd) {
& $cmd
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}
# If dotnet CLI is installed globally and it matches requested version, use for execution
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
$(dotnet --version) -and $LASTEXITCODE -eq 0) {
$env:DOTNET_EXE = (Get-Command "dotnet").Path
}
else {
# Download install script
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
# If global.json exists, load expected version
if (Test-Path $DotNetGlobalFile) {
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
$DotNetVersion = $DotNetGlobal.sdk.version
}
}
# Install by channel or version
$DotNetDirectory = "$TempDirectory\dotnet-win"
if (!(Test-Path variable:DotNetVersion)) {
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
} else {
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
}
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
}
Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }

62
build.sh Executable file
View File

@@ -0,0 +1,62 @@
#!/usr/bin/env bash
bash --version 2>&1 | head -n 1
set -eo pipefail
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
###########################################################################
# CONFIGURATION
###########################################################################
BUILD_PROJECT_FILE="$SCRIPT_DIR/nuke/_build.csproj"
TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp"
DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
DOTNET_CHANNEL="Current"
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export DOTNET_MULTILEVEL_LOOKUP=0
###########################################################################
# EXECUTION
###########################################################################
function FirstJsonValue {
perl -nle 'print $1 if m{"'"$1"'": "([^"]+)",?}' <<< "${@:2}"
}
# If dotnet CLI is installed globally and it matches requested version, use for execution
if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then
export DOTNET_EXE="$(command -v dotnet)"
else
# Download install script
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
mkdir -p "$TEMP_DIRECTORY"
curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL"
chmod +x "$DOTNET_INSTALL_FILE"
# If global.json exists, load expected version
if [[ -f "$DOTNET_GLOBAL_FILE" ]]; then
DOTNET_VERSION=$(FirstJsonValue "version" "$(cat "$DOTNET_GLOBAL_FILE")")
if [[ "$DOTNET_VERSION" == "" ]]; then
unset DOTNET_VERSION
fi
fi
# Install by channel or version
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
if [[ -z ${DOTNET_VERSION+x} ]]; then
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path
else
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
fi
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
fi
echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)"
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"

View File

@@ -1,45 +0,0 @@
echo "Start building Electron.NET dev stack..."
echo "Restore & Build API"
cd ElectronNet.API
dotnet restore
dotnet build
cd ..
echo "Restore & Build CLI"
cd ElectronNet.CLI
dotnet restore
dotnet build
cd ..
echo "Restore & Build WebApp Demo"
cd ElectronNet.WebApp
dotnet restore
dotnet build
echo "Invoke electronize build in WebApp Demo"
echo "Install CLI"
dotnet tool uninstall ElectronNET.CLI -g
dotnet tool install ElectronNET.CLI -g
echo "/target xxx (dev-build)"
electronize build /target custom win7-x86;win /dotnet-configuration Debug /electron-arch ia32 /electron-params "--publish never"
echo "/target win (dev-build)"
electronize build /target win /electron-params "--publish never"
echo "/target custom win7-x86;win (dev-build)"
electronize build /target custom win7-x86;win /electron-params "--publish never"
:: Be aware, that for non-electronnet-dev environments the correct
:: invoke command would be dotnet electronize ...
:: Not supported on Windows Systems, because of SymLinks...
:: echo "/target osx"
:: dotnet electronize build /target osx
:: Linux and Mac is not supported on with this buildAll.cmd test file, because the electron bundler does some strange stuff
:: Help welcome!
:: echo "/target linux (dev-build)"
:: electronize build /target linux /electron-params "--publish never"

View File

@@ -1,71 +0,0 @@
# flag arguments to target specific builds are available.
# sh ./buildAll.sh
# sh ./buildAll.sh -t osx
# sh ./buildAll.sh -t win
# sh ./buildAll.sh -t linux
target=default
while getopts t: flag; do
case "${flag}" in
t) target=${OPTARG} ;;
esac
done
dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
echo "Start building Electron.NET dev stack..."
echo "Build Electron Host"
pushd $dir//ElectronNET.Host
npm install
npm run-script start
popd
echo "Restore & Build API"
pushd $dir/ElectronNET.API
dotnet restore
dotnet build
popd
echo "Restore & Build CLI"
pushd $dir/ElectronNET.CLI
dotnet restore
dotnet build
popd
echo "Restore & Build WebApp Demo"
pushd $dir/ElectronNET.WebApp
dotnet restore
dotnet build
echo "Install CLI as dotnet tool"
dotnet tool uninstall ElectronNET.CLI -g
dotnet tool install ElectronNET.CLI -g
echo "Invoke electronize build in WebApp Demo"
if [[ "$target" != "default" ]]; then
echo "/target $target (dev-build)"
electronize build /target $target
else
echo "/target win (dev-build)"
electronize build /target win
echo "/target linux (dev-build)"
electronize build /target linux
# Cannot publish osx/win on windows due to:
# NETSDK1095: Optimizing assemblies for performance is not supported for the selected target platform or architecture.
if [[ "$OSTYPE" != "linux-gnu"* ]]; then
echo "/target osx (dev-build)"
electronize build /target osx
echo "/target custom win7-x86;win (dev-build)"
electronize build /target custom "win7-x86;win"
fi
fi
popd
# Be aware, that for non-electronnet-dev environments the correct
# invoke command would be dotnet electronize ...

View File

@@ -1,14 +0,0 @@
set ENETVER=23.6.1
echo "Start building Electron.NET dev stack..."
echo "Restore & Build API"
cd ElectronNet.API
dotnet restore
dotnet build --configuration Release --force /property:Version=%ENETVER%
dotnet pack /p:Version=%ENETVER% --configuration Release --force --output "%~dp0artifacts"
cd ..
echo "Restore & Build CLI"
cd ElectronNet.CLI
dotnet restore
dotnet build --configuration Release --force /property:Version=%ENETVER%
dotnet pack /p:Version=%ENETVER% --configuration Release --force --output "%~dp0artifacts"
cd ..

View File

@@ -1,15 +0,0 @@
echo "Start building Electron.NET dev stack..."
echo "Restore & Build API"
cd ElectronNET.API && \
dotnet restore && \
dotnet build --configuration Release --force /property:Version=5.22.12 && \
dotnet pack /p:Version=5.22.12 --configuration Release --force --output "%~dp0artifacts";
cd ../;
echo "Restore & Build CLI"
cd ElectronNET.CLI && \
dotnet restore && \
dotnet build --configuration Release --force /property:Version=5.22.12 && \
dotnet pack /p:Version=5.22.12 --configuration Release --force --output "%~dp0artifacts";

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetPlatformVersion>8.1</TargetPlatformVersion>
<IsCodeSharingProject>true</IsCodeSharingProject>
<DefineCommonItemSchemas>true</DefineCommonItemSchemas>
</PropertyGroup>
<PropertyGroup>
<MdIncludes>**/*.md;**/*.markdown</MdIncludes>
<ImageIncludes>**/*.png;**/*.bmp;**/*.jpg;**/*.gif;**/*.mp4</ImageIncludes>
<WebIncludes>**/*.css;**/*.js;**/*.json</WebIncludes>
</PropertyGroup>
<ItemGroup>
<Compile Remove="**/*" />
<Content Remove="**/*" />
</ItemGroup>
<ItemGroup>
<None Include="$(ImageIncludes)" />
<None Include="$(WebIncludes)" />
<None Include="$(MdIncludes)" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ProjectCapability Include="SourceItemsFromImports;SharedImports;SharedAssetsProject"/>
<ProjectCapability Include="HandlesOwnReload"/>
<ProjectCapability Include="UserSourceItems"/>
<ProjectCapability Include="OpenProjectFile"/>
<ProjectCapability Include="UseFileGlobs"/>
<ProjectCapability Include="SingleFileGenerators"/>
</ItemGroup>
<Target Name="Compile">
</Target>
<Target Name="Build">
</Target>
<Target Name="Clean">
</Target>
<Target Name="_CheckForInvalidConfigurationAndPlatform">
</Target>
</Project>

489
docs/API/App.md Normal file
View File

@@ -0,0 +1,489 @@
# Electron.App
Control your application's event lifecycle.
## Overview
The `Electron.App` API provides comprehensive control over your application's lifecycle, including startup, shutdown, window management, and system integration. It handles application-level events and provides methods for managing the overall application state.
## Properties
#### 📋 `CommandLine`
A `CommandLine` object that allows you to read and manipulate the command line arguments that Chromium uses.
#### 📋 `IsReady`
Application host fully started.
#### 📋 `Name`
A string property that indicates the current application's name, which is the name in the application's package.json file.
Usually the name field of package.json is a short lowercase name, according to the npm modules spec. You should usually also specify a productName field, which is your application's full capitalized name, and which will be preferred over name by Electron.
#### 📋 `NameAsync`
A `Task<string>` property that indicates the current application's name, which is the name in the application's package.json file.
Usually the name field of package.json is a short lowercase name, according to the npm modules spec. You should usually also specify a productName field, which is your application's full capitalized name, and which will be preferred over name by Electron.
#### 📋 `UserAgentFallback`
A string which is the user agent string Electron will use as a global fallback.
This is the user agent that will be used when no user agent is set at the webContents or session level. It is useful for ensuring that your entire app has the same user agent. Set to a custom value as early as possible in your app's initialization to ensure that your overridden value is used.
#### 📋 `UserAgentFallbackAsync`
A `Task<string>` which is the user agent string Electron will use as a global fallback.
This is the user agent that will be used when no user agent is set at the webContents or session level. It is useful for ensuring that your entire app has the same user agent. Set to a custom value as early as possible in your app's initialization to ensure that your overridden value is used.
## Methods
#### 🧊 `void AddRecentDocument(string path)`
Adds path to the recent documents list. This list is managed by the OS. On Windows you can visit the list from the task bar, and on macOS you can visit it from dock menu.
#### 🧊 `void ClearRecentDocuments()`
Clears the recent documents list.
#### 🧊 `void Exit(int exitCode = 0)`
All windows will be closed immediately without asking user and the BeforeQuit and WillQuit events will not be emitted.
**Parameters:**
- `exitCode` - Exits immediately with exitCode. exitCode defaults to 0.
#### 🧊 `void Focus()`
On Linux, focuses on the first visible window. On macOS, makes the application the active app. On Windows, focuses on the application's first window.
#### 🧊 `void Focus(FocusOptions focusOptions)`
On Linux, focuses on the first visible window. On macOS, makes the application the active app. On Windows, focuses on the application's first window.
You should seek to use the `FocusOptions.Steal` option as sparingly as possible.
**Parameters:**
- `focusOptions` - Focus options
#### 🧊 `Task<ProcessMetric[]> GetAppMetricsAsync(CancellationToken cancellationToken = default)`
Memory and cpu usage statistics of all the processes associated with the app.
**Returns:**
Array of ProcessMetric objects that correspond to memory and cpu usage statistics of all the processes associated with the app.
#### 🧊 `Task<string> GetAppPathAsync(CancellationToken cancellationToken = default)`
The current application directory.
**Returns:**
The current application directory.
#### 🧊 `Task<int> GetBadgeCountAsync(CancellationToken cancellationToken = default)`
The current value displayed in the counter badge.
**Returns:**
The current value displayed in the counter badge.
#### 🧊 `Task<string> GetCurrentActivityTypeAsync(CancellationToken cancellationToken = default)`
The type of the currently running activity.
**Returns:**
The type of the currently running activity.
#### 🧊 `Task<GPUFeatureStatus> GetGpuFeatureStatusAsync(CancellationToken cancellationToken = default)`
The Graphics Feature Status from chrome://gpu/.
Note: This information is only usable after the gpu-info-update event is emitted.
**Returns:**
The Graphics Feature Status from chrome://gpu/.
#### 🧊 `Task<JumpListSettings> GetJumpListSettingsAsync(CancellationToken cancellationToken = default)`
Jump List settings for the application.
**Returns:**
Jump List settings.
#### 🧊 `Task<string> GetLocaleAsync(CancellationToken cancellationToken = default)`
The current application locale. Possible return values are documented [here](https://www.electronjs.org/docs/api/locales).
Note: When distributing your packaged app, you have to also ship the locales folder.
Note: On Windows, you have to call it after the Ready events gets emitted.
**Returns:**
The current application locale.
#### 🧊 `Task<LoginItemSettings> GetLoginItemSettingsAsync(CancellationToken cancellationToken = default)`
If you provided path and args options to SetLoginItemSettings then you need to pass the same arguments here for LoginItemSettings.OpenAtLogin to be set correctly.
**Returns:**
Login item settings.
#### 🧊 `Task<string> GetPathAsync(PathName pathName, CancellationToken cancellationToken = default)`
The path to a special directory. If GetPathAsync is called without called SetAppLogsPath being called first, a default directory will be created equivalent to calling SetAppLogsPath without a path parameter.
**Parameters:**
- `pathName` - Special directory.
**Returns:**
A path to a special directory or file associated with name.
#### 🧊 `Task<string> GetVersionAsync(CancellationToken cancellationToken = default)`
The version of the loaded application. If no version is found in the application's package.json file, the version of the current bundle or executable is returned.
**Returns:**
The version of the loaded application.
#### 🧊 `Task<bool> HasSingleInstanceLockAsync(CancellationToken cancellationToken = default)`
This method returns whether or not this instance of your app is currently holding the single instance lock. You can request the lock with RequestSingleInstanceLockAsync and release with ReleaseSingleInstanceLock.
**Returns:**
Whether this instance of your app is currently holding the single instance lock.
#### 🧊 `void Hide()`
Hides all application windows without minimizing them.
#### 🧊 `Task<int> ImportCertificateAsync(ImportCertificateOptions options, CancellationToken cancellationToken = default)`
Imports the certificate in pkcs12 format into the platform certificate store. callback is called with the result of import operation, a value of 0 indicates success while any other value indicates failure according to chromium net_error_list.
**Parameters:**
- `options` - Import certificate options
- `cancellationToken` - The cancellation token
**Returns:**
Result of import. Value of 0 indicates success.
#### 🧊 `void InvalidateCurrentActivity()`
Invalidates the current Handoff user activity.
#### 🧊 `Task<bool> IsAccessibilitySupportEnabledAsync(CancellationToken cancellationToken = default)`
true if Chrome's accessibility support is enabled, false otherwise. This API will return true if the use of assistive technologies, such as screen readers, has been detected. See Chromium's accessibility docs for more details.
**Returns:**
true if Chrome's accessibility support is enabled, false otherwise.
#### 🧊 `Task<bool> IsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default)`
This method checks if the current executable is the default handler for a protocol (aka URI scheme).
Note: On macOS, you can use this method to check if the app has been registered as the default protocol handler for a protocol. You can also verify this by checking ~/Library/Preferences/com.apple.LaunchServices.plist on the macOS machine. Please refer to Apple's documentation for details.
The API uses the Windows Registry and LSCopyDefaultHandlerForURLScheme internally.
**Parameters:**
- `protocol` - The name of your protocol, without ://
- `cancellationToken` - The cancellation token
**Returns:**
Whether the current executable is the default handler for a protocol (aka URI scheme).
#### 🧊 `Task<bool> IsUnityRunningAsync(CancellationToken cancellationToken = default)`
Whether the current desktop environment is Unity launcher.
**Returns:**
Whether the current desktop environment is Unity launcher.
#### 🧊 `void Quit()`
Try to close all windows. The BeforeQuit event will be emitted first. If all windows are successfully closed, the WillQuit event will be emitted and by default the application will terminate. This method guarantees that all beforeunload and unload event handlers are correctly executed. It is possible that a window cancels the quitting by returning false in the beforeunload event handler.
#### 🧊 `void ReleaseSingleInstanceLock()`
Releases all locks that were created by makeSingleInstance. This will allow multiple instances of the application to once again run side by side.
#### 🧊 `void Relaunch()`
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.
Note that this method does not quit the app when executed, you have to call Quit or Exit after calling Relaunch() to make the app restart.
When Relaunch() is called for multiple times, multiple instances will be started after current instance exited.
#### 🧊 `void Relaunch(RelaunchOptions relaunchOptions)`
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. When RelaunchOptions.Args is specified, the RelaunchOptions.Args will be passed as command line arguments instead. When RelaunchOptions.ExecPath is specified, the RelaunchOptions.ExecPath will be executed for relaunch instead of current app.
Note that this method does not quit the app when executed, you have to call Quit or Exit after calling Relaunch() to make the app restart.
When Relaunch() is called for multiple times, multiple instances will be started after current instance exited.
**Parameters:**
- `relaunchOptions` - Options for the relaunch
#### 🧊 `Task<bool> RemoveAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default)`
This method checks if the current executable as the default handler for a protocol (aka URI scheme). If so, it will remove the app as the default handler.
**Parameters:**
- `protocol` - The name of your protocol, without ://
- `cancellationToken` - The cancellation token
**Returns:**
Whether the call succeeded.
#### 🧊 `Task<bool> RequestSingleInstanceLockAsync(Action<string[], string> newInstanceOpened, CancellationToken cancellationToken = default)`
The return value of this method indicates whether or not this instance of your application successfully obtained the lock. If it failed to obtain the lock, you can assume that another instance of your application is already running with the lock and exit immediately.
I.e.This method returns true if your process is the primary instance of your application and your app should continue loading. It returns false if your process should immediately quit as it has sent its parameters to another instance that has already acquired the lock.
On macOS, the system enforces single instance automatically when users try to open a second instance of your app in Finder, and the open-file and open-url events will be emitted for that.However when users start your app in command line, the system's single instance mechanism will be bypassed, and you have to use this method to ensure single instance.
**Parameters:**
- `newInstanceOpened` - Lambda with an array of the second instance's command line arguments. The second parameter is the working directory path.
- `cancellationToken` - The cancellation token
**Returns:**
This method returns false if your process is the primary instance of the application and your app should continue loading. And returns true if your process has sent its parameters to another instance, and you should immediately quit.
#### 🧊 `void ResignCurrentActivity()`
Marks the current Handoff user activity as inactive without invalidating it.
#### 🧊 `void SetAccessibilitySupportEnabled(bool enabled)`
Manually enables Chrome's accessibility support, allowing to expose accessibility switch to users in application settings. See Chromium's accessibility docs for more details. Disabled (false) by default.
This API must be called after the Ready event is emitted.
Note: Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
**Parameters:**
- `enabled` - Enable or disable accessibility tree rendering
#### 🧊 `void SetAppLogsPath(string path)`
Sets or creates a directory your app's logs which can then be manipulated with GetPathAsync or SetPath.
Calling SetAppLogsPath without a path parameter will result in this directory being set to ~/Library/Logs/YourAppName on macOS, and inside the userData directory on Linux and Windows.
**Parameters:**
- `path` - A custom path for your logs. Must be absolute
#### 🧊 `void SetAppUserModelId(string id)`
Changes the Application User Model ID to id.
**Parameters:**
- `id` - Model Id
#### 🧊 `Task<bool> SetAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default)`
Sets the current executable as the default handler for a protocol (aka URI scheme). It allows you to integrate your app deeper into the operating system. Once registered, all links with your-protocol:// will be opened with the current executable. The whole link, including protocol, will be passed to your application as a parameter.
Note: On macOS, you can only register protocols that have been added to your app's info.plist, which cannot be modified at runtime. However, you can change the file during build time via Electron Forge, Electron Packager, or by editing info.plist with a text editor. Please refer to Apple's documentation for details.
Note: In a Windows Store environment (when packaged as an appx) this API will return true for all calls but the registry key it sets won't be accessible by other applications. In order to register your Windows Store application as a default protocol handler you must declare the protocol in your manifest.
The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme internally.
**Parameters:**
- `protocol` - The name of your protocol, without ://. For example, if you want your app to handle electron:// links, call this method with electron as the parameter.
- `cancellationToken` - The cancellation token
**Returns:**
Whether the call succeeded.
#### 🧊 `Task<bool> SetBadgeCountAsync(int count, CancellationToken cancellationToken = default)`
Sets the counter badge for current app. Setting the count to 0 will hide the badge. On macOS it shows on the dock icon. On Linux it only works for Unity launcher.
Note: Unity launcher requires the existence of a .desktop file to work, for more information please read Desktop Environment Integration.
**Parameters:**
- `count` - Counter badge
- `cancellationToken` - The cancellation token
**Returns:**
Whether the call succeeded.
#### 🧊 `void SetJumpList(JumpListCategory[] categories)`
Sets or removes a custom Jump List for the application. If categories is null the previously set custom Jump List (if any) will be replaced by the standard Jump List for the app (managed by Windows).
Note: If a JumpListCategory object has neither the Type nor the Name property set then its Type is assumed to be tasks. If the Name property is set but the Type property is omitted then the Type is assumed to be custom.
Note: Users can remove items from custom categories, and Windows will not allow a removed item to be added back into a custom category until after the next successful call to SetJumpList. Any attempt to re-add a removed item to a custom category earlier than that will result in the entire custom category being omitted from the Jump List. The list of removed items can be obtained using GetJumpListSettingsAsync.
**Parameters:**
- `categories` - Array of JumpListCategory objects
#### 🧊 `void SetLoginItemSettings(LoginSettings loginSettings)`
Set the app's login item settings.
To work with Electron's autoUpdater on Windows, which uses Squirrel, you'll want to set the launch path to Update.exe, and pass arguments that specify your application name.
**Parameters:**
- `loginSettings` - Login settings
#### 🧊 `void SetPath(PathName name, string path)`
Overrides the path to a special directory or file associated with name. If the path specifies a directory that does not exist, an Error is thrown. In that case, the directory should be created with fs.mkdirSync or similar.
You can only override paths of a name defined in GetPathAsync.
By default, web pages' cookies and caches will be stored under the PathName.UserData directory. If you want to change this location, you have to override the PathName.UserData path before the Ready event of the App module is emitted.
**Parameters:**
- `name` - Special directory name
- `path` - New path to a special directory
#### 🧊 `void SetUserActivity(string type, object userInfo)`
Creates an NSUserActivity and sets it as the current activity. The activity is eligible for Handoff to another device afterward.
**Parameters:**
- `type` - Uniquely identifies the activity. Maps to NSUserActivity.activityType.
- `userInfo` - App-specific state to store for use by another device
#### 🧊 `Task<bool> SetUserTasksAsync(UserTask[] userTasks, CancellationToken cancellationToken = default)`
Adds tasks to the UserTask category of the JumpList on Windows.
Note: If you'd like to customize the Jump List even more use SetJumpList instead.
**Parameters:**
- `userTasks` - Array of UserTask objects
- `cancellationToken` - The cancellation token
**Returns:**
Whether the call succeeded.
#### 🧊 `void Show()`
Shows application windows after they were hidden. Does not automatically focus them.
#### 🧊 `void ShowAboutPanel()`
Show the app's about panel options. These options can be overridden with SetAboutPanelOptions.
## Events
#### ⚡ `AccessibilitySupportChanged`
Emitted when Chrome's accessibility support changes. This event fires when assistive technologies, such as screen readers, are enabled or disabled. See https://www.chromium.org/developers/design-documents/accessibility for more details.
#### ⚡ `BrowserWindowBlur`
Emitted when a BrowserWindow blurred.
#### ⚡ `BrowserWindowCreated`
Emitted when a new BrowserWindow is created.
#### ⚡ `BrowserWindowFocus`
Emitted when a BrowserWindow gets focused.
#### ⚡ `OpenFile`
Emitted when a macOS user wants to open a file with the application. The open-file event is usually emitted when the application is already open and the OS wants to reuse the application to open the file. open-file is also emitted when a file is dropped onto the dock and the application is not yet running.
On Windows, you have to parse the arguments using App.CommandLine to get the filepath.
#### ⚡ `OpenUrl`
Emitted when a macOS user wants to open a URL with the application. Your application's Info.plist file must define the URL scheme within the CFBundleURLTypes key, and set NSPrincipalClass to AtomApplication.
#### ⚡ `Quitting`
Emitted when the application is quitting.
Note: On Windows, this event will not be emitted if the app is closed due to a shutdown/restart of the system or a user logout.
#### ⚡ `Ready`
Emitted when the application has finished basic startup.
#### ⚡ `WebContentsCreated`
Emitted when a new WebContents is created.
#### ⚡ `WillQuit`
Emitted when all windows have been closed and the application will quit.
See the description of the WindowAllClosed event for the differences between the WillQuit and WindowAllClosed events.
Note: On Windows, this event will not be emitted if the app is closed due to a shutdown/restart of the system or a user logout.
#### ⚡ `WindowAllClosed`
Emitted when all windows have been closed.
If you do not subscribe to this event and all windows are closed, the default behavior is to quit the app; however, if you subscribe, you control whether the app quits or not.If the user pressed Cmd + Q, or the developer called Quit, Electron will first try to close all the windows and then emit the WillQuit event, and in this case the WindowAllClosed event would not be emitted.
## Usage Examples
### Application Lifecycle
```csharp
// Handle app startup
Electron.App.Ready += () =>
{
Console.WriteLine("App is ready!");
};
// Handle window management
Electron.App.WindowAllClosed += () =>
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Electron.App.Quit();
}
};
// Prevent quit
Electron.App.BeforeQuit += async (args) =>
{
var result = await Electron.Dialog.ShowMessageBoxAsync("Do you want to quit?");
if (result.Response == 1) // Cancel
{
args.PreventDefault = true;
}
};
```
### Protocol Handling
```csharp
// Register custom protocol
var success = await Electron.App.SetAsDefaultProtocolClientAsync("myapp");
// Check if registered
var isDefault = await Electron.App.IsDefaultProtocolClientAsync("myapp");
```
### Jump List (Windows)
```csharp
// Set user tasks
await Electron.App.SetUserTasksAsync(new[]
{
new UserTask
{
Program = "myapp.exe",
Arguments = "--new-document",
Title = "New Document",
Description = "Create a new document"
}
});
```
### Application Information
```csharp
// Get app information
var appPath = await Electron.App.GetAppPathAsync();
var version = await Electron.App.GetVersionAsync();
var locale = await Electron.App.GetLocaleAsync();
// Set app name
await Electron.App.NameAsync; // Get current name
Electron.App.Name = "My Custom App Name";
```
### Badge Count (macOS/Linux)
```csharp
// Set badge count
await Electron.App.SetBadgeCountAsync(5);
// Get current badge count
var count = await Electron.App.GetBadgeCountAsync();
```
## Related APIs
- [Electron.WindowManager](WindowManager.md) - Window creation and management
- [Electron.Dialog](Dialog.md) - User interaction dialogs
- [Electron.Menu](Menu.md) - Application menus
## Additional Resources
- [Electron App Documentation](https://electronjs.org/docs/api/app) - Official Electron app API
- [Startup Methods](../Using/Startup-Methods.md) - Different application startup modes

243
docs/API/AutoUpdater.md Normal file
View File

@@ -0,0 +1,243 @@
# Electron.AutoUpdater
Handle application updates and installation processes.
## Overview
The `Electron.AutoUpdater` API provides comprehensive functionality for handling application updates, including checking for updates, downloading, and installation. It supports multiple update providers and platforms with automatic update capabilities.
## Properties
#### 📋 `bool AllowDowngrade`
Whether to allow version downgrade. Default is false.
#### 📋 `bool AllowPrerelease`
GitHub provider only. Whether to allow update to pre-release versions. Defaults to true if application version contains prerelease components.
#### 📋 `bool AutoDownload`
Whether to automatically download an update when it is found. Default is true.
#### 📋 `bool AutoInstallOnAppQuit`
Whether to automatically install a downloaded update on app quit. Applicable only on Windows and Linux.
#### 📋 `string Channel`
Get the update channel. Not applicable for GitHub. Doesn't return channel from the update configuration, only if was previously set.
#### 📋 `Task<string> ChannelAsync`
Get the update channel. Not applicable for GitHub. Doesn't return channel from the update configuration, only if was previously set.
#### 📋 `Task<SemVer> CurrentVersionAsync`
Get the current application version.
#### 📋 `bool FullChangelog`
GitHub provider only. Get all release notes (from current version to latest), not just the latest. Default is false.
#### 📋 `Dictionary<string, string> RequestHeaders`
The request headers.
#### 📋 `Task<Dictionary<string, string>> RequestHeadersAsync`
Get the current request headers.
#### 📋 `string UpdateConfigPath`
For test only. Configuration path for updates.
## Methods
#### 🧊 `Task<UpdateCheckResult> CheckForUpdatesAndNotifyAsync()`
Asks the server whether there is an update and notifies the user if an update is available.
#### 🧊 `Task<UpdateCheckResult> CheckForUpdatesAsync()`
Asks the server whether there is an update.
#### 🧊 `Task<string> DownloadUpdateAsync()`
Start downloading update manually. Use this method if AutoDownload option is set to false.
**Returns:**
Path to downloaded file.
#### 🧊 `Task<string> GetFeedURLAsync()`
Get the current feed URL.
**Returns:**
Feed URL.
#### 🧊 `void QuitAndInstall(bool isSilent = false, bool isForceRunAfter = false)`
Restarts the app and installs the update after it has been downloaded. Should only be called after update-downloaded has been emitted.
Note: QuitAndInstall() will close all application windows first and only emit before-quit event on app after that. This is different from the normal quit event sequence.
**Parameters:**
- `isSilent` - Windows-only: Runs the installer in silent mode. Defaults to false
- `isForceRunAfter` - Run the app after finish even on silent install. Not applicable for macOS
## Events
#### ⚡ `OnCheckingForUpdate`
Emitted when checking if an update has started.
#### ⚡ `OnDownloadProgress`
Emitted on download progress.
#### ⚡ `OnError`
Emitted when there is an error while updating.
#### ⚡ `OnUpdateAvailable`
Emitted when there is an available update. The update is downloaded automatically if AutoDownload is true.
#### ⚡ `OnUpdateDownloaded`
Emitted on download complete.
#### ⚡ `OnUpdateNotAvailable`
Emitted when there is no available update.
## Usage Examples
### Basic Auto-Update Setup
```csharp
// Configure auto-updater
Electron.AutoUpdater.AutoDownload = true;
Electron.AutoUpdater.AutoInstallOnAppQuit = true;
// Check for updates
var updateCheck = await Electron.AutoUpdater.CheckForUpdatesAsync();
if (updateCheck.UpdateInfo != null)
{
Console.WriteLine($"Update available: {updateCheck.UpdateInfo.Version}");
}
```
### Manual Update Management
```csharp
// Disable auto-download for manual control
Electron.AutoUpdater.AutoDownload = false;
// Check for updates
var result = await Electron.AutoUpdater.CheckForUpdatesAsync();
if (result.UpdateInfo != null)
{
Console.WriteLine($"Update found: {result.UpdateInfo.Version}");
// Ask user confirmation
var confirmResult = await Electron.Dialog.ShowMessageBoxAsync(
"Update Available",
$"Version {result.UpdateInfo.Version} is available. Download now?");
if (confirmResult.Response == 1) // Yes
{
// Download update manually
var downloadPath = await Electron.AutoUpdater.DownloadUpdateAsync();
Console.WriteLine($"Downloaded to: {downloadPath}");
// Install update
Electron.AutoUpdater.QuitAndInstall();
}
}
```
### Update Event Handling
```csharp
// Handle update events
Electron.AutoUpdater.OnCheckingForUpdate += () =>
{
Console.WriteLine("Checking for updates...");
};
Electron.AutoUpdater.OnUpdateAvailable += (updateInfo) =>
{
Console.WriteLine($"Update available: {updateInfo.Version}");
};
Electron.AutoUpdater.OnUpdateNotAvailable += (updateInfo) =>
{
Console.WriteLine("No updates available");
};
Electron.AutoUpdater.OnDownloadProgress += (progressInfo) =>
{
Console.WriteLine($"Download progress: {progressInfo.Percent}%");
};
Electron.AutoUpdater.OnUpdateDownloaded += (updateInfo) =>
{
Console.WriteLine($"Update downloaded: {updateInfo.Version}");
// Show notification to user
Electron.Notification.Show(new NotificationOptions
{
Title = "Update Downloaded",
Body = $"Version {updateInfo.Version} is ready to install.",
Actions = new[]
{
new NotificationAction { Text = "Install Now", Type = NotificationActionType.Button },
new NotificationAction { Text = "Later", Type = NotificationActionType.Button }
}
});
};
Electron.AutoUpdater.OnError += (error) =>
{
Console.WriteLine($"Update error: {error}");
Electron.Dialog.ShowErrorBox("Update Error", $"Failed to update: {error}");
};
```
### GitHub Provider Configuration
```csharp
// Configure for GitHub releases
Electron.AutoUpdater.AllowPrerelease = true; // Allow pre-release versions
Electron.AutoUpdater.FullChangelog = true; // Get full changelog
Electron.AutoUpdater.AllowDowngrade = false; // Prevent downgrades
// Set request headers if needed
Electron.AutoUpdater.RequestHeaders = new Dictionary<string, string>
{
["Authorization"] = "token your-github-token",
["User-Agent"] = "MyApp-Updater"
};
```
### Update Installation
```csharp
// Install update immediately
if (updateDownloaded)
{
Electron.AutoUpdater.QuitAndInstall();
}
// Silent install (Windows only)
Electron.AutoUpdater.QuitAndInstall(isSilent: true, isForceRunAfter: true);
```
### Version Management
```csharp
// Get current version
var currentVersion = await Electron.AutoUpdater.CurrentVersionAsync;
Console.WriteLine($"Current version: {currentVersion}");
// Get update channel
var channel = await Electron.AutoUpdater.ChannelAsync;
Console.WriteLine($"Update channel: {channel}");
// Set custom feed URL
// Note: This would typically be configured in electron-builder.json
var feedUrl = await Electron.AutoUpdater.GetFeedURLAsync();
Console.WriteLine($"Feed URL: {feedUrl}");
```
## Related APIs
- [Electron.App](App.md) - Application lifecycle events during updates
- [Electron.Notification](Notification.md) - Notify users about update status
- [Electron.Dialog](Dialog.md) - Show update confirmation dialogs
## Additional Resources
- [Electron AutoUpdater Documentation](https://electronjs.org/docs/api/auto-updater) - Official Electron auto-updater API

231
docs/API/Clipboard.md Normal file
View File

@@ -0,0 +1,231 @@
# Electron.Clipboard
Perform copy and paste operations on the system clipboard.
## Overview
The `Electron.Clipboard` API provides comprehensive access to the system clipboard, supporting multiple data formats including text, HTML, RTF, images, and custom data. It enables reading from and writing to the clipboard with platform-specific behavior.
## Methods
#### 🧊 `Task<string[]> AvailableFormatsAsync(string type = "")`
Get an array of supported formats for the clipboard type.
**Parameters:**
- `type` - Clipboard type
**Returns:**
An array of supported formats for the clipboard type.
#### 🧊 `void Clear(string type = "")`
Clears the clipboard content.
**Parameters:**
- `type` - Clipboard type
#### 🧊 `Task<ReadBookmark> ReadBookmarkAsync()`
Returns an Object containing title and url keys representing the bookmark in the clipboard. The title and url values will be empty strings when the bookmark is unavailable.
**Returns:**
Object containing title and url keys representing the bookmark in the clipboard.
#### 🧊 `Task<string> ReadFindTextAsync()`
macOS: The text on the find pasteboard. This method uses synchronous IPC when called from the renderer process. The cached value is reread from the find pasteboard whenever the application is activated.
**Returns:**
The text on the find pasteboard.
#### 🧊 `Task<string> ReadHTMLAsync(string type = "")`
Read the content in the clipboard as HTML markup.
**Parameters:**
- `type` - Clipboard type
**Returns:**
The content in the clipboard as markup.
#### 🧊 `Task<NativeImage> ReadImageAsync(string type = "")`
Read an image from the clipboard.
**Parameters:**
- `type` - Clipboard type
**Returns:**
An image from the clipboard.
#### 🧊 `Task<string> ReadRTFAsync(string type = "")`
Read the content in the clipboard as RTF.
**Parameters:**
- `type` - Clipboard type
**Returns:**
The content in the clipboard as RTF.
#### 🧊 `Task<string> ReadTextAsync(string type = "")`
Read the content in the clipboard as plain text.
**Parameters:**
- `type` - Clipboard type
**Returns:**
The content in the clipboard as plain text.
#### 🧊 `void Write(Data data, string type = "")`
Writes data to the clipboard.
**Parameters:**
- `data` - Data object to write
- `type` - Clipboard type
#### 🧊 `void WriteBookmark(string title, string url, string type = "")`
Writes the title and url into the clipboard as a bookmark.
Note: Most apps on Windows don't support pasting bookmarks into them so you can use clipboard.write to write both a bookmark and fallback text to the clipboard.
**Parameters:**
- `title` - Bookmark title
- `url` - Bookmark URL
- `type` - Clipboard type
#### 🧊 `void WriteFindText(string text)`
macOS: Writes the text into the find pasteboard as plain text. This method uses synchronous IPC when called from the renderer process.
**Parameters:**
- `text` - Text to write to find pasteboard
#### 🧊 `void WriteHTML(string markup, string type = "")`
Writes markup to the clipboard.
**Parameters:**
- `markup` - HTML markup to write
- `type` - Clipboard type
#### 🧊 `void WriteImage(NativeImage image, string type = "")`
Writes an image to the clipboard.
**Parameters:**
- `image` - Image to write to clipboard
- `type` - Clipboard type
#### 🧊 `void WriteRTF(string text, string type = "")`
Writes the text into the clipboard in RTF.
**Parameters:**
- `text` - RTF content to write
- `type` - Clipboard type
#### 🧊 `void WriteText(string text, string type = "")`
Writes the text into the clipboard as plain text.
**Parameters:**
- `text` - Text content to write
- `type` - Clipboard type
## Usage Examples
### Basic Text Operations
```csharp
// Read text from clipboard
var text = await Electron.Clipboard.ReadTextAsync();
Console.WriteLine($"Clipboard text: {text}");
// Write text to clipboard
Electron.Clipboard.WriteText("Hello, Electron.NET!");
// Read with specific type
var html = await Electron.Clipboard.ReadHTMLAsync("public.main");
```
### Rich Content Handling
```csharp
// Copy formatted text
var htmlContent = "<h1>Title</h1><p>Some <strong>bold</strong> text</p>";
Electron.Clipboard.WriteHTML(htmlContent);
// Read RTF content
var rtf = await Electron.Clipboard.ReadRTFAsync();
Console.WriteLine($"RTF content: {rtf}");
```
### Image Operations
```csharp
// Read image from clipboard
var image = await Electron.Clipboard.ReadImageAsync();
if (image != null)
{
Console.WriteLine($"Image size: {image.Size.Width}x{image.Size.Height}");
}
// Write image to clipboard
var nativeImage = NativeImage.CreateFromPath("screenshot.png");
Electron.Clipboard.WriteImage(nativeImage);
```
### Bookmark Management
```csharp
// Read bookmark from clipboard
var bookmark = await Electron.Clipboard.ReadBookmarkAsync();
if (!string.IsNullOrEmpty(bookmark.Title))
{
Console.WriteLine($"Bookmark: {bookmark.Title} -> {bookmark.Url}");
}
// Write bookmark to clipboard
Electron.Clipboard.WriteBookmark("Electron.NET", "https://github.com/ElectronNET/Electron.NET");
```
### Advanced Clipboard Operations
```csharp
// Check available formats
var formats = await Electron.Clipboard.AvailableFormatsAsync();
Console.WriteLine($"Available formats: {string.Join(", ", formats)}");
// Clear clipboard
Electron.Clipboard.Clear();
// Write custom data
var data = new Data
{
Text = "Custom data",
Html = "<p>Custom HTML</p>",
Image = nativeImage
};
Electron.Clipboard.Write(data);
```
### macOS Find Pasteboard
```csharp
// macOS specific find pasteboard operations
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
// Read find text
var findText = await Electron.Clipboard.ReadFindTextAsync();
Console.WriteLine($"Find text: {findText}");
// Write find text
Electron.Clipboard.WriteFindText("search term");
}
```
## Related APIs
- [Electron.Shell](Shell.md) - Work with file paths from clipboard
- [Electron.Notification](Notification.md) - Show clipboard operation results
## Additional Resources
- [Electron Clipboard Documentation](https://electronjs.org/docs/api/clipboard) - Official Electron clipboard API

160
docs/API/Dialog.md Normal file
View File

@@ -0,0 +1,160 @@
# Electron.Dialog
Display native system dialogs for opening and saving files, alerting, etc.
## Overview
The `Electron.Dialog` API provides access to native system dialogs for file operations, message boxes, and certificate trust dialogs. These dialogs are modal and provide a consistent user experience across different platforms.
## Methods
#### 🧊 `Task<MessageBoxResult> ShowMessageBoxAsync(BrowserWindow browserWindow, MessageBoxOptions messageBoxOptions)`
Shows a message box, it will block the process until the message box is closed. It returns the index of the clicked button. If a callback is passed, the dialog will not block the process.
**Parameters:**
- `browserWindow` - The browserWindow argument allows the dialog to attach itself to a parent window, making it modal.
- `messageBoxOptions` - Message content and configuration
**Returns:**
The API call will be asynchronous and the result will be passed via MessageBoxResult.
#### 🧊 `Task<MessageBoxResult> ShowMessageBoxAsync(BrowserWindow browserWindow, string message)`
Shows a message box, it will block the process until the message box is closed. It returns the index of the clicked button. If a callback is passed, the dialog will not block the process.
**Parameters:**
- `browserWindow` - The browserWindow argument allows the dialog to attach itself to a parent window, making it modal.
- `message` - Message content
**Returns:**
The API call will be asynchronous and the result will be passed via MessageBoxResult.
#### 🧊 `Task<MessageBoxResult> ShowMessageBoxAsync(MessageBoxOptions messageBoxOptions)`
Shows a message box, it will block the process until the message box is closed. It returns the index of the clicked button. If a callback is passed, the dialog will not block the process.
**Parameters:**
- `messageBoxOptions` - Message content and configuration
**Returns:**
The API call will be asynchronous and the result will be passed via MessageBoxResult.
#### 🧊 `Task<MessageBoxResult> ShowMessageBoxAsync(string message)`
Shows a message box, it will block the process until the message box is closed. It returns the index of the clicked button. If a callback is passed, the dialog will not block the process.
**Parameters:**
- `message` - Message content
**Returns:**
The API call will be asynchronous and the result will be passed via MessageBoxResult.
#### 🧊 `Task<string[]> ShowOpenDialogAsync(BrowserWindow browserWindow, OpenDialogOptions options)`
Note: On Windows and Linux an open dialog can not be both a file selector and a directory selector, so if you set properties to ['openFile', 'openDirectory'] on these platforms, a directory selector will be shown.
**Parameters:**
- `browserWindow` - The browserWindow argument allows the dialog to attach itself to a parent window, making it modal.
- `options` - Dialog configuration options
**Returns:**
An array of file paths chosen by the user
#### 🧊 `Task<string> ShowSaveDialogAsync(BrowserWindow browserWindow, SaveDialogOptions options)`
Dialog for save files.
**Parameters:**
- `browserWindow` - The browserWindow argument allows the dialog to attach itself to a parent window, making it modal.
- `options` - Dialog configuration options
**Returns:**
Returns String, the path of the file chosen by the user, if a callback is provided it returns an empty string.
#### 🧊 `void ShowErrorBox(string title, string content)`
Displays a modal dialog that shows an error message.
This API can be called safely before the ready event the app module emits, it is usually used to report errors in early stage of startup.If called before the app readyevent on Linux, the message will be emitted to stderr, and no GUI dialog will appear.
**Parameters:**
- `title` - The title to display in the error box.
- `content` - The text content to display in the error box.
#### 🧊 `Task ShowCertificateTrustDialogAsync(BrowserWindow browserWindow, CertificateTrustDialogOptions options)`
On macOS, this displays a modal dialog that shows a message and certificate information, and gives the user the option of trusting/importing the certificate. If you provide a browserWindow argument the dialog will be attached to the parent window, making it modal.
**Parameters:**
- `browserWindow` - Parent window for modal behavior
- `options` - Certificate trust dialog options
#### 🧊 `Task ShowCertificateTrustDialogAsync(CertificateTrustDialogOptions options)`
On macOS, this displays a modal dialog that shows a message and certificate information, and gives the user the option of trusting/importing the certificate. If you provide a browserWindow argument the dialog will be attached to the parent window, making it modal.
**Parameters:**
- `options` - Certificate trust dialog options
## Usage Examples
### File Operations
```csharp
// Open multiple files
var files = await Electron.Dialog.ShowOpenDialogAsync(window, new OpenDialogOptions
{
Properties = new[] { OpenDialogProperty.OpenFile, OpenDialogProperty.MultiSelections }
});
// Save with custom extension
var path = await Electron.Dialog.ShowSaveDialogAsync(window, new SaveDialogOptions
{
DefaultPath = "backup.json",
Filters = new[] { new FileFilter { Name = "JSON", Extensions = new[] { "json" } } }
});
```
### User Confirmation
```csharp
// Confirmation dialog
var result = await Electron.Dialog.ShowMessageBoxAsync(window, new MessageBoxOptions
{
Type = MessageBoxType.Question,
Title = "Confirm Delete",
Message = $"Delete {filename}?",
Buttons = new[] { "Cancel", "Delete" },
DefaultId = 0,
CancelId = 0
});
if (result.Response == 1)
{
// Delete file
}
```
### Error Handling
```csharp
// Error dialog
Electron.Dialog.ShowErrorBox("Save Failed", "Could not save file. Please check permissions and try again.");
// Warning dialog
await Electron.Dialog.ShowMessageBoxAsync(new MessageBoxOptions
{
Type = MessageBoxType.Warning,
Title = "Warning",
Message = "This operation may take several minutes.",
Buttons = new[] { "Continue", "Cancel" }
});
```
## Related APIs
- [Electron.WindowManager](WindowManager.md) - Parent windows for modal dialogs
- [Electron.App](App.md) - Application lifecycle events
- [Electron.Shell](Shell.md) - File operations with selected paths
## Additional Resources
- [Electron Dialog Documentation](https://electronjs.org/docs/api/dialog) - Official Electron dialog API

209
docs/API/Dock.md Normal file
View File

@@ -0,0 +1,209 @@
# Electron.Dock
Control your app in the macOS dock.
## Overview
The `Electron.Dock` API provides control over your application's appearance and behavior in the macOS dock. This includes bouncing the dock icon, setting badges, managing menus, and controlling visibility.
## Properties
#### 📋 `IReadOnlyCollection<MenuItem> MenuItems`
Gets a read-only collection of all current dock menu items.
## Methods
#### 🧊 `Task<int> BounceAsync(DockBounceType type, CancellationToken cancellationToken = default)`
When `DockBounceType.Critical` is passed, the dock icon will bounce until either the application becomes active or the request is canceled. When `DockBounceType.Informational` is passed, the dock icon will bounce for one second. However, the request remains active until either the application becomes active or the request is canceled.
Note: This method can only be used while the app is not focused; when the app is focused it will return -1.
**Parameters:**
- `type` - Can be critical or informational. The default is informational.
- `cancellationToken` - The cancellation token
**Returns:**
An ID representing the request.
#### 🧊 `void CancelBounce(int id)`
Cancel the bounce of id.
**Parameters:**
- `id` - Id of the request
#### 🧊 `void DownloadFinished(string filePath)`
Bounces the Downloads stack if the filePath is inside the Downloads folder.
**Parameters:**
- `filePath` - Path to the downloaded file
#### 🧊 `Task<string> GetBadgeAsync(CancellationToken cancellationToken = default)`
Gets the string to be displayed in the dock's badging area.
**Returns:**
The badge string of the dock.
#### 🧊 `Task<Menu> GetMenu(CancellationToken cancellationToken = default)`
Gets the application's dock menu.
**Returns:**
The application's dock menu.
#### 🧊 `void Hide()`
Hides the dock icon.
#### 🧊 `Task<bool> IsVisibleAsync(CancellationToken cancellationToken = default)`
Whether the dock icon is visible. The app.dock.show() call is asynchronous so this method might not return true immediately after that call.
**Returns:**
Whether the dock icon is visible.
#### 🧊 `void SetBadge(string text)`
Sets the string to be displayed in the dock's badging area.
**Parameters:**
- `text` - Badge text to display
#### 🧊 `void SetIcon(string image)`
Sets the image associated with this dock icon.
**Parameters:**
- `image` - Icon image path
#### 🧊 `void SetMenu(MenuItem[] menuItems)`
Sets the application's dock menu.
**Parameters:**
- `menuItems` - Array of menu items for the dock menu
#### 🧊 `void Show()`
Shows the dock icon.
## Usage Examples
### Basic Dock Operations
```csharp
// Hide/Show dock icon
Electron.Dock.Hide();
await Task.Delay(2000);
Electron.Dock.Show();
// Check visibility
var isVisible = await Electron.Dock.IsVisibleAsync();
Console.WriteLine($"Dock visible: {isVisible}");
```
### Badge Notifications
```csharp
// Set badge count
Electron.Dock.SetBadge("5");
// Get current badge
var badge = await Electron.Dock.GetBadgeAsync();
Console.WriteLine($"Current badge: {badge}");
// Clear badge
Electron.Dock.SetBadge("");
```
### Dock Icon Animation
```csharp
// Bounce for attention
var bounceId = await Electron.Dock.BounceAsync(DockBounceType.Critical);
Console.WriteLine($"Bounce ID: {bounceId}");
// Cancel bounce after 3 seconds
await Task.Delay(3000);
Electron.Dock.CancelBounce(bounceId);
// Informational bounce
await Electron.Dock.BounceAsync(DockBounceType.Informational);
```
### Dock Menu
```csharp
// Create dock menu
var dockMenuItems = new[]
{
new MenuItem { Label = "Show Window", Click = () => ShowMainWindow() },
new MenuItem { Label = "Settings", Click = () => OpenSettings() },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Label = "Exit", Click = () => Electron.App.Quit() }
};
// Set dock menu
Electron.Dock.SetMenu(dockMenuItems);
// Get current menu
var currentMenu = await Electron.Dock.GetMenu();
Console.WriteLine($"Menu items: {Electron.Dock.MenuItems.Count}");
```
### Download Notifications
```csharp
// Notify about completed download
var downloadPath = "/Users/username/Downloads/document.pdf";
Electron.Dock.DownloadFinished(downloadPath);
```
### Custom Dock Icon
```csharp
// Set custom dock icon
Electron.Dock.SetIcon("assets/custom-dock-icon.png");
// Set icon based on status
if (isConnected)
{
Electron.Dock.SetIcon("assets/connected-icon.png");
}
else
{
Electron.Dock.SetIcon("assets/disconnected-icon.png");
}
```
### Application Integration
```csharp
// Update dock badge based on unread count
UpdateDockBadge(unreadMessageCount);
void UpdateDockBadge(int count)
{
if (count > 0)
{
Electron.Dock.SetBadge(count.ToString());
}
else
{
Electron.Dock.SetBadge("");
}
}
// Animate dock when receiving message
private async void OnMessageReceived()
{
await Electron.Dock.BounceAsync(DockBounceType.Informational);
Electron.Dock.SetBadge((unreadCount + 1).ToString());
}
```
## Related APIs
- [Electron.App](App.md) - Application lifecycle events
- [Electron.Notification](Notification.md) - Desktop notifications
- [Electron.Menu](Menu.md) - Menu items for dock menu
## Additional Resources
- [Electron Dock Documentation](https://electronjs.org/docs/api/dock) - Official Electron dock API

189
docs/API/GlobalShortcut.md Normal file
View File

@@ -0,0 +1,189 @@
# Electron.GlobalShortcut
Register global keyboard shortcuts that work even when the application is not focused.
## Overview
The `Electron.GlobalShortcut` API provides the ability to register global keyboard shortcuts that can be triggered even when the application does not have keyboard focus. This is useful for creating system-wide hotkeys and shortcuts.
## Methods
#### 🧊 `Task<bool> IsRegisteredAsync(string accelerator)`
Check if the accelerator is registered.
**Parameters:**
- `accelerator` - Keyboard shortcut to check
**Returns:**
Whether this application has registered the accelerator.
#### 🧊 `void Register(string accelerator, Action function)`
Registers a global shortcut of accelerator. The callback is called when the registered shortcut is pressed by the user.
**Parameters:**
- `accelerator` - Keyboard shortcut combination
- `function` - Callback function to execute when shortcut is pressed
#### 🧊 `void Unregister(string accelerator)`
Unregisters the global shortcut of accelerator.
**Parameters:**
- `accelerator` - Keyboard shortcut to unregister
#### 🧊 `void UnregisterAll()`
Unregisters all of the global shortcuts.
## Usage Examples
### Basic Global Shortcuts
```csharp
// Register global shortcuts
Electron.GlobalShortcut.Register("CommandOrControl+N", () =>
{
CreateNewDocument();
});
Electron.GlobalShortcut.Register("CommandOrControl+O", () =>
{
OpenDocument();
});
Electron.GlobalShortcut.Register("CommandOrControl+S", () =>
{
SaveDocument();
});
```
### Media Control Shortcuts
```csharp
// Media playback shortcuts
Electron.GlobalShortcut.Register("MediaPlayPause", () =>
{
TogglePlayback();
});
Electron.GlobalShortcut.Register("MediaNextTrack", () =>
{
NextTrack();
});
Electron.GlobalShortcut.Register("MediaPreviousTrack", () =>
{
PreviousTrack();
});
```
### Application Control Shortcuts
```csharp
// Application control shortcuts
Electron.GlobalShortcut.Register("CommandOrControl+Shift+Q", async () =>
{
var result = await Electron.Dialog.ShowMessageBoxAsync("Quit Application?", "Are you sure you want to quit?");
if (result.Response == 1) // Yes
{
Electron.App.Quit();
}
});
Electron.GlobalShortcut.Register("CommandOrControl+Shift+H", () =>
{
ToggleMainWindow();
});
```
### Dynamic Shortcut Management
```csharp
// Register shortcuts based on user preferences
public void RegisterUserShortcuts(Dictionary<string, Action> shortcuts)
{
foreach (var shortcut in shortcuts)
{
Electron.GlobalShortcut.Register(shortcut.Key, shortcut.Value);
}
}
// Check if shortcut is available
public async Task<bool> IsShortcutAvailable(string accelerator)
{
return await Electron.GlobalShortcut.IsRegisteredAsync(accelerator);
}
// Unregister specific shortcut
public void UnregisterShortcut(string accelerator)
{
Electron.GlobalShortcut.Unregister(accelerator);
}
```
### Platform-Specific Shortcuts
```csharp
// macOS specific shortcuts
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Electron.GlobalShortcut.Register("Command+Comma", () =>
{
OpenPreferences();
});
Electron.GlobalShortcut.Register("Command+H", () =>
{
Electron.App.Hide();
});
}
// Windows/Linux shortcuts
else
{
Electron.GlobalShortcut.Register("Ctrl+Shift+P", () =>
{
OpenPreferences();
});
Electron.GlobalShortcut.Register("Alt+F4", () =>
{
Electron.App.Quit();
});
}
```
### Shortcut Validation
```csharp
// Validate shortcuts before registration
public async Task<bool> TryRegisterShortcut(string accelerator, Action callback)
{
if (await Electron.GlobalShortcut.IsRegisteredAsync(accelerator))
{
Console.WriteLine($"Shortcut {accelerator} is already registered");
return false;
}
try
{
Electron.GlobalShortcut.Register(accelerator, callback);
Console.WriteLine($"Successfully registered shortcut: {accelerator}");
return true;
}
catch (Exception ex)
{
Console.WriteLine($"Failed to register shortcut {accelerator}: {ex.Message}");
return false;
}
}
```
## Related APIs
- [Electron.App](App.md) - Application lifecycle events
- [Electron.Menu](Menu.md) - Menu-based shortcuts
- [Electron.WindowManager](WindowManager.md) - Window focus management
## Additional Resources
- [Electron GlobalShortcut Documentation](https://electronjs.org/docs/api/global-shortcut) - Official Electron global shortcut API

152
docs/API/HostHook.md Normal file
View File

@@ -0,0 +1,152 @@
# Electron.HostHook
Execute native JavaScript/TypeScript code from the host process.
## Overview
The `Electron.HostHook` API allows you to execute native JavaScript/TypeScript code from the host process. This enables advanced integration scenarios where you need to run custom JavaScript code or access Node.js APIs directly.
## Methods
#### 🧊 `void Call(string socketEventName, params dynamic[] arguments)`
Execute native JavaScript/TypeScript code synchronously.
**Parameters:**
- `socketEventName` - Socket name registered on the host
- `arguments` - Optional parameters
#### 🧊 `Task<T> CallAsync<T>(string socketEventName, params dynamic[] arguments)`
Execute native JavaScript/TypeScript code asynchronously with type-safe return values.
**Parameters:**
- `T` - Expected return type
- `socketEventName` - Socket name registered on the host
- `arguments` - Optional parameters
**Returns:**
Task<T> with the result from the executed host code.
## Usage Examples
### Basic Host Hook Execution
```csharp
// Execute simple JavaScript function
Electron.HostHook.Call("myFunction", "parameter1", 42);
// Execute with callback-style result
var result = await Electron.HostHook.CallAsync<string>("getUserName", userId);
Console.WriteLine($"User name: {result}");
```
### Advanced Integration
```csharp
// Call custom Electron API
var fileContent = await Electron.HostHook.CallAsync<string>("readFile", "config.json");
Console.WriteLine($"Config: {fileContent}");
// Execute with multiple parameters
var processedData = await Electron.HostHook.CallAsync<object[]>("processData", rawData, options);
// Call with complex objects
var settings = new { theme = "dark", language = "en" };
var updatedSettings = await Electron.HostHook.CallAsync<object>("updateSettings", settings);
```
### Error Handling
```csharp
try
{
// Execute host function with error handling
var result = await Electron.HostHook.CallAsync<string>("riskyOperation", inputData);
Console.WriteLine($"Success: {result}");
}
catch (Exception ex)
{
// Handle execution errors
Console.WriteLine($"Host hook error: {ex.Message}");
Electron.Dialog.ShowErrorBox("Operation Failed", "Could not execute host function.");
}
```
### Type-Safe Operations
```csharp
// Strongly typed return values
var userInfo = await Electron.HostHook.CallAsync<UserInfo>("getUserInfo", userId);
Console.WriteLine($"User: {userInfo.Name}, Email: {userInfo.Email}");
// Array results
var fileList = await Electron.HostHook.CallAsync<string[]>("listFiles", directoryPath);
foreach (var file in fileList)
{
Console.WriteLine($"File: {file}");
}
// Complex object results
var systemStats = await Electron.HostHook.CallAsync<SystemStatistics>("getSystemStats");
Console.WriteLine($"CPU: {systemStats.CpuUsage}%, Memory: {systemStats.MemoryUsage}%");
```
### Custom ElectronHostHook Setup
```csharp
// In your ElectronHostHook/index.ts
import { app } from 'electron';
export function getAppVersion(): string {
return app.getVersion();
}
export async function readConfigFile(): Promise<string> {
const fs = require('fs').promises;
return await fs.readFile('config.json', 'utf8');
}
export function customNotification(message: string): void {
// Custom notification logic
console.log(`Custom notification: ${message}`);
}
```
### Integration with .NET Code
```csharp
// Use host hook in your application logic
public async Task<string> GetApplicationVersion()
{
return await Electron.HostHook.CallAsync<string>("getAppVersion");
}
public async Task LoadConfiguration()
{
try
{
var config = await Electron.HostHook.CallAsync<ConfigObject>("readConfigFile");
ApplyConfiguration(config);
}
catch (Exception ex)
{
Console.WriteLine($"Failed to load config: {ex.Message}");
UseDefaultConfiguration();
}
}
public void ShowCustomNotification(string message)
{
Electron.HostHook.Call("customNotification", message);
}
```
## Related APIs
- [Electron.IpcMain](IpcMain.md) - Inter-process communication
- [Electron.App](App.md) - Application lifecycle events
- [Electron.WebContents](WebContents.md) - Web content integration
## Additional Resources
- [Host Hook Documentation](../Core/Advanced-Migration-Topics.md) - Setting up custom host hooks

167
docs/API/IpcMain.md Normal file
View File

@@ -0,0 +1,167 @@
# Electron.IpcMain
Communicate asynchronously from the main process to renderer processes.
## Overview
The `Electron.IpcMain` API provides inter-process communication between the main process and renderer processes. It allows you to send messages, listen for events, and handle communication between different parts of your Electron application.
## Methods
#### 🧊 `Task On(string channel, Action<object> listener)`
Listens to channel, when a new message arrives listener would be called with listener(event, args...).
**Parameters:**
- `channel` - Channel name to listen on
- `listener` - Callback method to handle incoming messages
#### 🧊 `void OnSync(string channel, Func<object, object> listener)`
Send a message to the renderer process synchronously via channel. Note: Sending a synchronous message will block the whole renderer process.
**Parameters:**
- `channel` - Channel name to listen on
- `listener` - Synchronous callback method
#### 🧊 `void Once(string channel, Action<object> listener)`
Adds a one time listener method for the event. This listener is invoked only the next time a message is sent to channel, after which it is removed.
**Parameters:**
- `channel` - Channel name to listen on
- `listener` - Callback method to handle the message once
#### 🧊 `void RemoveAllListeners(string channel)`
Removes all listeners of the specified channel.
**Parameters:**
- `channel` - Channel name to remove listeners from
#### 🧊 `void Send(BrowserView browserView, string channel, params object[] data)`
Send a message to the BrowserView renderer process asynchronously via channel.
**Parameters:**
- `browserView` - Target browser view
- `channel` - Channel name to send on
- `data` - Arguments to send
#### 🧊 `void Send(BrowserWindow browserWindow, string channel, params object[] data)`
Send a message to the renderer process asynchronously via channel.
**Parameters:**
- `browserWindow` - Target browser window
- `channel` - Channel name to send on
- `data` - Arguments to send
## Usage Examples
### Basic Message Handling
```csharp
// Listen for messages from renderer
await Electron.IpcMain.On("request-data", (args) =>
{
Console.WriteLine($"Received request: {args}");
// Process the request and send response
});
// Send response back to renderer
Electron.IpcMain.Send(mainWindow, "data-response", processedData);
```
### Synchronous Communication
```csharp
// Handle synchronous requests
Electron.IpcMain.OnSync("get-user-info", (request) =>
{
var userId = request.ToString();
var userInfo = GetUserInfo(userId);
return userInfo;
});
```
### One-time Event Handling
```csharp
// Handle initialization request once
Electron.IpcMain.Once("app-initialized", (args) =>
{
Console.WriteLine("App initialized, setting up...");
InitializeApplication();
});
```
### Complex Data Exchange
```csharp
// Send complex data to renderer
var appData = new
{
Version = "1.0.0",
Features = new[] { "feature1", "feature2" },
Settings = new { Theme = "dark", Language = "en" }
};
Electron.IpcMain.Send(mainWindow, "app-config", appData);
// Listen for settings updates
await Electron.IpcMain.On("update-settings", (settings) =>
{
var config = JsonConvert.DeserializeObject<AppSettings>(settings.ToString());
ApplySettings(config);
});
```
### Multi-Window Communication
```csharp
// Send message to specific window
var settingsWindow = await Electron.WindowManager.CreateWindowAsync();
Electron.IpcMain.Send(settingsWindow, "show-settings", currentSettings);
// Broadcast to all windows
foreach (var window in Electron.WindowManager.BrowserWindows)
{
Electron.IpcMain.Send(window, "notification", message);
}
```
### Error Handling
```csharp
// Handle IPC errors gracefully
await Electron.IpcMain.On("risky-operation", async (args) =>
{
try
{
var result = await PerformRiskyOperation(args);
Electron.IpcMain.Send(mainWindow, "operation-success", result);
}
catch (Exception ex)
{
Electron.IpcMain.Send(mainWindow, "operation-error", ex.Message);
}
});
```
### Integration with Host Hooks
```csharp
// Use with custom host functionality
await Electron.IpcMain.On("execute-host-function", async (args) =>
{
var functionName = args.ToString();
var result = await Electron.HostHook.CallAsync<string>(functionName);
Electron.IpcMain.Send(mainWindow, "function-result", result);
});
```
## Related APIs
- [Electron.HostHook](HostHook.md) - Execute custom JavaScript functions
- [Electron.WindowManager](WindowManager.md) - Target specific windows for communication
- [Electron.WebContents](WebContents.md) - Send messages to web content
## Additional Resources
- [Electron IPC Documentation](https://electronjs.org/docs/api/ipc-main) - Official Electron IPC API

210
docs/API/Menu.md Normal file
View File

@@ -0,0 +1,210 @@
# Electron.Menu
Create application menus, context menus, and menu items with full keyboard shortcut support.
## Overview
The `Electron.Menu` API provides comprehensive control over application menus and context menus. It supports native platform menus with custom menu items, submenus, keyboard shortcuts, and role-based menu items.
## Properties
#### 📋 `IReadOnlyDictionary<int, ReadOnlyCollection<MenuItem>> ContextMenuItems`
Gets a read-only dictionary of all current context menu items, keyed by browser window ID.
#### 📋 `IReadOnlyCollection<MenuItem> MenuItems`
Gets a read-only collection of all current application menu items.
## Methods
#### 🧊 `void ContextMenuPopup(BrowserWindow browserWindow)`
Shows the context menu for the specified browser window.
**Parameters:**
- `browserWindow` - The browser window to show the context menu for
#### 🧊 `void SetApplicationMenu(MenuItem[] menuItems)`
Sets the application menu for the entire application.
**Parameters:**
- `menuItems` - Array of MenuItem objects defining the application menu
#### 🧊 `void SetContextMenu(BrowserWindow browserWindow, MenuItem[] menuItems)`
Sets a context menu for a specific browser window.
**Parameters:**
- `browserWindow` - The browser window to attach the context menu to
- `menuItems` - Array of MenuItem objects defining the context menu
## Usage Examples
### Application Menu
```csharp
// Create application menu
var menuItems = new[]
{
new MenuItem
{
Label = "File",
Submenu = new[]
{
new MenuItem { Label = "New", Click = () => CreateNewDocument() },
new MenuItem { Label = "Open", Click = () => OpenDocument() },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Label = "Exit", Click = () => Electron.App.Quit() }
}
},
new MenuItem
{
Label = "Edit",
Submenu = new[]
{
new MenuItem { Role = MenuRole.Undo },
new MenuItem { Role = MenuRole.Redo },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Role = MenuRole.Cut },
new MenuItem { Role = MenuRole.Copy },
new MenuItem { Role = MenuRole.Paste }
}
},
new MenuItem
{
Label = "View",
Submenu = new[]
{
new MenuItem { Role = MenuRole.Reload },
new MenuItem { Role = MenuRole.ForceReload },
new MenuItem { Role = MenuRole.ToggleDevTools },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Role = MenuRole.ResetZoom },
new MenuItem { Role = MenuRole.ZoomIn },
new MenuItem { Role = MenuRole.ZoomOut }
}
},
new MenuItem
{
Label = "Window",
Submenu = new[]
{
new MenuItem { Role = MenuRole.Minimize },
new MenuItem { Role = MenuRole.Close }
}
}
};
// Set application menu
Electron.Menu.SetApplicationMenu(menuItems);
```
### Context Menu
```csharp
// Create context menu for specific window
var contextMenuItems = new[]
{
new MenuItem { Label = "Copy", Click = () => CopySelectedText() },
new MenuItem { Label = "Paste", Click = () => PasteText() },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Label = "Inspect Element", Click = () => InspectElement() }
};
// Set context menu for window
Electron.Menu.SetContextMenu(mainWindow, contextMenuItems);
// Show context menu programmatically
Electron.Menu.ContextMenuPopup(mainWindow);
```
### Menu with Keyboard Shortcuts
```csharp
// Create menu with keyboard shortcuts
var menuItems = new[]
{
new MenuItem
{
Label = "File",
Submenu = new[]
{
new MenuItem
{
Label = "New",
Accelerator = "CmdOrCtrl+N",
Click = () => CreateNewDocument()
},
new MenuItem
{
Label = "Open",
Accelerator = "CmdOrCtrl+O",
Click = () => OpenDocument()
},
new MenuItem
{
Label = "Save",
Accelerator = "CmdOrCtrl+S",
Click = () => SaveDocument()
}
}
}
};
Electron.Menu.SetApplicationMenu(menuItems);
```
### Dynamic Menu Updates
```csharp
// Update menu items dynamically
var fileMenu = Electron.Menu.MenuItems.FirstOrDefault(m => m.Label == "File");
if (fileMenu?.Submenu != null)
{
var saveItem = fileMenu.Submenu.FirstOrDefault(m => m.Label == "Save");
if (saveItem != null)
{
saveItem.Enabled = HasUnsavedChanges;
}
}
```
### Platform-Specific Menus
```csharp
// macOS specific menu items
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
var macMenuItems = new[]
{
new MenuItem
{
Label = "MyApp",
Submenu = new[]
{
new MenuItem { Role = MenuRole.About },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Role = MenuRole.Services },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Role = MenuRole.Hide },
new MenuItem { Role = MenuRole.HideOthers },
new MenuItem { Role = MenuRole.Unhide },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Role = MenuRole.Quit }
}
}
};
// Insert before File menu
var allMenus = new List<MenuItem>(macMenuItems);
allMenus.AddRange(menuItems);
Electron.Menu.SetApplicationMenu(allMenus.ToArray());
}
```
## Related APIs
- [Electron.WindowManager](WindowManager.md) - Windows for context menus
- [Electron.App](App.md) - Application lifecycle events
- [Electron.GlobalShortcut](GlobalShortcut.md) - Global keyboard shortcuts
## Additional Resources
- [Electron Menu Documentation](https://electronjs.org/docs/api/menu) - Official Electron menu API

189
docs/API/NativeTheme.md Normal file
View File

@@ -0,0 +1,189 @@
# Electron.NativeTheme
Detect and respond to changes in Chromium's native color theme.
## Overview
The `Electron.NativeTheme` API provides access to Chromium's native color theme information and allows you to detect and respond to changes in the system's dark/light mode settings. This enables your application to automatically adapt to the user's theme preferences.
## Methods
#### 🧊 `Task<ThemeSourceMode> GetThemeSourceAsync()`
Get the current theme source setting.
**Returns:**
A `ThemeSourceMode` property that can be `ThemeSourceMode.System`, `ThemeSourceMode.Light` or `ThemeSourceMode.Dark`.
#### 🧊 `void SetThemeSource(ThemeSourceMode themeSourceMode)`
Setting this property to `ThemeSourceMode.System` will remove the override and everything will be reset to the OS default. By default 'ThemeSource' is `ThemeSourceMode.System`.
**Parameters:**
- `themeSourceMode` - The new ThemeSource
#### 🧊 `Task<bool> ShouldUseDarkColorsAsync()`
Check if the system is currently using dark colors.
**Returns:**
A bool for if the OS / Chromium currently has a dark mode enabled or is being instructed to show a dark-style UI.
#### 🧊 `Task<bool> ShouldUseHighContrastColorsAsync()`
Check if the system is currently using high contrast colors.
**Returns:**
A bool for if the OS / Chromium currently has high-contrast mode enabled or is being instructed to show a high-contrast UI.
#### 🧊 `Task<bool> ShouldUseInvertedColorSchemeAsync()`
Check if the system is currently using an inverted color scheme.
**Returns:**
A bool for if the OS / Chromium currently has an inverted color scheme or is being instructed to use an inverted color scheme.
## Events
#### ⚡ `Updated`
Emitted when something in the underlying NativeTheme has changed. This normally means that either the value of ShouldUseDarkColorsAsync, ShouldUseHighContrastColorsAsync or ShouldUseInvertedColorSchemeAsync has changed.
## Usage Examples
### Basic Theme Detection
```csharp
// Check current theme
var isDarkMode = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
Console.WriteLine($"Dark mode: {isDarkMode}");
// Get current theme source
var themeSource = await Electron.NativeTheme.GetThemeSourceAsync();
Console.WriteLine($"Theme source: {themeSource}");
```
### Theme Change Monitoring
```csharp
// Monitor theme changes
Electron.NativeTheme.Updated += () =>
{
Console.WriteLine("Theme updated");
UpdateApplicationTheme();
};
async void UpdateApplicationTheme()
{
var isDarkMode = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
var isHighContrast = await Electron.NativeTheme.ShouldUseHighContrastColorsAsync();
// Update application appearance
ApplyTheme(isDarkMode, isHighContrast);
}
```
### Manual Theme Control
```csharp
// Force dark theme
Electron.NativeTheme.SetThemeSource(ThemeSourceMode.Dark);
// Force light theme
Electron.NativeTheme.SetThemeSource(ThemeSourceMode.Light);
// Follow system theme
Electron.NativeTheme.SetThemeSource(ThemeSourceMode.System);
```
### Application Theme Integration
```csharp
public async Task InitializeThemeSupport()
{
// Set initial theme based on system preference
var isDarkMode = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
ApplyTheme(isDarkMode);
// Monitor theme changes
Electron.NativeTheme.Updated += async () =>
{
var darkMode = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
ApplyTheme(darkMode);
};
}
private void ApplyTheme(bool isDarkMode)
{
if (isDarkMode)
{
// Apply dark theme
SetDarkThemeColors();
UpdateWindowTheme("dark");
}
else
{
// Apply light theme
SetLightThemeColors();
UpdateWindowTheme("light");
}
}
```
### Advanced Theme Management
```csharp
// Check all theme properties
var isDarkMode = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
var isHighContrast = await Electron.NativeTheme.ShouldUseHighContrastColorsAsync();
var isInverted = await Electron.NativeTheme.ShouldUseInvertedColorSchemeAsync();
Console.WriteLine($"Dark mode: {isDarkMode}");
Console.WriteLine($"High contrast: {isHighContrast}");
Console.WriteLine($"Inverted: {isInverted}");
// Apply appropriate theme
if (isHighContrast)
{
ApplyHighContrastTheme();
}
else if (isDarkMode)
{
ApplyDarkTheme();
}
else
{
ApplyLightTheme();
}
```
### Theme-Aware Window Creation
```csharp
// Create window with theme-appropriate settings
var isDarkMode = await Electron.NativeTheme.ShouldUseDarkColorsAsync();
var windowOptions = new BrowserWindowOptions
{
Width = 1200,
Height = 800,
Title = "My Application",
BackgroundColor = isDarkMode ? "#1a1a1a" : "#ffffff",
WebPreferences = new WebPreferences
{
// Additional web preferences based on theme
}
};
var window = await Electron.WindowManager.CreateWindowAsync(windowOptions);
```
## Related APIs
- [Electron.WindowManager](WindowManager.md) - Apply theme to windows
- [Electron.Screen](Screen.md) - Screen-related theme considerations
- [Electron.App](App.md) - Application-level theme events
## Additional Resources
- [Electron NativeTheme Documentation](https://electronjs.org/docs/api/native-theme) - Official Electron native theme API
- [Theme Support](../Core/What's-New.md) - Understanding theme functionality
- [User Experience](../Using/Configuration.md) - Design theme-aware applications

164
docs/API/Notification.md Normal file
View File

@@ -0,0 +1,164 @@
# Electron.Notification
Show native desktop notifications with custom content and actions.
## Overview
The `Electron.Notification` API provides the ability to show native desktop notifications with custom titles, bodies, icons, and actions. Notifications work across Windows, macOS, and Linux with platform-specific behavior.
## Methods
#### 🧊 `Task<bool> IsSupportedAsync()`
Check if desktop notifications are supported on the current platform.
**Returns:**
Whether or not desktop notifications are supported on the current system.
#### 🧊 `void Show(NotificationOptions notificationOptions)`
Create OS desktop notifications with the specified options.
**Parameters:**
- `notificationOptions` - Notification configuration options
## Usage Examples
### Basic Notification
```csharp
// Simple notification
Electron.Notification.Show(new NotificationOptions
{
Title = "My Application",
Body = "This is a notification message",
Icon = "assets/notification-icon.png"
});
```
### Notification with Actions
```csharp
// Notification with reply action
Electron.Notification.Show(new NotificationOptions
{
Title = "New Message",
Body = "You have a new message from John",
Icon = "assets/message-icon.png",
Actions = new[]
{
new NotificationAction { Text = "Reply", Type = NotificationActionType.Button },
new NotificationAction { Text = "View", Type = NotificationActionType.Button }
},
OnClick = () => OpenMessageWindow(),
OnAction = (action) =>
{
if (action == "Reply")
{
ShowReplyDialog();
}
else if (action == "View")
{
OpenMessageWindow();
}
}
});
```
### Rich Notifications
```csharp
// Rich notification with all options
Electron.Notification.Show(new NotificationOptions
{
Title = "Download Complete",
Subtitle = "Your file has finished downloading",
Body = "document.pdf has been downloaded to your Downloads folder.",
Icon = "assets/download-icon.png",
ImageUrl = "file://" + Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets/preview.png"),
Sound = NotificationSound.Default,
Urgency = NotificationUrgency.Normal,
Category = "transfer.complete",
Tag = "download-123",
Actions = new[]
{
new NotificationAction { Text = "Open", Type = NotificationActionType.Button },
new NotificationAction { Text = "Show in Folder", Type = NotificationActionType.Button }
},
OnShow = () => Console.WriteLine("Notification shown"),
OnClick = () => OpenDownloadedFile(),
OnClose = () => Console.WriteLine("Notification closed"),
OnAction = (action) =>
{
if (action == "Open")
{
OpenDownloadedFile();
}
else if (action == "Show in Folder")
{
ShowInFolder();
}
}
});
```
### Platform-Specific Notifications
```csharp
// Windows toast notification
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Electron.Notification.Show(new NotificationOptions
{
Title = "Background Task",
Body = "Your backup is complete",
Icon = "assets/app-icon.ico",
Tag = "backup-complete",
RequireInteraction = true
});
}
// macOS notification with sound
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Electron.Notification.Show(new NotificationOptions
{
Title = "Alert",
Body = "Something needs your attention",
Sound = NotificationSound.Default,
Actions = new[]
{
new NotificationAction { Text = "View", Type = NotificationActionType.Button }
}
});
}
```
### Notification Management
```csharp
// Check notification support
var isSupported = await Electron.Notification.IsSupportedAsync();
Console.WriteLine($"Notifications supported: {isSupported}");
// Create notification with events
var notification = new NotificationOptions
{
Title = "Task Complete",
Body = "Your long-running task has finished",
OnShow = () => Console.WriteLine("Notification displayed"),
OnClick = () => OpenTaskResults(),
OnClose = () => Console.WriteLine("Notification dismissed")
};
Electron.Notification.Show(notification);
```
## Related APIs
- [Electron.App](App.md) - Application lifecycle events
- [Electron.Tray](Tray.md) - System tray integration with notifications
- [Electron.Screen](Screen.md) - Position notifications based on screen layout
## Additional Resources
- [Electron Notification Documentation](https://electronjs.org/docs/api/notification) - Official Electron notification API

62
docs/API/Overview.md Normal file
View File

@@ -0,0 +1,62 @@
# API Reference Overview
The ElectronNET.Core API provides comprehensive access to Electron's native desktop functionality through a .NET interface. This section documents all the available API classes and their methods, events, and usage patterns.
## API Classes
### Core Application Management
- **[Electron.App](App.md)** - Control your application's event lifecycle, manage app metadata, and handle system-level operations
- **[Electron.WindowManager](WindowManager.md)** - Create and manage browser windows, control window behavior and appearance
- **[Electron.Menu](Menu.md)** - Create application menus, context menus, and menu items with full keyboard shortcut support
### User Interface & Interaction
- **[Electron.Dialog](Dialog.md)** - Display native system dialogs for opening/saving files, showing messages and alerts
- **[Electron.Notification](Notification.md)** - Show native desktop notifications with custom content and actions
- **[Electron.Tray](Tray.md)** - Create system tray icons with context menus and tooltip support
- **[Electron.Dock](Dock.md)** - macOS dock integration for bounce effects and badge counts
### System Integration
- **[Electron.Shell](Shell.md)** - Desktop integration for opening files, URLs, and accessing system paths
- **[Electron.Clipboard](Clipboard.md)** - Read from and write to the system clipboard with multiple data formats
- **[Electron.Screen](Screen.md)** - Access display and screen information for responsive layouts
- **[Electron.NativeTheme](NativeTheme.md)** - Detect and respond to system theme changes (light/dark mode)
### Communication & Automation
- **[Electron.IpcMain](IpcMain.md)** - Inter-process communication between main process and renderer processes
- **[Electron.HostHook](HostHook.md)** - Custom host hook functionality for advanced integration scenarios
- **[Electron.GlobalShortcut](GlobalShortcut.md)** - Register global keyboard shortcuts that work even when app is not focused
- **[Electron.AutoUpdater](AutoUpdater.md)** - Handle application updates and installation processes
### System Monitoring
- **[Electron.PowerMonitor](PowerMonitor.md)** - Monitor system power events like sleep, wake, and battery status
## API Relationships
### Window and Dialog Integration
- Use `BrowserWindow` instances as parent windows for dialogs
- Dialogs automatically become modal when parent window is provided
- Window events coordinate with application lifecycle events
### IPC Communication
- `IpcMain` handles communication from renderer processes
- Use with `Electron.WindowManager` for window-specific messaging
- Coordinate with `Electron.App` events for application-wide communication
### System Integration
- `Shell` operations work with file paths from `Dialog` operations
- `Screen` information helps create properly sized windows
- `Notification` and `Tray` provide complementary user interaction methods
## 🚀 Next Steps
- **[Electron.App](App.md)** - Start with application lifecycle management
- **[Electron.WindowManager](WindowManager.md)** - Learn window creation and management
- **[Electron.Dialog](Dialog.md)** - Add file operations and user interactions
- **[Electron.Menu](Menu.md)** - Implement application menus and shortcuts
## 📚 Additional Resources
- **[Electron Documentation](https://electronjs.org/docs)** - Official Electron API reference
- **[Getting Started](../GettingStarted/ASP.Net.md)** - Development setup guides
- **[Migration Guide](../Core/Migration-Guide.md)** - Moving from previous versions

188
docs/API/PowerMonitor.md Normal file
View File

@@ -0,0 +1,188 @@
# Electron.PowerMonitor
Monitor system power events like sleep, wake, and battery status.
## Overview
The `Electron.PowerMonitor` API provides access to system power events and state changes. This includes monitoring when the system is going to sleep, waking up, or changing power sources.
## Events
#### ⚡ `OnAC`
Emitted when the system changes to AC power.
#### ⚡ `OnBattery`
Emitted when system changes to battery power.
#### ⚡ `OnLockScreen`
Emitted when the system is about to lock the screen.
#### ⚡ `OnResume`
Emitted when system is resuming.
#### ⚡ `OnShutdown`
Emitted when the system is about to reboot or shut down.
#### ⚡ `OnSuspend`
Emitted when the system is suspending.
#### ⚡ `OnUnLockScreen`
Emitted when the system is about to unlock the screen.
## Usage Examples
### Basic Power Event Monitoring
```csharp
// Monitor system sleep/wake
Electron.PowerMonitor.OnSuspend += () =>
{
Console.WriteLine("System going to sleep");
// Save application state
SaveApplicationState();
};
Electron.PowerMonitor.OnResume += () =>
{
Console.WriteLine("System waking up");
// Restore application state
RestoreApplicationState();
};
```
### Screen Lock/Unlock Monitoring
```csharp
// Handle screen lock events
Electron.PowerMonitor.OnLockScreen += () =>
{
Console.WriteLine("Screen locking");
// Pause real-time operations
PauseRealTimeOperations();
};
Electron.PowerMonitor.OnUnLockScreen += () =>
{
Console.WriteLine("Screen unlocking");
// Resume real-time operations
ResumeRealTimeOperations();
};
```
### Power Source Changes
```csharp
// Monitor power source changes
Electron.PowerMonitor.OnAC += () =>
{
Console.WriteLine("Switched to AC power");
// Adjust power-intensive operations
EnablePowerIntensiveFeatures();
};
Electron.PowerMonitor.OnBattery += () =>
{
Console.WriteLine("Switched to battery power");
// Reduce power consumption
EnablePowerSavingMode();
};
```
### System Shutdown Handling
```csharp
// Handle system shutdown
Electron.PowerMonitor.OnShutdown += () =>
{
Console.WriteLine("System shutting down");
// Save critical data and exit gracefully
SaveAndExit();
};
```
### Application State Management
```csharp
private bool isSuspended = false;
public void InitializePowerMonitoring()
{
// Track suspension state
Electron.PowerMonitor.OnSuspend += () =>
{
isSuspended = true;
OnSystemSleep();
};
Electron.PowerMonitor.OnResume += () =>
{
isSuspended = false;
OnSystemWake();
};
// Handle screen lock for security
Electron.PowerMonitor.OnLockScreen += () =>
{
OnScreenLocked();
};
}
private void OnSystemSleep()
{
// Pause network operations
PauseNetworkOperations();
// Save unsaved work
AutoSaveDocuments();
// Reduce resource usage
MinimizeResourceUsage();
}
private void OnSystemWake()
{
// Resume network operations
ResumeNetworkOperations();
// Check for updates
CheckForUpdates();
// Restore full functionality
RestoreFullFunctionality();
}
private void OnScreenLocked()
{
// Hide sensitive information
HideSensitiveData();
// Pause real-time features
PauseRealTimeFeatures();
}
```
### Battery Status Monitoring
```csharp
// Monitor battery status changes
Electron.PowerMonitor.OnAC += () =>
{
Console.WriteLine("Plugged in - full performance mode");
EnableFullPerformanceMode();
};
Electron.PowerMonitor.OnBattery += () =>
{
Console.WriteLine("On battery - power saving mode");
EnablePowerSavingMode();
};
```
## Related APIs
- [Electron.App](App.md) - Application lifecycle events
- [Electron.Notification](Notification.md) - Notify users about power events
## Additional Resources
- [Electron PowerMonitor Documentation](https://electronjs.org/docs/api/power-monitor) - Official Electron power monitor API

174
docs/API/Screen.md Normal file
View File

@@ -0,0 +1,174 @@
# Electron.Screen
Access display and screen information for responsive layouts.
## Overview
The `Electron.Screen` API provides access to screen and display information, including screen size, display metrics, cursor position, and multi-monitor configurations. This is essential for creating responsive applications that adapt to different screen configurations.
## Methods
#### 🧊 `Task<Display[]> GetAllDisplaysAsync()`
Gets information about all available displays.
**Returns:**
An array of displays that are currently available.
#### 🧊 `Task<Point> GetCursorScreenPointAsync()`
Gets the current position of the mouse cursor on screen.
**Returns:**
The current absolute position of the mouse pointer.
#### 🧊 `Task<Display> GetDisplayMatchingAsync(Rectangle rectangle)`
Gets the display that most closely intersects the provided bounds.
**Parameters:**
- `rectangle` - The rectangle to find the matching display for
**Returns:**
The display that most closely intersects the provided bounds.
#### 🧊 `Task<Display> GetDisplayNearestPointAsync(Point point)`
Gets the display that is closest to the specified point.
**Parameters:**
- `point` - The point to find the nearest display for
**Returns:**
The display nearest the specified point.
#### 🧊 `Task<int> GetMenuBarHeightAsync()`
macOS: The height of the menu bar in pixels.
**Returns:**
The height of the menu bar in pixels.
#### 🧊 `Task<Display> GetPrimaryDisplayAsync()`
Gets information about the primary display (main screen).
**Returns:**
The primary display.
## Events
#### ⚡ `OnDisplayAdded`
Emitted when a new Display has been added.
#### ⚡ `OnDisplayMetricsChanged`
Emitted when one or more metrics change in a display. The changedMetrics is an array of strings that describe the changes. Possible changes are bounds, workArea, scaleFactor and rotation.
#### ⚡ `OnDisplayRemoved`
Emitted when oldDisplay has been removed.
## Usage Examples
### Display Information
```csharp
// Get primary display
var primaryDisplay = await Electron.Screen.GetPrimaryDisplayAsync();
Console.WriteLine($"Primary display: {primaryDisplay.Size.Width}x{primaryDisplay.Size.Height}");
// Get all displays
var displays = await Electron.Screen.GetAllDisplaysAsync();
Console.WriteLine($"Available displays: {displays.Length}");
// Get display near cursor
var cursorPoint = await Electron.Screen.GetCursorScreenPointAsync();
var nearestDisplay = await Electron.Screen.GetDisplayNearestPointAsync(cursorPoint);
Console.WriteLine($"Nearest display scale factor: {nearestDisplay.ScaleFactor}");
```
### Multi-Monitor Setup
```csharp
// Get all displays for multi-monitor setup
var displays = await Electron.Screen.GetAllDisplaysAsync();
foreach (var display in displays)
{
Console.WriteLine($"Display {display.Id}:");
Console.WriteLine($" Size: {display.Size.Width}x{display.Size.Height}");
Console.WriteLine($" Position: {display.Bounds.X},{display.Bounds.Y}");
Console.WriteLine($" Scale Factor: {display.ScaleFactor}");
Console.WriteLine($" Work Area: {display.WorkArea.Width}x{display.WorkArea.Height}");
}
```
### Responsive Window Placement
```csharp
// Create window on appropriate display
var displays = await Electron.Screen.GetAllDisplaysAsync();
var targetDisplay = displays.FirstOrDefault(d => d.Bounds.X > 0) ?? displays.First();
var windowOptions = new BrowserWindowOptions
{
Width = Math.Min(1200, targetDisplay.WorkArea.Width),
Height = Math.Min(800, targetDisplay.WorkArea.Height),
X = targetDisplay.WorkArea.X + (targetDisplay.WorkArea.Width - 1200) / 2,
Y = targetDisplay.WorkArea.Y + (targetDisplay.WorkArea.Height - 800) / 2
};
var window = await Electron.WindowManager.CreateWindowAsync(windowOptions);
```
### Display Change Monitoring
```csharp
// Monitor display changes
Electron.Screen.OnDisplayAdded += (display) =>
{
Console.WriteLine($"Display added: {display.Id}");
UpdateWindowPositions();
};
Electron.Screen.OnDisplayRemoved += (display) =>
{
Console.WriteLine($"Display removed: {display.Id}");
UpdateWindowPositions();
};
Electron.Screen.OnDisplayMetricsChanged += (display, metrics) =>
{
Console.WriteLine($"Display {display.Id} metrics changed: {string.Join(", ", metrics)}");
UpdateWindowPositions();
};
void UpdateWindowPositions()
{
// Recalculate window positions based on current displays
}
```
### macOS Menu Bar Height
```csharp
// Account for menu bar height on macOS
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
var menuBarHeight = await Electron.Screen.GetMenuBarHeightAsync();
var windowOptions = new BrowserWindowOptions
{
Y = menuBarHeight, // Position below menu bar
TitleBarStyle = TitleBarStyle.Hidden // Hide title bar for custom look
};
}
```
## Related APIs
- [Electron.WindowManager](WindowManager.md) - Position windows based on screen information
- [Electron.App](App.md) - Handle display-related application events
## Additional Resources
- [Electron Screen Documentation](https://electronjs.org/docs/api/screen) - Official Electron screen API

175
docs/API/Shell.md Normal file
View File

@@ -0,0 +1,175 @@
# Electron.Shell
Desktop integration for opening files, URLs, and accessing system paths.
## Overview
The `Electron.Shell` API provides system integration functionality for opening files and URLs with their default applications, managing trash/recycle bin, and creating/reading shortcut links.
## Methods
#### 🧊 `void Beep()`
Play the beep sound.
#### 🧊 `Task<string> OpenExternalAsync(string url)`
Open the given external protocol URL in the desktop's default manner (e.g., mailto: URLs in the user's default mail agent).
**Parameters:**
- `url` - Max 2081 characters on windows
**Returns:**
The error message corresponding to the failure if a failure occurred, otherwise empty string.
#### 🧊 `Task<string> OpenExternalAsync(string url, OpenExternalOptions options)`
Open the given external protocol URL with additional options.
**Parameters:**
- `url` - Max 2081 characters on windows
- `options` - Controls the behavior of OpenExternal
**Returns:**
The error message corresponding to the failure if a failure occurred, otherwise empty string.
#### 🧊 `Task<string> OpenPathAsync(string path)`
Open the given file in the desktop's default manner.
**Parameters:**
- `path` - The path to the directory or file
**Returns:**
The error message corresponding to the failure if a failure occurred, otherwise empty string.
#### 🧊 `Task<ShortcutDetails> ReadShortcutLinkAsync(string shortcutPath)`
Resolves the shortcut link at shortcutPath. An exception will be thrown when any error happens.
**Parameters:**
- `shortcutPath` - The path to the shortcut
**Returns:**
ShortcutDetails of the shortcut.
#### 🧊 `Task ShowItemInFolderAsync(string fullPath)`
Show the given file in a file manager. If possible, select the file.
**Parameters:**
- `fullPath` - The full path to the directory or file
#### 🧊 `Task<bool> TrashItemAsync(string fullPath)`
Move the given file to trash and returns a bool status for the operation.
**Parameters:**
- `fullPath` - The full path to the directory or file
**Returns:**
Whether the item was successfully moved to the trash.
#### 🧊 `Task<bool> WriteShortcutLinkAsync(string shortcutPath, ShortcutLinkOperation operation, ShortcutDetails options)`
Creates or updates a shortcut link at shortcutPath.
**Parameters:**
- `shortcutPath` - The path to the shortcut
- `operation` - Default is ShortcutLinkOperation.Create
- `options` - Structure of a shortcut
**Returns:**
Whether the shortcut was created successfully.
## Usage Examples
### File Operations
```csharp
// Open file with default application
var error = await Electron.Shell.OpenPathAsync(filePath);
if (string.IsNullOrEmpty(error))
{
Console.WriteLine("File opened successfully");
}
else
{
Console.WriteLine($"Failed to open file: {error}");
}
// Show file in file manager
await Electron.Shell.ShowItemInFolderAsync(filePath);
// Move file to trash
var trashed = await Electron.Shell.TrashItemAsync(filePath);
Console.WriteLine($"File trashed: {trashed}");
```
### URL Operations
```csharp
// Open URL in default browser
var error = await Electron.Shell.OpenExternalAsync("https://electron.net");
if (!string.IsNullOrEmpty(error))
{
Console.WriteLine($"Failed to open URL: {error}");
}
// Open email client
await Electron.Shell.OpenExternalAsync("mailto:user@example.com");
// Open with options
var error = await Electron.Shell.OpenExternalAsync("https://example.com", new OpenExternalOptions
{
Activate = true
});
```
### System Integration
```csharp
// Play system beep
Electron.Shell.Beep();
// Create desktop shortcut
var success = await Electron.Shell.WriteShortcutLinkAsync(
@"C:\Users\Public\Desktop\MyApp.lnk",
ShortcutLinkOperation.Create,
new ShortcutDetails
{
Target = "C:\\Program Files\\MyApp\\MyApp.exe",
Description = "My Application",
WorkingDirectory = "C:\\Program Files\\MyApp"
}
);
// Read shortcut information
var details = await Electron.Shell.ReadShortcutLinkAsync(@"C:\Users\Public\Desktop\MyApp.lnk");
Console.WriteLine($"Target: {details.Target}");
```
### Integration with Dialog API
```csharp
// Use with file dialog results
var files = await Electron.Dialog.ShowOpenDialogAsync(window, options);
if (files.Length > 0)
{
var selectedFile = files[0];
// Open the selected file
await Electron.Shell.OpenPathAsync(selectedFile);
// Show in file manager
await Electron.Shell.ShowItemInFolderAsync(selectedFile);
}
```
## Related APIs
- [Electron.Dialog](Dialog.md) - Select files to open with Shell
- [Electron.App](App.md) - Application lifecycle events
- [Electron.Clipboard](Clipboard.md) - Copy file paths for Shell operations
## Additional Resources
- [Electron Shell Documentation](https://electronjs.org/docs/api/shell) - Official Electron shell API

232
docs/API/Tray.md Normal file
View File

@@ -0,0 +1,232 @@
# Electron.Tray
Add icons and context menus to the system's notification area.
## Overview
The `Electron.Tray` API provides the ability to add icons and context menus to the system's notification area (system tray). This allows applications to provide quick access to common functions and maintain a presence in the system even when windows are closed.
## Properties
#### 📋 `IReadOnlyCollection<MenuItem> MenuItems`
Gets a read-only collection of all current tray menu items.
## Methods
#### 🧊 `void Destroy()`
Destroys the tray icon immediately.
#### 🧊 `void DisplayBalloon(DisplayBalloonOptions options)`
Windows: Displays a tray balloon notification.
**Parameters:**
- `options` - Balloon notification options
#### 🧊 `Task<bool> IsDestroyedAsync()`
Check if the tray icon has been destroyed.
**Returns:**
Whether the tray icon is destroyed.
#### 🧊 `void SetImage(string image)`
Sets the image associated with this tray icon.
**Parameters:**
- `image` - New image for the tray icon
#### 🧊 `void SetPressedImage(string image)`
Sets the image associated with this tray icon when pressed on macOS.
**Parameters:**
- `image` - Image for pressed state
#### 🧊 `void SetTitle(string title)`
macOS: Sets the title displayed aside of the tray icon in the status bar.
**Parameters:**
- `title` - Title text
#### 🧊 `void SetToolTip(string toolTip)`
Sets the hover text for this tray icon.
**Parameters:**
- `toolTip` - Tooltip text
#### 🧊 `void Show(string image)`
Shows the tray icon without a context menu.
**Parameters:**
- `image` - The image to use for the tray icon
#### 🧊 `void Show(string image, MenuItem menuItem)`
Shows the tray icon with a single menu item.
**Parameters:**
- `image` - The image to use for the tray icon
- `menuItem` - Single menu item for the tray context menu
#### 🧊 `void Show(string image, MenuItem[] menuItems)`
Shows the tray icon with multiple menu items.
**Parameters:**
- `image` - The image to use for the tray icon
- `menuItems` - Array of menu items for the tray context menu
## Events
#### ⚡ `OnBalloonClick`
Windows: Emitted when the tray balloon is clicked.
#### ⚡ `OnBalloonClosed`
Windows: Emitted when the tray balloon is closed because of timeout or user manually closes it.
#### ⚡ `OnBalloonShow`
Windows: Emitted when the tray balloon shows.
#### ⚡ `OnClick`
Emitted when the tray icon is clicked.
#### ⚡ `OnDoubleClick`
macOS, Windows: Emitted when the tray icon is double clicked.
#### ⚡ `OnRightClick`
macOS, Windows: Emitted when the tray icon is right clicked.
## Usage Examples
### Basic Tray Icon
```csharp
// Simple tray icon
await Electron.Tray.Show("assets/tray-icon.png");
// Tray icon with single menu item
await Electron.Tray.Show("assets/tray-icon.png", new MenuItem
{
Label = "Show Window",
Click = () => ShowMainWindow()
});
```
### Tray with Context Menu
```csharp
// Tray with multiple menu items
var trayMenuItems = new[]
{
new MenuItem { Label = "Show Window", Click = () => ShowMainWindow() },
new MenuItem { Label = "Settings", Click = () => OpenSettings() },
new MenuItem { Type = MenuType.Separator },
new MenuItem { Label = "Exit", Click = () => Electron.App.Quit() }
};
await Electron.Tray.Show("assets/tray-icon.png", trayMenuItems);
```
### Dynamic Tray Updates
```csharp
// Update tray tooltip based on status
await Electron.Tray.SetToolTip("MyApp - Connected");
// Change tray icon based on state
if (isConnected)
{
await Electron.Tray.SetImage("assets/connected.png");
}
else
{
await Electron.Tray.SetImage("assets/disconnected.png");
}
```
### Tray Event Handling
```csharp
// Handle tray clicks
Electron.Tray.OnClick += (clickArgs, bounds) =>
{
if (clickArgs.AltKey || clickArgs.ShiftKey)
{
// Alt+Click or Shift+Click - show context menu
Electron.Menu.ContextMenuPopup(Electron.WindowManager.BrowserWindows.First());
}
else
{
// Regular click - toggle main window
ToggleMainWindow();
}
};
Electron.Tray.OnRightClick += (clickArgs, bounds) =>
{
// Show context menu on right click
Electron.Menu.ContextMenuPopup(Electron.WindowManager.BrowserWindows.First());
};
```
### Windows Balloon Notifications
```csharp
// Show Windows balloon notification
await Electron.Tray.DisplayBalloon(new DisplayBalloonOptions
{
Title = "Background Task Complete",
Content = "Your file has been processed successfully.",
Icon = "assets/notification-icon.ico"
});
// Handle balloon events
Electron.Tray.OnBalloonClick += () =>
{
ShowMainWindow();
Electron.WindowManager.BrowserWindows.First().Focus();
};
```
### macOS Tray Features
```csharp
// macOS specific tray features
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
await Electron.Tray.SetTitle("MyApp");
// Use template image for dark mode support
await Electron.Tray.SetImage("assets/tray-template.png");
await Electron.Tray.SetPressedImage("assets/tray-pressed-template.png");
}
```
### Application Integration
```csharp
// Integrate with application lifecycle
Electron.App.WindowAllClosed += () =>
{
// Keep app running in tray when windows are closed
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Electron.App.Hide();
}
};
// Handle tray double-click
Electron.Tray.OnDoubleClick += (clickArgs, bounds) =>
{
ShowMainWindow();
Electron.WindowManager.BrowserWindows.First().Focus();
};
```
## Related APIs
- [Electron.Menu](Menu.md) - Context menus for tray icons
- [Electron.Notification](Notification.md) - Desktop notifications
- [Electron.App](App.md) - Application lifecycle events
- [Electron.WindowManager](WindowManager.md) - Windows to show/hide from tray
## Additional Resources
- [Electron Tray Documentation](https://electronjs.org/docs/api/tray) - Official Electron tray API

Some files were not shown because too many files have changed in this diff Show More