Compare commits

...

438 Commits
11.5.1 ... main

Author SHA1 Message Date
Florian Rappl
456135a562 Merge pull request #1015 from hillin/main
Update Migration Guide
2026-01-21 12:18:25 +01:00
lucas
300f52510c Update Migration Guide with details on electron-builder.json location and launch settings 2026-01-21 15:30:44 +08:00
Florian Rappl
7e6760a428 Merge pull request #998 from ElectronNET/develop
Release 0.4.0
2025-12-19 00:09:34 +01:00
Florian Rappl
29fdbb5315 Updated changelog 2025-12-18 23:58:04 +01:00
Florian Rappl
36bba6a49f Merge pull request #995 from softworkz/submit_packageid
Set PackageId from ElectronPackageId
2025-12-18 21:57:28 +01:00
Florian Rappl
44a010e0ed Merge pull request #996 from softworkz/submit_singleinstance
Fix ElectronSingleInstance handling
2025-12-18 21:56:59 +01:00
softworkz
25770db138 Update src/ElectronNET/build/ElectronNET.Core.targets
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-18 17:25:52 +01:00
Florian Rappl
1c99ab02cc Merge pull request #997 from softworkz/submit_rerun
Try fix retry-test-jobs
2025-12-18 16:56:29 +01:00
softworkz
73c56e2450 Try fix retry-test-jobs 2025-12-18 16:13:04 +01:00
softworkz
30037fce69 Fix ElectronSingleInstance handling 2025-12-18 15:52:56 +01:00
softworkz
69048d5565 Set PackageId from ElectronPackageId 2025-12-18 15:12:21 +01:00
Florian Rappl
d9c8e04b5c Meta for 0.4.0 2025-12-17 16:40:46 +01:00
Florian Rappl
368ef412bb Merge pull request #988 from softworkz/submit_crossdebug
Core: Introduce cross-platform npm restore and check mismatch on publish
2025-12-17 15:29:48 +01:00
Florian Rappl
cb20fbad25 Merge pull request #991 from ElectronNET/develop
Release 0.3.1
2025-12-16 19:00:07 +01:00
Florian Rappl
89cdf2f55b Merge pull request #992 from softworkz/submit_rerun
Try fix job re-run
2025-12-16 18:53:23 +01:00
softworkz
1c62c1f132 Try fix job re-run 2025-12-16 16:02:43 +01:00
Florian Rappl
d3e3188681 Prepare for 0.3.1 2025-12-16 15:51:39 +01:00
Florian Rappl
4f95043309 Merge pull request #990 from softworkz/submit_packageid
Use ElectronPackageId instead of PackageId
2025-12-16 15:48:43 +01:00
softworkz
13f1203ccc Use ElectronPackageId instead of PackageId 2025-12-16 14:54:20 +01:00
softworkz
9d0378798b ElectronProcessActive: Add check for platform mismatch 2025-12-15 13:22:53 +01:00
softworkz
1d6ef7a250 ElectronProcessActive: Mark binaries as executable when debugging 2025-12-15 12:18:42 +01:00
softworkz
2d6d4e2320 Fix up incorrect symlinks created by npm on Windows 2025-12-15 12:18:42 +01:00
softworkz
df8e269d5c Core: Introduce cross-platform npm restore and check mismatch on publish 2025-12-15 12:18:42 +01:00
Florian Rappl
bdfbcd5b77 Merge pull request #986 from ElectronNET/develop
Release 0.3.0
2025-12-14 22:13:10 +01:00
Florian Rappl
19e785f53f Fixed whitespace 2025-12-14 15:30:21 +01:00
Florian Rappl
0b453177b5 Added contributing guide 2025-12-14 15:20:15 +01:00
Florian Rappl
8ed7f27722 Make sure the electron-host-hook strays unobtrusive 2025-12-14 00:49:34 +01:00
Florian Rappl
321b8cd9e5 Merge branch 'develop' of https://github.com/ElectronNET/Electron.NET into develop 2025-12-14 00:36:59 +01:00
Florian Rappl
b326f863d8 Updated changelog 2025-12-14 00:36:53 +01:00
Florian Rappl
f148fe6a14 Merge pull request #983 from markatosi/develop
Wiki Package building macOS sections added
2025-12-14 00:32:37 +01:00
Florian Rappl
515d325731 Fixed startup in VS Code 2025-12-13 23:43:12 +01:00
markatosi
f32a40fe17 Add macOS profiles for ASP.NET and Console apps
Added profiles for ASP.NET and Console applications on macOS.
2025-12-13 12:18:38 -10:00
Florian Rappl
c53a5a9163 Merge pull request #982 from markatosi/develop
Change Example code for AutoMenuHide
2025-12-13 12:28:41 +01:00
markatosi
8d4cdddc46 Conditionally set AutoHideMenuBar for Windows/Linux 2025-12-12 13:45:56 -10:00
Florian Rappl
70e8f85123 Merge pull request #977 from softworkz/submit_revertnet6
Combine and separate workflows
2025-12-12 07:23:26 +01:00
softworkz
5a7cbd972f Combine and separate workflows
- Separate between PR and Push execution (with and without secrets)
- Turn tests into re-usable workflows and call them from the main ones
2025-12-12 02:15:44 +01:00
softworkz
33da428c45 Fix build after PR merge
Re-adding .net6 caused the collection expression to fail
2025-12-12 01:39:02 +01:00
softworkz
f1b4766360 Add automatic retry for failed test jobs 2025-12-12 00:51:13 +01:00
softworkz
e070759645 integration-tests: Add random delay 2025-12-12 00:49:16 +01:00
Florian Rappl
49eaa5e129 Merge pull request #973 from davidroth/set-menu-items
Add dynamic tray menu update functionality
2025-12-11 22:58:06 +01:00
Florian Rappl
b3f5a3c52b Merge pull request #976 from softworkz/submit_revertnet6
Partially revert "Drop .NET 6.0, default to .NET 10.0 and update dependencies"
2025-12-11 22:57:40 +01:00
softworkz
0d732ce99e Partially revert "Drop .NET 6.0, default to .NET 10.0 and update dependencies" 2025-12-11 22:35:45 +01:00
David Roth
218b99808b Add dynamic tray menu update functionality
Introduced a `SetMenuItems` method in `Tray.cs` to enable updating the tray's context menu dynamically. This method clears existing menu items, adds new ones, and registers click handlers. Added XML documentation for the method.
2025-12-11 18:04:31 +01:00
Florian Rappl
7f507a6d86 Merge pull request #975 from davidroth/missing-usings
Fix build by adding necessary using directives for async and DI setup.
2025-12-11 10:55:17 +01:00
Florian Rappl
81b3793966 Merge pull request #974 from davidroth/dotnet-targets
Drop .NET 6.0, default to .NET 10.0 and update dependencies
2025-12-11 10:54:44 +01:00
David Roth
1baa5c6200 Drop .NET 6.0, default to .NET 10.0 and update dependencies
Updated all projects to target .NET 10.0, removing support for .NET 6.0. Upgraded key dependencies, including:
- `Microsoft.Build` and `Microsoft.Build.Tasks.Core` to 18.0.2.
- `Nuke.Common` to 10.1.0.
- `System.Drawing.Common` to 10.0.1.
- `System.Text.Json` to 10.0.1.

Removed `NoWarn` configurations for .NET 6.0 in `ElectronNET.AspNet.csproj`. Reformatted the `Copy` task in `ElectronNET.Build.csproj` for readability. Updated `.pubxml` files and other project files to reflect the framework upgrade.
2025-12-11 07:25:07 +01:00
David Roth
5f76804065 Fix buidl by adding necessary using directives for async and DI setup. 2025-12-11 07:23:30 +01:00
Florian Rappl
70ffebf39d Updated changelog 2025-12-10 23:03:57 +01:00
Florian Rappl
0a54735f35 Merge branch 'main' of https://github.com/ElectronNET/Electron.NET into develop 2025-12-10 22:54:56 +01:00
Florian Rappl
1ac371b3da Merge pull request #962 from softworkz/submit_testupd
Collection of test fixes
2025-12-09 15:23:33 +01:00
Florian Rappl
e854451043 Merge pull request #968 from adityashirsatrao007/feat/host-hook-sample
feat: Add ElectronHostHook sample application (#967)
2025-12-09 10:21:36 +01:00
Aditya
331c2f548c fix: address review comments (protocol, config, startup) 2025-12-07 23:08:09 +05:30
Aditya
b00adcbd38 feat: Add ElectronHostHook sample application (#967) 2025-12-07 22:57:35 +05:30
Florian Rappl
ed6d24dbb1 Merge pull request #964 from niteshsinghal85/custom_main_example
Add custom_main.js guide to documentation
2025-12-07 18:08:26 +01:00
Florian Rappl
2c82206c62 Merge pull request #966 from softworkz/submit_migrationchecks
Add migration checks
2025-12-07 18:00:18 +01:00
softworkz
d0eb0880b1 Fix publishing documentation 2025-12-07 16:12:49 +01:00
softworkz
0321804128 Add documentation for migration checks 2025-12-07 16:12:49 +01:00
softworkz
f548ff08d4 Add migration checks 2025-12-07 16:12:23 +01:00
Nitesh Singhal
bbc7c79d5a Merge branch 'custom_main_example' of https://github.com/niteshsinghal85/Electron.NET into custom_main_example 2025-12-07 18:17:26 +05:30
Nitesh Singhal
2389ae32bd Update Custom_main.md to clarify usage of custom_main.js 2025-12-07 18:16:48 +05:30
Nitesh Singhal
42fecbdc98 Update docs/_Sidebar.md
Co-authored-by: softworkz <4985349+softworkz@users.noreply.github.com>
2025-12-07 18:10:16 +05:30
softworkz
95e02e2655 Introduce common base class for tests 2025-12-07 11:56:32 +01:00
softworkz
153625ba51 Introduce IntegrationFactAttribute 2025-12-07 11:56:26 +01:00
softworkz
c97f914e7a Introduce TimeSpan extensions 2025-12-07 11:20:43 +01:00
Nitesh Singhal
d95b41fbae Add custom_main.js guide to documentation 2025-12-07 15:00:28 +05:30
softworkz
2b2b26e13b GetSetUserAgent 2025-12-06 21:08:47 +01:00
softworkz
9bb2adca78 Use 3s timeout for GetUserAgentAsync and updat test 2025-12-06 20:53:15 +01:00
softworkz
88d2daacb1 WebContentsTests: Experiment!
Re-enable some tests for CI as experiment
2025-12-06 20:35:51 +01:00
softworkz
c90f003519 GetSetZoomLevel: Don't use shared window
Because we need a visible window and the main window
visibility must not be mutated by tests
2025-12-06 20:11:27 +01:00
softworkz
daa9f399e9 ScreenTests: Remove invalid constraints
Negative values for cursor position are not invalid
2025-12-06 20:09:05 +01:00
softworkz
6246b44d68 ReadyToShow_event_fires: Destroy window 2025-12-06 20:08:01 +01:00
softworkz
347c1ef0e4 Show_hide_visibility_roundtrip: Don't use shared window 2025-12-06 20:06:34 +01:00
softworkz
7c8eeef225 GetPrintersAsync: Increase timeout 2025-12-06 20:04:23 +01:00
Florian Rappl
44a820e285 Merge pull request #960 from agracio/apis
Removing all properties merged in #958
2025-12-06 14:12:59 +01:00
agracio
8ccc7bfdd0 updating Microsoft.VisualStudio.JavaScript.Sdk to correct version 2025-12-06 12:30:05 +00:00
agracio
cf185fd2fb removing properties from webContents.ts 2025-12-06 12:11:58 +00:00
agracio
4ee11aaeae removing properties 2025-12-06 11:58:30 +00:00
Florian Rappl
f1063bbe98 Merge pull request #958 from agracio/apis
Additional APIs for WebContents
2025-12-05 09:10:11 +01:00
agracio
7c39d28f81 adding missing semicolon 2025-12-05 00:09:22 +00:00
agracio
e52bf69dee excluding some tests based on GitHub runner OS 2025-12-04 20:36:41 +00:00
agracio
46d395ad12 excluding some tests based on GitHub runner OS 2025-12-04 20:31:14 +00:00
agracio
c0e3a595c3 adding a couple await Task.Delay(500); to test in order to resolve flaky tests 2025-12-04 19:26:24 +00:00
agracio
65db66b4e9 trying a different env variable for skipping tests 2025-12-04 19:16:41 +00:00
agracio
ce8a86baf5 trying to fix some tests on CI 2025-12-04 19:13:20 +00:00
agracio
7eaf84a021 attempting to fix some tests on CI 2025-12-04 19:07:26 +00:00
agracio
90f5f5dbe2 attempting to fix some tests on CI 2025-12-04 18:38:12 +00:00
agracio
e09ef35be4 removing incorrect import 2025-12-04 18:08:42 +00:00
agracio
dae521180f adding WebContents APIs for Zoom, Audio and DevTools 2025-12-04 17:52:01 +00:00
Florian Rappl
c81ed54fff Merge pull request #953 from kevinfoley/readme-fix
README.md: fix grammar and typos
2025-11-29 21:12:35 +01:00
Kevin Foley
276ce8f4dc README.md: fix grammar and typos 2025-11-25 17:13:20 -08:00
Florian Rappl
20212cdca7 Merge pull request #951 from agracio/macos-intel-runners
adding macOS Intel runner
2025-11-24 09:01:23 +01:00
agracio
0acdc65271 adding macOS Intel runner 2025-11-24 00:45:31 +00:00
Florian Rappl
c92a54fbda Merge pull request #949 from softworkz/submit_model_update
Update all model classes to Electron API 39.2
2025-11-22 14:17:25 +01:00
Florian Rappl
4de7760556 Merge pull request #948 from softworkz/submit_extend_test_matrix
CI Tests: Extend matrix - 6 runners and 2 Electron versions
2025-11-22 14:11:50 +01:00
softworkz
3821ca60ea getPrinters: Increase timeout 2025-11-22 02:27:44 +01:00
softworkz
59887cce5f Guard deserialization error 2025-11-22 02:24:32 +01:00
softworkz
77834d0f2e Drop workaround via DescriptinoAttribute: No longer needed 2025-11-22 02:24:32 +01:00
softworkz
6761119241 Update all model classes to Electron API 39.2 2025-11-22 02:24:32 +01:00
softworkz
41d9f0afc7 Integration CI Tests: Extend matrix for more runners and two Electron versions 2025-11-22 00:57:15 +01:00
Florian Rappl
1d554fda60 Merge pull request #945 from softworkz/submit_outpath
BrowserWindowOptions; Fix default  and add more Tests
2025-11-21 00:34:09 +01:00
softworkz
2f4d37d823 Try macOS 26 2025-11-20 20:32:08 +01:00
softworkz
1815951092 BrowserWindowOptions; Fix default for FullScreenable
Electron's default is true
2025-11-20 02:56:00 +01:00
Florian Rappl
aa483ebaa4 Updated version 2025-11-19 09:14:54 +01:00
Florian Rappl
9b4e0e4504 Merge pull request #942 from softworkz/submit_outpath
electron-builder: Provide correct output path
2025-11-19 02:14:45 +01:00
softworkz
d05191d1e2 electron-builder: Provide correct output path and fix publish url 2025-11-19 02:05:48 +01:00
Florian Rappl
ef41329a91 Merge pull request #938 from softworkz/submit_ipc_types
Fix API break: public API must not expose JsonElement objects
2025-11-17 16:27:56 +01:00
Florian Rappl
edafa8ccdb Merge pull request #939 from softworkz/submit_cleanup
Cleanup & Consistency
2025-11-17 15:15:42 +01:00
softworkz
55c035323b Use non-generic TaskCompletionSource where applicable 2025-11-17 13:58:47 +01:00
softworkz
2e5c6200a6 ShowItemInFolderAsync: Fix endless hang 2025-11-17 13:58:47 +01:00
softworkz
be518a7a10 IpcMain: Properly handle Ipc message params (always 2-elem array) 2025-11-17 13:57:04 +01:00
softworkz
9e9558b837 SocketIoFacade: Remove unused method
It's not needed for compatibility since SocketIoFacade is internal
2025-11-17 13:18:41 +01:00
softworkz
5f6e4a9e9d Disable Nullable for all projects (was already for API/AspNet) 2025-11-17 13:18:41 +01:00
softworkz
b89c08ee96 IpcMainTests: Properly test for the types of values (must not be JsonElement) 2025-11-17 13:17:01 +01:00
softworkz
8ff875435b Fix API break: public API must not expose JsonElement objects
This changes deserialization to the way how it was with
Json.Net: Only .net primitive types are exposed publicly
2025-11-17 13:17:01 +01:00
Florian Rappl
bfad0cd45a Merge pull request #937 from softworkz/submit_move_workflow
Move PR comment creation to separate workflow on:pull_request_target
2025-11-17 09:03:53 +01:00
softworkz
91ed116cb1 Harden reading of PR number against injection attacks 2025-11-17 03:33:51 +01:00
softworkz
54eac4b521 Add workflow files to solution 2025-11-17 02:49:57 +01:00
softworkz
ac05ded844 Move PR comment creation to separate workflow on:pull_request_target 2025-11-17 02:49:57 +01:00
Florian Rappl
5434b0ec8e Merge pull request #936 from ElectronNET/develop
Release 0.2.0
2025-11-16 23:19:06 +01:00
Florian Rappl
20acd31f1a Updated changelog 2025-11-16 09:59:46 +01:00
Florian Rappl
f53d071bd9 Merge pull request #929 from softworkz/submit_platform_annotations
ElectronNET.API: Add platform support attributes
2025-11-16 09:38:31 +01:00
softworkz
2cf3095450 BrowserWindowTests: Add delays everywhere 2025-11-16 03:05:33 +01:00
softworkz
0ec791da9d Improve test Progress_bar_and_always_on_top_toggle 2025-11-16 02:59:50 +01:00
softworkz
0580942a59 ElectronNET API: Add platform support attributes 2025-11-16 02:53:28 +01:00
Florian Rappl
8e8d88c48f Merge pull request #931 from softworkz/submit_update_tests
Integration Tests Everywhere!
2025-11-16 02:42:22 +01:00
softworkz
61476e3ca4 Try fix remaining tests 2025-11-16 01:04:58 +01:00
softworkz
9488576d8f Add integration-tests workflow 2025-11-16 00:30:07 +01:00
softworkz
ff1b802838 Update ElectronFixture 2025-11-16 00:30:07 +01:00
softworkz
c98ad58290 Add xunit.runner.json 2025-11-16 00:30:07 +01:00
softworkz
a30239e3a6 Update electron start 2025-11-16 00:30:07 +01:00
softworkz
17f24749cd Project defaults: Make RuntimeIdentifier overrideable 2025-11-16 00:30:07 +01:00
softworkz
7558037b91 ElectronNET.IntegrationTests: Add platform support attributes 2025-11-16 00:30:07 +01:00
softworkz
e4485fd483 Remove Can_set_app_logs_path test
It's pointless because it doesn't ever throw
2025-11-16 00:24:17 +01:00
softworkz
1a964b405e BrowserWindow tests: use about:blank as url 2025-11-16 00:24:17 +01:00
softworkz
dfcb2345f3 Test project: Update to .net10 2025-11-16 00:24:17 +01:00
softworkz
3f10d6b5dd Remove tests for app badgecount
These require a full-blown desktop environment which is hardly ever available where these tests are run
2025-11-16 00:24:17 +01:00
Florian Rappl
90c3eb2c88 Merge pull request #935 from softworkz/submit_ts_project
ElectronNET.Host: Replace website by a real ts project
2025-11-15 16:02:02 +01:00
Florian Rappl
dbf76a1d6d Merge pull request #927 from softworkz/submit_whitespace2
Fix formatting and add GitHub Action to check trailing whitespace
2025-11-15 16:00:36 +01:00
softworkz
8e7892ebd4 Fix whitespace formatting 2025-11-15 13:52:19 +01:00
softworkz
30b547b8d3 Add R# settings 2025-11-15 13:41:25 +01:00
softworkz
30b4d92291 Add GitHub Action to check trailing whitespace on PRs 2025-11-15 13:41:25 +01:00
softworkz
6c9027faf3 WebApp: Do not compiled TS on build
(it's sufficient on save)
2025-11-15 13:14:27 +01:00
softworkz
c712027ea3 ElectronNET.Host: Replace website by a real ts project 2025-11-15 13:13:35 +01:00
Florian Rappl
7889057022 Merge pull request #933 from softworkz/submit_invocation_rename
Rename PropertyGet to more generic Invocator
2025-11-15 12:38:48 +01:00
Florian Rappl
68c50f1c1e Merge pull request #928 from softworkz/submit_remove_priv
Remove softworkz' special sauce
2025-11-15 12:37:24 +01:00
Florian Rappl
1006355bb7 Merge pull request #930 from softworkz/submit_pkg_update
build project: Update packages (due to vulnerabilities)
2025-11-15 12:35:34 +01:00
Florian Rappl
12c5391164 Merge pull request #932 from softworkz/submit_platform_specific
Webb app: add platform guards and promote analyzer severity
2025-11-15 12:34:57 +01:00
Florian Rappl
8ba24c0f2f Merge pull request #934 from ElectronNET/dependabot/npm_and_yarn/src/ElectronNET.WebApp/ElectronHostHook/js-yaml-4.1.1
Bump js-yaml from 4.1.0 to 4.1.1 in /src/ElectronNET.WebApp/ElectronHostHook
2025-11-15 12:25:28 +01:00
dependabot[bot]
bb7ae8d711 Bump js-yaml in /src/ElectronNET.WebApp/ElectronHostHook
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 4.1.0 to 4.1.1.
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/4.1.0...4.1.1)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 4.1.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-15 10:40:05 +00:00
softworkz
385dcfbf52 ApiBase: Code style and whitespace 2025-11-15 10:21:18 +01:00
softworkz
515430ff96 ApiBase: Rename PropertyGet to more generic Invocator 2025-11-15 10:21:18 +01:00
softworkz
a6d67a4dfe Make CA1416 and error (platform-depended reachabílitiy of code 2025-11-15 09:50:00 +01:00
softworkz
946b2af81a Webb app: add platform conditions 2025-11-15 09:50:00 +01:00
softworkz
1e483e9cc4 build project: Update packages (due to vulnerabilities) 2025-11-15 09:35:42 +01:00
softworkz
5305e17ba9 MSBuild props/targets: Adapt demo/test projects for change 2025-11-15 08:44:50 +01:00
softworkz
442084a3e5 MSBuild props/targets: Remove wrapped files 2025-11-15 08:44:50 +01:00
softworkz
cd205edabb common.props: Remove personal extras 2025-11-15 08:27:34 +01:00
Florian Rappl
10bf461b51 Prepare for Blazor support 2025-11-14 17:38:55 +01:00
Florian Rappl
5b0ab76d38 Disable Linux for now 2025-11-14 09:55:30 +01:00
Florian Rappl
349762bd5e Updated changelog 2025-11-14 09:46:01 +01:00
Florian Rappl
0b49467186 Merge pull request #924 from agracio/event-task-rework
ApiEventManager Rework and refactoring of task calls
2025-11-13 14:30:31 +01:00
agracio
6fa65aa149 adding block statements to if 2025-11-12 20:20:13 +00:00
agracio
816e9c0fe9 increasing test timeout times 2025-11-12 15:56:36 +00:00
agracio
c81b0e537f increasing test timeout times 2025-11-12 15:40:04 +00:00
agracio
b89e3caa17 Merge branch 'event-task-rework' of https://github.com/agracio/Electron.NET into event-task-rework 2025-11-12 15:32:33 +00:00
agracio
e8c5de63c9 reverting Linux CI changes, skipping printer test in CI 2025-11-12 15:32:17 +00:00
agracio
d7b9174853 Merge branch 'develop' into event-task-rework 2025-11-12 15:09:44 +00:00
agracio
5ba4ab24d5 adding virtual env instructions for Linux CI 2025-11-12 15:06:14 +00:00
agracio
c6ff957d9a rebase from develop, add timeouts to tests and attempt to skip NativeImageTests on Linux 2025-11-12 14:42:43 +00:00
Florian Rappl
c37f98dcd6 Added the test logger 2025-11-12 14:27:30 +01:00
Florian Rappl
0188051d6c Updated NUKE and integrated tests in CI/CD 2025-11-12 14:21:11 +01:00
Florian Rappl
3eb8507985 Updated to target .NET 10 as well 2025-11-12 13:48:03 +01:00
agracio
546668a2c0 refactoring events API, replacing task code with calls to ApiBase. 2025-11-12 10:43:32 +00:00
Florian Rappl
68feffba02 Merge pull request #922 from softworkz/submit_fix_ipc_params
Fix sendToIpcRenderer parameter handling
2025-11-12 01:30:35 +01:00
softworkz
12d2fcb484 Fix sendToIpcRenderer parameter handling 2025-11-11 23:46:56 +01:00
Florian Rappl
979cf72d4c Merge pull request #920 from Denny09310/feature/using-once
feat: Add "Once" socket listener registration for one-time handlers
2025-11-10 22:29:01 +01:00
Florian Rappl
14bf7fdcd8 Merge pull request #921 from softworkz/submit_missing_locks
SocketIOFacade: Add missing locking on .Off calls
2025-11-10 22:27:02 +01:00
softworkz
f89f2e7591 SocketIOFacade: Add missing locking on .Off calls 2025-11-10 21:29:16 +01:00
Denny09310
9a0a494bc5 fix: missing "Once" changes, rollback to "On" on Notification 2025-11-10 11:27:32 +01:00
Florian Rappl
41a2b075c9 Merge pull request #917 from Denny09310/feature/system-text-json
refactor: Migrating from Newtonsoft.Json to System.Text.Json
2025-11-10 11:03:19 +01:00
Denny09310
adc1e81743 fix: simplified add/remove of socket listener through usage of "Once" 2025-11-10 10:40:51 +01:00
Denny09310
d8062aae00 fix: scale factor can be a double 2025-11-10 10:40:19 +01:00
Denny09310
0522bc425b fix: using correct deserialization type instead JsonElement for everyting except mixed arrays 2025-11-09 15:46:33 +01:00
Denny09310
168eceac8c fix: removed unused JsonPropertyName as ElectronJson.Options as by default camel case 2025-11-09 15:17:42 +01:00
Denny09310
4736bc640c fix: added usings, simplified imports, using JsonElement.Deserialize directly instead of JsonSerializer.Deserialize(JsonElement), removed some unused attributes 2025-11-09 15:15:52 +01:00
Denny09310
18b1317fc5 fix: ignore writing when value is null 2025-11-09 14:53:44 +01:00
Denny09310
dfe04f14d0 fix: menuItems splattering due to "params" keyword 2025-11-09 14:40:55 +01:00
Denny09310
9d6861ffcd fix: including internal properties in json 2025-11-09 14:40:55 +01:00
Denny09310
d8b0d0443d fix: removed useless attribute 2025-11-09 14:40:55 +01:00
Denny09310
71ced8db56 refactor: Migrated from Newtonsoft.Json to System.Text.Json, missing one test passing 2025-11-09 14:40:51 +01:00
Florian Rappl
fc69598b09 Merge pull request #913 from softworkz/submit_tests_fixes
Add 77 IntegrationTests and lots of fixes
2025-11-09 14:05:41 +01:00
softworkz
60a278c41f Cookie: Fix formatting 2025-11-09 12:47:56 +01:00
softworkz
9d25795b7a SocketBridgeService: Fix state transition error 2025-11-09 12:45:01 +01:00
softworkz
5b597cc12c StartupManager: Add support for running under testhost 2025-11-09 12:45:01 +01:00
softworkz
707c0f5a7b BrowserView.cs: Fix cast exception in Bounds property getter 2025-11-09 12:45:01 +01:00
softworkz
bb59bc8365 App.cs: Fix UserAgentFallbackAsync 2025-11-09 12:45:01 +01:00
softworkz
423ea57af7 ipc.ts: Add helper method for tests 2025-11-09 12:45:01 +01:00
softworkz
8dcc3721eb browserWindows.ts: Fix SetThumbarButtons 2025-11-09 12:45:01 +01:00
softworkz
dc27511aa5 browserWindows.ts: Add catch for Set/GetRepresentedFilename
It's not supported on all platforms
2025-11-09 12:45:01 +01:00
softworkz
dd465baebf notification.ts: Fix notificationIsSupported
It's a method, was used like a property
2025-11-09 12:45:01 +01:00
softworkz
04210955a3 webContents.ts: Fix clearAuthCache invocation
The options were no propagated for the overload
with RemovePassword options
2025-11-09 12:45:01 +01:00
softworkz
4129cc17a6 main.js: Load api/process import (was missing) 2025-11-09 12:45:01 +01:00
softworkz
bc0f601dd8 ProcessMetric: Fix deserialization error for CreationTime 2025-11-09 12:45:01 +01:00
softworkz
95fd7aa665 ApiBase: fix event names for App 2025-11-09 12:45:01 +01:00
softworkz
402147b8ef BrowserWindow: Disable SetPosition 'workaround'
It doesn't make sense to do this adjustment for
set only but not for get.
Neither is this done for SetBounds, so it should
be either fully consistent or left up to the
application to deal with it.
2025-11-09 12:45:01 +01:00
softworkz
ed7cc434ea browserWindowSetParentWindow: Support null parameter 2025-11-09 12:44:20 +01:00
softworkz
c5fb5f62d9 Add IntegrationTests project 2025-11-09 12:44:20 +01:00
Florian Rappl
84989cda25 Merge pull request #914 from softworkz/submit_whitespace
Fix and normalize whitespace
2025-11-09 12:25:49 +01:00
softworkz
84b3c59353 Fix and normalize whitespace 2025-11-09 03:50:24 +01:00
Florian Rappl
c1e7b84ec6 Merge pull request #911 from Denny09310/develop
feat: updated 'TitleBarOverlay' property to be passed as object
2025-11-08 16:54:35 +01:00
Denny09310
9bb7dcfa62 fix: added WriteUndefined as there is Newtonsoft.Json 2025-11-08 16:49:33 +01:00
Denny09310
c0e711940d fix: don't write anything if value is null 2025-11-08 16:45:25 +01:00
Florian Rappl
d03458094b Added converter to improve object serialization 2025-11-08 16:38:36 +01:00
Denny09310
14962e1983 chore: updated documentation 2025-11-08 11:24:36 +01:00
Denny09310
d79b73e960 fix: using newtonsoft.json instead of system.text.json for the converter 2025-11-08 11:21:39 +01:00
Denny09310
21ae89bc70 fix: missing public constructor 2025-11-08 11:15:34 +01:00
Denny09310
7927a95cb8 feat: enhance titleBarOverlay to accept both a boolean and an object 2025-11-08 11:14:33 +01:00
Florian Rappl
758e6a41e3 Added properties 2025-11-07 22:12:54 +01:00
Florian Rappl
61421ddd66 Updated changelog 2025-11-07 09:58:38 +01:00
Florian Rappl
98d085f112 Merge pull request #907 from NimbusFox/main
Removed ownjsonSerializer from WindowManager
2025-11-07 08:47:12 +01:00
Florian Rappl
cf0b12ed0a Merge pull request #908 from softworkz/submit_api_consolidation
Mitigate race conditions and simplify API invocations
2025-11-07 08:46:36 +01:00
softworkz
4c3065c64b SocketIOFacade: Synchronize un/registration of events 2025-11-07 03:49:42 +01:00
softworkz
2a6d2117e9 Mitigate race condition, introduce timeout and simplify code for property gets 2025-11-07 03:49:08 +01:00
softworkz
93f457dd0f Introduce ApiBase and simplify method invocation 2025-11-07 00:11:52 +01:00
NimbusFox
6001a3c481 Removed ownjsonSerializer from WindowManager
Removed the unneeded serializer and applied the settings to the global
this._jsonSerializer as when the X and Y values are -1 in the options
it would lead to some settings not being applied. E.g. ContextIsolation
with it now applying the default values when serializing, settings
mentioned before are correctly assigned on Electron's end
2025-11-06 18:04:06 +00:00
Florian Rappl
4671b9b32a Merge pull request #905 from agracio/develop
Initial refactoring of dotnet  API
2025-11-06 10:22:04 +01:00
agracio
de7f98136e removing '-event' suffix from event names to normalise naming convention 2025-11-05 19:05:12 +00:00
agracio
87668f5606 removing '-event' suffix from event names to normalise naming convention 2025-11-05 18:59:21 +00:00
agracio
ea688026d0 refactoring dotnet events 2025-11-05 15:08:43 +00:00
agracio
b6b9292478 refactoring dotnet events 2025-11-05 15:06:41 +00:00
agracio
408f83e401 refactoring dotnet events 2025-11-05 14:14:37 +00:00
agracio
689a002dc2 refactoring dotnet events 2025-11-05 13:25:15 +00:00
Florian Rappl
f919289628 Switched default to true 2025-11-05 01:00:44 +01:00
Florian Rappl
2c544a83e9 Updated process class 2025-11-04 17:22:15 +01:00
Florian Rappl
2b393079ae Merge branch 'develop' 2025-11-04 16:18:53 +01:00
Florian Rappl
79d3d3f0b1 Fixed dup 2025-11-04 16:16:15 +01:00
Florian Rappl
688d6d83cc Fixed single instance behavior 2025-11-02 23:36:26 +01:00
Florian Rappl
7bcc5c9878 Corrected output path 2025-11-02 22:43:35 +01:00
Florian Rappl
0cfadb36f5 Updated process metric 2025-11-02 02:43:16 +01:00
Florian Rappl
568c785412 Redefine URL 2025-11-02 02:39:06 +01:00
Florian Rappl
2944e69b21 Added couple of enhancements 2025-11-02 02:24:32 +01:00
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
c2ba55e333 Merge branch 'develop' 2025-10-31 17:52:49 +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
9a615ca7e0 Merge pull request #881 from hillin/reintroduce-#648
Reintroduce #648
2025-06-22 07:53:30 +02:00
Todd Schavey
f9601a6e3e fix #647 make ProcessVersions Entity a record to ensure readonly access to props
This is to address a PR #648 review comment to ensure that only the external
users are not able to modify the instance values.
2025-06-18 11:57:04 +08:00
Todd Schavey
8daf4d1498 #647 update XML documentation to ElectronNET.API Process members 2025-06-18 11:52:02 +08:00
Todd Schavey
c01ef407af fix #647 add to ElectronNET.API Process member interfaces for various fields 2025-06-18 11:51:58 +08:00
Todd Schavey
dc019adb10 #647 add to ElectronNET.API Process member interfaces for argv and type 2025-06-18 11:47:01 +08:00
Todd Schavey
f7de17f1ee fix #647 add initial Process class to ElectronNET.API 2025-06-18 11:46:42 +08:00
Todd Schavey
ca748384cf fix #647 process argv for open-file for win and linux 2025-06-18 11:40:23 +08: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
Robert Muehsig
a2514ed5bc build script updated 2023-03-27 20:04:37 +02:00
Gregor Biswanger
b453278803 Update to new Electron.NET 23.6.1 2023-03-24 14:16:14 +01:00
Gregor Biswanger
a244382383 Add workaround for web-socket communication 2023-03-24 14:15:55 +01:00
Gregor Biswanger
a82e714ef8 Update Changelog für Electron.NET 23.6.1 2023-03-24 13:27:21 +01:00
Gregor Biswanger
b339485fdc Change signature of PrintToPDFOptions 2023-03-24 13:26:15 +01:00
Gregor Biswanger
551635867d Replace deprecated scroll-touch-events with input-event 2023-03-24 01:50:13 +01:00
Gregor Biswanger
941b8cf5c2 Add vscode dev profiles 2023-03-24 01:47:11 +01:00
Gregor Biswanger
06b01f75da Update Demo App to 23.6.1 2023-03-23 20:53:58 +01:00
Gregor Biswanger
e4b1f6586e Update NPM packages 2023-03-23 20:42:42 +01:00
Gregor Biswanger
0657a274d4 Add socket.io client csharp package 2023-03-23 20:29:08 +01:00
Gregor Biswanger
e3acc79c4f Change to .NET 6 build 2023-03-15 23:26:09 +01:00
Gregor Biswanger
73c1d1cd46 Upgrade to .NET 7 2023-02-24 14:56:40 +01:00
Robert Muehsig
c2a8c627b9 13.5.1 2021-07-08 14:09:44 +02:00
Gregor Biswanger
1862094861 Merge pull request #585 from tub5/bug/584
If we provide the Version parameter and haven't included the version …
2021-07-02 17:18:41 +02:00
Gregor Biswanger
0ad89c7d22 RequestSingleInstanceLockAsync callback does work now - bug fix #519 2021-07-02 17:18:14 +02:00
tub5
0af664b8a6 If we provide the Version parameter and haven't included the version or product version dotnet flag then add them.
Fixes: #584
2021-07-02 16:07:31 +01:00
Gregor Biswanger
afcd113675 singleInstance handle command line arguments 2021-07-02 16:50:48 +02:00
Gregor Biswanger
0e22ee3fd3 Changed CLI help text 2021-07-02 12:47:51 +02:00
Gregor Biswanger
ce0cdf39c6 Update to native Electron 13.1.5, Update Changelog 2021-07-02 02:04:23 +02:00
Gregor Biswanger
305544ab42 Merge pull request #579 from tub5/bug/578
Upgrade to use Electron 12.0.12
2021-07-01 23:43:10 +02:00
Gregor Biswanger
78d9d601b1 Merge branch 'master' into bug/578 2021-07-01 23:42:09 +02:00
Gregor Biswanger
fdd643ba48 Merge pull request #573 from tantumalice/serialization-fix
Vibrancy serialization fix
2021-07-01 23:40:09 +02:00
Gregor Biswanger
29a257251f Merge pull request #570 from cristiangiagante/net5_compat
Changes PublishSingleFile default to false for NET5 compatibility
2021-07-01 23:38:27 +02:00
Gregor Biswanger
3676db89d3 Merge branch 'master' into net5_compat 2021-07-01 23:38:19 +02:00
Gregor Biswanger
29011189f8 Merge pull request #582 from ElectronNET/dependabot/npm_and_yarn/ElectronNET.Host/ws-7.4.6
Bump ws from 7.4.2 to 7.4.6 in /ElectronNET.Host
2021-07-01 23:25:54 +02:00
Gregor Biswanger
9d7d859764 Merge pull request #583 from ElectronNET/dependabot/npm_and_yarn/ElectronNET.Host/lodash-4.17.21
Bump lodash from 4.17.19 to 4.17.21 in /ElectronNET.Host
2021-07-01 23:25:24 +02:00
Gregor Biswanger
5cdda5595a Merge pull request #581 from ElectronNET/dependabot/npm_and_yarn/ElectronNET.Host/normalize-url-4.5.1
Bump normalize-url from 4.5.0 to 4.5.1 in /ElectronNET.Host
2021-07-01 23:25:01 +02:00
Gregor Biswanger
62fe944ae3 Merge pull request #565 from ElectronNET/dependabot/npm_and_yarn/ElectronNET.WebApp/ElectronHostHook/lodash-4.17.21
Bump lodash from 4.17.19 to 4.17.21 in /ElectronNET.WebApp/ElectronHostHook
2021-07-01 23:24:25 +02:00
Gregor Biswanger
617eb15df8 Merge pull request #562 from TSrgy/using-exit-code
Using exit code instead of seek for the term 'error'
2021-07-01 23:24:10 +02:00
Gregor Biswanger
bff71dc86a Merge pull request #561 from nfichter/proxy-credentials
Add support for proxies that require basic username/password authentication
2021-07-01 23:20:36 +02:00
Gregor Biswanger
f0280f420a Merge pull request #560 from nfichter/ipc-to-browser-view
Allow IpcMain to send IPC messages to BrowserViews
2021-07-01 23:18:55 +02:00
Gregor Biswanger
9f7809810f Merge pull request #559 from nfichter/insert-css
Add WebContents insertCSS functionality
2021-07-01 23:16:53 +02:00
Gregor Biswanger
e610c96550 Merge pull request #547 from Funkrusha/feature/enable-post-requests
Add PostData to LoadURLOptions to allow http-posts in LoadURL calls
2021-07-01 23:13:19 +02:00
Gregor Biswanger
f3bd3d07d5 Merge pull request #546 from tub5/master
Fixes Add ability to pass an argument for "Version" for both the "dot…
2021-07-01 22:55:15 +02:00
Gregor Biswanger
0e8cfec689 Merge branch 'master' into master 2021-07-01 22:55:09 +02:00
Gregor Biswanger
c1b3d422d5 Merge pull request #540 from MiniguyBrendan/master
Resolve #539, #357 - Fix splash screen interaction causing crashes, ghost dragging, and resizable behavior
2021-07-01 22:41:00 +02:00
dependabot[bot]
fc12363e11 Bump lodash from 4.17.19 to 4.17.21 in /ElectronNET.Host
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21)

---
updated-dependencies:
- dependency-name: lodash
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-01 18:17:06 +00:00
dependabot[bot]
02f2fd770c Bump ws from 7.4.2 to 7.4.6 in /ElectronNET.Host
Bumps [ws](https://github.com/websockets/ws) from 7.4.2 to 7.4.6.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.4.2...7.4.6)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-01 18:16:42 +00:00
dependabot[bot]
5ee1918bb4 Bump normalize-url from 4.5.0 to 4.5.1 in /ElectronNET.Host
Bumps [normalize-url](https://github.com/sindresorhus/normalize-url) from 4.5.0 to 4.5.1.
- [Release notes](https://github.com/sindresorhus/normalize-url/releases)
- [Commits](https://github.com/sindresorhus/normalize-url/commits)

---
updated-dependencies:
- dependency-name: normalize-url
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-01 18:16:36 +00:00
dependabot[bot]
2213c61746 Bump lodash in /ElectronNET.WebApp/ElectronHostHook
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-01 18:16:36 +00:00
Gregor Biswanger
3cdff747fe Merge pull request #531 from stackify/issue/523
fixes #523 allow for property overrides to be passed in
2021-07-01 20:12:04 +02:00
tub5
476cc9e505 Updating ContextIsolation as per the comment from @danatcofo. "on electron v12 WebPreferences.contextIsolation defaults to true… this means that window.require() will no longer function" 2021-06-28 15:55:16 +01:00
tub5
fb8ca94e8e Upgrade to use Electron 12.0.12
Resolves #578
2021-06-28 12:46:17 +01:00
tub5
c94702fc60 Remove incorrect text at the top of the file 2021-06-28 12:10:05 +01:00
Alisa Semenova
cd9e06d5db Vibrancy serialization fix 2021-06-14 16:52:33 +03:00
Cristian Giagante
613f0a05b3 Changes PublishSingleFile default to false for NET5 compatibility 2021-06-02 22:39:28 -03:00
TSrgy
de2ce85a5c write command to console 2021-04-29 21:25:42 +05:00
TSrgy
e5d47e077b escape arguments for bash 2021-04-29 21:11:16 +05:00
TSrgy
ac77ccce9f Using exit code 2021-04-29 08:29:36 +05:00
Noah Fichter
504cc59760 Remove app argument from browserViewApi since it's no longer needed 2021-04-26 14:45:02 -04:00
Noah Fichter
0ee7097f31 Add support for proxies that require basic authentication 2021-04-26 14:38:41 -04:00
Noah Fichter
2d93d959f7 Allow IpcMain to send IPC messages to BrowserViews 2021-04-26 13:04:34 -04:00
Noah Fichter
a4d261a4e7 Add WebContents insertCSS functionality 2021-04-26 12:41:14 -04:00
Martin Schweizer
3838fe8971 Add PostData to LoadURLOptions to allow http-posts in LoadURL calls
Enable the possibility to post data to external Url's with the BrowserWindow.LoadURL function. The post data is provided through LoadURLOptions
2021-03-12 16:31:29 +01:00
tub5
b5e69f5dda Fixes Add ability to pass an argument for "Version" for both the "dotnet publish" and "electron-builder" commands #543 2021-03-04 14:45:52 +00:00
Brendan
55a3f10d37 Splash screen always renders on top 2021-02-18 13:32:45 -05:00
Brendan
7e494518f3 Fully ignore mouse events on splash screen (avoids drag + drop file into window) 2021-02-17 02:30:19 -05:00
Brendan
4596492cd9 Fix splash screen interaction causing crashes, fix splash screen content ghost drag, fix resizable splash screen. Resolves #539, #357
Using the browser-window-focus event would cause the splashScreen to be destroyed early (since regular mouse-focus events would cause the event to be fired).

Using the browser-window-created event produces the correct behavior.
2021-02-17 02:07:42 -05:00
Daniel Gidman
dd5bfd3961 Pass dotnet publsh /p: arguments to the publish command
use '/p:propertyName=value' or '/property:propertyName=value' to pass in dotnet build property overrides.

fixes #523
https://github.com/ElectronNET/Electron.NET/issues/523
2021-01-25 12:15:01 -06:00
dependabot[bot]
5d907864d8 Bump socket.io from 2.2.0 to 2.4.0 in /ElectronNET.Host
Bumps [socket.io](https://github.com/socketio/socket.io) from 2.2.0 to 2.4.0.
- [Release notes](https://github.com/socketio/socket.io/releases)
- [Changelog](https://github.com/socketio/socket.io/blob/2.4.0/CHANGELOG.md)
- [Commits](https://github.com/socketio/socket.io/compare/2.2.0...2.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-25 10:14:46 -06:00
Gregor Biswanger
30941df39c Update to .NET 5 infos 2021-01-22 00:16:04 +01:00
Gregor Biswanger
3588a8696d Update Changelog 2021-01-22 00:12:40 +01:00
668 changed files with 42450 additions and 17470 deletions

137
.github/CONTRIBUTING.md vendored Normal file
View File

@@ -0,0 +1,137 @@
# Contributing
## Project Scope
The Electron.NET project ultimately tries to provide a framework for developing cross-platform client applications on the basis of .NET and Electron. Anything that is related to this goal will be considered. The project aims to be as close to Electron with .NET as a basis as possible. If your contribution does not reflect that goal, the chances of accepting it are limited.
## Code License
This is an open source project falling under the [MIT License](../LICENSE). By using, distributing, or contributing to this project, you accept and agree that all code within the Electron.NET project and its libraries are licensed under MIT license.
## Becoming a Contributor
Usually appointing someone as a contributor follows this process:
1. An individual contributes actively via discussions (reporting bugs, giving feedback to existing or opening new issues) and / or pull requests
2. The individual is either directly asked, invited or asks for contributor rights on the project
3. The individual uses the contribution rights to sustain or increase the active contributions
Every contributor might have to sign the contributor's license agreement (CLA) to establish a legal trust between the project and its contributors.
## Working on Electron.NET
### Issue Discussion
Discussion of issues should be placed transparently in the issue tracker here on GitHub.
* [General issues, bugs, new features](https://github.com/ElectronNET/Electron.NET/issues)
* [General discussions, help, exchange of ideas](https://github.com/ElectronNET/Electron.NET/discussions)
### Modifying the code
Electron.NET and its libraries uses features from the latest versions of C# (e.g., C# 10). You will therefore need a C# compiler that is up for the job.
1. Fork and clone the repo.
2. First try to build the ElectronNET.Core library and see if you get the tests running.
3. You will be required to resolve some dependencies via NuGet.
The build system of Electron.NET uses NUKE.
### Code Conventions
Most parts in the Electron.NET project are fairly straight forward. Among these are:
* Always use statement blocks for control statements, e.g., in a for-loop, if-condition, ...
* You may use a simple (throw) statement in case of enforcing contracts on argument
* Be explicit about modifiers (some files follow an older convention of the code base, but we settled on the explicit style)
### Development Workflow
1. If no issue already exists for the work you'll be doing, create one to document the problem(s) being solved and self-assign.
2. Otherwise please let us know that you are working on the problem. Regular status updates (e.g. "still in progress", "no time anymore", "practically done", "pull request issued") are highly welcome.
3. Create a new branch—please don't work in the `main` branch directly. It is reserved for releases. We recommend naming the branch to match the issue being addressed (`feature/#777` or `issue-777`).
4. Add failing tests for the change you want to make. Tests are crucial and should be taken from W3C (or other specification).
5. Fix stuff. Always go from edge case to edge case.
6. All tests should pass now. Also your new implementation should not break existing tests.
7. Update the documentation to reflect any changes. (or document such changes in the original issue)
8. Push to your fork or push your issue-specific branch to the main repository, then submit a pull request against `develop`.
Just to illustrate the git workflow for Electron.NET a little bit more we've added the following graphs.
Initially, Electron.NET starts at the `main` branch. This branch should contain the latest stable (or released) version.
Here we now created a new branch called `develop`. This is the development branch.
Now active work is supposed to be done. Therefore a new branch should be created. Let's create one:
```sh
git checkout -b feature/#777
```
There may be many of these feature branches. Most of them are also pushed to the server for discussion or synchronization.
```sh
git push -u origin feature/#777
```
Now feature branches may be closed when they are done. Here we simply merge with the feature branch(es). For instance the following command takes the `feature/#777` branch from the server and merges it with the `develop` branch.
```sh
git checkout develop
git pull
git pull origin feature/#777
git push
```
Finally, we may have all the features that are needed to release a new version of Electron.NET. Here we tag the release. For instance for the 1.0 release we use `v1.0`.
```sh
git checkout main
git merge develop
git tag v1.0
```
(The last part is automatically performed by our CI system. Don't tag manually.)
### Versioning
The rules of [semver](http://semver.org/) don't necessarily apply here, but we will try to stay quite close to them.
Prior to version 1.0.0 we use the following scheme:
1. MINOR versions for reaching a feature milestone potentially combined with dramatic API changes
2. PATCH versions for refinements (e.g. performance improvements, bug fixes)
After releasing version 1.0.0 the scheme changes to become:
1. MAJOR versions at maintainers' discretion following significant changes to the codebase (e.g., API changes)
2. MINOR versions for backwards-compatible enhancements (e.g., performance improvements)
3. PATCH versions for backwards-compatible bug fixes (e.g., spec compliance bugs, support issues)
#### Code style
Regarding code style like indentation and whitespace, **follow the conventions you see used in the source already.** In general most of the [C# coding guidelines from Microsoft](https://msdn.microsoft.com/en-us/library/ff926074.aspx) are followed. This project prefers type inference with `var` to explicitly stating (redundant) information.
It is also important to keep a certain `async`-flow and to always use `ConfigureAwait(false)` in conjunction with an `await` expression.
## Backwards Compatibility
We always try to remain backwards compatible beyond the currently supported versions of .NET.
For instance, in December 2025 there have been activity to remove .NET 6 support from the codebase. We rejected this. Key points:
1. We have absolutely no need to drop `.net6` support. It doesn't hurt us in any way.
2. Many are still using `.net6`, including Electron.NET (non-Core) users. It doesn't make sense to force them to update two things at the same time (.NET + Electron.NET).
3. We MUST NOT and NEVER update `Microsoft.Build.Utilities.Core`. This will make Electron.NET stop working on older Visual Studio and MSBuild versions. There's are also no reasons to update it in the first place.
It's important to note that the Microsoft label of "Out of support" on .NET has almost no practical meaning. We've rarely (if ever) seen any bugs fixed in the same .NET version which mattered. The bugs that all new .NET versions have are much worse than mature .NET versions which are declared as "out of support". Keep in mind that the LTS matters most for active development / ongoing supported projects. If, e.g., a TV has been released a decade ago it most likely won't be patched. Still, you might want to deploy applications to it, which then naturally would involve being based on "out of support" versions of the framework.
TL;DR: Unless there is a technical reason (e.g., a crucial new API not being available) we should not drop "out of support" .NET versions. At the time of writing (December 2025) the minimum supported .NET version remains at `.net6`.
## Timeline
**All of this information is related to ElectronNET.Core pre-v1!**
We pretty much release whenever we have something new (i.e., do fixes such as a 0.1.1, or add new features, such as a 0.2.0) quite quickly.
We will go for a 1.0.0 release of this as early as ~mid of January 2026 (unless we find some critical things or want to extend the beta phase for ElectronNET.Core). This should be sufficient time to get some user input and have enough experience to call it stable.

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.

43
.github/workflows/Build and Publish.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: Build and Publish
on: [push]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
concurrency:
group: build-publish-${{ github.ref }}
cancel-in-progress: true
jobs:
Integration-Tests:
uses: ./.github/workflows/integration-tests.yml
name: '1'
Publish:
needs: [Integration-Tests]
runs-on: windows-latest
timeout-minutes: 10
name: '2 / Publish'
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
10.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
}

39
.github/workflows/PR Validation.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: PR Validation
on: [pull_request]
concurrency:
group: pr-validation-${{ github.ref }}
cancel-in-progress: true
jobs:
Whitespace-Check:
uses: ./.github/workflows/trailing-whitespace-check.yml
secrets: inherit
name: '1'
Tests:
needs: Whitespace-Check
uses: ./.github/workflows/integration-tests.yml
secrets: inherit
name: '2'
build:
needs: [Whitespace-Check, Tests]
runs-on: windows-latest
timeout-minutes: 10
name: '3 / Build'
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
10.0.x
- name: Build
run: .\build.ps1

220
.github/workflows/integration-tests.yml vendored Normal file
View File

@@ -0,0 +1,220 @@
name: Tests
on:
workflow_call:
concurrency:
group: integration-tests-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
name: ${{ matrix.os }} API-${{ matrix.electronVersion }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04, windows-2022, windows-2025, macos-14, macos-15-intel, macos-26]
electronVersion: ['30.4.0', '38.2.2']
include:
- os: ubuntu-22.04
rid: linux-x64
- os: ubuntu-24.04
rid: linux-x64
- os: windows-2022
rid: win-x64
- os: windows-2025
rid: win-x64
- os: macos-14
rid: osx-arm64
- os: macos-15-intel
rid: osx-x64
- os: macos-26
rid: osx-arm64
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: 1
CI: true
ELECTRON_ENABLE_LOGGING: 1
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Random delay (0-20 seconds)
shell: bash
run: |
DELAY=$((RANDOM % 21))
echo "Waiting for $DELAY seconds..."
sleep $DELAY
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Restore
run: dotnet restore -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} -p:ElectronVersion=${{ matrix.electronVersion }} src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj
- name: Build
run: dotnet build --no-restore -c Release -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} -p:ElectronVersion=${{ matrix.electronVersion }} src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj
- name: Install Linux GUI dependencies
if: runner.os == 'Linux'
run: |
set -e
sudo apt-get update
. /etc/os-release
if [ "$VERSION_ID" = "24.04" ]; then ALSA_PKG=libasound2t64; else ALSA_PKG=libasound2; fi
echo "Using ALSA package: $ALSA_PKG"
sudo apt-get install -y xvfb \
libgtk-3-0 libnss3 libgdk-pixbuf-2.0-0 libdrm2 libgbm1 libxss1 libxtst6 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libx11-xcb1 "$ALSA_PKG"
- name: Run tests (Linux)
if: runner.os == 'Linux'
continue-on-error: true
run: |
mkdir -p test-results
xvfb-run -a dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj \
-c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} -p:ElectronVersion=${{ matrix.electronVersion }} \
--logger "trx;LogFileName=${{ matrix.os }}-electron-${{ matrix.electronVersion }}.trx" \
--logger "console;verbosity=detailed" \
--results-directory test-results
- name: Run tests (Windows)
if: runner.os == 'Windows'
continue-on-error: true
run: |
New-Item -ItemType Directory -Force -Path test-results | Out-Null
dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj -c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} -p:ElectronVersion=${{ matrix.electronVersion }} --logger "trx;LogFileName=${{ matrix.os }}-electron-${{ matrix.electronVersion }}.trx" --logger "console;verbosity=detailed" --results-directory test-results
- name: Run tests (macOS)
if: runner.os == 'macOS'
continue-on-error: true
run: |
mkdir -p test-results
dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj -c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} -p:ElectronVersion=${{ matrix.electronVersion }} --logger "trx;LogFileName=${{ matrix.os }}-electron-${{ matrix.electronVersion }}.trx" --logger "console;verbosity=detailed" --results-directory test-results
- name: Upload raw test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}-electron-${{ matrix.electronVersion }}
path: test-results/*.trx
retention-days: 7
summary:
name: Test Results
runs-on: ubuntu-24.04
if: always()
needs: [tests]
permissions:
actions: read
contents: read
checks: write
pull-requests: write
steps:
- name: Download all test results
uses: actions/download-artifact@v4
with:
path: test-results
- name: Setup .NET (for CTRF conversion)
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Install CTRF TRX→CTRF converter (dotnet tool)
run: |
dotnet new tool-manifest
dotnet tool install DotnetCtrfJsonReporter --local
- name: Convert TRX → CTRF and clean names (filePath=OS|Electron X.Y.Z)
shell: bash
run: |
set -euo pipefail
mkdir -p ctrf
shopt -s globstar nullglob
conv=0
for trx in test-results/**/*.trx; do
base="$(basename "$trx" .trx)" # e.g. ubuntu-22.04-electron-30.4.0
os="${base%%-electron-*}"
electron="${base#*-electron-}"
label="$os|Electron $electron"
outdir="ctrf/${label}"
mkdir -p "$outdir"
out="${outdir}/ctrf-report.json"
dotnet tool run DotnetCtrfJsonReporter -p "$trx" -d "$outdir" -f "ctrf-report.json"
jq --arg fp "$label" '.results.tests |= map(.filePath = $fp)' "$out" > "${out}.tmp" && mv "${out}.tmp" "$out"
echo "Converted & normalized $trx -> $out"
conv=$((conv+1))
done
echo "Processed $conv TRX file(s)"
- name: Publish Test Report
if: always()
uses: ctrf-io/github-test-reporter@v1
with:
report-path: 'ctrf/**/*.json'
summary: true
pull-request: false
status-check: false
status-check-name: 'Integration Tests'
use-suite-name: true
update-comment: true
always-group-by: true
overwrite-comment: true
exit-on-fail: true
group-by: 'suite'
upload-artifact: true
fetch-previous-results: true
summary-report: false
summary-delta-report: true
github-report: true
test-report: false
test-list-report: false
failed-report: true
failed-folded-report: false
skipped-report: true
suite-folded-report: true
suite-list-report: false
file-report: true
previous-results-report: true
insights-report: true
flaky-report: true
flaky-rate-report: true
fail-rate-report: false
slowest-report: false
report-order: 'summary-delta-report,failed-report,skipped-report,suite-folded-report,file-report,previous-results-report,github-report'
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Save PR Number
if: github.event_name == 'pull_request'
run: echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
- name: Write PR Number to File
if: github.event_name == 'pull_request'
run: echo "$PR_NUMBER" > pr_number.txt
shell: bash
- name: Upload PR Number Artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr_number.txt
- name: Summary
run: echo "All matrix test jobs completed."

81
.github/workflows/pr-comment.yml vendored Normal file
View File

@@ -0,0 +1,81 @@
name: Create PR Comments
on:
workflow_run:
workflows: [ "PR Validation" ]
types: [completed]
permissions:
contents: read
actions: read
pull-requests: write
jobs:
pr-comment:
name: Post Test Result as PR comment
runs-on: ubuntu-24.04
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion != 'cancelled'
steps:
- name: Download CTRF artifact
uses: dawidd6/action-download-artifact@v8
with:
github_token: ${{ github.token }}
run_id: ${{ github.event.workflow_run.id }}
name: ctrf-report
path: ctrf
- name: Download PR Number Artifact
uses: dawidd6/action-download-artifact@v8
with:
github_token: ${{ github.token }}
run_id: ${{ github.event.workflow_run.id }}
name: pr_number
path: pr_number
- name: Read PR Number
run: |
set -Eeuo pipefail
FILE='pr_number/pr_number.txt'
# Ensure file exists
if [ ! -f "$FILE" ] || [ -L "$FILE" ]; then
echo "Error: $FILE is missing or is not a regular file." >&2
exit 1
fi
# Chec file size
if [ "$(wc -c < "$FILE" | tr -d ' ')" -gt 200 ]; then
echo "Error: $FILE is too large." >&2
exit 1
fi
# Read first line
PR_NUMBER=""
IFS= read -r PR_NUMBER < "$FILE" || true
# Validate whether it's a number
if ! [[ "$PR_NUMBER" =~ ^[0-9]{1,10}$ ]]; then
echo "Error: PR_NUMBER is not a valid integer on the first line." >&2
exit 1
fi
printf 'PR_NUMBER=%s\n' "$PR_NUMBER" >> "$GITHUB_ENV"
- name: Post PR Comment
uses: ctrf-io/github-test-reporter@v1
with:
report-path: 'ctrf/**/*.json'
issue: ${{ env.PR_NUMBER }}
summary: true
pull-request: true
use-suite-name: true
update-comment: true
always-group-by: true
overwrite-comment: true
upload-artifact: false
pull-request-report: true
env:
GITHUB_TOKEN: ${{ github.token }}

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'

49
.github/workflows/retry-test-jobs.yml vendored Normal file
View File

@@ -0,0 +1,49 @@
name: Tests auto-rerun
on:
workflow_run:
workflows: [ "PR Validation", "Build and Publish" ]
types: [ completed ]
jobs:
rerun-failed-matrix-jobs-once:
if: >
${{
github.event.workflow_run.conclusion == 'failure' &&
github.event.workflow_run.run_attempt == 1
}}
runs-on: ubuntu-24.04
permissions:
actions: write
contents: read
steps:
- name: Decide whether to rerun (only if matrix jobs failed)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
RUN_ID: ${{ github.event.workflow_run.id }}
run: |
echo "Inspecting jobs of workflow run $RUN_ID in $REPO"
jobs_json="$(gh api -R $REPO repos/$REPO/actions/runs/$RUN_ID/jobs)"
echo "Jobs and conclusions:"
echo "$jobs_json" | jq '.jobs[] | {name: .name, conclusion: .conclusion}'
failed_matrix_jobs=$(echo "$jobs_json" | jq -r '
[ .jobs[]
| select(.conclusion == "failure"
and (.name | contains(" API-")))
]
| length // 0
')
failed_matrix_jobs=${failed_matrix_jobs:-0}
if [ "${failed_matrix_jobs}" -gt 0 ]; then
echo "Detected failing Integration Tests jobs re-running failed jobs for this run."
gh run rerun -R "$REPO" "$RUN_ID" --failed
else
echo "Only non-matrix jobs (like Test Results) failed not auto-rerunning."
fi

View File

@@ -0,0 +1,84 @@
name: Whitespace Check
on:
workflow_call:
jobs:
check-whitespace:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for trailing whitespace
run: |
echo "Checking for trailing whitespace in changed files..."
# Get the base branch
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
# Get list of changed files (excluding deleted files)
CHANGED_FILES=$(git diff --name-only --diff-filter=d "$BASE_SHA" "$HEAD_SHA")
if [ -z "$CHANGED_FILES" ]; then
echo "No files to check."
exit 0
fi
# File patterns to check (text files)
PATTERNS="\.cs$|\.csproj$|\.sln$|\.ts$|\.html$|\.css$|\.scss$"
# Directories and file patterns to exclude
EXCLUDE_PATTERNS="(^|\/)(\.|node_modules|bin|obj|artifacts|packages|\.vs|\.nuke\/temp)($|\/)"
ERRORS_FOUND=0
TEMP_FILE=$(mktemp)
while IFS= read -r file; do
# Skip if file doesn't exist (shouldn't happen with --diff-filter=d, but just in case)
if [ ! -f "$file" ]; then
continue
fi
# Check if file matches patterns to check
if ! echo "$file" | grep -qE "$PATTERNS"; then
continue
fi
# Check if file should be excluded
if echo "$file" | grep -qE "$EXCLUDE_PATTERNS"; then
continue
fi
# Find trailing whitespace lines, excluding XML doc placeholder lines that are exactly "/// " (one space)
MATCHES=$(grep -n '[[:space:]]$' "$file" | grep -vE '^[0-9]+:[[:space:]]*/// $' || true)
if [ -n "$MATCHES" ]; then
echo "❌ Trailing whitespace found in: $file"
echo "$MATCHES" | head -10
TOTAL=$(echo "$MATCHES" | wc -l)
if [ "$TOTAL" -gt 10 ]; then
echo " ... and $(($TOTAL - 10)) more lines"
fi
echo "1" >> "$TEMP_FILE"
fi
done <<< "$CHANGED_FILES"
ERRORS_FOUND=$(wc -l < "$TEMP_FILE" 2>/dev/null || echo "0")
rm -f "$TEMP_FILE"
if [ "$ERRORS_FOUND" -gt 0 ]; then
echo ""
echo "❌ Found trailing whitespace in $ERRORS_FOUND file(s)."
echo "Please remove trailing whitespace from the files listed above."
exit 1
else
echo "✅ No trailing whitespace found in changed files."
exit 0
fi

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

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

@@ -0,0 +1,137 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"Host": {
"type": "string",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
},
"ExecutableTarget": {
"type": "string",
"enum": [
"Clean",
"Compile",
"Default",
"Package",
"PrePublish",
"Publish",
"PublishPackages",
"PublishPreRelease",
"PublishRelease",
"Restore",
"RunUnitTests"
]
},
"Verbosity": {
"type": "string",
"description": "",
"enum": [
"Verbose",
"Normal",
"Minimal",
"Quiet"
]
},
"NukeBuild": {
"properties": {
"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": {
"description": "Host for execution. Default is 'automatic'",
"$ref": "#/definitions/Host"
},
"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"
}
},
"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": {
"$ref": "#/definitions/ExecutableTarget"
}
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"$ref": "#/definitions/ExecutableTarget"
}
},
"Verbosity": {
"description": "Logging verbosity during build execution. Default is 'Normal'",
"$ref": "#/definitions/Verbosity"
}
}
}
},
"allOf": [
{
"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"
]
},
"ReleaseNotesFilePath": {
"type": "string",
"description": "ReleaseNotesFilePath - To determine the lates changelog version"
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
}
}
},
{
"$ref": "#/definitions/NukeBuild"
}
]
}

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,

32
.vscode/tasks.json vendored
View File

@@ -1,16 +1,18 @@
{
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [
"${workspaceRoot}/ElectronNET.CLI/ElectronNET.CLI.csproj"
],
"isBuildCommand": true,
"problemMatcher": "$msCompile"
}
]
}
"version": "2.0.0",
"command": "dotnet",
"args": [],
"tasks": [
{
"label": "build",
"type": "shell",
"command": "dotnet",
"args": ["build", "${workspaceRoot}/src/ElectronNET.CLI/ElectronNET.CLI.csproj"],
"problemMatcher": "$msCompile",
"group": {
"_id": "build",
"isDefault": false
}
}
]
}

View File

@@ -1,327 +1,132 @@
# Not released
# 11.5.1
ElectronNET.CLI:
* 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)
ElectronNET.API:
* 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)
Example for the Dock Menu
`Electron.Dock.SetMenu(new [] {
new MenuItem {
Label = "Dock Menu Item",
Click = () => {
// do something
}
},
});`
Example for consuming the activate event (MacOs only)
`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)
# Released
# 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
# 0.4.0
## ElectronNET.Core
- Fixed ElectronSingleInstance handling (#996) @softworkz
- Fixed `PackageId` handling (#993) @softworkz
- Added cross-platform npm restore and check mismatch on publish (#988) @softworkz
# 0.3.1
## ElectronNET.Core
- Fixed issue transforming the project ID (#989, #990) @softworkz
# 0.3.0
## ElectronNET.Core
- Updated infrastructure (#937, #939) @softworkz
- Updated all model classes to Electron API 39.2 (#949) @softworkz
- Fixed output path for `electron-builder` (#942) @softworkz
- Fixed floating point display resolution (#944) @softworkz
- Fixed error in case of missing electron-host-hook (#978)
- Fixed previous API break using exposed `JsonElement` objects (#938) @softworkz
- Fixed and improved several test cases (#962) @softworkz
- Fixed startup of Electron.NET from VS Code Debug Adapter (#952)
- Fixed the `BrowserWindowOptions` (#945) @softworkz
- Fixed example for `AutoMenuHide` to reflect platform capabilities (#982) @markatosi
- Added several migration checks for publishing (#966) @softworkz
- Added more test runners for E2E tests (#950, #951) @agracio
- Added dynamic updates for tray menu (#973) @davidroth
- Added matrix tests with 6 runners and 2 electron version (#948) @softworkz
- Added additional APIs for WebContents (#958) @agracio
- Added documentation for MacOS package publish (#983) @markatosi
- Added sample application for `ElectronHostHook` (#967) @adityashirsatrao007
# 0.2.0
## ElectronNET.Core
- Updated dependencies (#930) @softworkz
- Updated integration tests (#931) @softworkz
- Updated `ElectronNET.Host` (#935) @softworkz
- Removed transition period specific build configuration (#928) @softworkz
- Added `IsRunningBlazor` option to `BrowserWindowOptions` (#926)
- Added platform support attributes (#929) @softworkz
# 0.1.0
## ElectronNET.Core
- Updated `PrintToPDFOptions` to also allow specifying the `PageSize` with an object (#769)
- Updated splashscreen image to have 0 margin (#622)
- Updated the IPC API w.r.t. naming and consistency (#905) @agracio
- Updated the IPC bridge w.r.t. synchronization and thread-safety (#918) @agracio
- Updated serialization to use `System.Text.Json` replacing `Newtonsoft.Json` (#917) @Denny09310
- Fixed parameter handling for the `sendToIpcRenderer` function (#922) @softworkz
- Fixed synchronization on removing event handlers (#921) @softworkz
- Fixed creation of windows with `contextIsolation` enabled (#906) @NimbusFox
- Fixed single instance behavior using the `ElectronSingleInstance` property (#901)
- Fixed potential race conditions (#908) @softworkz
- Added option to use `ElectronSplashScreen` with an HTML file (#799)
- Added option to provide floating point value as aspect ratios with `SetAspectRatio` (#793)
- Added option to provide `TitleBarOverlay` as an object (#911) @Denny09310
- Added `TitleBarOverlay` property to `BrowserWindowOptions` (#909)
- Added `RoundedCorners` property to `BrowserWindowOptions`
- Added integration tests and robustness checks (#913) @softworkz
- Added .NET 10 as an explicit target
# 0.0.18
## ElectronNET.Core
### Highlights
- **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
### Build System & Project Structure
- 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
### Development Experience
- 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)
### Debugging & Runtime
- 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
### Technical Improvements
- 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
### Package & Distribution
- 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
### Migration & Compatibility
- 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
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,621 +0,0 @@
using ElectronNET.API.Entities;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace ElectronNET.API
{
/// <summary>
/// Enable apps to automatically update themselves. Based on electron-updater.
/// </summary>
public sealed class AutoUpdater
{
/// <summary>
/// Whether to automatically download an update when it is found. (Default is true)
/// </summary>
public bool AutoDownload
{
get
{
return Task.Run<bool>(() =>
{
var taskCompletionSource = new TaskCompletionSource<bool>();
BridgeConnector.Socket.On("autoUpdater-autoDownload-get-reply", (result) =>
{
BridgeConnector.Socket.Off("autoUpdater-autoDownload-get-reply");
taskCompletionSource.SetResult((bool)result);
});
BridgeConnector.Socket.Emit("autoUpdater-autoDownload-get");
return taskCompletionSource.Task;
}).Result;
}
set
{
BridgeConnector.Socket.Emit("autoUpdater-autoDownload-set", value);
}
}
/// <summary>
/// Whether to automatically install a downloaded update on app quit (if `QuitAndInstall` was not called before).
///
/// Applicable only on Windows and Linux.
/// </summary>
public bool AutoInstallOnAppQuit
{
get
{
return Task.Run<bool>(() =>
{
var taskCompletionSource = new TaskCompletionSource<bool>();
BridgeConnector.Socket.On("autoUpdater-autoInstallOnAppQuit-get-reply", (result) =>
{
BridgeConnector.Socket.Off("autoUpdater-autoInstallOnAppQuit-get-reply");
taskCompletionSource.SetResult((bool)result);
});
BridgeConnector.Socket.Emit("autoUpdater-autoInstallOnAppQuit-get");
return taskCompletionSource.Task;
}).Result;
}
set
{
BridgeConnector.Socket.Emit("autoUpdater-autoInstallOnAppQuit-set", value);
}
}
/// <summary>
/// *GitHub provider only.* Whether to allow update to pre-release versions.
/// Defaults to "true" if application version contains prerelease components (e.g. "0.12.1-alpha.1", here "alpha" is a prerelease component), otherwise "false".
///
/// If "true", downgrade will be allowed("allowDowngrade" will be set to "true").
/// </summary>
public bool AllowPrerelease
{
get
{
return Task.Run<bool>(() =>
{
var taskCompletionSource = new TaskCompletionSource<bool>();
BridgeConnector.Socket.On("autoUpdater-allowPrerelease-get-reply", (result) =>
{
BridgeConnector.Socket.Off("autoUpdater-allowPrerelease-get-reply");
taskCompletionSource.SetResult((bool)result);
});
BridgeConnector.Socket.Emit("autoUpdater-allowPrerelease-get");
return taskCompletionSource.Task;
}).Result;
}
set
{
BridgeConnector.Socket.Emit("autoUpdater-allowPrerelease-set", value);
}
}
/// <summary>
/// *GitHub provider only.*
/// Get all release notes (from current version to latest), not just the latest (Default is false).
/// </summary>
public bool FullChangelog
{
get
{
return Task.Run<bool>(() =>
{
var taskCompletionSource = new TaskCompletionSource<bool>();
BridgeConnector.Socket.On("autoUpdater-fullChangelog-get-reply", (result) =>
{
BridgeConnector.Socket.Off("autoUpdater-fullChangelog-get-reply");
taskCompletionSource.SetResult((bool)result);
});
BridgeConnector.Socket.Emit("autoUpdater-fullChangelog-get");
return taskCompletionSource.Task;
}).Result;
}
set
{
BridgeConnector.Socket.Emit("autoUpdater-fullChangelog-set", value);
}
}
/// <summary>
/// Whether to allow version downgrade (when a user from the beta channel wants to go back to the stable channel).
/// Taken in account only if channel differs (pre-release version component in terms of semantic versioning).
/// Default is false.
/// </summary>
public bool AllowDowngrade
{
get
{
return Task.Run<bool>(() =>
{
var taskCompletionSource = new TaskCompletionSource<bool>();
BridgeConnector.Socket.On("autoUpdater-allowDowngrade-get-reply", (result) =>
{
BridgeConnector.Socket.Off("autoUpdater-allowDowngrade-get-reply");
taskCompletionSource.SetResult((bool)result);
});
BridgeConnector.Socket.Emit("autoUpdater-allowDowngrade-get");
return taskCompletionSource.Task;
}).Result;
}
set
{
BridgeConnector.Socket.Emit("autoUpdater-allowDowngrade-set", value);
}
}
/// <summary>
/// For test only.
/// </summary>
public string UpdateConfigPath
{
get
{
return Task.Run<string>(() =>
{
var taskCompletionSource = new TaskCompletionSource<string>();
BridgeConnector.Socket.On("autoUpdater-updateConfigPath-get-reply", (result) =>
{
BridgeConnector.Socket.Off("autoUpdater-updateConfigPath-get-reply");
taskCompletionSource.SetResult(result.ToString());
});
BridgeConnector.Socket.Emit("autoUpdater-updateConfigPath-get");
return taskCompletionSource.Task;
}).Result;
}
}
/// <summary>
/// The current application version
/// </summary>
public Task<SemVer> CurrentVersionAsync
{
get
{
return Task.Run<SemVer>(() =>
{
var taskCompletionSource = new TaskCompletionSource<SemVer>();
BridgeConnector.Socket.On("autoUpdater-currentVersion-get-reply", (result) =>
{
BridgeConnector.Socket.Off("autoUpdater-currentVersion-get-reply");
SemVer version = ((JObject)result).ToObject<SemVer>();
taskCompletionSource.SetResult(version);
});
BridgeConnector.Socket.Emit("autoUpdater-currentVersion-get");
return taskCompletionSource.Task;
});
}
}
/// <summary>
/// Get the update channel. Not applicable for GitHub.
/// Doesnt return channel from the update configuration, only if was previously set.
/// </summary>
[Obsolete("Use the asynchronous version ChannelAsync instead")]
public string Channel
{
get
{
return ChannelAsync.Result;
}
}
/// <summary>
/// Get the update channel. Not applicable for GitHub.
/// Doesnt return channel from the update configuration, only if was previously set.
/// </summary>
public Task<string> ChannelAsync
{
get
{
return Task.Run<string>(() =>
{
var taskCompletionSource = new TaskCompletionSource<string>();
BridgeConnector.Socket.On("autoUpdater-channel-get-reply", (result) =>
{
BridgeConnector.Socket.Off("autoUpdater-channel-get-reply");
taskCompletionSource.SetResult(result.ToString());
});
BridgeConnector.Socket.Emit("autoUpdater-channel-get");
return taskCompletionSource.Task;
});
}
}
/// <summary>
/// The request headers.
/// </summary>
public Task<Dictionary<string, string>> RequestHeadersAsync
{
get
{
return Task.Run(() =>
{
var taskCompletionSource = new TaskCompletionSource<Dictionary<string, string>>();
BridgeConnector.Socket.On("autoUpdater-requestHeaders-get-reply", (headers) =>
{
BridgeConnector.Socket.Off("autoUpdater-requestHeaders-get-reply");
Dictionary<string, string> result = ((JObject)headers).ToObject<Dictionary<string, string>>();
taskCompletionSource.SetResult(result);
});
BridgeConnector.Socket.Emit("autoUpdater-requestHeaders-get");
return taskCompletionSource.Task;
});
}
}
/// <summary>
/// The request headers.
/// </summary>
public Dictionary<string, string> RequestHeaders
{
set
{
BridgeConnector.Socket.Emit("autoUpdater-requestHeaders-set", JObject.FromObject(value, _jsonSerializer));
}
}
/// <summary>
/// Emitted when there is an error while updating.
/// </summary>
public event Action<string> OnError
{
add
{
if (_error == null)
{
BridgeConnector.Socket.On("autoUpdater-error" + GetHashCode(), (message) =>
{
_error(message.ToString());
});
BridgeConnector.Socket.Emit("register-autoUpdater-error-event", GetHashCode());
}
_error += value;
}
remove
{
_error -= value;
if (_error == null)
BridgeConnector.Socket.Off("autoUpdater-error" + GetHashCode());
}
}
private event Action<string> _error;
/// <summary>
/// Emitted when checking if an update has started.
/// </summary>
public event Action OnCheckingForUpdate
{
add
{
if (_checkingForUpdate == null)
{
BridgeConnector.Socket.On("autoUpdater-checking-for-update" + GetHashCode(), () =>
{
_checkingForUpdate();
});
BridgeConnector.Socket.Emit("register-autoUpdater-checking-for-update-event", GetHashCode());
}
_checkingForUpdate += value;
}
remove
{
_checkingForUpdate -= value;
if (_checkingForUpdate == null)
BridgeConnector.Socket.Off("autoUpdater-checking-for-update" + GetHashCode());
}
}
private event Action _checkingForUpdate;
/// <summary>
/// Emitted when there is an available update.
/// The update is downloaded automatically if AutoDownload is true.
/// </summary>
public event Action<UpdateInfo> OnUpdateAvailable
{
add
{
if (_updateAvailable == null)
{
BridgeConnector.Socket.On("autoUpdater-update-available" + GetHashCode(), (updateInfo) =>
{
_updateAvailable(JObject.Parse(updateInfo.ToString()).ToObject<UpdateInfo>());
});
BridgeConnector.Socket.Emit("register-autoUpdater-update-available-event", GetHashCode());
}
_updateAvailable += value;
}
remove
{
_updateAvailable -= value;
if (_updateAvailable == null)
BridgeConnector.Socket.Off("autoUpdater-update-available" + GetHashCode());
}
}
private event Action<UpdateInfo> _updateAvailable;
/// <summary>
/// Emitted when there is no available update.
/// </summary>
public event Action<UpdateInfo> OnUpdateNotAvailable
{
add
{
if (_updateNotAvailable == null)
{
BridgeConnector.Socket.On("autoUpdater-update-not-available" + GetHashCode(), (updateInfo) =>
{
_updateNotAvailable(JObject.Parse(updateInfo.ToString()).ToObject<UpdateInfo>());
});
BridgeConnector.Socket.Emit("register-autoUpdater-update-not-available-event", GetHashCode());
}
_updateNotAvailable += value;
}
remove
{
_updateNotAvailable -= value;
if (_updateNotAvailable == null)
BridgeConnector.Socket.Off("autoUpdater-update-not-available" + GetHashCode());
}
}
private event Action<UpdateInfo> _updateNotAvailable;
/// <summary>
/// Emitted on download progress.
/// </summary>
public event Action<ProgressInfo> OnDownloadProgress
{
add
{
if (_downloadProgress == null)
{
BridgeConnector.Socket.On("autoUpdater-download-progress" + GetHashCode(), (progressInfo) =>
{
_downloadProgress(JObject.Parse(progressInfo.ToString()).ToObject<ProgressInfo>());
});
BridgeConnector.Socket.Emit("register-autoUpdater-download-progress-event", GetHashCode());
}
_downloadProgress += value;
}
remove
{
_downloadProgress -= value;
if (_downloadProgress == null)
BridgeConnector.Socket.Off("autoUpdater-download-progress" + GetHashCode());
}
}
private event Action<ProgressInfo> _downloadProgress;
/// <summary>
/// Emitted on download complete.
/// </summary>
public event Action<UpdateInfo> OnUpdateDownloaded
{
add
{
if (_updateDownloaded == null)
{
BridgeConnector.Socket.On("autoUpdater-update-downloaded" + GetHashCode(), (updateInfo) =>
{
_updateDownloaded(JObject.Parse(updateInfo.ToString()).ToObject<UpdateInfo>());
});
BridgeConnector.Socket.Emit("register-autoUpdater-update-downloaded-event", GetHashCode());
}
_updateDownloaded += value;
}
remove
{
_updateDownloaded -= value;
if (_updateDownloaded == null)
BridgeConnector.Socket.Off("autoUpdater-update-downloaded" + GetHashCode());
}
}
private event Action<UpdateInfo> _updateDownloaded;
private static AutoUpdater _autoUpdater;
private static object _syncRoot = new object();
internal AutoUpdater() { }
internal static AutoUpdater Instance
{
get
{
if (_autoUpdater == null)
{
lock (_syncRoot)
{
if (_autoUpdater == null)
{
_autoUpdater = new AutoUpdater();
}
}
}
return _autoUpdater;
}
}
/// <summary>
/// Asks the server whether there is an update.
/// </summary>
/// <returns></returns>
public Task<UpdateCheckResult> CheckForUpdatesAsync()
{
var taskCompletionSource = new TaskCompletionSource<UpdateCheckResult>();
string guid = Guid.NewGuid().ToString();
BridgeConnector.Socket.On("autoUpdaterCheckForUpdatesComplete" + guid, (updateCheckResult) =>
{
try
{
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesComplete" + guid);
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesError" + guid);
taskCompletionSource.SetResult(JObject.Parse(updateCheckResult.ToString()).ToObject<UpdateCheckResult>());
}
catch (Exception ex)
{
taskCompletionSource.SetException(ex);
}
});
BridgeConnector.Socket.On("autoUpdaterCheckForUpdatesError" + guid, (error) =>
{
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesComplete" + guid);
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesError" + guid);
string message = "An error occurred in CheckForUpdatesAsync";
if (error != null && !string.IsNullOrEmpty(error.ToString()))
message = JsonConvert.SerializeObject(error);
taskCompletionSource.SetException(new Exception(message));
});
BridgeConnector.Socket.Emit("autoUpdaterCheckForUpdates", guid);
return taskCompletionSource.Task;
}
/// <summary>
/// Asks the server whether there is an update.
///
/// This will immediately download an update, then install when the app quits.
/// </summary>
/// <returns></returns>
public Task<UpdateCheckResult> CheckForUpdatesAndNotifyAsync()
{
var taskCompletionSource = new TaskCompletionSource<UpdateCheckResult>();
string guid = Guid.NewGuid().ToString();
BridgeConnector.Socket.On("autoUpdaterCheckForUpdatesAndNotifyComplete" + guid, (updateCheckResult) =>
{
try
{
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesAndNotifyComplete" + guid);
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesAndNotifyError" + guid);
if (updateCheckResult == null)
taskCompletionSource.SetResult(null);
else
taskCompletionSource.SetResult(JObject.Parse(updateCheckResult.ToString()).ToObject<UpdateCheckResult>());
}
catch (Exception ex)
{
taskCompletionSource.SetException(ex);
}
});
BridgeConnector.Socket.On("autoUpdaterCheckForUpdatesAndNotifyError" + guid, (error) =>
{
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesAndNotifyComplete" + guid);
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesAndNotifyError" + guid);
string message = "An error occurred in autoUpdaterCheckForUpdatesAndNotify";
if (error != null)
message = JsonConvert.SerializeObject(error);
taskCompletionSource.SetException(new Exception(message));
});
BridgeConnector.Socket.Emit("autoUpdaterCheckForUpdatesAndNotify", guid);
return taskCompletionSource.Task;
}
/// <summary>
/// Restarts the app and installs the update after it has been downloaded.
/// It 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.
/// </summary>
/// <param name="isSilent">*windows-only* Runs the installer in silent mode. Defaults to `false`.</param>
/// <param name="isForceRunAfter">Run the app after finish even on silent install. Not applicable for macOS. Ignored if `isSilent` is set to `false`.</param>
public void QuitAndInstall(bool isSilent = false, bool isForceRunAfter = false)
{
BridgeConnector.Socket.Emit("autoUpdaterQuitAndInstall", isSilent, isForceRunAfter);
}
/// <summary>
/// Start downloading update manually. You can use this method if "AutoDownload" option is set to "false".
/// </summary>
/// <returns>Path to downloaded file.</returns>
public Task<string> DownloadUpdateAsync()
{
var taskCompletionSource = new TaskCompletionSource<string>();
string guid = Guid.NewGuid().ToString();
BridgeConnector.Socket.On("autoUpdaterDownloadUpdateComplete" + guid, (downloadedPath) =>
{
BridgeConnector.Socket.Off("autoUpdaterDownloadUpdateComplete" + guid);
taskCompletionSource.SetResult(downloadedPath.ToString());
});
BridgeConnector.Socket.Emit("autoUpdaterDownloadUpdate", guid);
return taskCompletionSource.Task;
}
/// <summary>
/// Feed URL.
/// </summary>
/// <returns>Feed URL.</returns>
public Task<string> GetFeedURLAsync()
{
var taskCompletionSource = new TaskCompletionSource<string>();
string guid = Guid.NewGuid().ToString();
BridgeConnector.Socket.On("autoUpdaterGetFeedURLComplete" + guid, (downloadedPath) =>
{
BridgeConnector.Socket.Off("autoUpdaterGetFeedURLComplete" + guid);
taskCompletionSource.SetResult(downloadedPath.ToString());
});
BridgeConnector.Socket.Emit("autoUpdaterGetFeedURL", guid);
return taskCompletionSource.Task;
}
private readonly JsonSerializer _jsonSerializer = new JsonSerializer()
{
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
}
}

View File

@@ -1,44 +0,0 @@
using Quobject.SocketIoClientDotNet.Client;
using System;
namespace ElectronNET.API
{
internal static class BridgeConnector
{
private static Socket _socket;
private static object _syncRoot = new object();
public static Socket Socket
{
get
{
if(_socket == null && HybridSupport.IsElectronActive)
{
lock (_syncRoot)
{
if (_socket == null && HybridSupport.IsElectronActive)
{
_socket = IO.Socket("http://localhost:" + BridgeSettings.SocketPort);
_socket.On(Socket.EVENT_CONNECT, () =>
{
Console.WriteLine("BridgeConnector connected!");
});
}
}
}
else if(_socket == null && !HybridSupport.IsElectronActive)
{
lock (_syncRoot)
{
if (_socket == null && !HybridSupport.IsElectronActive)
{
_socket = IO.Socket(new Uri("http://localhost"), new IO.Options { AutoConnect = false });
}
}
}
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; }
}
}

File diff suppressed because it is too large Load Diff

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,92 +0,0 @@
namespace ElectronNET.API
{
/// <summary>
/// The Electron.NET API
/// </summary>
public static class Electron
{
/// <summary>
/// Communicate asynchronously from the main process to renderer processes.
/// </summary>
public static IpcMain IpcMain { get { return IpcMain.Instance; } }
/// <summary>
/// Control your application's event lifecycle.
/// </summary>
public static App App { get { return App.Instance; } }
/// <summary>
/// Enable apps to automatically update themselves. Based on electron-updater.
/// </summary>
public static AutoUpdater AutoUpdater { get { return AutoUpdater.Instance; } }
/// <summary>
/// Control your windows.
/// </summary>
public static WindowManager WindowManager { get { return WindowManager.Instance; } }
/// <summary>
/// Create native application menus and context menus.
/// </summary>
public static Menu Menu { get { return Menu.Instance; } }
/// <summary>
/// Display native system dialogs for opening and saving files, alerting, etc.
/// </summary>
public static Dialog Dialog { get { return Dialog.Instance; } }
/// <summary>
/// Create OS desktop notifications
/// </summary>
public static Notification Notification { get { return Notification.Instance; } }
/// <summary>
/// Add icons and context menus to the systems notification area.
/// </summary>
public static Tray Tray { get { return Tray.Instance; } }
/// <summary>
/// Detect keyboard events when the application does not have keyboard focus.
/// </summary>
public static GlobalShortcut GlobalShortcut { get { return GlobalShortcut.Instance; } }
/// <summary>
/// Manage files and URLs using their default applications.
/// </summary>
public static Shell Shell { get { return Shell.Instance; } }
/// <summary>
/// Retrieve information about screen size, displays, cursor position, etc.
/// </summary>
public static Screen Screen { get { return Screen.Instance; } }
/// <summary>
/// Perform copy and paste operations on the system clipboard.
/// </summary>
public static Clipboard Clipboard { get { return Clipboard.Instance; } }
/// <summary>
/// Allows you to execute native JavaScript/TypeScript code from the host process.
///
/// It is only possible if the Electron.NET CLI has previously added an
/// ElectronHostHook directory:
/// <c>electronize add HostHook</c>
/// </summary>
public static HostHook HostHook { get { return HostHook.Instance; } }
/// <summary>
/// Allows you to execute native Lock and Unlock process.
/// </summary>
public static PowerMonitor PowerMonitor { get { return PowerMonitor.Instance; } }
/// <summary>
/// Read and respond to changes in Chromium's native color theme.
/// </summary>
public static NativeTheme NativeTheme { get { return NativeTheme.Instance; } }
/// <summary>
/// Control your app in the macOS dock.
/// </summary>
public static Dock Dock { get { return Dock.Instance; } }
}
}

View File

@@ -1,47 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>..\artifacts</PackageOutputPath>
<PackageId>ElectronNET.API</PackageId>
<Authors>Gregor Biswanger, Robert Muehsig</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="SocketIoClientDotNet" Version="1.0.5" />
<PackageReference Include="System.Drawing.Common" Version="5.0.0" />
</ItemGroup>
</Project>

View File

@@ -1,33 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class AddRepresentationOptions
{
/// <summary>
/// Gets or sets the width
/// </summary>
public int? Width { get; set; }
/// <summary>
/// Gets or sets the height
/// </summary>
public int? Height { get; set; }
/// <summary>
/// Gets or sets the scalefactor
/// </summary>
public float ScaleFactor { get; set; } = 1.0f;
/// <summary>
/// Gets or sets the buffer
/// </summary>
public byte[] Buffer { get; set; }
/// <summary>
/// Gets or sets the dataURL
/// </summary>
public string DataUrl { get; set; }
}
}

View File

@@ -1,13 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class BrowserViewConstructorOptions
{
/// <summary>
/// See BrowserWindow.
/// </summary>
public WebPreferences WebPreferences { get; set; }
}
}

View File

@@ -1,19 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class CPUUsage
{
/// <summary>
/// Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
/// </summary>
public int PercentCPUUsage { get; set; }
/// <summary>
/// The number of average idle cpu wakeups per second since the last call to
/// getCPUUsage.First call returns 0.
/// </summary>
public int IdleWakeupsPerSecond { get; set; }
}
}

View File

@@ -1,24 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ClearStorageDataOptions
{
/// <summary>
/// Should follow window.location.origins representation scheme://host:port.
/// </summary>
public string Origin { get; set; }
/// <summary>
/// The types of storages to clear, can contain: appcache, cookies, filesystem,
/// indexdb, localstorage, shadercache, websql, serviceworkers, cachestorage.
/// </summary>
public string[] Storages { get; set; }
/// <summary>
/// The types of quotas to clear, can contain: temporary, persistent, syncable.
/// </summary>
public string[] Quotas { get; set; }
}
}

View File

@@ -1,51 +0,0 @@
namespace ElectronNET.API.Entities {
/// <summary>
///
/// </summary>
public class Cookie {
/// <summary>
/// The name of the cookie.
/// </summary>
public string Name { get; set;}
/// <summary>
/// The value of the cookie.
/// </summary>
public string Value { get; set; }
/// <summary>
/// (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains.
/// </summary>
public string Domain { get; set; }
/// <summary>
/// (optional) - Whether the cookie is a host-only cookie; this will only be true if no domain was passed.
/// </summary>
public bool HostOnly { get; set; }
/// <summary>
/// (optional) - The path of the cookie.
/// </summary>
public string Path { get; set; }
/// <summary>
/// (optional) - Whether the cookie is marked as secure.
/// </summary>
public bool Secure { get; set; }
/// <summary>
/// (optional) - Whether the cookie is marked as HTTP only.
/// </summary>
public bool HttpOnly { get; set; }
/// <summary>
/// (optional) - Whether the cookie is a session cookie or a persistent cookie with an expiration date.
/// </summary>
public bool Session { get; set; }
/// <summary>
/// (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies.
/// </summary>
public long ExpirationDate { get; set; }
}
}

View File

@@ -1,38 +0,0 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace ElectronNET.API.Entities {
/// <summary>
/// The cause of the change
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum CookieChangedCause
{
/// <summary>
///The cookie was changed directly by a consumer's action.
/// </summary>
[JsonProperty("explicit")]
@explicit,
/// <summary>
/// The cookie was automatically removed due to an insert operation that overwrote it.
/// </summary>
overwrite,
/// <summary>
/// The cookie was automatically removed as it expired.
/// </summary>
expired,
/// <summary>
/// The cookie was automatically evicted during garbage collection.
/// </summary>
evicted,
/// <summary>
/// The cookie was overwritten with an already-expired expiration date.
/// </summary>
[JsonProperty("expired_overwrite")]
expiredOverwrite
}
}

View File

@@ -1,56 +0,0 @@
using System.ComponentModel;
namespace ElectronNET.API.Entities {
/// <summary>
///
/// </summary>
public class CookieDetails {
/// <summary>
/// The URL to associate the cookie with. The callback will be rejected if the URL is invalid.
/// </summary>
public string Url { get; set; }
/// <summary>
/// (optional) - The name of the cookie. Empty by default if omitted.
/// </summary>
[DefaultValue("")]
public string Name { get; set; }
/// <summary>
/// (optional) - The value of the cookie. Empty by default if omitted.
/// </summary>
[DefaultValue("")]
public string Value { get; set; }
/// <summary>
/// (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains. Empty by default if omitted.
/// </summary>
[DefaultValue("")]
public string Domain { get; set; }
/// <summary>
/// (optional) - The path of the cookie. Empty by default if omitted.
/// </summary>
[DefaultValue("")]
public string Path { get; set; }
/// <summary>
/// (optional) - Whether the cookie is marked as secure. Defaults to false.
/// </summary>
[DefaultValue(false)]
public bool Secure { get; set; }
/// <summary>
/// (optional) - Whether the cookie is marked as HTTP only. Defaults to false.
/// </summary>
[DefaultValue(false)]
public bool HttpOnly { get; set; }
/// <summary>
/// (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch.
/// If omitted then the cookie becomes a session cookie and will not be retained between sessions.
/// </summary>
[DefaultValue(0)]
public long ExpirationDate { get; set; }
}
}

View File

@@ -1,60 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class Display
{
/// <summary>
/// Gets or sets the bounds.
/// </summary>
/// <value>
/// The bounds.
/// </value>
public Rectangle Bounds { get; set; }
/// <summary>
/// Unique identifier associated with the display.
/// </summary>
public string Id { get; set; }
/// <summary>
/// Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
/// </summary>
public int Rotation { get; set; }
/// <summary>
/// Output device's pixel scale factor.
/// </summary>
public int ScaleFactor { get; set; }
/// <summary>
/// Gets or sets the size.
/// </summary>
/// <value>
/// The size.
/// </value>
public Size Size { get; set; }
/// <summary>
/// Can be available, unavailable, unknown.
/// </summary>
public string TouchSupport { get; set; }
/// <summary>
/// Gets or sets the work area.
/// </summary>
/// <value>
/// The work area.
/// </value>
public Rectangle WorkArea { get; set; }
/// <summary>
/// Gets or sets the size of the work area.
/// </summary>
/// <value>
/// The size of the work area.
/// </value>
public Size WorkAreaSize { get; set; }
}
}

View File

@@ -1,32 +0,0 @@
namespace ElectronNET.API
{
/// <summary>
///
/// </summary>
public class DisplayBalloonOptions
{
/// <summary>
/// Gets or sets the icon.
/// </summary>
/// <value>
/// The icon.
/// </value>
public string Icon { get; set; }
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>
/// The title.
/// </value>
public string Title { get; set; }
/// <summary>
/// Gets or sets the content.
/// </summary>
/// <value>
/// The content.
/// </value>
public string Content { get; set; }
}
}

View File

@@ -1,23 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public enum FileIconSize
{
/// <summary>
/// The small
/// </summary>
small,
/// <summary>
/// The normal
/// </summary>
normal,
/// <summary>
/// The large
/// </summary>
large
}
}

View File

@@ -1,85 +0,0 @@
using Newtonsoft.Json;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class GPUFeatureStatus
{
/// <summary>
/// Canvas.
/// </summary>
[JsonProperty("2d_canvas")]
public string Canvas { get; set; }
/// <summary>
/// Flash.
/// </summary>
[JsonProperty("flash_3d")]
public string Flash3D { get; set; }
/// <summary>
/// Flash Stage3D.
/// </summary>
[JsonProperty("flash_stage3d")]
public string FlashStage3D { get; set; }
/// <summary>
/// Flash Stage3D Baseline profile.
/// </summary>
[JsonProperty("flash_stage3d_baseline")]
public string FlashStage3dBaseline { get; set; }
/// <summary>
/// Compositing.
/// </summary>
[JsonProperty("gpu_compositing")]
public string GpuCompositing { get; set; }
/// <summary>
/// Multiple Raster Threads.
/// </summary>
[JsonProperty("multiple_raster_threads")]
public string MultipleRasterThreads { get; set; }
/// <summary>
/// Native GpuMemoryBuffers.
/// </summary>
[JsonProperty("native_gpu_memory_buffers")]
public string NativeGpuMemoryBuffers { get; set; }
/// <summary>
/// Rasterization.
/// </summary>
public string Rasterization { get; set; }
/// <summary>
/// Video Decode.
/// </summary>
[JsonProperty("video_decode")]
public string VideoDecode { get; set; }
/// <summary>
/// Video Encode.
/// </summary>
[JsonProperty("video_encode")]
public string VideoEncode { get; set; }
/// <summary>
/// VPx Video Decode.
/// </summary>
[JsonProperty("vpx_decode")]
public string VpxDecode { get; set; }
/// <summary>
/// WebGL.
/// </summary>
public string Webgl { get; set; }
/// <summary>
/// WebGL2.
/// </summary>
public string Webgl2 { get; set; }
}
}

View File

@@ -1,27 +0,0 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class JumpListCategory
{
/// <summary>
/// Must be set if type is custom, otherwise it should be omitted.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Array of objects if type is tasks or custom, otherwise it should be omitted.
/// </summary>
public JumpListItem[] Items { get; set; }
/// <summary>
/// One of the following: "tasks" | "frequent" | "recent" | "custom"
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public JumpListCategoryType Type { get; set; }
}
}

View File

@@ -1,58 +0,0 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class JumpListItem
{
/// <summary>
/// The command line arguments when program is executed. Should only be set if type is task.
/// </summary>
public string Args { get; set; }
/// <summary>
/// Description of the task (displayed in a tooltip). Should only be set if type is task.
/// </summary>
public string Description { get; set; }
/// <summary>
/// The index of the icon in the resource file. If a resource file contains multiple
/// icons this value can be used to specify the zero-based index of the icon that
/// should be displayed for this task.If a resource file contains only one icon,
/// this property should be set to zero.
/// </summary>
public int IconIndex { get; set; }
/// <summary>
/// The absolute path to an icon to be displayed in a Jump List, which can be an
/// arbitrary resource file that contains an icon(e.g. .ico, .exe, .dll). You can
/// usually specify process.execPath to show the program icon.
/// </summary>
public string IconPath { get; set; }
/// <summary>
/// Path of the file to open, should only be set if type is file.
/// </summary>
public string Path { get; set; }
/// <summary>
/// Path of the program to execute, usually you should specify process.execPath
/// which opens the current program.Should only be set if type is task.
/// </summary>
public string Program { get; set; }
/// <summary>
/// The text to be displayed for the item in the Jump List. Should only be set if type is task.
/// </summary>
public string Title { get; set; }
/// <summary>
/// One of the following: "task" | "separator" | "file"
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public JumpListItemType Type { get; set; }
}
}

View File

@@ -1,30 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class LoadURLOptions
{
/// <summary>
/// A HTTP Referrer url.
/// </summary>
public string HttpReferrer { get; set; }
/// <summary>
/// A user agent originating the request.
/// </summary>
public string UserAgent { get; set; }
/// <summary>
/// Base url (with trailing path separator) for files to be loaded by the data url.
/// This is needed only if the specified url is a data url and needs to load other
/// files.
/// </summary>
public string BaseURLForDataURL { get; set; }
/// <summary>
/// Extra headers for the request.
/// </summary>
public string ExtraHeaders { get; set; }
}
}

View File

@@ -1,39 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class LoginItemSettings
{
/// <summary>
/// <see langword="true"/> if the app is set to open at login.
/// </summary>
public bool OpenAtLogin { get; set; }
/// <summary>
/// <see langword="true"/> if the app is set to open as hidden at login. This setting is not available
/// on <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
/// </summary>
public bool OpenAsHidden { get; set; }
/// <summary>
/// <see langword="true"/> if the app was opened at login automatically. This setting is not available
/// on <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
/// </summary>
public bool WasOpenedAtLogin { get; set; }
/// <summary>
/// <see langword="true"/> if the app was opened as a hidden login item. This indicates that the app should not
/// open any windows at startup. This setting is not available on
/// <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
/// </summary>
public bool WasOpenedAsHidden { get; set; }
/// <summary>
/// <see langword="true"/> if the app was opened as a login item that should restore the state from the previous
/// session. This indicates that the app should restore the windows that were open the last time the app was closed.
/// This setting is not available on <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
/// </summary>
public bool RestoreState { get; set; }
}
}

View File

@@ -1,18 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class LoginItemSettingsOptions
{
/// <summary>
/// The executable path to compare against. Defaults to process.execPath.
/// </summary>
public string Path { get; set; }
/// <summary>
/// The command-line arguments to compare against. Defaults to an empty array.
/// </summary>
public string[] Args { get; set; }
}
}

View File

@@ -1,32 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class LoginSettings
{
/// <summary>
/// <see langword="true"/> to open the app at login, <see langword="false"/> to remove the app as a login item.
/// Defaults to <see langword="false"/>.
/// </summary>
public bool OpenAtLogin { get; set; }
/// <summary>
/// <see langword="true"/> to open the app as hidden. Defaults to <see langword="false"/>. The user can edit this
/// setting from the System Preferences so app.getLoginItemSettings().wasOpenedAsHidden should be checked when the app is
/// opened to know the current value. This setting is not available on <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
/// </summary>
public bool OpenAsHidden { get; set; }
/// <summary>
/// The executable to launch at login. Defaults to process.execPath.
/// </summary>
public string Path { get; set; }
/// <summary>
/// The command-line arguments to pass to the executable. Defaults to an empty
/// array.Take care to wrap paths in quotes.
/// </summary>
public string[] Args { get; set; }
}
}

View File

@@ -1,24 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class MemoryInfo
{
/// <summary>
/// The amount of memory currently pinned to actual physical RAM.
/// </summary>
public int WorkingSetSize { get; set; }
/// <summary>
/// The maximum amount of memory that has ever been pinned to actual physical RAM.
/// </summary>
public int PeakWorkingSetSize { get; set; }
/// <summary>
/// The amount of memory not shared by other processes, such as JS heap or HTML
/// content.
/// </summary>
public int PrivateBytes { get; set; }
}
}

View File

@@ -1,103 +0,0 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.ComponentModel;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class MenuItem
{
/// <summary>
/// Will be called with click(menuItem, browserWindow, event) when the menu item is
/// clicked.
/// </summary>
[JsonIgnore]
public Action Click { get; set; }
/// <summary>
/// Define the action of the menu item, when specified the click property will be
/// ignored.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public MenuRole Role { get; set; }
/// <summary>
/// Can be normal, separator, submenu, checkbox or radio.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public MenuType Type { get; set; }
/// <summary>
/// Gets or sets the label.
/// </summary>
/// <value>
/// The label.
/// </value>
public string Label { get; set; }
/// <summary>
/// Gets or sets the sublabel.
/// </summary>
/// <value>
/// The sublabel.
/// </value>
public string Sublabel { get; set; }
/// <summary>
/// Gets or sets the accelerator.
/// </summary>
/// <value>
/// The accelerator.
/// </value>
public string Accelerator { get; set; }
/// <summary>
/// Gets or sets the icon.
/// </summary>
/// <value>
/// The icon.
/// </value>
public string Icon { get; set; }
/// <summary>
/// If false, the menu item will be greyed out and unclickable.
/// </summary>
public bool Enabled { get; set; } = true;
/// <summary>
/// If false, the menu item will be entirely hidden.
/// </summary>
public bool Visible { get; set; } = true;
/// <summary>
/// Should only be specified for checkbox or radio type menu items.
/// </summary>
public bool Checked { get; set; }
/// <summary>
/// Should be specified for submenu type menu items. If submenu is specified, the
/// type: 'submenu' can be omitted.If the value is not a Menu then it will be
/// automatically converted to one using Menu.buildFromTemplate.
/// </summary>
public MenuItem[] Submenu { get; set; }
/// <summary>
/// Unique within a single menu. If defined then it can be used as a reference to
/// this item by the position attribute.
/// </summary>
public string Id { get; internal set; }
/// <summary>
/// This field allows fine-grained definition of the specific location within a
/// given menu.
/// </summary>
public string Position { get; set; }
}
}

View File

@@ -1,33 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public enum MenuType
{
/// <summary>
/// The normal
/// </summary>
normal,
/// <summary>
/// The separator
/// </summary>
separator,
/// <summary>
/// The submenu
/// </summary>
submenu,
/// <summary>
/// The checkbox
/// </summary>
checkbox,
/// <summary>
/// The radio
/// </summary>
radio
}
}

View File

@@ -1,101 +0,0 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class MessageBoxOptions
{
/// <summary>
/// Can be "none", "info", "error", "question" or "warning". On Windows, "question"
/// displays the same icon as "info", unless you set an icon using the "icon"
/// option. On macOS, both "warning" and "error" display the same warning icon.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public MessageBoxType Type { get; set; }
/// <summary>
/// Array of texts for buttons. On Windows, an empty array will result in one button
/// labeled "OK".
/// </summary>
public string[] Buttons { get; set; }
/// <summary>
/// Index of the button in the buttons array which will be selected by default when
/// the message box opens.
/// </summary>
public int DefaultId { get; set; }
/// <summary>
/// Title of the message box, some platforms will not show it.
/// </summary>
public string Title { get; set; }
/// <summary>
/// Content of the message box.
/// </summary>
public string Message { get; set; }
/// <summary>
/// Extra information of the message.
/// </summary>
public string Detail { get; set; }
/// <summary>
/// If provided, the message box will include a checkbox with the given label. The
/// checkbox state can be inspected only when using callback.
/// </summary>
public string CheckboxLabel { get; set; }
/// <summary>
/// Initial checked state of the checkbox. false by default.
/// </summary>
public bool CheckboxChecked { get; set; }
/// <summary>
/// Gets or sets the icon.
/// </summary>
/// <value>
/// The icon.
/// </value>
public string Icon { get; set; }
/// <summary>
/// The index of the button to be used to cancel the dialog, via the Esc key. By
/// default this is assigned to the first button with "cancel" or "no" as the label.
/// If no such labeled buttons exist and this option is not set, 0 will be used as
/// the return value or callback response. This option is ignored on Windows.
/// </summary>
public int CancelId { get; set; }
/// <summary>
/// On Windows Electron will try to figure out which one of the buttons are common
/// buttons(like "Cancel" or "Yes"), and show the others as command links in the
/// dialog.This can make the dialog appear in the style of modern Windows apps. If
/// you don't like this behavior, you can set noLink to true.
/// </summary>
public bool NoLink { get; set; }
/// <summary>
/// Normalize the keyboard access keys across platforms. Default is false. Enabling
/// this assumes AND character is used in the button labels for the placement of the keyboard
/// shortcut access key and labels will be converted so they work correctly on each
/// platform, AND characters are removed on macOS, converted to _ on Linux, and left
/// untouched on Windows.For example, a button label of VieANDw will be converted to
/// Vie_w on Linux and View on macOS and can be selected via Alt-W on Windows and
/// Linux.
/// </summary>
public bool NormalizeAccessKeys { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="MessageBoxOptions"/> class.
/// </summary>
/// <param name="message">The message.</param>
public MessageBoxOptions(string message)
{
Message = message;
}
}
}

View File

@@ -1,34 +0,0 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using Newtonsoft.Json;
namespace ElectronNET.API.Entities
{
internal class NativeImageJsonConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
if (value is NativeImage nativeImage)
{
var scaledImages = nativeImage.GetAllScaledImages();
serializer.Serialize(writer, scaledImages);
}
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
var dict = serializer.Deserialize<Dictionary<float, string>>(reader);
var newDictionary = new Dictionary<float, Image>();
foreach (var item in dict)
{
var bytes = Convert.FromBase64String(item.Value);
newDictionary.Add(item.Key, Image.FromStream(new MemoryStream(bytes)));
}
return new NativeImage(newDictionary);
}
public override bool CanConvert(Type objectType) => objectType == typeof(NativeImage);
}
}

View File

@@ -1,18 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class NotificationAction
{
/// <summary>
/// The label for the given action.
/// </summary>
public string Text { get; set; }
/// <summary>
/// The type of action, can be button.
/// </summary>
public string Type { get; set; }
}
}

View File

@@ -1,19 +0,0 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class OpenDevToolsOptions
{
/// <summary>
/// Opens the devtools with specified dock state, can be right, bottom, undocked,
/// detach.Defaults to last used dock state.In undocked mode it's possible to dock
/// back.In detach mode it's not.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public DevToolsMode Mode { get; set; }
}
}

View File

@@ -1,22 +0,0 @@
using System;
using System.ComponentModel;
namespace ElectronNET.API.Entities
{
/// <summary>
/// Controls the behavior of OpenExternal.
/// </summary>
public class OpenExternalOptions
{
/// <summary>
/// <see langword="true"/> to bring the opened application to the foreground. The default is <see langword="true"/>.
/// </summary>
[DefaultValue(true)]
public bool Activate { get; set; } = true;
/// <summary>
/// The working directory.
/// </summary>
public string WorkingDirectory { get; set; }
}
}

View File

@@ -1,95 +0,0 @@
using System.ComponentModel;
namespace ElectronNET.API.Entities
{
/// <summary>
/// Defines the PathName enumeration.
/// </summary>
public enum PathName
{
/// <summary>
/// Users home directory.
/// </summary>
[Description("home")]
Home,
/// <summary>
/// Per-user application data directory.
/// </summary>
[Description("appData")]
AppData,
/// <summary>
/// The directory for storing your apps configuration files,
/// which by default it is the appData directory appended with your apps name.
/// </summary>
[Description("userData")]
UserData,
/// <summary>
/// Temporary directory.
/// </summary>
[Description("temp")]
Temp,
/// <summary>
/// The current executable file.
/// </summary>
[Description("exe")]
Exe,
/// <summary>
/// The libchromiumcontent library.
/// </summary>
[Description("Module")]
Module,
/// <summary>
/// The current users Desktop directory.
/// </summary>
[Description("desktop")]
Desktop,
/// <summary>
/// Directory for a users “My Documents”.
/// </summary>
[Description("documents")]
Documents,
/// <summary>
/// Directory for a users downloads.
/// </summary>
[Description("downloads")]
Downloads,
/// <summary>
/// Directory for a users music.
/// </summary>
[Description("music")]
Music,
/// <summary>
/// Directory for a users pictures.
/// </summary>
[Description("pictures")]
Pictures,
/// <summary>
/// Directory for a users videos.
/// </summary>
[Description("videos")]
Videos,
/// <summary>
/// The logs.
/// </summary>
[Description("logs")]
Logs,
/// <summary>
/// Full path to the system version of the Pepper Flash plugin.
/// </summary>
[Description("PepperFlashSystemPlugin")]
PepperFlashSystemPlugin
}
}

View File

@@ -1,107 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
/// Print dpi
/// </summary>
public class PrintDpi
{
/// <summary>
/// The horizontal dpi
/// </summary>
public float Horizontal { get; set; }
/// <summary>
/// The vertical dpi
/// </summary>
public float Vertical { get; set; }
}
/// <summary>
/// The page range to print
/// </summary>
public class PrintPageRange
{
/// <summary>
/// From
/// </summary>
public int From { get; set; }
/// <summary>
/// To
/// </summary>
public int To { get; set; }
}
/// <summary>
/// Print options
/// </summary>
public class PrintOptions
{
/// <summary>
/// Don't ask user for print settings
/// </summary>
public bool Silent { get; set; }
/// <summary>
/// Prints the background color and image of the web page
/// </summary>
public bool PrintBackground { get; set; }
/// <summary>
/// Set the printer device name to use
/// </summary>
public string DeviceName { get; set; }
/// <summary>
/// Set whether the printed web page will be in color or grayscale
/// </summary>
public bool Color { get; set; }
/// <summary>
/// Specifies the type of margins to use. Uses 0 for default margin, 1 for no
/// margin, and 2 for minimum margin.
/// </summary>
public int MarginsType { get; set; }
/// <summary>
/// true for landscape, false for portrait.
/// </summary>
public bool Landscape { get; set; }
/// <summary>
/// The scale factor of the web page
/// </summary>
public float ScaleFactor { get; set; }
/// <summary>
/// The number of pages to print per page sheet
/// </summary>
public int PagesPerSheet { get; set; }
/// <summary>
/// The number of copies of the web page to print
/// </summary>
public bool Copies { get; set; }
/// <summary>
/// Whether the web page should be collated
/// </summary>
public bool Collate { get; set; }
/// <summary>
/// The page range to print
/// </summary>
public PrintPageRange PageRanges { get; set; }
/// <summary>
/// Set the duplex mode of the printed web page. Can be simplex, shortEdge, or longEdge.
/// </summary>
public string DuplexMode { get; set; }
/// <summary>
/// Dpi
/// </summary>
public PrintDpi Dpi { get; set; }
}
}

View File

@@ -1,35 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class PrintToPDFOptions
{
/// <summary>
/// Specifies the type of margins to use. Uses 0 for default margin, 1 for no
/// margin, and 2 for minimum margin.
/// </summary>
public int MarginsType { get; set; }
/// <summary>
/// Specify page size of the generated PDF. Can be A3, A4, A5, Legal, Letter,
/// Tabloid or an Object containing height and width in microns.
/// </summary>
public string PageSize { get; set; }
/// <summary>
/// Whether to print CSS backgrounds.
/// </summary>
public bool PrintBackground { get; set; }
/// <summary>
/// Whether to print selection only.
/// </summary>
public bool PrintSelectionOnly { get; set; }
/// <summary>
/// true for landscape, false for portrait.
/// </summary>
public bool Landscape { get; set; }
}
}

View File

@@ -1,29 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
/// Printer info
/// </summary>
public class PrinterInfo
{
/// <summary>
/// Name
/// </summary>
public string Name { get; set; }
/// <summary>
/// Name
/// </summary>
public string Description { get; set; }
/// <summary>
/// Status
/// </summary>
public int Status { get; set; }
/// <summary>
/// Is default
/// </summary>
public bool IsDefault { get; set; }
}
}

View File

@@ -1,46 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ProcessMetric
{
/// <summary>
/// Process id of the process.
/// </summary>
public int PId { get; set; }
/// <summary>
/// Process type (Browser or Tab or GPU etc).
/// </summary>
public string Type { get; set; }
/// <summary>
/// CPU usage of the process.
/// </summary>
public CPUUsage Cpu { get; set; }
/// <summary>
/// Creation time for this process. The time is represented as number of milliseconds since epoch.
/// Since the <see cref="PId"/> can be reused after a process dies, it is useful to use both the <see cref="PId"/>
/// and the <see cref="CreationTime"/> to uniquely identify a process.
/// </summary>
public int CreationTime { get; set; }
/// <summary>
/// Memory information for the process.
/// </summary>
public MemoryInfo Memory { get; set; }
/// <summary>
/// Whether the process is sandboxed on OS level.
/// </summary>
public bool Sandboxed { get; set; }
/// <summary>
/// One of the following values:
/// untrusted | low | medium | high | unknown
/// </summary>
public string IntegrityLevel { get; set; }
}
}

View File

@@ -1,17 +0,0 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ProgressBarOptions
{
/// <summary>
/// Mode for the progress bar. Can be 'none' | 'normal' | 'indeterminate' | 'error' | 'paused'.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public ProgressBarMode Mode { get; set; }
}
}

View File

@@ -1,37 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ProgressInfo
{
/// <summary>
///
/// </summary>
public string Progress { get; set; }
/// <summary>
///
/// </summary>
public string BytesPerSecond { get; set; }
/// <summary>
///
/// </summary>
public string Percent { get; set; }
/// <summary>
///
/// </summary>
public string Total { get; set; }
/// <summary>
///
/// </summary>
public string Transferred { get; set; }
}
}

View File

@@ -1,13 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ToBitmapOptions
{
/// <summary>
/// Gets or sets the scalefactor
/// </summary>
public float ScaleFactor { get; set; } = 1.0f;
}
}

View File

@@ -1,63 +0,0 @@
using Newtonsoft.Json;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public enum Vibrancy
{
/// <summary>
/// The appearance based
/// </summary>
[JsonProperty("appearance-based")]
appearanceBased,
/// <summary>
/// The light
/// </summary>
light,
/// <summary>
/// The dark
/// </summary>
dark,
/// <summary>
/// The titlebar
/// </summary>
titlebar,
/// <summary>
/// The selection
/// </summary>
selection,
/// <summary>
/// The menu
/// </summary>
menu,
/// <summary>
/// The popover
/// </summary>
popover,
/// <summary>
/// The sidebar
/// </summary>
sidebar,
/// <summary>
/// The medium light
/// </summary>
[JsonProperty("medium-light")]
mediumLight,
/// <summary>
/// The ultra dark
/// </summary>
[JsonProperty("ultra-dark")]
ultraDark
}
}

View File

@@ -1,105 +0,0 @@
using System;
using System.Globalization;
using Quobject.EngineIoClientDotNet.ComponentEmitter;
namespace ElectronNET.API
{
/// <summary>
/// Generic Event Consumers for Electron Modules
/// </summary>
internal class Events
{
private static Events _events;
private static object _syncRoot = new object();
private TextInfo _ti = new CultureInfo("en-US", false).TextInfo;
private Events()
{
}
public static Events Instance
{
get
{
if (_events == null)
{
lock (_syncRoot)
{
if (_events == null)
{
_events = new Events();
}
}
}
return _events;
}
}
/// <summary>
/// Subscribe to an unmapped electron event.
/// </summary>
/// <param name="moduleName">The name of the module, e.g. app, dock, etc...</param>
/// <param name="eventName">The name of the event</param>
/// <param name="fn">The event handler</param>
public void On(string moduleName, string eventName, Action fn)
=> On(moduleName, eventName, new ListenerImpl(fn));
/// <summary>
/// Subscribe to an unmapped electron event.
/// </summary>
/// <param name="moduleName">The name of the module, e.g. app, dock, etc...</param>
/// <param name="eventName">The name of the event</param>
/// <param name="fn">The event handler</param>
public void On(string moduleName, string eventName, Action<object> fn)
=> On(moduleName, eventName, new ListenerImpl(fn));
/// <summary>
/// Subscribe to an unmapped electron event.
/// </summary>
/// <param name="moduleName">The name of the module, e.g. app, dock, etc...</param>
/// <param name="eventName">The name of the event</param>
/// <param name="fn">The event handler</param>
private void On(string moduleName, string eventName, IListener fn)
{
var listener = $"{moduleName}{_ti.ToTitleCase(eventName)}Completed";
var subscriber = $"register-{moduleName}-on-event";
BridgeConnector.Socket.On(listener, fn);
BridgeConnector.Socket.Emit(subscriber, eventName, listener);
}
/// <summary>
/// Subscribe to an unmapped electron event.
/// </summary>
/// <param name="moduleName">The name of the module, e.g. app, dock, etc...</param>
/// <param name="eventName">The name of the event</param>
/// <param name="fn">The event handler</param>
public void Once(string moduleName, string eventName, Action fn)
=> Once(moduleName, eventName, new ListenerImpl(fn));
/// <summary>
/// Subscribe to an unmapped electron event.
/// </summary>
/// <param name="moduleName">The name of the module, e.g. app, dock, etc...</param>
/// <param name="eventName">The name of the event</param>
/// <param name="fn">The event handler</param>
public void Once(string moduleName, string eventName, Action<object> fn)
=> Once(moduleName, eventName, new ListenerImpl(fn));
/// <summary>
/// Subscribe to an unmapped electron event.
/// </summary>
/// <param name="moduleName">The name of the module, e.g. app, dock, etc...</param>
/// <param name="eventName">The name of the event</param>
/// <param name="fn">The event handler</param>
private void Once(string moduleName, string eventName, IListener fn)
{
var listener = $"{moduleName}{_ti.ToTitleCase(eventName)}Completed";
var subscriber = $"register-{moduleName}-once-event";
BridgeConnector.Socket.Once(listener, fn);
BridgeConnector.Socket.Emit(subscriber, eventName, listener);
}
}
}

View File

@@ -1,34 +0,0 @@
using System;
using System.ComponentModel;
using System.Reflection;
namespace ElectronNET.API.Extensions
{
internal static class EnumExtensions
{
public static string GetDescription<T>(this T enumerationValue) where T : struct
{
Type type = enumerationValue.GetType();
if (!type.IsEnum)
{
throw new ArgumentException("EnumerationValue must be of Enum type", "enumerationValue");
}
//Tries to find a DescriptionAttribute for a potential friendly name
//for the enum
MemberInfo[] memberInfo = type.GetMember(enumerationValue.ToString());
if (memberInfo != null && memberInfo.Length > 0)
{
object[] attrs = memberInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);
if (attrs != null && attrs.Length > 0)
{
//Pull out the description value
return ((DescriptionAttribute)attrs[0]).Description;
}
}
//If we have no description attribute, just return the ToString of the enum
return enumerationValue.ToString();
}
}
}

View File

@@ -1,189 +0,0 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace ElectronNET.API
{
/// <summary>
/// Communicate asynchronously from the main process to renderer processes.
/// </summary>
public sealed class IpcMain
{
private static IpcMain _ipcMain;
private static object _syncRoot = new object();
internal IpcMain() { }
internal static IpcMain Instance
{
get
{
if(_ipcMain == null)
{
lock (_syncRoot)
{
if(_ipcMain == null)
{
_ipcMain = new IpcMain();
}
}
}
return _ipcMain;
}
}
/// <summary>
/// Listens to channel, when a new message arrives listener would be called with
/// listener(event, args...).
/// </summary>
/// <param name="channel">Channelname.</param>
/// <param name="listener">Callback Method.</param>
public void On(string channel, Action<object> listener)
{
BridgeConnector.Socket.Emit("registerIpcMainChannel", channel);
BridgeConnector.Socket.Off(channel);
BridgeConnector.Socket.On(channel, (args) =>
{
List<object> objectArray = FormatArguments(args);
if(objectArray.Count == 1)
{
listener(objectArray.First());
}
else
{
listener(objectArray);
}
});
}
private List<object> FormatArguments(object args)
{
List<object> objectArray = ((JArray)args).ToObject<object[]>().ToList();
for (int index = 0; index < objectArray.Count; index++)
{
var item = objectArray[index];
if (item == null)
{
objectArray.Remove(item);
}
}
return objectArray;
}
/// <summary>
/// Send a message to the renderer process synchronously via channel,
/// you can also send arbitrary arguments.
///
/// Note: Sending a synchronous message will block the whole renderer process,
/// unless you know what you are doing you should never use it.
/// </summary>
/// <param name="channel"></param>
/// <param name="listener"></param>
public void OnSync(string channel, Func<object, object> listener)
{
BridgeConnector.Socket.Emit("registerSyncIpcMainChannel", channel);
BridgeConnector.Socket.On(channel, (args) => {
List<object> objectArray = FormatArguments(args);
object parameter;
if (objectArray.Count == 1)
{
parameter = objectArray.First();
}
else
{
parameter = objectArray;
}
var result = listener(parameter);
BridgeConnector.Socket.Emit(channel + "Sync", result);
});
}
/// <summary>
/// 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.
/// </summary>
/// <param name="channel">Channelname.</param>
/// <param name="listener">Callback Method.</param>
public void Once(string channel, Action<object> listener)
{
BridgeConnector.Socket.Emit("registerOnceIpcMainChannel", channel);
BridgeConnector.Socket.On(channel, (args) =>
{
List<object> objectArray = FormatArguments(args);
if (objectArray.Count == 1)
{
listener(objectArray.First());
}
else
{
listener(objectArray);
}
});
}
/// <summary>
/// Removes listeners of the specified channel.
/// </summary>
/// <param name="channel">Channelname.</param>
public void RemoveAllListeners(string channel)
{
BridgeConnector.Socket.Emit("removeAllListenersIpcMainChannel", channel);
}
/// <summary>
/// Send a message to the renderer process asynchronously via channel, you can also send
/// arbitrary arguments. Arguments will be serialized in JSON internally and hence
/// no functions or prototype chain will be included. The renderer process handles it by
/// listening for channel with ipcRenderer module.
/// </summary>
/// <param name="browserWindow">BrowserWindow with channel.</param>
/// <param name="channel">Channelname.</param>
/// <param name="data">Arguments data.</param>
public void Send(BrowserWindow browserWindow, string channel, params object[] data)
{
List<JObject> jobjects = new List<JObject>();
List<JArray> jarrays = new List<JArray>();
List<object> objects = new List<object>();
foreach (var parameterObject in data)
{
if(parameterObject.GetType().IsArray || parameterObject.GetType().IsGenericType && parameterObject is IEnumerable)
{
jarrays.Add(JArray.FromObject(parameterObject, _jsonSerializer));
} else if(parameterObject.GetType().IsClass && !parameterObject.GetType().IsPrimitive && !(parameterObject is string))
{
jobjects.Add(JObject.FromObject(parameterObject, _jsonSerializer));
} else if(parameterObject.GetType().IsPrimitive || (parameterObject is string))
{
objects.Add(parameterObject);
}
}
if(jobjects.Count > 0 || jarrays.Count > 0)
{
BridgeConnector.Socket.Emit("sendToIpcRenderer", JObject.FromObject(browserWindow, _jsonSerializer), channel, jarrays.ToArray(), jobjects.ToArray(), objects.ToArray());
}
else
{
BridgeConnector.Socket.Emit("sendToIpcRenderer", JObject.FromObject(browserWindow, _jsonSerializer), channel, data);
}
}
private JsonSerializer _jsonSerializer = new JsonSerializer()
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
NullValueHandling = NullValueHandling.Ignore,
DefaultValueHandling = DefaultValueHandling.Ignore
};
}
}

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,242 +0,0 @@
using System;
using System.Threading.Tasks;
namespace ElectronNET.API
{
/// <summary>
/// Monitor power state changes..
/// </summary>
public sealed class PowerMonitor
{
/// <summary>
/// Emitted when the system is about to lock the screen.
/// </summary>
public event Action OnLockScreen
{
add
{
if (_lockScreen == null)
{
BridgeConnector.Socket.On("pm-lock-screen" , () =>
{
_lockScreen();
});
BridgeConnector.Socket.Emit("register-pm-lock-screen");
}
_lockScreen += value;
}
remove
{
_lockScreen -= value;
if (_lockScreen == null)
BridgeConnector.Socket.Off("pm-lock-screen");
}
}
private event Action _lockScreen;
/// <summary>
/// Emitted when the system is about to unlock the screen.
/// </summary>
public event Action OnUnLockScreen
{
add
{
if (_unlockScreen == null)
{
BridgeConnector.Socket.On("pm-unlock-screen", () =>
{
_unlockScreen();
});
BridgeConnector.Socket.Emit("register-pm-unlock-screen");
}
_unlockScreen += value;
}
remove
{
_unlockScreen -= value;
if (_unlockScreen == null)
BridgeConnector.Socket.Off("pm-unlock-screen");
}
}
private event Action _unlockScreen;
/// <summary>
/// Emitted when the system is suspending.
/// </summary>
public event Action OnSuspend
{
add
{
if (_suspend == null)
{
BridgeConnector.Socket.On("pm-suspend", () =>
{
_suspend();
});
BridgeConnector.Socket.Emit("register-pm-suspend");
}
_suspend += value;
}
remove
{
_suspend -= value;
if (_suspend == null)
BridgeConnector.Socket.Off("pm-suspend");
}
}
private event Action _suspend;
/// <summary>
/// Emitted when system is resuming.
/// </summary>
public event Action OnResume
{
add
{
if (_resume == null)
{
BridgeConnector.Socket.On("pm-resume", () =>
{
_resume();
});
BridgeConnector.Socket.Emit("register-pm-resume");
}
_resume += value;
}
remove
{
_resume -= value;
if (_resume == null)
BridgeConnector.Socket.Off("pm-resume");
}
}
private event Action _resume;
/// <summary>
/// Emitted when the system changes to AC power.
/// </summary>
public event Action OnAC
{
add
{
if (_onAC == null)
{
BridgeConnector.Socket.On("pm-on-ac", () =>
{
_onAC();
});
BridgeConnector.Socket.Emit("register-pm-on-ac");
}
_onAC += value;
}
remove
{
_onAC -= value;
if (_onAC == null)
BridgeConnector.Socket.Off("pm-on-ac");
}
}
private event Action _onAC;
/// <summary>
/// Emitted when system changes to battery power.
/// </summary>
public event Action OnBattery
{
add
{
if (_onBattery == null)
{
BridgeConnector.Socket.On("pm-on-battery", () =>
{
_onBattery();
});
BridgeConnector.Socket.Emit("register-pm-on-battery");
}
_onBattery += value;
}
remove
{
_onBattery -= value;
if (_onBattery == null)
BridgeConnector.Socket.Off("pm-on-battery");
}
}
private event Action _onBattery;
/// <summary>
/// Emitted when the system is about to reboot or shut down. If the event handler
/// invokes `e.preventDefault()`, Electron will attempt to delay system shutdown in
/// order for the app to exit cleanly.If `e.preventDefault()` is called, the app
/// should exit as soon as possible by calling something like `app.quit()`.
/// </summary>
public event Action OnShutdown
{
add
{
if (_shutdown == null)
{
BridgeConnector.Socket.On("pm-shutdown", () =>
{
_shutdown();
});
BridgeConnector.Socket.Emit("register-pm-shutdown");
}
_shutdown += value;
}
remove
{
_shutdown -= value;
if (_shutdown == null)
BridgeConnector.Socket.Off("pm-on-shutdown");
}
}
private event Action _shutdown;
private static PowerMonitor _powerMonitor;
private static object _syncRoot = new object();
internal PowerMonitor() { }
internal static PowerMonitor Instance
{
get
{
if (_powerMonitor == null)
{
lock (_syncRoot)
{
if (_powerMonitor == null)
{
_powerMonitor = new PowerMonitor();
}
}
}
return _powerMonitor;
}
}
}
}

View File

@@ -1,259 +0,0 @@
using ElectronNET.API.Entities;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using System;
using System.Threading.Tasks;
namespace ElectronNET.API
{
/// <summary>
/// Retrieve information about screen size, displays, cursor position, etc.
/// </summary>
public sealed class Screen
{
/// <summary>
/// Emitted when an new Display has been added.
/// </summary>
public event Action<Display> OnDisplayAdded
{
add
{
if (_onDisplayAdded == null)
{
BridgeConnector.Socket.On("screen-display-added-event" + GetHashCode(), (display) =>
{
_onDisplayAdded(((JObject)display).ToObject<Display>());
});
BridgeConnector.Socket.Emit("register-screen-display-added", GetHashCode());
}
_onDisplayAdded += value;
}
remove
{
_onDisplayAdded -= value;
if (_onDisplayAdded == null)
BridgeConnector.Socket.Off("screen-display-added-event" + GetHashCode());
}
}
private event Action<Display> _onDisplayAdded;
/// <summary>
/// Emitted when oldDisplay has been removed.
/// </summary>
public event Action<Display> OnDisplayRemoved
{
add
{
if (_onDisplayRemoved == null)
{
BridgeConnector.Socket.On("screen-display-removed-event" + GetHashCode(), (display) =>
{
_onDisplayRemoved(((JObject)display).ToObject<Display>());
});
BridgeConnector.Socket.Emit("register-screen-display-removed", GetHashCode());
}
_onDisplayRemoved += value;
}
remove
{
_onDisplayRemoved -= value;
if (_onDisplayRemoved == null)
BridgeConnector.Socket.Off("screen-display-removed-event" + GetHashCode());
}
}
private event Action<Display> _onDisplayRemoved;
/// <summary>
/// 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.
/// </summary>
public event Action<Display, string[]> OnDisplayMetricsChanged
{
add
{
if (_onDisplayMetricsChanged == null)
{
BridgeConnector.Socket.On("screen-display-metrics-changed-event" + GetHashCode(), (args) =>
{
var display = ((JArray)args).First.ToObject<Display>();
var metrics = ((JArray)args).Last.ToObject<string[]>();
_onDisplayMetricsChanged(display, metrics);
});
BridgeConnector.Socket.Emit("register-screen-display-metrics-changed", GetHashCode());
}
_onDisplayMetricsChanged += value;
}
remove
{
_onDisplayMetricsChanged -= value;
if (_onDisplayMetricsChanged == null)
BridgeConnector.Socket.Off("screen-display-metrics-changed-event" + GetHashCode());
}
}
private event Action<Display, string[]> _onDisplayMetricsChanged;
private static Screen _screen;
private static object _syncRoot = new object();
internal Screen() { }
internal static Screen Instance
{
get
{
if (_screen == null)
{
lock (_syncRoot)
{
if (_screen == null)
{
_screen = new Screen();
}
}
}
return _screen;
}
}
/// <summary>
/// The current absolute position of the mouse pointer.
/// </summary>
/// <returns></returns>
public Task<Point> GetCursorScreenPointAsync()
{
var taskCompletionSource = new TaskCompletionSource<Point>();
BridgeConnector.Socket.On("screen-getCursorScreenPointCompleted", (point) =>
{
BridgeConnector.Socket.Off("screen-getCursorScreenPointCompleted");
taskCompletionSource.SetResult(((JObject)point).ToObject<Point>());
});
BridgeConnector.Socket.Emit("screen-getCursorScreenPoint");
return taskCompletionSource.Task;
}
/// <summary>
/// macOS: The height of the menu bar in pixels.
/// </summary>
/// <returns>The height of the menu bar in pixels.</returns>
public Task<int> GetMenuBarHeightAsync()
{
var taskCompletionSource = new TaskCompletionSource<int>();
BridgeConnector.Socket.On("screen-getMenuBarHeightCompleted", (height) =>
{
BridgeConnector.Socket.Off("screen-getMenuBarHeightCompleted");
taskCompletionSource.SetResult(int.Parse(height.ToString()));
});
BridgeConnector.Socket.Emit("screen-getMenuBarHeight");
return taskCompletionSource.Task;
}
/// <summary>
/// The primary display.
/// </summary>
/// <returns></returns>
public Task<Display> GetPrimaryDisplayAsync()
{
var taskCompletionSource = new TaskCompletionSource<Display>();
BridgeConnector.Socket.On("screen-getPrimaryDisplayCompleted", (display) =>
{
BridgeConnector.Socket.Off("screen-getPrimaryDisplayCompleted");
taskCompletionSource.SetResult(((JObject)display).ToObject<Display>());
});
BridgeConnector.Socket.Emit("screen-getPrimaryDisplay");
return taskCompletionSource.Task;
}
/// <summary>
/// An array of displays that are currently available.
/// </summary>
/// <returns>An array of displays that are currently available.</returns>
public Task<Display[]> GetAllDisplaysAsync()
{
var taskCompletionSource = new TaskCompletionSource<Display[]>();
BridgeConnector.Socket.On("screen-getAllDisplaysCompleted", (displays) =>
{
BridgeConnector.Socket.Off("screen-getAllDisplaysCompleted");
taskCompletionSource.SetResult(((JArray)displays).ToObject<Display[]>());
});
BridgeConnector.Socket.Emit("screen-getAllDisplays");
return taskCompletionSource.Task;
}
/// <summary>
/// The display nearest the specified point.
/// </summary>
/// <returns>The display nearest the specified point.</returns>
public Task<Display> GetDisplayNearestPointAsync(Point point)
{
var taskCompletionSource = new TaskCompletionSource<Display>();
BridgeConnector.Socket.On("screen-getDisplayNearestPointCompleted", (display) =>
{
BridgeConnector.Socket.Off("screen-getDisplayNearestPointCompleted");
taskCompletionSource.SetResult(((JObject)display).ToObject<Display>());
});
BridgeConnector.Socket.Emit("screen-getDisplayNearestPoint", JObject.FromObject(point, _jsonSerializer));
return taskCompletionSource.Task;
}
/// <summary>
/// The display that most closely intersects the provided bounds.
/// </summary>
/// <param name="rectangle"></param>
/// <returns>The display that most closely intersects the provided bounds.</returns>
public Task<Display> GetDisplayMatchingAsync(Rectangle rectangle)
{
var taskCompletionSource = new TaskCompletionSource<Display>();
BridgeConnector.Socket.On("screen-getDisplayMatching", (display) =>
{
BridgeConnector.Socket.Off("screen-getDisplayMatching");
taskCompletionSource.SetResult(((JObject)display).ToObject<Display>());
});
BridgeConnector.Socket.Emit("screen-getDisplayMatching", JObject.FromObject(rectangle, _jsonSerializer));
return taskCompletionSource.Task;
}
private JsonSerializer _jsonSerializer = new JsonSerializer()
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
NullValueHandling = NullValueHandling.Ignore,
DefaultValueHandling = DefaultValueHandling.Ignore
};
}
}

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,268 +0,0 @@
using ElectronNET.API.Entities;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using System;
using System.Threading.Tasks;
namespace ElectronNET.API
{
/// <summary>
/// Render and control web pages.
/// </summary>
public class WebContents
{
/// <summary>
/// Gets the identifier.
/// </summary>
/// <value>
/// The identifier.
/// </value>
public int Id { get; private set; }
/// <summary>
/// Manage browser sessions, cookies, cache, proxy settings, etc.
/// </summary>
public Session Session { get; internal set; }
/// <summary>
/// Emitted when the renderer process crashes or is killed.
/// </summary>
public event Action<bool> OnCrashed
{
add
{
if (_crashed == null)
{
BridgeConnector.Socket.On("webContents-crashed" + Id, (killed) =>
{
_crashed((bool)killed);
});
BridgeConnector.Socket.Emit("register-webContents-crashed", Id);
}
_crashed += value;
}
remove
{
_crashed -= value;
if (_crashed == null)
BridgeConnector.Socket.Off("webContents-crashed" + Id);
}
}
private event Action<bool> _crashed;
/// <summary>
/// Emitted when the navigation is done, i.e. the spinner of the tab has
/// stopped spinning, and the onload event was dispatched.
/// </summary>
public event Action OnDidFinishLoad
{
add
{
if (_didFinishLoad == null)
{
BridgeConnector.Socket.On("webContents-didFinishLoad" + Id, () =>
{
_didFinishLoad();
});
BridgeConnector.Socket.Emit("register-webContents-didFinishLoad", Id);
}
_didFinishLoad += value;
}
remove
{
_didFinishLoad -= value;
if (_didFinishLoad == null)
BridgeConnector.Socket.Off("webContents-didFinishLoad" + Id);
}
}
private event Action _didFinishLoad;
internal WebContents(int id)
{
Id = id;
Session = new Session(id);
}
/// <summary>
/// Opens the devtools.
/// </summary>
public void OpenDevTools()
{
BridgeConnector.Socket.Emit("webContentsOpenDevTools", Id);
}
/// <summary>
/// Opens the devtools.
/// </summary>
/// <param name="openDevToolsOptions"></param>
public void OpenDevTools(OpenDevToolsOptions openDevToolsOptions)
{
BridgeConnector.Socket.Emit("webContentsOpenDevTools", Id, JObject.FromObject(openDevToolsOptions, _jsonSerializer));
}
/// <summary>
/// Get system printers.
/// </summary>
/// <returns>printers</returns>
public Task<PrinterInfo[]> GetPrintersAsync()
{
var taskCompletionSource = new TaskCompletionSource<PrinterInfo[]>();
BridgeConnector.Socket.On("webContents-getPrinters-completed", (printers) =>
{
BridgeConnector.Socket.Off("webContents-getPrinters-completed");
taskCompletionSource.SetResult(((Newtonsoft.Json.Linq.JArray)printers).ToObject<PrinterInfo[]>());
});
BridgeConnector.Socket.Emit("webContents-getPrinters", Id);
return taskCompletionSource.Task;
}
/// <summary>
/// Prints window's web page.
/// </summary>
/// <param name="options"></param>
/// <returns>success</returns>
public Task<bool> PrintAsync(PrintOptions options = null)
{
var taskCompletionSource = new TaskCompletionSource<bool>();
BridgeConnector.Socket.On("webContents-print-completed", (success) =>
{
BridgeConnector.Socket.Off("webContents-print-completed");
taskCompletionSource.SetResult((bool)success);
});
if(options == null)
{
BridgeConnector.Socket.Emit("webContents-print", Id, "");
}
else
{
BridgeConnector.Socket.Emit("webContents-print", Id, JObject.FromObject(options, _jsonSerializer));
}
return taskCompletionSource.Task;
}
/// <summary>
/// Prints window's web page as PDF with Chromium's preview printing custom
/// settings.The landscape will be ignored if @page CSS at-rule is used in the web page.
/// By default, an empty options will be regarded as: Use page-break-before: always;
/// CSS style to force to print to a new page.
/// </summary>
/// <param name="path"></param>
/// <param name="options"></param>
/// <returns>success</returns>
public Task<bool> PrintToPDFAsync(string path, PrintToPDFOptions options = null)
{
var taskCompletionSource = new TaskCompletionSource<bool>();
BridgeConnector.Socket.On("webContents-printToPDF-completed", (success) =>
{
BridgeConnector.Socket.Off("webContents-printToPDF-completed");
taskCompletionSource.SetResult((bool)success);
});
if(options == null)
{
BridgeConnector.Socket.Emit("webContents-printToPDF", Id, "", path);
}
else
{
BridgeConnector.Socket.Emit("webContents-printToPDF", Id, JObject.FromObject(options, _jsonSerializer), path);
}
return taskCompletionSource.Task;
}
/// <summary>
/// Is used to get the Url of the loaded page.
/// It's usefull if a web-server redirects you and you need to know where it redirects. For instance, It's useful in case of Implicit Authorization.
/// </summary>
/// <returns>URL of the loaded page</returns>
public Task<string> GetUrl()
{
var taskCompletionSource = new TaskCompletionSource<string>();
var eventString = "webContents-getUrl" + Id;
BridgeConnector.Socket.On(eventString, (url) =>
{
BridgeConnector.Socket.Off(eventString);
taskCompletionSource.SetResult((string)url);
});
BridgeConnector.Socket.Emit("webContents-getUrl", Id);
return taskCompletionSource.Task;
}
/// <summary>
/// The async method will resolve when the page has finished loading,
/// and rejects if the page fails to load.
///
/// A noop rejection handler is already attached, which avoids unhandled rejection
/// errors.
///
/// Loads the `url` in the window. The `url` must contain the protocol prefix, e.g.
/// the `http://` or `file://`. If the load should bypass http cache then use the
/// `pragma` header to achieve it.
/// </summary>
/// <param name="url"></param>
public Task LoadURLAsync(string url)
{
return LoadURLAsync(url, new LoadURLOptions());
}
/// <summary>
/// The async method will resolve when the page has finished loading,
/// and rejects if the page fails to load.
///
/// A noop rejection handler is already attached, which avoids unhandled rejection
/// errors.
///
/// Loads the `url` in the window. The `url` must contain the protocol prefix, e.g.
/// the `http://` or `file://`. If the load should bypass http cache then use the
/// `pragma` header to achieve it.
/// </summary>
/// <param name="url"></param>
/// <param name="options"></param>
public Task LoadURLAsync(string url, LoadURLOptions options)
{
var taskCompletionSource = new TaskCompletionSource<object>();
BridgeConnector.Socket.On("webContents-loadURL-complete" + Id, () =>
{
BridgeConnector.Socket.Off("webContents-loadURL-complete" + Id);
BridgeConnector.Socket.Off("webContents-loadURL-error" + Id);
taskCompletionSource.SetResult(null);
});
BridgeConnector.Socket.On("webContents-loadURL-error" + Id, (error) =>
{
BridgeConnector.Socket.Off("webContents-loadURL-error" + Id);
taskCompletionSource.SetException(new InvalidOperationException(error.ToString()));
});
BridgeConnector.Socket.Emit("webContents-loadURL", Id, url, JObject.FromObject(options, _jsonSerializer));
return taskCompletionSource.Task;
}
private JsonSerializer _jsonSerializer = new JsonSerializer()
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
NullValueHandling = NullValueHandling.Ignore,
DefaultValueHandling = DefaultValueHandling.Ignore
};
}
}

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,45 +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 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,208 +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;win32\"'" + 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 +
"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";
public Task<bool> ExecuteAsync()
{
return Task.Run(() =>
{
Console.WriteLine("Build Electron Application...");
SimpleCommandLineParser parser = new SimpleCommandLineParser();
parser.Parse(_args);
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...");
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";
}
var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} -c \"{configuration}\" --output \"{tempBinPath}\" {publishReadyToRun} {publishSingleFile} --self-contained", 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($"node build-helper.js " + manifestFileName, 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=11.1.1 {electronParams}", tempPath);
Console.WriteLine("... done");
return true;
});
}
}
}

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,91 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.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, Robert Muehsig</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" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</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,97 +0,0 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
namespace ElectronNET.CLI
{
public class ProcessHelper
{
private readonly static Regex ErrorRegex = new Regex(@"\berror\b", RegexOptions.IgnoreCase | RegexOptions.Compiled);
public static int CmdExecute(string command, string workingDirectoryPath, bool output = true, bool waitForExit = true)
{
using (Process cmd = new Process())
{
bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
if (isWindows)
{
cmd.StartInfo.FileName = "cmd.exe";
}
else
{
// works for OSX and Linux (at least on Ubuntu)
cmd.StartInfo.FileName = "bash";
}
cmd.StartInfo.RedirectStandardInput = true;
cmd.StartInfo.RedirectStandardOutput = true;
cmd.StartInfo.RedirectStandardError = true;
cmd.StartInfo.CreateNoWindow = true;
cmd.StartInfo.UseShellExecute = false;
cmd.StartInfo.WorkingDirectory = workingDirectoryPath;
int returnCode = 0;
if (output)
{
cmd.OutputDataReceived += (s, e) =>
{
// (sometimes error messages are only visbile here)
// poor mans solution, we just seek for the term 'error'
// we can't just use cmd.ExitCode, because
// we delegate it to cmd.exe, which runs fine
// but we can catch any error here and return
// 1 if something fails
if (e != null && string.IsNullOrWhiteSpace(e.Data) == false)
{
if (ErrorRegex.IsMatch(e.Data))
{
returnCode = 1;
}
Console.WriteLine(e.Data);
}
};
cmd.ErrorDataReceived += (s, e) =>
{
// poor mans solution, we just seek for the term 'error'
// we can't just use cmd.ExitCode, because
// we delegate it to cmd.exe, which runs fine
// but we can catch any error here and return
// 1 if something fails
if (e != null && string.IsNullOrWhiteSpace(e.Data) == false)
{
if (ErrorRegex.IsMatch(e.Data))
{
returnCode = 1;
}
Console.WriteLine(e.Data);
}
};
}
cmd.Start();
cmd.BeginOutputReadLine();
cmd.BeginErrorReadLine();
cmd.StandardInput.WriteLine(command);
cmd.StandardInput.Flush();
cmd.StandardInput.Close();
if (waitForExit)
{
cmd.WaitForExit();
}
return returnCode;
}
}
}
}

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,38 +0,0 @@
using System.Collections.Generic;
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();
}
public bool Contains(string name)
{
return Arguments.ContainsKey(name);
}
}
}

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,32 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Electron App",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
"program": "${workspaceFolder}/main.js",
"sourceMaps": true,
"args": [
"--test=true",
"--blub=wuhuu"
]
},
{
"type": "node",
"request": "launch",
"name": "Launch build-helper",
"program": "${workspaceFolder}/build-helper.js",
"skipFiles": [
"<node_internals>/**"
],
"args": [
"electron.manifest.json"
]
}
]
}

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,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":"autoUpdater.js","sourceRoot":"","sources":["autoUpdater.ts"],"names":[],"mappings":";AAAA,uDAA+C;AAC/C,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,cAAc,GAAG,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,kCAAkC,EAAE,CAAC,EAAE,EAAE,EAAE;QACjD,8BAAW,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAC9B,cAAc,CAAC,IAAI,CAAC,mBAAmB,GAAG,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gDAAgD,EAAE,CAAC,EAAE,EAAE,EAAE;QAC/D,8BAAW,CAAC,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;YACvC,cAAc,CAAC,IAAI,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6CAA6C,EAAE,CAAC,EAAE,EAAE,EAAE;QAC5D,8BAAW,CAAC,EAAE,CAAC,kBAAkB,EAAE,CAAC,UAAU,EAAE,EAAE;YAC9C,cAAc,CAAC,IAAI,CAAC,8BAA8B,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iDAAiD,EAAE,CAAC,EAAE,EAAE,EAAE;QAChE,8BAAW,CAAC,EAAE,CAAC,sBAAsB,EAAE,CAAC,UAAU,EAAE,EAAE;YAClD,cAAc,CAAC,IAAI,CAAC,kCAAkC,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;QAC7E,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8CAA8C,EAAE,CAAC,EAAE,EAAE,EAAE;QAC7D,8BAAW,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,YAAY,EAAE,EAAE;YACjD,cAAc,CAAC,IAAI,CAAC,+BAA+B,GAAG,EAAE,EAAE,YAAY,CAAC,CAAC;QAC5E,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8CAA8C,EAAE,CAAC,EAAE,EAAE,EAAE;QAC7D,8BAAW,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,UAAU,EAAE,EAAE;YAC/C,cAAc,CAAC,IAAI,CAAC,+BAA+B,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,mBAAmB;IAEnB,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QAC3C,cAAc,CAAC,IAAI,CAAC,oCAAoC,EAAE,8BAAW,CAAC,YAAY,CAAC,CAAC;IACxF,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,CAAC,KAAK,EAAE,EAAE;QAChD,8BAAW,CAAC,YAAY,GAAG,KAAK,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QACnD,cAAc,CAAC,IAAI,CAAC,4CAA4C,EAAE,8BAAW,CAAC,oBAAoB,CAAC,CAAC;IACxG,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,sCAAsC,EAAE,CAAC,KAAK,EAAE,EAAE;QACxD,8BAAW,CAAC,oBAAoB,GAAG,KAAK,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QAC9C,cAAc,CAAC,IAAI,CAAC,uCAAuC,EAAE,8BAAW,CAAC,eAAe,CAAC,CAAC;IAC9F,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iCAAiC,EAAE,CAAC,KAAK,EAAE,EAAE;QACnD,8BAAW,CAAC,eAAe,GAAG,KAAK,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QAC5C,cAAc,CAAC,IAAI,CAAC,qCAAqC,EAAE,8BAAW,CAAC,aAAa,CAAC,CAAC;IAC1F,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,+BAA+B,EAAE,CAAC,KAAK,EAAE,EAAE;QACjD,8BAAW,CAAC,aAAa,GAAG,KAAK,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QAC7C,cAAc,CAAC,IAAI,CAAC,sCAAsC,EAAE,8BAAW,CAAC,cAAc,CAAC,CAAC;IAC5F,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gCAAgC,EAAE,CAAC,KAAK,EAAE,EAAE;QAClD,8BAAW,CAAC,cAAc,GAAG,KAAK,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC/C,cAAc,CAAC,IAAI,CAAC,wCAAwC,EAAE,8BAAW,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;IACtG,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,kCAAkC,EAAE,CAAC,KAAK,EAAE,EAAE;QACpD,8BAAW,CAAC,gBAAgB,GAAG,KAAK,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QAC7C,cAAc,CAAC,IAAI,CAAC,sCAAsC,EAAE,8BAAW,CAAC,cAAc,CAAC,CAAC;IAC5F,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACtC,cAAc,CAAC,IAAI,CAAC,+BAA+B,EAAE,8BAAW,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,KAAK,EAAE,EAAE;QAC3C,8BAAW,CAAC,OAAO,GAAG,KAAK,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QAC7C,cAAc,CAAC,IAAI,CAAC,sCAAsC,EAAE,8BAAW,CAAC,cAAc,CAAC,CAAC;IAC5F,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gCAAgC,EAAE,CAAC,KAAK,EAAE,EAAE;QAClD,8BAAW,CAAC,cAAc,GAAG,KAAK,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,qCAAqC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QAC5D,8BAAW,CAAC,wBAAwB,EAAE,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,EAAE;YAC9D,cAAc,CAAC,IAAI,CAAC,6CAA6C,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC;QACjG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,cAAc,CAAC,IAAI,CAAC,0CAA0C,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC;QAClF,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACnD,8BAAW,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,EAAE;YACrD,cAAc,CAAC,IAAI,CAAC,oCAAoC,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC;QACxF,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,cAAc,CAAC,IAAI,CAAC,iCAAiC,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE;QACvE,8BAAW,CAAC,cAAc,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QAClD,MAAM,cAAc,GAAG,MAAM,8BAAW,CAAC,cAAc,EAAE,CAAC;QAC1D,cAAc,CAAC,IAAI,CAAC,mCAAmC,GAAG,IAAI,EAAE,cAAc,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QAC9C,MAAM,OAAO,GAAG,MAAM,8BAAW,CAAC,UAAU,EAAE,CAAC;QAC/C,cAAc,CAAC,IAAI,CAAC,+BAA+B,GAAG,IAAI,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}

View File

@@ -1,142 +0,0 @@
import { autoUpdater } from 'electron-updater';
let electronSocket;
export = (socket: SocketIO.Socket) => {
electronSocket = socket;
socket.on('register-autoUpdater-error-event', (id) => {
autoUpdater.on('error', (error) => {
electronSocket.emit('autoUpdater-error' + id, error.message);
});
});
socket.on('register-autoUpdater-checking-for-update-event', (id) => {
autoUpdater.on('checking-for-update', () => {
electronSocket.emit('autoUpdater-checking-for-update' + id);
});
});
socket.on('register-autoUpdater-update-available-event', (id) => {
autoUpdater.on('update-available', (updateInfo) => {
electronSocket.emit('autoUpdater-update-available' + id, updateInfo);
});
});
socket.on('register-autoUpdater-update-not-available-event', (id) => {
autoUpdater.on('update-not-available', (updateInfo) => {
electronSocket.emit('autoUpdater-update-not-available' + id, updateInfo);
});
});
socket.on('register-autoUpdater-download-progress-event', (id) => {
autoUpdater.on('download-progress', (progressInfo) => {
electronSocket.emit('autoUpdater-download-progress' + id, progressInfo);
});
});
socket.on('register-autoUpdater-update-downloaded-event', (id) => {
autoUpdater.on('update-downloaded', (updateInfo) => {
electronSocket.emit('autoUpdater-update-downloaded' + id, updateInfo);
});
});
// Properties *****
socket.on('autoUpdater-autoDownload-get', () => {
electronSocket.emit('autoUpdater-autoDownload-get-reply', autoUpdater.autoDownload);
});
socket.on('autoUpdater-autoDownload-set', (value) => {
autoUpdater.autoDownload = value;
});
socket.on('autoUpdater-autoInstallOnAppQuit-get', () => {
electronSocket.emit('autoUpdater-autoInstallOnAppQuit-get-reply', autoUpdater.autoInstallOnAppQuit);
});
socket.on('autoUpdater-autoInstallOnAppQuit-set', (value) => {
autoUpdater.autoInstallOnAppQuit = value;
});
socket.on('autoUpdater-allowPrerelease-get', () => {
electronSocket.emit('autoUpdater-allowPrerelease-get-reply', autoUpdater.allowPrerelease);
});
socket.on('autoUpdater-allowPrerelease-set', (value) => {
autoUpdater.allowPrerelease = value;
});
socket.on('autoUpdater-fullChangelog-get', () => {
electronSocket.emit('autoUpdater-fullChangelog-get-reply', autoUpdater.fullChangelog);
});
socket.on('autoUpdater-fullChangelog-set', (value) => {
autoUpdater.fullChangelog = value;
});
socket.on('autoUpdater-allowDowngrade-get', () => {
electronSocket.emit('autoUpdater-allowDowngrade-get-reply', autoUpdater.allowDowngrade);
});
socket.on('autoUpdater-allowDowngrade-set', (value) => {
autoUpdater.allowDowngrade = value;
});
socket.on('autoUpdater-updateConfigPath-get', () => {
electronSocket.emit('autoUpdater-updateConfigPath-get-reply', autoUpdater.updateConfigPath || '');
});
socket.on('autoUpdater-updateConfigPath-set', (value) => {
autoUpdater.updateConfigPath = value;
});
socket.on('autoUpdater-currentVersion-get', () => {
electronSocket.emit('autoUpdater-currentVersion-get-reply', autoUpdater.currentVersion);
});
socket.on('autoUpdater-channel-get', () => {
electronSocket.emit('autoUpdater-channel-get-reply', autoUpdater.channel || '');
});
socket.on('autoUpdater-channel-set', (value) => {
autoUpdater.channel = value;
});
socket.on('autoUpdater-requestHeaders-get', () => {
electronSocket.emit('autoUpdater-requestHeaders-get-reply', autoUpdater.requestHeaders);
});
socket.on('autoUpdater-requestHeaders-set', (value) => {
autoUpdater.requestHeaders = value;
});
socket.on('autoUpdaterCheckForUpdatesAndNotify', async (guid) => {
autoUpdater.checkForUpdatesAndNotify().then((updateCheckResult) => {
electronSocket.emit('autoUpdaterCheckForUpdatesAndNotifyComplete' + guid, updateCheckResult);
}).catch((error) => {
electronSocket.emit('autoUpdaterCheckForUpdatesAndNotifyError' + guid, error);
});
});
socket.on('autoUpdaterCheckForUpdates', async (guid) => {
autoUpdater.checkForUpdates().then((updateCheckResult) => {
electronSocket.emit('autoUpdaterCheckForUpdatesComplete' + guid, updateCheckResult);
}).catch((error) => {
electronSocket.emit('autoUpdaterCheckForUpdatesError' + guid, error);
});
});
socket.on('autoUpdaterQuitAndInstall', async (isSilent, isForceRunAfter) => {
autoUpdater.quitAndInstall(isSilent, isForceRunAfter);
});
socket.on('autoUpdaterDownloadUpdate', async (guid) => {
const downloadedPath = await autoUpdater.downloadUpdate();
electronSocket.emit('autoUpdaterDownloadUpdateComplete' + guid, downloadedPath);
});
socket.on('autoUpdaterGetFeedURL', async (guid) => {
const feedUrl = await autoUpdater.getFeedURL();
electronSocket.emit('autoUpdaterGetFeedURLComplete' + guid, feedUrl || '');
});
};

View File

@@ -1 +0,0 @@
{"version":3,"file":"browserView.js","sourceRoot":"","sources":["browserView.ts"],"names":[],"mappings":";;;AAAA,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;AAE7C,MAAM,cAAc,GAAG,CAAC,MAAuB,EAAE,EAAE;IAC/C,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,EAAE,CAAC;SACvE;QAED,WAAW,GAAG,IAAI,sBAAW,CAAC,OAAO,CAAC,CAAC;QACvC,WAAW,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;QAC5C,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"}

View File

@@ -1,607 +0,0 @@
"use strict";
const electron_1 = require("electron");
const browserView_1 = require("./browserView");
const path = require('path');
const windows = (global['browserWindows'] = global['browserWindows'] || []);
let readyToShowWindowsIds = [];
let window, lastOptions, electronSocket;
let mainWindowURL;
module.exports = (socket, app) => {
electronSocket = socket;
socket.on('register-browserWindow-ready-to-show', (id) => {
if (readyToShowWindowsIds.includes(id)) {
readyToShowWindowsIds = readyToShowWindowsIds.filter(value => value !== id);
electronSocket.emit('browserWindow-ready-to-show' + id);
}
getWindowById(id).on('ready-to-show', () => {
readyToShowWindowsIds.push(id);
electronSocket.emit('browserWindow-ready-to-show' + id);
});
});
socket.on('register-browserWindow-page-title-updated', (id) => {
getWindowById(id).on('page-title-updated', (event, title) => {
electronSocket.emit('browserWindow-page-title-updated' + id, title);
});
});
socket.on('register-browserWindow-close', (id) => {
getWindowById(id).on('close', () => {
electronSocket.emit('browserWindow-close' + id);
});
});
socket.on('register-browserWindow-closed', (id) => {
getWindowById(id).on('closed', () => {
electronSocket.emit('browserWindow-closed' + id);
});
});
socket.on('register-browserWindow-session-end', (id) => {
getWindowById(id).on('session-end', () => {
electronSocket.emit('browserWindow-session-end' + id);
});
});
socket.on('register-browserWindow-unresponsive', (id) => {
getWindowById(id).on('unresponsive', () => {
electronSocket.emit('browserWindow-unresponsive' + id);
});
});
socket.on('register-browserWindow-responsive', (id) => {
getWindowById(id).on('responsive', () => {
electronSocket.emit('browserWindow-responsive' + id);
});
});
socket.on('register-browserWindow-blur', (id) => {
getWindowById(id).on('blur', () => {
electronSocket.emit('browserWindow-blur' + id);
});
});
socket.on('register-browserWindow-focus', (id) => {
getWindowById(id).on('focus', () => {
electronSocket.emit('browserWindow-focus' + id);
});
});
socket.on('register-browserWindow-show', (id) => {
getWindowById(id).on('show', () => {
electronSocket.emit('browserWindow-show' + id);
});
});
socket.on('register-browserWindow-hide', (id) => {
getWindowById(id).on('hide', () => {
electronSocket.emit('browserWindow-hide' + id);
});
});
socket.on('register-browserWindow-maximize', (id) => {
getWindowById(id).on('maximize', () => {
electronSocket.emit('browserWindow-maximize' + id);
});
});
socket.on('register-browserWindow-unmaximize', (id) => {
getWindowById(id).on('unmaximize', () => {
electronSocket.emit('browserWindow-unmaximize' + id);
});
});
socket.on('register-browserWindow-minimize', (id) => {
getWindowById(id).on('minimize', () => {
electronSocket.emit('browserWindow-minimize' + id);
});
});
socket.on('register-browserWindow-restore', (id) => {
getWindowById(id).on('restore', () => {
electronSocket.emit('browserWindow-restore' + id);
});
});
socket.on('register-browserWindow-resize', (id) => {
getWindowById(id).on('resize', () => {
electronSocket.emit('browserWindow-resize' + id);
});
});
socket.on('register-browserWindow-move', (id) => {
getWindowById(id).on('move', () => {
electronSocket.emit('browserWindow-move' + id);
});
});
socket.on('register-browserWindow-moved', (id) => {
getWindowById(id).on('moved', () => {
electronSocket.emit('browserWindow-moved' + id);
});
});
socket.on('register-browserWindow-enter-full-screen', (id) => {
getWindowById(id).on('enter-full-screen', () => {
electronSocket.emit('browserWindow-enter-full-screen' + id);
});
});
socket.on('register-browserWindow-leave-full-screen', (id) => {
getWindowById(id).on('leave-full-screen', () => {
electronSocket.emit('browserWindow-leave-full-screen' + id);
});
});
socket.on('register-browserWindow-enter-html-full-screen', (id) => {
getWindowById(id).on('enter-html-full-screen', () => {
electronSocket.emit('browserWindow-enter-html-full-screen' + id);
});
});
socket.on('register-browserWindow-leave-html-full-screen', (id) => {
getWindowById(id).on('leave-html-full-screen', () => {
electronSocket.emit('browserWindow-leave-html-full-screen' + id);
});
});
socket.on('register-browserWindow-app-command', (id) => {
getWindowById(id).on('app-command', (event, command) => {
electronSocket.emit('browserWindow-app-command' + id, command);
});
});
socket.on('register-browserWindow-scroll-touch-begin', (id) => {
getWindowById(id).on('scroll-touch-begin', () => {
electronSocket.emit('browserWindow-scroll-touch-begin' + id);
});
});
socket.on('register-browserWindow-scroll-touch-end', (id) => {
getWindowById(id).on('scroll-touch-end', () => {
electronSocket.emit('browserWindow-scroll-touch-end' + id);
});
});
socket.on('register-browserWindow-scroll-touch-edge', (id) => {
getWindowById(id).on('scroll-touch-edge', () => {
electronSocket.emit('browserWindow-scroll-touch-edge' + id);
});
});
socket.on('register-browserWindow-swipe', (id) => {
getWindowById(id).on('swipe', (event, direction) => {
electronSocket.emit('browserWindow-swipe' + id, direction);
});
});
socket.on('register-browserWindow-sheet-begin', (id) => {
getWindowById(id).on('sheet-begin', () => {
electronSocket.emit('browserWindow-sheet-begin' + id);
});
});
socket.on('register-browserWindow-sheet-end', (id) => {
getWindowById(id).on('sheet-end', () => {
electronSocket.emit('browserWindow-sheet-end' + id);
});
});
socket.on('register-browserWindow-new-window-for-tab', (id) => {
getWindowById(id).on('new-window-for-tab', () => {
electronSocket.emit('browserWindow-new-window-for-tab' + id);
});
});
socket.on('createBrowserWindow', (options, loadUrl) => {
if (options.webPreferences && !('nodeIntegration' in options.webPreferences)) {
options = { ...options, webPreferences: { ...options.webPreferences, nodeIntegration: true } };
}
else if (!options.webPreferences) {
options = { ...options, webPreferences: { nodeIntegration: true } };
}
// we dont want to recreate the window when watch is ready.
if (app.commandLine.hasSwitch('watch') && app['mainWindowURL'] === loadUrl) {
window = app['mainWindow'];
if (window) {
window.reload();
windows.push(window);
electronSocket.emit('BrowserWindowCreated', window.id);
return;
}
}
else {
window = new electron_1.BrowserWindow(options);
}
window.on('ready-to-show', () => {
if (readyToShowWindowsIds.includes(window.id)) {
readyToShowWindowsIds = readyToShowWindowsIds.filter(value => value !== window.id);
}
else {
readyToShowWindowsIds.push(window.id);
}
});
lastOptions = options;
window.on('closed', (sender) => {
for (let index = 0; index < windows.length; index++) {
const windowItem = windows[index];
try {
windowItem.id;
}
catch (error) {
if (error.message === 'Object has been destroyed') {
windows.splice(index, 1);
const ids = [];
windows.forEach(x => ids.push(x.id));
electronSocket.emit('BrowserWindowClosed', ids);
}
}
}
});
app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (window === null && lastOptions) {
window = new electron_1.BrowserWindow(lastOptions);
}
});
if (loadUrl) {
window.loadURL(loadUrl);
}
if (app.commandLine.hasSwitch('clear-cache') &&
app.commandLine.getSwitchValue('clear-cache')) {
window.webContents.session.clearCache();
console.log('auto clear-cache active for new window.');
}
// set main window url
if (app['mainWindowURL'] == undefined || app['mainWindowURL'] == "") {
app['mainWindowURL'] = loadUrl;
app['mainWindow'] = window;
}
windows.push(window);
electronSocket.emit('BrowserWindowCreated', window.id);
});
socket.on('browserWindowDestroy', (id) => {
getWindowById(id).destroy();
});
socket.on('browserWindowClose', (id) => {
getWindowById(id).close();
});
socket.on('browserWindowFocus', (id) => {
getWindowById(id).focus();
});
socket.on('browserWindowBlur', (id) => {
getWindowById(id).blur();
});
socket.on('browserWindowIsFocused', (id) => {
const isFocused = getWindowById(id).isFocused();
electronSocket.emit('browserWindow-isFocused-completed', isFocused);
});
socket.on('browserWindowIsDestroyed', (id) => {
const isDestroyed = getWindowById(id).isDestroyed();
electronSocket.emit('browserWindow-isDestroyed-completed', isDestroyed);
});
socket.on('browserWindowShow', (id) => {
getWindowById(id).show();
});
socket.on('browserWindowShowInactive', (id) => {
getWindowById(id).showInactive();
});
socket.on('browserWindowHide', (id) => {
getWindowById(id).hide();
});
socket.on('browserWindowIsVisible', (id) => {
const isVisible = getWindowById(id).isVisible();
electronSocket.emit('browserWindow-isVisible-completed', isVisible);
});
socket.on('browserWindowIsModal', (id) => {
const isModal = getWindowById(id).isModal();
electronSocket.emit('browserWindow-isModal-completed', isModal);
});
socket.on('browserWindowMaximize', (id) => {
getWindowById(id).maximize();
});
socket.on('browserWindowUnmaximize', (id) => {
getWindowById(id).unmaximize();
});
socket.on('browserWindowIsMaximized', (id) => {
const isMaximized = getWindowById(id).isMaximized();
electronSocket.emit('browserWindow-isMaximized-completed', isMaximized);
});
socket.on('browserWindowMinimize', (id) => {
getWindowById(id).minimize();
});
socket.on('browserWindowRestore', (id) => {
getWindowById(id).restore();
});
socket.on('browserWindowIsMinimized', (id) => {
const isMinimized = getWindowById(id).isMinimized();
electronSocket.emit('browserWindow-isMinimized-completed', isMinimized);
});
socket.on('browserWindowSetFullScreen', (id, fullscreen) => {
getWindowById(id).setFullScreen(fullscreen);
});
socket.on('browserWindowIsFullScreen', (id) => {
const isFullScreen = getWindowById(id).isFullScreen();
electronSocket.emit('browserWindow-isFullScreen-completed', isFullScreen);
});
socket.on('browserWindowSetAspectRatio', (id, aspectRatio, extraSize) => {
getWindowById(id).setAspectRatio(aspectRatio, extraSize);
});
socket.on('browserWindowPreviewFile', (id, path, displayname) => {
getWindowById(id).previewFile(path, displayname);
});
socket.on('browserWindowCloseFilePreview', (id) => {
getWindowById(id).closeFilePreview();
});
socket.on('browserWindowSetBounds', (id, bounds, animate) => {
getWindowById(id).setBounds(bounds, animate);
});
socket.on('browserWindowGetBounds', (id) => {
const rectangle = getWindowById(id).getBounds();
electronSocket.emit('browserWindow-getBounds-completed', rectangle);
});
socket.on('browserWindowSetContentBounds', (id, bounds, animate) => {
getWindowById(id).setContentBounds(bounds, animate);
});
socket.on('browserWindowGetContentBounds', (id) => {
const rectangle = getWindowById(id).getContentBounds();
electronSocket.emit('browserWindow-getContentBounds-completed', rectangle);
});
socket.on('browserWindowSetSize', (id, width, height, animate) => {
getWindowById(id).setSize(width, height, animate);
});
socket.on('browserWindowGetSize', (id) => {
const size = getWindowById(id).getSize();
electronSocket.emit('browserWindow-getSize-completed', size);
});
socket.on('browserWindowSetContentSize', (id, width, height, animate) => {
getWindowById(id).setContentSize(width, height, animate);
});
socket.on('browserWindowGetContentSize', (id) => {
const size = getWindowById(id).getContentSize();
electronSocket.emit('browserWindow-getContentSize-completed', size);
});
socket.on('browserWindowSetMinimumSize', (id, width, height) => {
getWindowById(id).setMinimumSize(width, height);
});
socket.on('browserWindowGetMinimumSize', (id) => {
const size = getWindowById(id).getMinimumSize();
electronSocket.emit('browserWindow-getMinimumSize-completed', size);
});
socket.on('browserWindowSetMaximumSize', (id, width, height) => {
getWindowById(id).setMaximumSize(width, height);
});
socket.on('browserWindowGetMaximumSize', (id) => {
const size = getWindowById(id).getMaximumSize();
electronSocket.emit('browserWindow-getMaximumSize-completed', size);
});
socket.on('browserWindowSetResizable', (id, resizable) => {
getWindowById(id).setResizable(resizable);
});
socket.on('browserWindowIsResizable', (id) => {
const resizable = getWindowById(id).isResizable();
electronSocket.emit('browserWindow-isResizable-completed', resizable);
});
socket.on('browserWindowSetMovable', (id, movable) => {
getWindowById(id).setMovable(movable);
});
socket.on('browserWindowIsMovable', (id) => {
const movable = getWindowById(id).isMovable();
electronSocket.emit('browserWindow-isMovable-completed', movable);
});
socket.on('browserWindowSetMinimizable', (id, minimizable) => {
getWindowById(id).setMinimizable(minimizable);
});
socket.on('browserWindowIsMinimizable', (id) => {
const minimizable = getWindowById(id).isMinimizable();
electronSocket.emit('browserWindow-isMinimizable-completed', minimizable);
});
socket.on('browserWindowSetMaximizable', (id, maximizable) => {
getWindowById(id).setMaximizable(maximizable);
});
socket.on('browserWindowIsMaximizable', (id) => {
const maximizable = getWindowById(id).isMaximizable();
electronSocket.emit('browserWindow-isMaximizable-completed', maximizable);
});
socket.on('browserWindowSetFullScreenable', (id, fullscreenable) => {
getWindowById(id).setFullScreenable(fullscreenable);
});
socket.on('browserWindowIsFullScreenable', (id) => {
const fullscreenable = getWindowById(id).isFullScreenable();
electronSocket.emit('browserWindow-isFullScreenable-completed', fullscreenable);
});
socket.on('browserWindowSetClosable', (id, closable) => {
getWindowById(id).setClosable(closable);
});
socket.on('browserWindowIsClosable', (id) => {
const closable = getWindowById(id).isClosable();
electronSocket.emit('browserWindow-isClosable-completed', closable);
});
socket.on('browserWindowSetAlwaysOnTop', (id, flag, level, relativeLevel) => {
getWindowById(id).setAlwaysOnTop(flag, level, relativeLevel);
});
socket.on('browserWindowIsAlwaysOnTop', (id) => {
const isAlwaysOnTop = getWindowById(id).isAlwaysOnTop();
electronSocket.emit('browserWindow-isAlwaysOnTop-completed', isAlwaysOnTop);
});
socket.on('browserWindowCenter', (id) => {
getWindowById(id).center();
});
socket.on('browserWindowSetPosition', (id, x, y, animate) => {
getWindowById(id).setPosition(x, y, animate);
});
socket.on('browserWindowGetPosition', (id) => {
const position = getWindowById(id).getPosition();
electronSocket.emit('browserWindow-getPosition-completed', position);
});
socket.on('browserWindowSetTitle', (id, title) => {
getWindowById(id).setTitle(title);
});
socket.on('browserWindowGetTitle', (id) => {
const title = getWindowById(id).getTitle();
electronSocket.emit('browserWindow-getTitle-completed', title);
});
socket.on('browserWindowSetTitle', (id, title) => {
getWindowById(id).setTitle(title);
});
socket.on('browserWindowSetSheetOffset', (id, offsetY, offsetX) => {
if (offsetX) {
getWindowById(id).setSheetOffset(offsetY, offsetX);
}
else {
getWindowById(id).setSheetOffset(offsetY);
}
});
socket.on('browserWindowFlashFrame', (id, flag) => {
getWindowById(id).flashFrame(flag);
});
socket.on('browserWindowSetSkipTaskbar', (id, skip) => {
getWindowById(id).setSkipTaskbar(skip);
});
socket.on('browserWindowSetKiosk', (id, flag) => {
getWindowById(id).setKiosk(flag);
});
socket.on('browserWindowIsKiosk', (id) => {
const isKiosk = getWindowById(id).isKiosk();
electronSocket.emit('browserWindow-isKiosk-completed', isKiosk);
});
socket.on('browserWindowGetNativeWindowHandle', (id) => {
const nativeWindowHandle = getWindowById(id).getNativeWindowHandle().readInt32LE(0).toString(16);
electronSocket.emit('browserWindow-getNativeWindowHandle-completed', nativeWindowHandle);
});
socket.on('browserWindowSetRepresentedFilename', (id, filename) => {
getWindowById(id).setRepresentedFilename(filename);
});
socket.on('browserWindowGetRepresentedFilename', (id) => {
const pathname = getWindowById(id).getRepresentedFilename();
electronSocket.emit('browserWindow-getRepresentedFilename-completed', pathname);
});
socket.on('browserWindowSetDocumentEdited', (id, edited) => {
getWindowById(id).setDocumentEdited(edited);
});
socket.on('browserWindowIsDocumentEdited', (id) => {
const edited = getWindowById(id).isDocumentEdited();
electronSocket.emit('browserWindow-isDocumentEdited-completed', edited);
});
socket.on('browserWindowFocusOnWebView', (id) => {
getWindowById(id).focusOnWebView();
});
socket.on('browserWindowBlurWebView', (id) => {
getWindowById(id).blurWebView();
});
socket.on('browserWindowLoadURL', (id, url, options) => {
getWindowById(id).loadURL(url, options);
});
socket.on('browserWindowReload', (id) => {
getWindowById(id).reload();
});
socket.on('browserWindowSetMenu', (id, menuItems) => {
let menu = null;
if (menuItems) {
menu = electron_1.Menu.buildFromTemplate(menuItems);
addMenuItemClickConnector(menu.items, (id) => {
electronSocket.emit('windowMenuItemClicked', id);
});
}
getWindowById(id).setMenu(menu);
});
socket.on('browserWindowRemoveMenu', (id) => {
getWindowById(id).removeMenu();
});
function addMenuItemClickConnector(menuItems, callback) {
menuItems.forEach((item) => {
if (item.submenu && item.submenu.items.length > 0) {
addMenuItemClickConnector(item.submenu.items, callback);
}
if ('id' in item && item.id) {
item.click = () => { callback(item.id); };
}
});
}
socket.on('browserWindowSetProgressBar', (id, progress) => {
getWindowById(id).setProgressBar(progress);
});
socket.on('browserWindowSetProgressBar', (id, progress, options) => {
getWindowById(id).setProgressBar(progress, options);
});
socket.on('browserWindowSetHasShadow', (id, hasShadow) => {
getWindowById(id).setHasShadow(hasShadow);
});
socket.on('browserWindowHasShadow', (id) => {
const hasShadow = getWindowById(id).hasShadow();
electronSocket.emit('browserWindow-hasShadow-completed', hasShadow);
});
socket.on('browserWindowSetThumbarButtons', (id, thumbarButtons) => {
thumbarButtons.forEach(thumbarButton => {
const imagePath = path.join(__dirname.replace('api', ''), 'bin', thumbarButton.icon.toString());
thumbarButton.icon = electron_1.nativeImage.createFromPath(imagePath);
thumbarButton.click = () => {
electronSocket.emit('thumbarButtonClicked', thumbarButton['id']);
};
});
const success = getWindowById(id).setThumbarButtons(thumbarButtons);
electronSocket.emit('browserWindowSetThumbarButtons-completed', success);
});
socket.on('browserWindowSetThumbnailClip', (id, rectangle) => {
getWindowById(id).setThumbnailClip(rectangle);
});
socket.on('browserWindowSetThumbnailToolTip', (id, toolTip) => {
getWindowById(id).setThumbnailToolTip(toolTip);
});
socket.on('browserWindowSetAppDetails', (id, options) => {
getWindowById(id).setAppDetails(options);
});
socket.on('browserWindowShowDefinitionForSelection', (id) => {
getWindowById(id).showDefinitionForSelection();
});
socket.on('browserWindowSetAutoHideMenuBar', (id, hide) => {
getWindowById(id).setAutoHideMenuBar(hide);
});
socket.on('browserWindowIsMenuBarAutoHide', (id) => {
const isMenuBarAutoHide = getWindowById(id).isMenuBarAutoHide();
electronSocket.emit('browserWindow-isMenuBarAutoHide-completed', isMenuBarAutoHide);
});
socket.on('browserWindowSetMenuBarVisibility', (id, visible) => {
getWindowById(id).setMenuBarVisibility(visible);
});
socket.on('browserWindowIsMenuBarVisible', (id) => {
const isMenuBarVisible = getWindowById(id).isMenuBarVisible();
electronSocket.emit('browserWindow-isMenuBarVisible-completed', isMenuBarVisible);
});
socket.on('browserWindowSetVisibleOnAllWorkspaces', (id, visible) => {
getWindowById(id).setVisibleOnAllWorkspaces(visible);
});
socket.on('browserWindowIsVisibleOnAllWorkspaces', (id) => {
const isVisibleOnAllWorkspaces = getWindowById(id).isVisibleOnAllWorkspaces();
electronSocket.emit('browserWindow-isVisibleOnAllWorkspaces-completed', isVisibleOnAllWorkspaces);
});
socket.on('browserWindowSetIgnoreMouseEvents', (id, ignore) => {
getWindowById(id).setIgnoreMouseEvents(ignore);
});
socket.on('browserWindowSetContentProtection', (id, enable) => {
getWindowById(id).setContentProtection(enable);
});
socket.on('browserWindowSetFocusable', (id, focusable) => {
getWindowById(id).setFocusable(focusable);
});
socket.on('browserWindowSetParentWindow', (id, parent) => {
const browserWindow = electron_1.BrowserWindow.fromId(parent.id);
getWindowById(id).setParentWindow(browserWindow);
});
socket.on('browserWindowGetParentWindow', (id) => {
const browserWindow = getWindowById(id).getParentWindow();
electronSocket.emit('browserWindow-getParentWindow-completed', browserWindow.id);
});
socket.on('browserWindowGetChildWindows', (id) => {
const browserWindows = getWindowById(id).getChildWindows();
const ids = [];
browserWindows.forEach(x => {
ids.push(x.id);
});
electronSocket.emit('browserWindow-getChildWindows-completed', ids);
});
socket.on('browserWindowSetAutoHideCursor', (id, autoHide) => {
getWindowById(id).setAutoHideCursor(autoHide);
});
socket.on('browserWindowSetVibrancy', (id, type) => {
getWindowById(id).setVibrancy(type);
});
socket.on('browserWindowAddExtension', (path) => {
const extensionName = electron_1.BrowserWindow.addExtension(path);
electronSocket.emit('browserWindow-addExtension-completed', extensionName);
});
socket.on('browserWindowRemoveExtension', (name) => {
electron_1.BrowserWindow.removeExtension(name);
});
socket.on('browserWindowGetExtensions', () => {
const extensionsList = electron_1.BrowserWindow.getExtensions();
const chromeExtensionInfo = [];
Object.keys(extensionsList).forEach(key => {
chromeExtensionInfo.push(extensionsList[key]);
});
electronSocket.emit('browserWindow-getExtensions-completed', chromeExtensionInfo);
});
socket.on('browserWindow-setBrowserView', (id, browserViewId) => {
getWindowById(id).setBrowserView(browserView_1.browserViewMediateService(browserViewId));
});
function getWindowById(id) {
for (let index = 0; index < windows.length; index++) {
const element = windows[index];
if (element.id === id) {
return element;
}
}
}
};
//# sourceMappingURL=browserWindows.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,782 +0,0 @@
import { BrowserWindow, Menu, nativeImage } from 'electron';
import { browserViewMediateService } from './browserView';
const path = require('path');
const windows: Electron.BrowserWindow[] = (global['browserWindows'] = global['browserWindows'] || []) as Electron.BrowserWindow[];
let readyToShowWindowsIds: number[] = [];
let window, lastOptions, electronSocket;
let mainWindowURL;
export = (socket: SocketIO.Socket, app: Electron.App) => {
electronSocket = socket;
socket.on('register-browserWindow-ready-to-show', (id) => {
if (readyToShowWindowsIds.includes(id)) {
readyToShowWindowsIds = readyToShowWindowsIds.filter(value => value !== id);
electronSocket.emit('browserWindow-ready-to-show' + id);
}
getWindowById(id).on('ready-to-show', () => {
readyToShowWindowsIds.push(id);
electronSocket.emit('browserWindow-ready-to-show' + id);
});
});
socket.on('register-browserWindow-page-title-updated', (id) => {
getWindowById(id).on('page-title-updated', (event, title) => {
electronSocket.emit('browserWindow-page-title-updated' + id, title);
});
});
socket.on('register-browserWindow-close', (id) => {
getWindowById(id).on('close', () => {
electronSocket.emit('browserWindow-close' + id);
});
});
socket.on('register-browserWindow-closed', (id) => {
getWindowById(id).on('closed', () => {
electronSocket.emit('browserWindow-closed' + id);
});
});
socket.on('register-browserWindow-session-end', (id) => {
getWindowById(id).on('session-end', () => {
electronSocket.emit('browserWindow-session-end' + id);
});
});
socket.on('register-browserWindow-unresponsive', (id) => {
getWindowById(id).on('unresponsive', () => {
electronSocket.emit('browserWindow-unresponsive' + id);
});
});
socket.on('register-browserWindow-responsive', (id) => {
getWindowById(id).on('responsive', () => {
electronSocket.emit('browserWindow-responsive' + id);
});
});
socket.on('register-browserWindow-blur', (id) => {
getWindowById(id).on('blur', () => {
electronSocket.emit('browserWindow-blur' + id);
});
});
socket.on('register-browserWindow-focus', (id) => {
getWindowById(id).on('focus', () => {
electronSocket.emit('browserWindow-focus' + id);
});
});
socket.on('register-browserWindow-show', (id) => {
getWindowById(id).on('show', () => {
electronSocket.emit('browserWindow-show' + id);
});
});
socket.on('register-browserWindow-hide', (id) => {
getWindowById(id).on('hide', () => {
electronSocket.emit('browserWindow-hide' + id);
});
});
socket.on('register-browserWindow-maximize', (id) => {
getWindowById(id).on('maximize', () => {
electronSocket.emit('browserWindow-maximize' + id);
});
});
socket.on('register-browserWindow-unmaximize', (id) => {
getWindowById(id).on('unmaximize', () => {
electronSocket.emit('browserWindow-unmaximize' + id);
});
});
socket.on('register-browserWindow-minimize', (id) => {
getWindowById(id).on('minimize', () => {
electronSocket.emit('browserWindow-minimize' + id);
});
});
socket.on('register-browserWindow-restore', (id) => {
getWindowById(id).on('restore', () => {
electronSocket.emit('browserWindow-restore' + id);
});
});
socket.on('register-browserWindow-resize', (id) => {
getWindowById(id).on('resize', () => {
electronSocket.emit('browserWindow-resize' + id);
});
});
socket.on('register-browserWindow-move', (id) => {
getWindowById(id).on('move', () => {
electronSocket.emit('browserWindow-move' + id);
});
});
socket.on('register-browserWindow-moved', (id) => {
getWindowById(id).on('moved', () => {
electronSocket.emit('browserWindow-moved' + id);
});
});
socket.on('register-browserWindow-enter-full-screen', (id) => {
getWindowById(id).on('enter-full-screen', () => {
electronSocket.emit('browserWindow-enter-full-screen' + id);
});
});
socket.on('register-browserWindow-leave-full-screen', (id) => {
getWindowById(id).on('leave-full-screen', () => {
electronSocket.emit('browserWindow-leave-full-screen' + id);
});
});
socket.on('register-browserWindow-enter-html-full-screen', (id) => {
getWindowById(id).on('enter-html-full-screen', () => {
electronSocket.emit('browserWindow-enter-html-full-screen' + id);
});
});
socket.on('register-browserWindow-leave-html-full-screen', (id) => {
getWindowById(id).on('leave-html-full-screen', () => {
electronSocket.emit('browserWindow-leave-html-full-screen' + id);
});
});
socket.on('register-browserWindow-app-command', (id) => {
getWindowById(id).on('app-command', (event, command) => {
electronSocket.emit('browserWindow-app-command' + id, command);
});
});
socket.on('register-browserWindow-scroll-touch-begin', (id) => {
getWindowById(id).on('scroll-touch-begin', () => {
electronSocket.emit('browserWindow-scroll-touch-begin' + id);
});
});
socket.on('register-browserWindow-scroll-touch-end', (id) => {
getWindowById(id).on('scroll-touch-end', () => {
electronSocket.emit('browserWindow-scroll-touch-end' + id);
});
});
socket.on('register-browserWindow-scroll-touch-edge', (id) => {
getWindowById(id).on('scroll-touch-edge', () => {
electronSocket.emit('browserWindow-scroll-touch-edge' + id);
});
});
socket.on('register-browserWindow-swipe', (id) => {
getWindowById(id).on('swipe', (event, direction) => {
electronSocket.emit('browserWindow-swipe' + id, direction);
});
});
socket.on('register-browserWindow-sheet-begin', (id) => {
getWindowById(id).on('sheet-begin', () => {
electronSocket.emit('browserWindow-sheet-begin' + id);
});
});
socket.on('register-browserWindow-sheet-end', (id) => {
getWindowById(id).on('sheet-end', () => {
electronSocket.emit('browserWindow-sheet-end' + id);
});
});
socket.on('register-browserWindow-new-window-for-tab', (id) => {
getWindowById(id).on('new-window-for-tab', () => {
electronSocket.emit('browserWindow-new-window-for-tab' + id);
});
});
socket.on('createBrowserWindow', (options, loadUrl) => {
if (options.webPreferences && !('nodeIntegration' in options.webPreferences)) {
options = { ...options, webPreferences: { ...options.webPreferences, nodeIntegration: true } };
} else if (!options.webPreferences) {
options = { ...options, webPreferences: { nodeIntegration: true } };
}
// we dont want to recreate the window when watch is ready.
if (app.commandLine.hasSwitch('watch') && app['mainWindowURL'] === loadUrl) {
window = app['mainWindow'];
if (window) {
window.reload();
windows.push(window);
electronSocket.emit('BrowserWindowCreated', window.id);
return;
}
} else {
window = new BrowserWindow(options);
}
window.on('ready-to-show', () => {
if (readyToShowWindowsIds.includes(window.id)) {
readyToShowWindowsIds = readyToShowWindowsIds.filter(value => value !== window.id);
} else {
readyToShowWindowsIds.push(window.id);
}
});
lastOptions = options;
window.on('closed', (sender) => {
for (let index = 0; index < windows.length; index++) {
const windowItem = windows[index];
try {
windowItem.id;
} catch (error) {
if (error.message === 'Object has been destroyed') {
windows.splice(index, 1);
const ids = [];
windows.forEach(x => ids.push(x.id));
electronSocket.emit('BrowserWindowClosed', ids);
}
}
}
});
app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (window === null && lastOptions) {
window = new BrowserWindow(lastOptions);
}
});
if (loadUrl) {
window.loadURL(loadUrl);
}
if (app.commandLine.hasSwitch('clear-cache') &&
app.commandLine.getSwitchValue('clear-cache')) {
window.webContents.session.clearCache();
console.log('auto clear-cache active for new window.');
}
// set main window url
if (app['mainWindowURL'] == undefined || app['mainWindowURL'] == "") {
app['mainWindowURL'] = loadUrl;
app['mainWindow'] = window;
}
windows.push(window);
electronSocket.emit('BrowserWindowCreated', window.id);
});
socket.on('browserWindowDestroy', (id) => {
getWindowById(id).destroy();
});
socket.on('browserWindowClose', (id) => {
getWindowById(id).close();
});
socket.on('browserWindowFocus', (id) => {
getWindowById(id).focus();
});
socket.on('browserWindowBlur', (id) => {
getWindowById(id).blur();
});
socket.on('browserWindowIsFocused', (id) => {
const isFocused = getWindowById(id).isFocused();
electronSocket.emit('browserWindow-isFocused-completed', isFocused);
});
socket.on('browserWindowIsDestroyed', (id) => {
const isDestroyed = getWindowById(id).isDestroyed();
electronSocket.emit('browserWindow-isDestroyed-completed', isDestroyed);
});
socket.on('browserWindowShow', (id) => {
getWindowById(id).show();
});
socket.on('browserWindowShowInactive', (id) => {
getWindowById(id).showInactive();
});
socket.on('browserWindowHide', (id) => {
getWindowById(id).hide();
});
socket.on('browserWindowIsVisible', (id) => {
const isVisible = getWindowById(id).isVisible();
electronSocket.emit('browserWindow-isVisible-completed', isVisible);
});
socket.on('browserWindowIsModal', (id) => {
const isModal = getWindowById(id).isModal();
electronSocket.emit('browserWindow-isModal-completed', isModal);
});
socket.on('browserWindowMaximize', (id) => {
getWindowById(id).maximize();
});
socket.on('browserWindowUnmaximize', (id) => {
getWindowById(id).unmaximize();
});
socket.on('browserWindowIsMaximized', (id) => {
const isMaximized = getWindowById(id).isMaximized();
electronSocket.emit('browserWindow-isMaximized-completed', isMaximized);
});
socket.on('browserWindowMinimize', (id) => {
getWindowById(id).minimize();
});
socket.on('browserWindowRestore', (id) => {
getWindowById(id).restore();
});
socket.on('browserWindowIsMinimized', (id) => {
const isMinimized = getWindowById(id).isMinimized();
electronSocket.emit('browserWindow-isMinimized-completed', isMinimized);
});
socket.on('browserWindowSetFullScreen', (id, fullscreen) => {
getWindowById(id).setFullScreen(fullscreen);
});
socket.on('browserWindowIsFullScreen', (id) => {
const isFullScreen = getWindowById(id).isFullScreen();
electronSocket.emit('browserWindow-isFullScreen-completed', isFullScreen);
});
socket.on('browserWindowSetAspectRatio', (id, aspectRatio, extraSize) => {
getWindowById(id).setAspectRatio(aspectRatio, extraSize);
});
socket.on('browserWindowPreviewFile', (id, path, displayname) => {
getWindowById(id).previewFile(path, displayname);
});
socket.on('browserWindowCloseFilePreview', (id) => {
getWindowById(id).closeFilePreview();
});
socket.on('browserWindowSetBounds', (id, bounds, animate) => {
getWindowById(id).setBounds(bounds, animate);
});
socket.on('browserWindowGetBounds', (id) => {
const rectangle = getWindowById(id).getBounds();
electronSocket.emit('browserWindow-getBounds-completed', rectangle);
});
socket.on('browserWindowSetContentBounds', (id, bounds, animate) => {
getWindowById(id).setContentBounds(bounds, animate);
});
socket.on('browserWindowGetContentBounds', (id) => {
const rectangle = getWindowById(id).getContentBounds();
electronSocket.emit('browserWindow-getContentBounds-completed', rectangle);
});
socket.on('browserWindowSetSize', (id, width, height, animate) => {
getWindowById(id).setSize(width, height, animate);
});
socket.on('browserWindowGetSize', (id) => {
const size = getWindowById(id).getSize();
electronSocket.emit('browserWindow-getSize-completed', size);
});
socket.on('browserWindowSetContentSize', (id, width, height, animate) => {
getWindowById(id).setContentSize(width, height, animate);
});
socket.on('browserWindowGetContentSize', (id) => {
const size = getWindowById(id).getContentSize();
electronSocket.emit('browserWindow-getContentSize-completed', size);
});
socket.on('browserWindowSetMinimumSize', (id, width, height) => {
getWindowById(id).setMinimumSize(width, height);
});
socket.on('browserWindowGetMinimumSize', (id) => {
const size = getWindowById(id).getMinimumSize();
electronSocket.emit('browserWindow-getMinimumSize-completed', size);
});
socket.on('browserWindowSetMaximumSize', (id, width, height) => {
getWindowById(id).setMaximumSize(width, height);
});
socket.on('browserWindowGetMaximumSize', (id) => {
const size = getWindowById(id).getMaximumSize();
electronSocket.emit('browserWindow-getMaximumSize-completed', size);
});
socket.on('browserWindowSetResizable', (id, resizable) => {
getWindowById(id).setResizable(resizable);
});
socket.on('browserWindowIsResizable', (id) => {
const resizable = getWindowById(id).isResizable();
electronSocket.emit('browserWindow-isResizable-completed', resizable);
});
socket.on('browserWindowSetMovable', (id, movable) => {
getWindowById(id).setMovable(movable);
});
socket.on('browserWindowIsMovable', (id) => {
const movable = getWindowById(id).isMovable();
electronSocket.emit('browserWindow-isMovable-completed', movable);
});
socket.on('browserWindowSetMinimizable', (id, minimizable) => {
getWindowById(id).setMinimizable(minimizable);
});
socket.on('browserWindowIsMinimizable', (id) => {
const minimizable = getWindowById(id).isMinimizable();
electronSocket.emit('browserWindow-isMinimizable-completed', minimizable);
});
socket.on('browserWindowSetMaximizable', (id, maximizable) => {
getWindowById(id).setMaximizable(maximizable);
});
socket.on('browserWindowIsMaximizable', (id) => {
const maximizable = getWindowById(id).isMaximizable();
electronSocket.emit('browserWindow-isMaximizable-completed', maximizable);
});
socket.on('browserWindowSetFullScreenable', (id, fullscreenable) => {
getWindowById(id).setFullScreenable(fullscreenable);
});
socket.on('browserWindowIsFullScreenable', (id) => {
const fullscreenable = getWindowById(id).isFullScreenable();
electronSocket.emit('browserWindow-isFullScreenable-completed', fullscreenable);
});
socket.on('browserWindowSetClosable', (id, closable) => {
getWindowById(id).setClosable(closable);
});
socket.on('browserWindowIsClosable', (id) => {
const closable = getWindowById(id).isClosable();
electronSocket.emit('browserWindow-isClosable-completed', closable);
});
socket.on('browserWindowSetAlwaysOnTop', (id, flag, level, relativeLevel) => {
getWindowById(id).setAlwaysOnTop(flag, level, relativeLevel);
});
socket.on('browserWindowIsAlwaysOnTop', (id) => {
const isAlwaysOnTop = getWindowById(id).isAlwaysOnTop();
electronSocket.emit('browserWindow-isAlwaysOnTop-completed', isAlwaysOnTop);
});
socket.on('browserWindowCenter', (id) => {
getWindowById(id).center();
});
socket.on('browserWindowSetPosition', (id, x, y, animate) => {
getWindowById(id).setPosition(x, y, animate);
});
socket.on('browserWindowGetPosition', (id) => {
const position = getWindowById(id).getPosition();
electronSocket.emit('browserWindow-getPosition-completed', position);
});
socket.on('browserWindowSetTitle', (id, title) => {
getWindowById(id).setTitle(title);
});
socket.on('browserWindowGetTitle', (id) => {
const title = getWindowById(id).getTitle();
electronSocket.emit('browserWindow-getTitle-completed', title);
});
socket.on('browserWindowSetTitle', (id, title) => {
getWindowById(id).setTitle(title);
});
socket.on('browserWindowSetSheetOffset', (id, offsetY, offsetX) => {
if (offsetX) {
getWindowById(id).setSheetOffset(offsetY, offsetX);
} else {
getWindowById(id).setSheetOffset(offsetY);
}
});
socket.on('browserWindowFlashFrame', (id, flag) => {
getWindowById(id).flashFrame(flag);
});
socket.on('browserWindowSetSkipTaskbar', (id, skip) => {
getWindowById(id).setSkipTaskbar(skip);
});
socket.on('browserWindowSetKiosk', (id, flag) => {
getWindowById(id).setKiosk(flag);
});
socket.on('browserWindowIsKiosk', (id) => {
const isKiosk = getWindowById(id).isKiosk();
electronSocket.emit('browserWindow-isKiosk-completed', isKiosk);
});
socket.on('browserWindowGetNativeWindowHandle', (id) => {
const nativeWindowHandle = getWindowById(id).getNativeWindowHandle().readInt32LE(0).toString(16);
electronSocket.emit('browserWindow-getNativeWindowHandle-completed', nativeWindowHandle);
});
socket.on('browserWindowSetRepresentedFilename', (id, filename) => {
getWindowById(id).setRepresentedFilename(filename);
});
socket.on('browserWindowGetRepresentedFilename', (id) => {
const pathname = getWindowById(id).getRepresentedFilename();
electronSocket.emit('browserWindow-getRepresentedFilename-completed', pathname);
});
socket.on('browserWindowSetDocumentEdited', (id, edited) => {
getWindowById(id).setDocumentEdited(edited);
});
socket.on('browserWindowIsDocumentEdited', (id) => {
const edited = getWindowById(id).isDocumentEdited();
electronSocket.emit('browserWindow-isDocumentEdited-completed', edited);
});
socket.on('browserWindowFocusOnWebView', (id) => {
getWindowById(id).focusOnWebView();
});
socket.on('browserWindowBlurWebView', (id) => {
getWindowById(id).blurWebView();
});
socket.on('browserWindowLoadURL', (id, url, options) => {
getWindowById(id).loadURL(url, options);
});
socket.on('browserWindowReload', (id) => {
getWindowById(id).reload();
});
socket.on('browserWindowSetMenu', (id, menuItems) => {
let menu = null;
if (menuItems) {
menu = Menu.buildFromTemplate(menuItems);
addMenuItemClickConnector(menu.items, (id) => {
electronSocket.emit('windowMenuItemClicked', id);
});
}
getWindowById(id).setMenu(menu);
});
socket.on('browserWindowRemoveMenu', (id) => {
getWindowById(id).removeMenu();
});
function addMenuItemClickConnector(menuItems, callback) {
menuItems.forEach((item) => {
if (item.submenu && item.submenu.items.length > 0) {
addMenuItemClickConnector(item.submenu.items, callback);
}
if ('id' in item && item.id) {
item.click = () => { callback(item.id); };
}
});
}
socket.on('browserWindowSetProgressBar', (id, progress) => {
getWindowById(id).setProgressBar(progress);
});
socket.on('browserWindowSetProgressBar', (id, progress, options) => {
getWindowById(id).setProgressBar(progress, options);
});
socket.on('browserWindowSetHasShadow', (id, hasShadow) => {
getWindowById(id).setHasShadow(hasShadow);
});
socket.on('browserWindowHasShadow', (id) => {
const hasShadow = getWindowById(id).hasShadow();
electronSocket.emit('browserWindow-hasShadow-completed', hasShadow);
});
socket.on('browserWindowSetThumbarButtons', (id, thumbarButtons: Electron.ThumbarButton[]) => {
thumbarButtons.forEach(thumbarButton => {
const imagePath = path.join(__dirname.replace('api', ''), 'bin', thumbarButton.icon.toString());
thumbarButton.icon = nativeImage.createFromPath(imagePath);
thumbarButton.click = () => {
electronSocket.emit('thumbarButtonClicked', thumbarButton['id']);
};
});
const success = getWindowById(id).setThumbarButtons(thumbarButtons);
electronSocket.emit('browserWindowSetThumbarButtons-completed', success);
});
socket.on('browserWindowSetThumbnailClip', (id, rectangle) => {
getWindowById(id).setThumbnailClip(rectangle);
});
socket.on('browserWindowSetThumbnailToolTip', (id, toolTip) => {
getWindowById(id).setThumbnailToolTip(toolTip);
});
socket.on('browserWindowSetAppDetails', (id, options) => {
getWindowById(id).setAppDetails(options);
});
socket.on('browserWindowShowDefinitionForSelection', (id) => {
getWindowById(id).showDefinitionForSelection();
});
socket.on('browserWindowSetAutoHideMenuBar', (id, hide) => {
getWindowById(id).setAutoHideMenuBar(hide);
});
socket.on('browserWindowIsMenuBarAutoHide', (id) => {
const isMenuBarAutoHide = getWindowById(id).isMenuBarAutoHide();
electronSocket.emit('browserWindow-isMenuBarAutoHide-completed', isMenuBarAutoHide);
});
socket.on('browserWindowSetMenuBarVisibility', (id, visible) => {
getWindowById(id).setMenuBarVisibility(visible);
});
socket.on('browserWindowIsMenuBarVisible', (id) => {
const isMenuBarVisible = getWindowById(id).isMenuBarVisible();
electronSocket.emit('browserWindow-isMenuBarVisible-completed', isMenuBarVisible);
});
socket.on('browserWindowSetVisibleOnAllWorkspaces', (id, visible) => {
getWindowById(id).setVisibleOnAllWorkspaces(visible);
});
socket.on('browserWindowIsVisibleOnAllWorkspaces', (id) => {
const isVisibleOnAllWorkspaces = getWindowById(id).isVisibleOnAllWorkspaces();
electronSocket.emit('browserWindow-isVisibleOnAllWorkspaces-completed', isVisibleOnAllWorkspaces);
});
socket.on('browserWindowSetIgnoreMouseEvents', (id, ignore) => {
getWindowById(id).setIgnoreMouseEvents(ignore);
});
socket.on('browserWindowSetContentProtection', (id, enable) => {
getWindowById(id).setContentProtection(enable);
});
socket.on('browserWindowSetFocusable', (id, focusable) => {
getWindowById(id).setFocusable(focusable);
});
socket.on('browserWindowSetParentWindow', (id, parent) => {
const browserWindow = BrowserWindow.fromId(parent.id);
getWindowById(id).setParentWindow(browserWindow);
});
socket.on('browserWindowGetParentWindow', (id) => {
const browserWindow = getWindowById(id).getParentWindow();
electronSocket.emit('browserWindow-getParentWindow-completed', browserWindow.id);
});
socket.on('browserWindowGetChildWindows', (id) => {
const browserWindows = getWindowById(id).getChildWindows();
const ids = [];
browserWindows.forEach(x => {
ids.push(x.id);
});
electronSocket.emit('browserWindow-getChildWindows-completed', ids);
});
socket.on('browserWindowSetAutoHideCursor', (id, autoHide) => {
getWindowById(id).setAutoHideCursor(autoHide);
});
socket.on('browserWindowSetVibrancy', (id, type) => {
getWindowById(id).setVibrancy(type);
});
socket.on('browserWindowAddExtension', (path) => {
const extensionName = BrowserWindow.addExtension(path);
electronSocket.emit('browserWindow-addExtension-completed', extensionName);
});
socket.on('browserWindowRemoveExtension', (name) => {
BrowserWindow.removeExtension(name);
});
socket.on('browserWindowGetExtensions', () => {
const extensionsList = BrowserWindow.getExtensions();
const chromeExtensionInfo = [];
Object.keys(extensionsList).forEach(key => {
chromeExtensionInfo.push(extensionsList[key]);
});
electronSocket.emit('browserWindow-getExtensions-completed', chromeExtensionInfo);
});
socket.on('browserWindow-setBrowserView', (id, browserViewId) => {
getWindowById(id).setBrowserView(browserViewMediateService(browserViewId));
});
function getWindowById(id: number): Electron.BrowserWindow {
for (let index = 0; index < windows.length; index++) {
const element = windows[index];
if (element.id === id) {
return element;
}
}
}
};

View File

@@ -1 +0,0 @@
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["clipboard.ts"],"names":[],"mappings":";AAAA,uCAAkD;AAClD,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE;QACrC,MAAM,IAAI,GAAG,oBAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtC,cAAc,CAAC,IAAI,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QAC5C,oBAAS,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,oBAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzC,cAAc,CAAC,IAAI,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;QAC9C,oBAAS,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,IAAI,EAAE,EAAE;QACpC,MAAM,OAAO,GAAG,oBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACxC,cAAc,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QAC3C,oBAAS,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACrC,MAAM,QAAQ,GAAG,oBAAS,CAAC,YAAY,EAAE,CAAC;QAC1C,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,QAAQ,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACtD,oBAAS,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACrC,MAAM,OAAO,GAAG,oBAAS,CAAC,YAAY,EAAE,CAAC;QACzC,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,IAAI,EAAE,EAAE;QAC1C,oBAAS,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE;QAClC,oBAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,CAAC,IAAI,EAAE,EAAE;QAC7C,MAAM,OAAO,GAAG,oBAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACjD,cAAc,CAAC,IAAI,CAAC,sCAAsC,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QACxC,oBAAS,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,IAAI,EAAE,EAAE;QACtC,MAAM,KAAK,GAAG,oBAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACxC,cAAc,CAAC,IAAI,CAAC,+BAA+B,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAClG,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,sBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QAC7C,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,KAAK,GAAG,sBAAW,CAAC,WAAW,EAAE,CAAC;QAExC,kCAAkC;QAClC,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE;YAC3B,MAAM,WAAW,GAAG,GAAG,CAAC;YACxB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YACxB,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YAC5C,KAAK,CAAC,iBAAiB,CAAC,EAAE,WAAW,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;SAC1E;QAED,oBAAS,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}

View File

@@ -1 +0,0 @@
{"version":3,"file":"commandLine.js","sourceRoot":"","sources":["commandLine.ts"],"names":[],"mappings":";AAAA,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,GAAiB,EAAE,EAAE;IACpD,cAAc,GAAG,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,CAAC,UAAkB,EAAE,KAAa,EAAE,EAAE;QAC1E,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,CAAC,KAAa,EAAE,EAAE;QACxD,GAAG,CAAC,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,KAAa,EAAE,EAAE;QACnD,MAAM,SAAS,GAAG,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACnD,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,SAAS,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,CAAC,UAAkB,EAAE,EAAE;QAC7D,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QACzD,cAAc,CAAC,IAAI,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}

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