Compare commits

...

521 Commits

Author SHA1 Message Date
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
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
Robert Muehsig
876bb98d92 11.5.1 2021-01-21 23:55:24 +01:00
Gregor Biswanger
427b57a002 Update Changelog 2021-01-21 22:06:08 +01:00
Gregor Biswanger
cc0b15c61e Merge pull request #528 from stackify/issue/527
Issue/527
2021-01-21 21:45:15 +01:00
Dan
8a0276daf9 Add ability to enable remote module in browser
The jump from Election 9x to 11x changed the default setting.  This exposes it so that user can re-enable it if needed.
2021-01-20 11:49:50 -06:00
Dan
e94196504e Support subscribing to unmapped events on App and Tray modules
`Electron.App.On("eventName", () => {});` or `Electron.App.On("eventName", obj => {});`

fix #527
2021-01-18 19:52:58 -06:00
Dan
6076c727d1 By blow fix of documentation
fix #500
2021-01-18 19:52:58 -06:00
Dan
300dc49dde Update the buildAll.sh so that you can run it successfully on a Mac 2021-01-18 19:52:58 -06:00
Dan
ce0f3fd61e Dock Menu support
fix #527
2021-01-18 19:52:58 -06:00
Dan
12f5eae65c Expose Electron members to the service provider
Used for class composition with IServiceProvider
2021-01-18 13:09:10 -06:00
Dan
3ef44cf878 Merge remote-tracking branch 'ElectronNET/master' 2021-01-18 10:30:57 -06:00
Gregor Biswanger
41fa8e9e74 Update WebApp to Electron 11.1.1 - Fix Chrome breaking changes with link ref=imports 2021-01-12 03:12:01 +01:00
Gregor Biswanger
49e21de465 Merge pull request #486 from stackify/bug/442
442: maintain references between socket.io connection events
2021-01-11 23:27:51 +01:00
Dan Gidman
d2f6308dd2 Merge remote-tracking branch 'upstream/master' into bug/442 2021-01-11 15:50:28 -06:00
Gregor Biswanger
f06b95803f Update to native Electron 11.1.1 - Fix breaking changes and refactoring. 2021-01-11 01:56:39 +01:00
Gregor Biswanger
b9feff3436 Merge pull request #522 from ElectronNET/dependabot/npm_and_yarn/ElectronNET.Host/ini-1.3.7
Bump ini from 1.3.5 to 1.3.7 in /ElectronNET.Host
2021-01-11 00:12:49 +01:00
Gregor Biswanger
335489d2d9 Merge pull request #509 from scottkuhl/issues/491-upgrade-to-net-5
Upgrade to .NET 5
2021-01-11 00:10:09 +01:00
Gregor Biswanger
6fe0c6f085 Merge pull request #506 from nathanwienand/add-publish-single-file
Added new build and start commandline options for single exe
2021-01-11 00:07:53 +01:00
Gregor Biswanger
f82d185865 Merge pull request #505 from aarong-av/aarong-av/donfigurable-default-port
Adding a configurable default electron port.
2021-01-11 00:05:14 +01:00
Gregor Biswanger
550e2c2625 Merge pull request #487 from ElectronNET/dependabot/npm_and_yarn/ElectronNET.Host/electron-9.3.1
Bump electron from 9.2.0 to 9.3.1 in /ElectronNET.Host
2021-01-11 00:03:05 +01:00
Gregor Biswanger
61f54ebd55 Merge pull request #480 from ElectronNET/dependabot/npm_and_yarn/ElectronNET.WebApp/ElectronHostHook/bl-4.0.3
Bump bl from 4.0.2 to 4.0.3 in /ElectronNET.WebApp/ElectronHostHook
2021-01-10 23:56:54 +01:00
Gregor Biswanger
c8c818a77a Merge pull request #478 from dlitty/master
Added support for launching the application with a file on MacOS
2021-01-10 23:55:20 +01:00
Gregor Biswanger
fc590f55d8 Merge pull request #474 from freosc/PullRequest
Avoid Blocking Calls in App and AutoUpdater
2021-01-10 23:50:48 +01:00
dependabot[bot]
5fbe01df30 Bump ini from 1.3.5 to 1.3.7 in /ElectronNET.Host
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.7.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.7)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-11 17:11:37 +00:00
Scott Kuhl
dbf4d0f720 Upgraded NuGet packages to the latest versions:
- Microsoft.SourceLink.GitHub 1.0.0-beta2-19367-01 > 1.0.0
- System.Drawing.Common 4.7.0 > 5.0.0
- Microsoft.VisualStudio.Web.CodeGeneration.Design 3.0.0 > 5.0.0
2020-11-21 16:24:24 -06:00
Scott Kuhl
f996b3023e Updated TypeScript from 3.8 to 4.0. 2020-11-21 16:13:49 -06:00
Scott Kuhl
7f62e7299b Updated .NET Core 3.1 to .NET 5.0. 2020-11-21 16:13:06 -06:00
Aaron Gilliland
b803e42a73 Minor fix due to a copy paste issue. 2020-11-14 19:15:54 -06:00
Nathan Wienand
da1838db60 adding new build and start commandline options for single exe 2020-11-12 11:15:37 +00:00
Aaron Gilliland
8af1f50b88 Adding a configurable default electron port. Our environment does not allow for random port assignment. Port 8000 is not an option for our environment. 2020-11-11 07:48:42 -06:00
dependabot[bot]
c4f2188c62 Bump electron from 9.2.0 to 9.3.1 in /ElectronNET.Host
Bumps [electron](https://github.com/electron/electron) from 9.2.0 to 9.3.1.
- [Release notes](https://github.com/electron/electron/releases)
- [Changelog](https://github.com/electron/electron/blob/master/docs/breaking-changes.md)
- [Commits](https://github.com/electron/electron/compare/v9.2.0...v9.3.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-06 18:02:00 +00:00
Dan Gidman
e73655bd68 442: maintain references between socket.io connection events
https://github.com/ElectronNET/Electron.NET/issues/442

remove deletes of modules during disconnect
add delete of hostHook during disconnect
check if modules exist before importing them curring connect
move local caches of modules into global scope.
2020-10-06 11:29:53 -05:00
dependabot[bot]
758424d3ce Bump bl from 4.0.2 to 4.0.3 in /ElectronNET.WebApp/ElectronHostHook
Bumps [bl](https://github.com/rvagg/bl) from 4.0.2 to 4.0.3.
- [Release notes](https://github.com/rvagg/bl/releases)
- [Commits](https://github.com/rvagg/bl/compare/v4.0.2...v4.0.3)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-02 17:53:24 +00:00
Dan Litty
7518acb3c2 Added support for launching the application with a file on MacOS by listening for the open-file and open-url events from the operating system, and forwarding them to the Electron.NET app when listeners are added 2020-08-31 16:47:05 -04:00
Fre
5522addc0b PR 2020-08-21 12:35:31 +02:00
Fre
7f204c2a42 PR 2020-08-21 12:32:33 +02:00
Fre
de13f49bb6 PR 2020-08-21 12:27:31 +02:00
Fre
bca37228d9 del asynchelper 2020-08-21 12:22:28 +02:00
Fre
e17a36f7cb small changes 2020-08-21 12:13:38 +02:00
Fre
deccebb582 Merge branch 'master' into freosc
# Conflicts:
#	ElectronNET.Host/main.js
2020-08-21 11:13:06 +02:00
Fre
776ccc21e8 Merge remote-tracking branch 'upstream/master' 2020-08-21 10:36:24 +02:00
Fre
d0c92cac85 avoid memory leak when re-adding the eventlisteners 2020-08-21 10:32:02 +02:00
Gregor Biswanger
b525bf1a9a Update Changelog for 9.31.3 - Update to the native Electron 9.2.0 support 2020-08-14 13:25:27 +02:00
Gregor Biswanger
6337cac588 Merge pull request #468 from duncanawoods/fix_bad_fontsize_if_position_is_set
set default WebPreferences.DefaultFontSize
2020-08-14 12:55:17 +02:00
Gregor Biswanger
5d4509babe Merge pull request #467 from duncanawoods/fix_ERR_UNKNOWN_URL_SCHEME
fix ERR_UNKNOWN_URL_SCHEME by intercepting file:// protocol
2020-08-14 12:51:56 +02:00
Gregor Biswanger
3eef85cddf Merge pull request #465 from duncanawoods/buildsh_linux_errors
buildAll.sh linux errors
2020-08-14 12:48:40 +02:00
Gregor Biswanger
3f582d6c4e Merge pull request #457 from kojo12228/add-fsharp-support
Search for .csproj and .fsproj in init and add commands
2020-08-14 12:44:45 +02:00
Gregor Biswanger
18c5a65d6d Merge pull request #453 from ElectronNET/dependabot/npm_and_yarn/ElectronNET.WebApp/ElectronHostHook/lodash-4.17.19
Bump lodash from 4.17.15 to 4.17.19 in /ElectronNET.WebApp/ElectronHostHook
2020-08-14 12:42:02 +02:00
Gregor Biswanger
f8bbb138d8 Merge pull request #450 from ElectronNET/dependabot/npm_and_yarn/ElectronNET.Host/lodash-4.17.19
Bump lodash from 4.17.15 to 4.17.19 in /ElectronNET.Host
2020-08-14 12:41:50 +02:00
Gregor Biswanger
7880d56e4c Merge pull request #445 from rbaker26/master
Update Documentation in the README.md
2020-08-14 12:41:06 +02:00
Gregor Biswanger
c16a888699 Merge pull request #463 from code-lever/master
Add target command line option found in 'build' to 'start' in CLI to …
2020-08-14 12:37:49 +02:00
Gregor Biswanger
814e046d5c Merge pull request #433 from BurtsevC/master
description added to package.json
2020-08-14 12:31:27 +02:00
duncan
d2457203bc Add build electron host to buildAll.sh 2020-08-14 10:19:11 +01:00
duncan
a70304948a set default WebPreferences.DefaultFontSize to fix tiny text when possition is set 2020-08-13 22:54:45 +01:00
duncan
a49b2ce278 fix ERR_UNKNOWN_URL_SCHEME by intercepting file:// protocol
fix whitespace

Revert "fix whitespace"

This reverts commit 608e364ebbabb19ffd6c3e3e0f357251c2e8e348.

fix whitespace
2020-08-13 20:46:10 +01:00
duncan
1577146187 buildall.sh disable win/osx builds on linux 2020-08-13 13:18:49 +01:00
duncan
d61f20dd67 buildall.sh restore original paths using pushd/pops 2020-08-13 13:15:47 +01:00
Gabe Cook
f7217b417f Add target command line option found in 'build' to 'start' in CLI to support custom targets in development. 2020-08-07 10:09:27 -05:00
Fre
e136ed4127 Merge branch 'master' of https://github.com/freosc/Electron.NET into freosc 2020-08-03 08:50:02 +02:00
Kojo Amoasi
7489543c75 search for .csproj and .fsproj in init and add 2020-07-22 13:42:00 +01:00
dependabot[bot]
cbf3032617 Bump lodash in /ElectronNET.WebApp/ElectronHostHook
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-20 23:26:19 +00:00
dependabot[bot]
68c54b9917 Bump lodash from 4.17.15 to 4.17.19 in /ElectronNET.Host
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-17 20:44:42 +00:00
Robert Muehsig
26d10fca38 9.31.2 2020-07-08 12:56:51 +02:00
Gregor Biswanger
bd15587079 Update to Electron 9.0.5 2020-07-08 12:56:50 +02:00
Gregor Biswanger
42613f5b56 Rollback to socket.io 2.2.0 2020-07-08 12:56:49 +02:00
Gregor Biswanger
62117df108 Update Changelog 2020-07-08 12:56:49 +02:00
Fre V
f68ea25cba Merge pull request #4 from ElectronNET/master
nieuwe versie
2020-07-08 11:25:37 +02:00
Fre
4e9de2abfa Aanpassingen autoupdate & async code 2020-07-08 11:16:00 +02:00
Bob Baker
a08d274dc1 Update README.md 2020-07-06 12:02:42 -07:00
Robert Muehsig
3dea16798b 9.31.2 2020-07-06 19:00:17 +02:00
Gregor Biswanger
bf8c7c8fa1 Update to Electron 9.0.5 2020-07-06 18:37:31 +02:00
Gregor Biswanger
06724f6eae Rollback to socket.io 2.2.0 2020-07-06 18:24:23 +02:00
Gregor Biswanger
83e579d44b Merge branch 'master' of https://github.com/ElectronNET/Electron.NET 2020-07-06 18:19:08 +02:00
Gregor Biswanger
ed67aa8072 Update Changelog 2020-07-06 18:19:02 +02:00
Fre V
f1ceaa208e Merge pull request #3 from ElectronNET/master
903
2020-07-06 15:59:12 +02:00
Gregor Biswanger
5e005499ef Merge pull request #435 from writzx/master
Enabled empty tray icon
2020-07-05 00:26:51 +02:00
Gregor Biswanger
975e4020dc Merge pull request #443 from rbaker26/master
Bug Fix, Fixed Publishing Issue ("Unknown argument: .")
2020-07-05 00:24:21 +02:00
Bob Baker
15ce35a7d9 removed extra . cause build failures 2020-07-03 23:19:19 -07:00
Writwick Das
de1637672a enabled empty tray icon
(fixes click event on macos)
2020-06-15 17:01:31 +02:00
BurtsevC
6b75f63135 description added to package.json 2020-06-13 15:53:52 +03:00
Robert Muehsig
8f92d3986f 9.31.1 2020-06-12 23:27:53 +02:00
Gregor Biswanger
ca7414b8e6 Merge pull request #430 from freosc/master
HostHook.CallAsync should use TaskCompletionSource.SetException instead of throwing exception
2020-06-12 15:54:58 +02:00
Fre
37ae869dcb HostHook CallAsync 2020-06-12 13:32:26 +02:00
Gregor Biswanger
3420ee2de4 Update to Electron 9.0.3 build - Update Changelog for Electron.NET 9.31.1 2020-06-11 23:39:08 +02:00
Gregor Biswanger
0a76e951eb Merge branch 'master' of https://github.com/ElectronNET/Electron.NET 2020-06-11 23:14:13 +02:00
Gregor Biswanger
4db316eb15 Update to Electron 9.0.3 - Update Changelog 2020-06-11 23:14:02 +02:00
Gregor Biswanger
a867f23220 Merge pull request #429 from kdlslyv/master
Add BrowserWindow.GetNativeWindowHandle()
2020-06-11 23:10:16 +02:00
kdl
490440c23a Add BrowserWindow.GetNativeWindowHandle() 2020-06-11 22:45:18 +02:00
Fre V
519fb53c00 Merge pull request #2 from ElectronNET/master
merge with original
2020-06-08 09:20:41 +02:00
Fre V
12388541ab Merge pull request #1 from freosc/CookieHandling
Implementation for electronjs cookie handling
2020-06-08 09:09:14 +02:00
Gregor Biswanger
8c8115f3bd Update for Electron.NET 9.31.1 2020-06-03 00:26:10 +02:00
Gregor Biswanger
4286bc4f45 Update for Electron.NET 9.31.1 2020-06-03 00:24:07 +02:00
Gregor Biswanger
886f839482 Update for Electron.9.31.1 2020-06-03 00:20:21 +02:00
Gregor Biswanger
96abbd161c Merge branch 'master' of https://github.com/ElectronNET/Electron.NET 2020-06-03 00:14:01 +02:00
Gregor Biswanger
9baf1528ac Update for Electron.NET 9.31.1 2020-06-03 00:13:56 +02:00
Gregor Biswanger
380441c2c8 Merge pull request #425 from konstantingross/feature/Fix_Dock_API
Fix Dock API/ Electron 9.0.1 Update / ...
2020-06-02 23:47:12 +02:00
Konstantin Gross
a66375e37c Fix cannot find modules in ElectronHostHook 2020-06-02 23:41:19 +02:00
Konstantin Gross
606d00de5a Improvement debugging and testing new api calls (without install cli) 2020-06-02 23:40:21 +02:00
Konstantin Gross
b3266cd93f Electron 9.0.1 Update 2020-06-02 23:33:54 +02:00
Konstantin Gross
cb36e34dc3 Fix deployment dock.js 2020-06-02 23:33:14 +02:00
Gregor Biswanger
db7a5ff868 Merge branch 'master' of https://github.com/ElectronNET/Electron.NET 2020-06-02 22:04:40 +02:00
Gregor Biswanger
a030e3cbe7 update Electron.NET 9.31.1 2020-06-02 22:04:35 +02:00
Gregor Biswanger
b98c570b9d Merge pull request #423 from gustavo-lara-molina/powerMonitor
Power monitor - adding missing events
2020-06-02 22:04:03 +02:00
Gregor Biswanger
d106c6b193 Merge pull request #422 from konstantingross/feature/App_API_Enhancements
App API enhancements
2020-06-02 21:58:58 +02:00
Gustavo Lara Molina
c95bbe7ab2 Merge remote-tracking branch 'origin/master' into powerMonitor 2020-06-02 09:42:06 -05:00
Gustavo Lara Molina
258710bc52 removing PM methods with issues for this versión 2020-06-02 09:31:15 -05:00
Konstantin Gross
9ddb1b195e Removed dock methods from app API and moved to dock API 2020-06-01 01:59:40 +02:00
Konstantin Gross
eee84d214e App API:
* Summaries rewritten
* Added new parameters / Removed not supported parameters
* Added some new methods like appFocus(options), appHasSingleLock, etc.
2020-05-31 03:09:54 +02:00
Gregor Biswanger
1ab48350e1 Merge branch 'master' of https://github.com/ElectronNET/Electron.NET 2020-05-27 22:26:57 +02:00
Gregor Biswanger
874bc8eb94 Update for Electron.NET 9.31.1 2020-05-27 22:26:53 +02:00
Gregor Biswanger
7aa2268a81 Merge pull request #418 from konstantingross/master
Shell API adapted to Electron 9.0.0
2020-05-27 22:26:17 +02:00
Konstantin Gross
b08222bddc Updated NuGet Package version 2020-05-27 11:32:12 +02:00
Konstantin Gross
c5c822a028 Update Shell.cs 2020-05-27 01:06:31 +02:00
Konstantin Gross
ce4ef03636 Update ShortcutLinkOperation.cs 2020-05-27 01:04:28 +02:00
Konstantin Gross
641864b946 * Shell.OpenPath API fix for Electron 9.0.0
* Shell.OpenExternal API fix for Electron 9.0.0
* Shell.MoveItemToTrash API fix for Electron 9.0.0 and added new macOS parameter
* Shell.ReadShortcutLink API fix for Electron 9.0.0
* Summaries have been rewritten
2020-05-27 00:51:48 +02:00
Konstantin Gross
c6d67a9145 Log disconnect reason 2020-05-27 00:43:28 +02:00
Gregor Biswanger
fabd25a89e Merge branch 'master' of https://github.com/ElectronNET/Electron.NET 2020-05-26 22:03:30 +02:00
Gregor Biswanger
029b077602 manage the configuration environment with the electron.manifest.json 2020-05-26 22:03:05 +02:00
Konstantin Gross
0329530815 Shell.ShowItemInFolder API fix for Electron 9.0.0 2020-05-26 15:11:22 +02:00
Konstantin Gross
58ab180c94 Missing semicolon 2020-05-26 15:09:47 +02:00
Gregor Biswanger
a03dc1d195 Merge pull request #417 from konstantingross/master
Shell.OpenItem API fix for Electron 9.0.0
2020-05-25 21:43:06 +02:00
Konstantin Gross
76dcdc4137 Shell.OpenItem API fix for Electron 9.0.0 2020-05-25 17:31:27 +02:00
Gregor Biswanger
2b415e5b59 Merge branch 'master' of https://github.com/ElectronNET/Electron.NET 2020-05-25 14:53:41 +02:00
Gregor Biswanger
94055b985f Update for 9.31.1 2020-05-25 14:53:36 +02:00
Gregor Biswanger
596aa68c70 Merge pull request #416 from konstantingross/master
Add missing API call for SetProgressBar options
2020-05-25 14:50:51 +02:00
Konstantin Gross
485bce08d7 Add missing API call for SetProgressBar options 2020-05-25 11:24:29 +02:00
Gregor Biswanger
2ba49dbd6a Update for 9.31.1 2020-05-24 22:03:04 +02:00
Gregor Biswanger
39c3e92128 implement lazy App.Ready event 2020-05-24 22:00:32 +02:00
Gregor Biswanger
c552a04347 add App.Ready event 2020-05-24 18:50:35 +02:00
Gregor Biswanger
1541553ed1 Merge pull request #415 from konstantingross/feature/New_host_IsReady_property
New App.IsReady property
2020-05-24 13:34:51 +02:00
Konstantin Gross
52b850092c Context menu example modified 2020-05-24 02:52:27 +02:00
Konstantin Gross
cac9cfcec8 Add lifetime hosted service to detect fully started ASP.NET Core 2020-05-24 02:51:34 +02:00
Konstantin Gross
4ad39ba4c1 Removed double slash in args 2020-05-24 02:43:36 +02:00
Gregor Biswanger
95acbd5dea Update to the native Electron 9.0.0 - Update electron-updater 4.3.1 - Update Changelog 2020-05-23 12:17:53 +02:00
Gregor Biswanger
95f9a59431 Merge pull request #413 from freosc/CookieHandling
Implementation for electronjs cookie handling
2020-05-23 11:49:59 +02:00
Frederik Vermeersch
d409c3a0f9 Implementation for electronjs cookie handling 2020-05-22 16:38:34 +02:00
Gregor Biswanger
6d0fbde5ad set contectmenu on correct lifetime.. 2020-05-22 00:18:59 +02:00
Gregor Biswanger
b113532a86 update 8.31.3 infos 2020-05-21 23:04:55 +02:00
Gregor Biswanger
b043688f7f add workaround for #412 - update to socket.io 2.3.0 2020-05-21 22:58:17 +02:00
Gregor Biswanger
3b3e38f1bf update 8.31.3 infos 2020-05-21 22:41:27 +02:00
Gregor Biswanger
9502eb787a Fixed bug - #411 2020-05-21 22:39:52 +02:00
Gregor Biswanger
4a9b6fa9c1 Merge pull request #409 from konstantingross/feature/Add_missing_config_parameter_#407
Add missing config parameter fixes #407
2020-05-21 20:40:28 +02:00
Gregor Biswanger
fb308ed1c6 Merge pull request #410 from konstantingross/feature/NotificationOptions_fixes_#408
Added missing properties in Notifications
2020-05-21 13:29:43 +02:00
Konstantin Gross
d51a481e50 Added three missing propertys and fixing typos 2020-05-21 01:32:38 +02:00
Konstantin Gross
bb3d073fae Custom user path removed and replaced by the correct directory with VS macro 2020-05-20 19:02:15 +02:00
Konstantin Gross
8c250ae83e Add ConfigurationProfile paramter to electronize start command 2020-05-20 18:59:38 +02:00
Konstantin Gross
a5543bfe60 Typo in summary 2020-05-20 18:58:31 +02:00
Gregor Biswanger
c40affb32e Merge pull request #406 from Mandrakia/master
Added UserAgentFallback to App
2020-05-19 13:34:15 +02:00
Gregor Biswanger
e9331728b4 Merge branch 'master' into master 2020-05-19 13:34:04 +02:00
Gregor Biswanger
92b0388300 Merge pull request #405 from dafergu2/master
Update application exit logic
2020-05-19 13:19:47 +02:00
Gire Jean-Philippe
f4ea6df204 Added UserAgentFallback to App 2020-05-19 11:59:11 +02:00
Dave Ferguson
b027ca7c66 Exit net core backend on electron quit
This change explicitly cleans up the .net core http process when the
hosting electron application quits.  On macos, the child process was
sometimes left running depending on how the application was exited.

GH-346
2020-05-18 19:58:31 -04:00
Dave Ferguson
0573e92ed5 Fix logic of all windows closed event on macos
The application was not raising the all windows closed event which
didn't allow the .NET application to exit properly when the last window
was closed.

The recommendation by electronjs is to subscribe to the all windows
closed event and exit the app via code on macos.

This change allows the event to propagated up to the .NET application.

It may be better to move all of the logic surrounding this to the
ElectronNET.API project and allow the application developer full
control over the behavior.  For now, this fixes the immediate bug.

GH-346
2020-05-18 19:58:22 -04:00
Gregor Biswanger
672e3b86fd Merge pull request #402 from konstantingross/feature/Additional_NativeTheme_implementations
Remaining implementation of the NativeTheme API
2020-05-19 00:24:28 +02:00
Konstantin Gross
b7960eb772 PR fixes 2020-05-18 23:57:10 +02:00
Gustavo Lara
bbab114c54 Adding All PowerMonitor Methods, Fixing Comments 2020-05-18 16:14:03 -05:00
Konstantin Gross
e77f48b2c5 Fix formatting and summary 2020-05-18 21:01:47 +02:00
Gustavo Lara Molina
8fe60bfcda adding all powerMonitor api events 2020-05-17 22:16:31 -05:00
gustavo-lara-molina
09fa662ed1 Merge pull request #1 from ElectronNET/master
Updating fork
2020-05-17 20:44:15 -05:00
Konstantin Gross
7f2269c4bd Remaining implementation of the NativeTheme API: shouldUseHighContrastColors, shouldUseInvertedColorScheme, get/set themeSource and updated event 2020-05-17 02:54:01 +02:00
Gregor Biswanger
05de4071d1 Update 2020-05-15 00:18:38 +02:00
Gregor Biswanger
169abc2376 implement NativeTheme API with shouldUseDarkColors 2020-05-13 14:16:36 +02:00
Gregor Biswanger
12a3f2689e Update 8.31.3 2020-05-13 01:44:40 +02:00
Gregor Biswanger
14587463e7 add new powerMonitor API js file - fix formating 2020-05-13 01:41:09 +02:00
Gregor Biswanger
6690b4a76e Merge pull request #399 from gustavo-lara-molina/powerMonitor
Power monitor
2020-05-13 01:12:57 +02:00
Gustavo Lara Molina
c8e51ef21b Updating Comments 2020-05-12 10:50:08 -05:00
Gustavo Lara Molina
96a5189f14 Merge - from master 2020-05-12 10:11:04 -05:00
Gustavo Lara Molina
13fcedc3a0 Updating Labesl 2020-05-12 10:10:34 -05:00
Gustavo Lara Molina
c12c26b491 Merge branch 'master' of https://github.com/ElectronNET/Electron.NET 2020-05-12 09:12:22 -05:00
Robert Muehsig
6ddce85bdd 8.31.2 2020-05-12 01:00:31 +02:00
Gregor Biswanger
68ee626d07 Update Changelog for 8.31.2 2020-05-12 00:37:14 +02:00
Gregor Biswanger
fd5801ffdc Update Context Menu Item for tray app on-the-fly. #270 2020-05-12 00:21:18 +02:00
Rocket
df02855471 Added the API Power 2020-05-11 12:59:21 -05:00
Gregor Biswanger
b6417d0718 Implement new command: electronize build /target win /PublishReadyToRun false #395 - Add self contained app #387 2020-05-10 00:31:28 +02:00
Gregor Biswanger
6f1f7cbc5e Merge pull request #394 from shotr-io/master
Implement NativeImage support, fixes #14
2020-05-09 21:09:12 +02:00
Gregor Biswanger
aec0da6075 Update Changelog 📑 2020-05-07 21:58:32 +02:00
ThrDev
c9f0c43bc9 Remove using Clipboard 2020-05-06 19:17:25 -04:00
ThrDev
b87d7f9899 Add XML comments 2020-05-06 19:14:34 -04:00
ThrDev
fa51cdd72c Merge remote-tracking branch 'upstream/master' 2020-05-06 19:07:31 -04:00
ThrDev
9b270755d0 Add full NativeImage support for Electron.NET 2020-05-06 19:05:21 -04:00
Gregor Biswanger
c5db735773 update 2020-05-03 00:57:37 +02:00
Gregor Biswanger
88f5995f40 update 2020-05-03 00:54:30 +02:00
Gregor Biswanger
042cd7e6cb update 2020-05-03 00:50:04 +02:00
Gregor Biswanger
cb096212f9 Merge branch 'master' of https://github.com/ElectronNET/Electron.NET 2020-05-02 23:56:00 +02:00
Gregor Biswanger
0363dc8924 update 2020-05-02 23:55:56 +02:00
Robert Muehsig
8cf5053512 Update .travis.yml 2020-05-01 22:55:03 +02:00
Robert Muehsig
32046adfb5 Update README.md 2020-05-01 22:53:53 +02:00
Robert Muehsig
003a9d0d35 8.31.1 Release 2020-05-01 22:49:49 +02:00
Gregor Biswanger
db6bed43dc fix memory leak and remove package 2020-05-01 15:52:54 +02:00
Gregor Biswanger
80d160a71c Merge pull request #390 from syedadeel2/LiveReload
Live reload
2020-05-01 14:29:58 +02:00
Syed Adeel Hassan Rizvi
01d938fb1a Storing main window instance to reload later. 2020-05-01 22:12:28 +10:00
Syed Adeel Hassan Rizvi
00eb9869dc 1. Watch enabled successfully.
2. Reloading electron after build.
2020-05-01 17:29:56 +10:00
Syed Adeel Hassan Rizvi
2987e3143d commented out the code 2020-05-01 09:45:02 +10:00
Syed Adeel Hassan Rizvi
20ca72b794 my file deleted 2020-05-01 09:44:14 +10:00
Syed Adeel Hassan Rizvi
a0e0cc3bbc /watch arg added, main.js updated 2020-04-30 22:31:12 +10:00
ThrDev
e295558258 Fix MenusController.cs 2020-04-26 19:36:16 -04:00
ThrDev
e67f6c500b Merge remote-tracking branch 'upstream/master' 2020-04-26 19:29:39 -04:00
ThrDev
23015a9f3d Add System.Drawing.Common reference. 2020-04-26 19:26:45 -04:00
ThrDev
7daac2d04e Add NativeImage support, clipboard image read/write. 2020-04-26 19:21:29 -04:00
Gregor Biswanger
71955b9181 Fixed: Unable to disable WebSecurity along with NodeIntegration enabled #389 2020-04-24 00:59:38 +02:00
Gregor Biswanger
a619b6e5c9 Implemented BrowserView API #371 2020-04-23 03:29:52 +02:00
Gregor Biswanger
3ba3fa6414 Add new Electronize CLI command #273 2020-04-21 19:38:16 +02:00
Gregor Biswanger
11fbd6b259 Fixed: Using OnReadyToShow to display the main window in Blazor does not seem to work with Show set to false #361 2020-04-21 14:39:21 +02:00
Gregor Biswanger
073eb0e00d Fixed: GetLoginItemSettingsAsync does not work #352 2020-04-21 01:00:59 +02:00
Gregor Biswanger
c0bf257b55 Increase startup time #356 🚀 2020-04-19 15:19:24 +02:00
Gregor Biswanger
62b37d059f add to set author and name in electron.manifest.json #348 2020-04-19 01:22:27 +02:00
Gregor Biswanger
ca8f4c454c MenuRole bug fix and add printer support. 2020-04-18 17:17:05 +02:00
Gregor Biswanger
d660dff871 changed App.GetNameAsync and App.SetNameAsync to App.Name - Fixed the Splashscreen bug #357 #350 2020-04-18 17:15:58 +02:00
Gregor Biswanger
c17720a4d7 Merge pull request #355 from x-xx-o/print
added print capability
2020-04-18 17:06:23 +02:00
Gregor Biswanger
274552f52b Merge pull request #369 from jjuback/master
Start MenuRole enum at 1.
2020-04-18 17:03:20 +02:00
Gregor Biswanger
1e3fe6183c update npm packages to newest version of electron, electron-updater, tslint and typescript 2020-04-18 15:09:44 +02:00
John Juback
88b04377a7 Merge branch 'master' of https://github.com/ElectronNET/Electron.NET 2020-02-07 15:00:17 -05:00
John Juback
92356d3587 Start MenuRole enum at 1. 2020-02-07 14:38:33 -05:00
Niko
a3c452eea5 add print capability 2019-12-15 09:56:14 +01:00
Gregor Biswanger
68288d9d73 Update Changelog.md 2019-12-03 11:45:50 +01:00
Robert Muehsig
022221307c Merge pull request #331 from ElectronNET/bug/318-rename-clitool
This should fix #318
2019-12-01 23:52:11 +01:00
Robert Muehsig
ffc6353bf2 Merge branch 'master' into bug/318-rename-clitool 2019-12-01 22:49:46 +01:00
Gregor Biswanger
f4d8144a8b update changelog with the new release 7.30.2 2019-12-01 01:17:00 +01:00
Gregor Biswanger
30d49ff6e8 Support for different manifest files (#340) 2019-11-30 23:30:15 +01:00
Gregor Biswanger
db9d3b1484 activate Electron 7.1.2 build 2019-11-30 02:48:23 +01:00
Gregor Biswanger
a788d71530 Implemented Electrons CommandLine-API, Implemented arguments support, Implemented different manifest file support 2019-11-30 01:30:22 +01:00
Gregor Biswanger
f5e2abfdb4 Change to Electron version 7, fix some breaking changes. 2019-11-28 22:34:49 +01:00
Gregor Biswanger
42f09de7b5 Merge pull request #323 from kant2002/cleanup-project
Cleanup project with regard to documentation
2019-11-27 20:50:13 +01:00
Andrii Kurdiumov
72d1f4b2b9 Cleanup project with regard to documentation
Was inspired when reviewing .NET Core 3 support
2019-11-27 21:31:19 +02:00
Gregor Biswanger
d2b3c28f91 Merge pull request #342 from jamiebrynes7/bugfix/check-required-args
Handle missing `/target` argument for `build` command.
2019-11-27 20:18:37 +01:00
Gregor Biswanger
94c4cd82b0 Merge pull request #334 from thecodejedi/master
#308 - Start process with listen port 8000 error.
2019-11-27 20:07:48 +01:00
Gregor Biswanger
600bc1a41b Merge pull request #322 from kant2002/improve-testability
Change test application initialization procedure.
2019-11-27 19:35:38 +01:00
Gregor Biswanger
4e8e771293 Merge pull request #311 from Daddoon/master
Support of AddExtension, RemoveExtension, GetExtensions
2019-11-27 19:27:08 +01:00
Jamie Brynes
4014ef7a4d changelog; 2019-11-16 15:17:55 +00:00
Jamie Brynes
364db7dc25 check for arg 2019-11-16 15:13:02 +00:00
Markus Hoffmann
3dda18ac9a use Electron Port as base 2019-11-02 13:31:18 +01:00
Robert Muehsig
7f92ffa20e 5.30.1 release 2019-10-29 00:33:03 +01:00
Robert Muehsig
b69d4d23bf Merge pull request #313 from ElectronNET/netcore30
Update to .NET Core 3.0
2019-10-29 00:21:32 +01:00
Robert Muehsig
eb4144053d This should fix #318 2019-10-28 23:58:43 +01:00
Robert Muehsig
239d914747 Merge pull request #328 from jimbuck/netcore30
Converted global npm dependencies to use npx
2019-10-28 23:36:00 +01:00
Robert Muehsig
5af8e489b9 Merge pull request #327 from tadic-luka/patch-1
Thanks!
2019-10-28 23:30:54 +01:00
Jim Buck
b6fb1cb0bf Converted global npm dependencies to use npx. 2019-10-22 23:59:47 -04:00
tadic-luka
aa98b85f18 Update README.md
EnableEndpointRouting should be set to false. Otherwise people will get error: 
Application startup exception: System.InvalidOperationException: Endpoint Routing does not support 'IApplicationBuilder.UseMvc(...)'. To use 'IApplicationBuilder.UseMvc' set 'MvcOptions.EnableEndpointRouting = false' inside 'ConfigureServices(...). 
The solution is even proposed in stack trace.
Issue was opened on https://github.com/aspnet/AspNetCore/issues/9542 and it is explained there what should be done.
2019-10-22 10:48:55 +02:00
Robert Muehsig
af74d24f50 Merge pull request #326 from jbeals12/patch-1 2019-10-21 21:07:07 +02:00
Jason
2240ffca82 Grammar fix. 2019-10-21 11:28:33 -06:00
Robert Muehsig
f64b780a27 documentation and one minor adjustment 2019-10-15 00:21:36 +02:00
Robert Muehsig
fbc5b93513 Merge branch 'netcore30' of https://github.com/ElectronNET/Electron.NET into netcore30 2019-10-15 00:13:34 +02:00
Robert Muehsig
14d02706c0 small changes for version stuff 2019-10-15 00:13:22 +02:00
Robert Muehsig
2c14693430 Merge branch 'master' into netcore30 2019-10-15 00:10:14 +02:00
Robert Muehsig
54ff11acf5 beta... 2019-10-15 00:09:15 +02:00
Robert Muehsig
b7e7ace6f3 fix build issues on windows 2019-10-14 22:44:30 +02:00
Robert Muehsig
1f7908a0f1 Merge pull request #321 from kant2002/issue-320
Fix `buildAll.cmd` and `buildAll.sh` when running on clear repo
2019-10-14 21:45:54 +02:00
Andrii Kurdiumov
cafffde339 Change test application initialization procedure.
It essentially the same as before, but MVC test tooling expect Program to have CreateWebHostBuilder. I referer to ability to seamlessly use WebApplicationFactory
I understand that story for testing Electron application will be not easy as it is, but this is allow better defaults for testing web applications which can be run in hybrid mode.
2019-10-14 18:31:32 +03:00
Andrii Kurdiumov
6fbba52edd Fix buildAll.cmd and buildAll.sh when running on clear repo
This is followup to c91884a520 change which on itself was reaction to electron-builder changes in the command line parameters interface
2019-10-14 11:13:53 +03:00
Robert Muehsig
8dd5d1561a test 2019-10-07 23:16:08 +02:00
Robert Muehsig
25f35e34fe global npm outside of build commands 2019-10-07 22:53:50 +02:00
Robert Muehsig
f1eaffb203 update github sourcelink and framework reference 2019-10-07 22:48:49 +02:00
Robert Muehsig
69ca5d6f9e Merge pull request #314 from ElectronNET/dependabot/npm_and_yarn/ElectronNET.Host/lodash-4.17.15
Bump lodash from 4.17.11 to 4.17.15 in /ElectronNET.Host
2019-10-07 22:42:03 +02:00
Robert Muehsig
5cd11a8110 build 2019-10-03 23:36:21 +02:00
dependabot[bot]
c343b19a60 Bump lodash from 4.17.11 to 4.17.15 in /ElectronNET.Host
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.15.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.11...4.17.15)

Signed-off-by: dependabot[bot] <support@github.com>
2019-10-03 21:16:04 +00:00
Robert Muehsig
b3bb3ceb97 fix build issues 2019-10-03 23:07:17 +02:00
Robert Muehsig
e25b89ff6a Update to .NET Core 3.0 2019-10-03 22:30:58 +02:00
Guillaume
28be0dd209 - Removed unused variable from a previous attempt. 2019-09-26 17:34:18 +02:00
Guillaume
8bf10c370c - Added XML documentation on ChromeExtensionInfo constructor 2019-09-26 17:30:21 +02:00
Guillaume
a32b50f86f - Fixed / Updated API for Chrome extensions
- Sample for quick testing will be put in the pull request
2019-09-26 17:26:33 +02:00
Guillaume
a781234d05 - Removed not existent parameter in method declaration of browserWindowGetExtensions in browserWindows.ts 2019-09-26 13:37:01 +02:00
Guillaume
8b66bdd7cb - Added BrowserWindow.AddExtension, RemoveExtension, GetExtensions support. Not yet tested 2019-09-26 13:27:22 +02:00
Guillaume
ba64639c1d - Added AddExtension, RemoveExtension and GetExtensions methods body
- Added a ChromeExtensionInfo class, that mimic the returned JS values from GetExtensions method (see https://electronjs.org/docs/api/browser-window#browserwindowgetextensions)
- GetExtensions return a Dictionary<string, ChromeExtensionInfo>, to respect JS documentation declaration.
2019-09-25 17:33:57 +02:00
Gregor Biswanger
5157561dc6 Merge pull request #303 from hack2root/master
fix issue #301
2019-08-21 17:10:47 +02:00
Gregor Biswanger
bbecd86cce Update Changelog.md 2019-08-21 17:10:10 +02:00
Artur Mustafin
bd99da560b fix issue #301 2019-08-21 06:43:56 +03:00
Gregor Biswanger
9278402d65 remove starter kits part
Is no longer actively maintained
2019-08-03 11:45:14 +02:00
Robert Muehsig
9bc1b46810 5.22.14 2019-07-29 22:04:52 +02:00
Gregor Biswanger
d2956e6f2f Fix Refresh-Window 2019-07-28 20:16:06 +02:00
Gregor Biswanger
da4e930478 New Feature: Support for set a custom static Port to ASP.NET Backend - #155 2019-07-28 14:14:15 +02:00
Gregor Biswanger
8e9f7b016a New Feature: Implement full support for Auto Updater - (Based on electron-updater - Version 4.0.6) 2019-07-28 13:32:34 +02:00
Gregor Biswanger
10e95afa5c Merge branch 'master' into dev/AutoUpdate 2019-07-28 13:24:41 +02:00
Gregor Biswanger
68505f8feb Create FUNDING.yml 2019-07-28 11:04:41 +02:00
Gregor Biswanger
c91884a520 Fixed bug: Build fails with latest electron-builder version - #288 2019-07-26 16:31:44 +02:00
Gregor Biswanger
ccf0a4c73b Merge pull request #262 from netpoetica/master
fix async issue where same port is considered open
2019-07-26 13:52:10 +02:00
Gregor Biswanger
660663d9c1 Merge pull request #286 from Tum4ik/master
Fixed bug: Electron tray icon TypeError
2019-07-26 13:21:10 +02:00
Robert Muehsig
36ee9c4dd7 Merge pull request #269 from ElectronNET/netcore2.2
update projects to use netcoreapp2.2
2019-07-15 22:29:11 +02:00
Robert Muehsig
9f7c99db53 Merge pull request #252 from Tum4ik/patch-1
Update README.md
2019-07-15 22:16:34 +02:00
Yevgeniy Tymchishin
b9ba162a88 Fixed bug: Electron tray icon TypeError 2019-07-05 23:33:04 +03:00
Robert Muehsig
ad399f50ee 5.22.13 release 2019-07-01 23:16:33 +02:00
Robert Muehsig
428e53e265 Merge pull request #266 from gfs/gfs/listen-on-127.0.0.1
Fix ASP.NET backend listening on 0.0.0.0
2019-07-01 23:10:40 +02:00
kthrose
0a02b7140b Fix filenames in shell script, ElectronNet != ElectionNET on Linux for builds. 2019-06-03 16:54:25 -04:00
Robert Muehsig
f6ea0dd8dc Merge branch 'master' into netcore2.2 2019-06-01 00:02:33 +02:00
Robert Muehsig
dc8987de5a Merge pull request #268 from ElectronNET/dotnet-travisci-dotnetcore
Use the most recent SDK
2019-05-31 23:56:42 +02:00
Robert Muehsig
dc73be0c81 update projects to use netcoreapp2.2 2019-05-31 23:54:47 +02:00
Robert Muehsig
4dc8f189f9 Update .travis.yml 2019-05-31 23:42:50 +02:00
Robert Muehsig
5ec179af5d Update .travis.yml 2019-05-31 23:28:02 +02:00
Gabe Stocco
802b1acf68 Update README.md 2019-05-31 09:12:07 -07:00
gfs
07a0bc9c7d Revert NodeIntegration Change
Add comment to note why it is true.
2019-05-31 08:57:21 -07:00
kthrose
43028afc02 add bash version of release script 2019-05-31 10:08:44 -04:00
gfs
d3d73611b7 Version in build script now a variable 2019-05-30 19:43:27 -07:00
gfs
6d31c41479 Change NodeIntegration Default to False
This should be the default as it is more secure. It is trivial for applications which wish to take on the additional attack surface to set "            browserWindowOptions.WebPreferences.NodeIntegration = false;"
2019-05-30 17:37:07 -07:00
gfs
98a549560f Prevents binding to 0.0.0.0 on Windows 2019-05-30 17:33:01 -07:00
kthrose
8a3b9951fa fix async issue where same port is considered open 2019-05-29 10:50:24 -04:00
Gregor Biswanger
552b4331b2 implement missing events and properties from the AutoUpdater-API 2019-05-23 23:10:45 +02:00
Gregor Biswanger
38785f9b18 Update README.md 2019-05-23 16:41:19 +02:00
Gregor Biswanger
886b4b81a5 Update Changelog.md 2019-05-23 16:15:24 +02:00
Gregor Biswanger
e6b6f990d7 Update Changelog.md 2019-05-23 16:14:48 +02:00
Gregor Biswanger
a2ada57292 Implement all electron-updater events 2019-05-23 02:59:30 +02:00
Gregor Biswanger
0cede6131e Fixed bug #257 - Menu Item visibility 2019-05-22 20:26:22 +02:00
Gregor Biswanger
ce52988aac Merge branch 'master' of https://github.com/ElectronNET/Electron.NET 2019-05-22 18:28:52 +02:00
Gregor Biswanger
3a52680a54 Bugfix #258: electron.manifest.json - singleInstance not working 2019-05-22 18:26:43 +02:00
Gregor Biswanger
6d28e57f04 Update README.md 2019-05-22 02:35:59 +02:00
Gregor Biswanger
a2cdabf8cb Update issue templates 2019-05-22 02:20:44 +02:00
Gregor Biswanger
25ab81ca8f Update README.md 2019-05-22 01:52:04 +02:00
Gregor Biswanger
5ba54ab40b Update README.md 2019-05-22 01:48:30 +02:00
Gregor Biswanger
cca8110c38 Update README.md 2019-05-22 00:54:50 +02:00
Gregor Biswanger
06f43032b4 Merge branch 'master' of https://github.com/ElectronNET/Electron.NET 2019-05-21 03:32:27 +02:00
Gregor Biswanger
0709d61120 add Auto Update demo sample 2019-05-21 03:32:18 +02:00
Robert Muehsig
aa09af8ad6 version bump 2019-05-20 22:47:21 +02:00
Gregor Biswanger
e90ef9e48d Merge branch 'dev/AutoUpdate' 2019-05-20 18:39:18 +02:00
Gregor Biswanger
6d076fb99a update version from Electron.Host/package.json by electron.manifest.json 2019-05-20 18:38:57 +02:00
Gregor Biswanger
131d1d9dd1 update changelog 2019-05-20 01:13:09 +02:00
Gregor Biswanger
e5132e8198 implement AutoUpdater 2019-05-20 01:08:26 +02:00
Tum4ik
6a7c60fdb5 Update README.md
Fixed documentation bug.
2019-05-19 15:37:48 +03:00
Gregor Biswanger
8605fab9a7 update changelog 2019-05-18 16:57:23 +02:00
Gregor Biswanger
c03d6e8976 implement splashscreen support 2019-05-18 15:04:11 +02:00
Gregor Biswanger
5e0ef7edb5 Merge pull request #250 from MaherJendoubi/spelling
Fixed some spelling issues
2019-05-18 02:06:21 +02:00
Gregor Biswanger
5300609360 implement electron-builder support, remove electron-packager 2019-05-18 02:01:06 +02:00
Maher Jendoubi
ed6ebe90b1 Fixed some spelling issues
* Cleanup of unnecessary usings
* Used language keywords instead of BCL types : Object --> object
* Fixed some spelling issues
2019-05-18 02:00:56 +02:00
Gregor Biswanger
4e95322468 update changelog 2019-05-16 18:07:46 +02:00
Gregor Biswanger
412f628422 implement Session-API, fix code selection problem for the Demo Web-App. 2019-05-16 18:03:31 +02:00
Gregor Biswanger
3cb92169dd Implement Electron 5.0.1 compatibility 2019-05-16 03:13:35 +02:00
Gregor Biswanger
aea2c7aff5 pull request #233 2019-05-16 01:29:34 +02:00
Gregor Biswanger
ba16c4e032 Merge pull request #228 from gfs/master
Adds new command line parameters to 'electronize build'
2019-05-16 01:07:04 +02:00
Gregor Biswanger
8b5bb636f3 Merge branch 'master' into master 2019-05-16 01:06:56 +02:00
Gregor Biswanger
0fac6ae1cd Merge branch 'master' of https://github.com/ElectronNET/Electron.NET 2019-05-16 00:53:40 +02:00
Gregor Biswanger
24d1f6f844 update changelog 2019-05-16 00:53:34 +02:00
Gregor Biswanger
73f7e5a7b2 Merge pull request #243 from Hecatron-Forks/hecatron-dev
Call electronize from the Path instead of via dotnet in launchSettings.json
2019-05-16 00:49:50 +02:00
Gregor Biswanger
01d1397a60 Merge pull request #241 from BorisTheBrave/improve-build-script
buildReleaseNuGetPackages should leave you in the same directory you …
2019-05-16 00:48:38 +02:00
Gregor Biswanger
77e7280b1f Merge pull request #240 from BorisTheBrave/set-progress-bar-fixes
Updates the C# API to accept floating point as in JS.
2019-05-16 00:47:55 +02:00
Gregor Biswanger
8d6a5a757e Merge pull request #236 from BorisTheBrave/electronize-cli-false-positive
Reduce chance of detecting false positives when scanning subprocesses for errors.
2019-05-16 00:46:59 +02:00
Gregor Biswanger
f2e0808ede Merge pull request #231 from CodeKenpachi/master
Fix BrowserWindow::SetMenu
2019-05-16 00:42:45 +02:00
Gregor Biswanger
aa7efbad4b Merge branch 'dev/hosthooks' 2019-05-15 23:58:40 +02:00
Gregor Biswanger
d0c52a1364 Implement HostHook logic to CLI and API. Implement an example in the Web-App. 2019-05-15 23:56:53 +02:00
grbd
4235aa4677 Calls electronize from the Path instead of via dotnet 2019-05-08 19:31:29 +01:00
Adam Newgas
8a3c86abc0 buildReleaseNuGetPackages should leave you in the same directory you started in. 2019-05-05 18:33:26 +01:00
Adam Newgas
eda9b08cac Updates the C# API to accept floating point as in JS.
Also adds supports for progress bar options.

Fixes #239
2019-05-05 18:30:07 +01:00
Adam Newgas
a5cee6e6d5 Reduce chance of detecting false positives when scanning subprocesses for errors.
Fixes #160
2019-04-27 19:05:26 +01:00
GLINTT\ppinto
4db0ac0ebb FIX application hangs after socket reconnect
Tray, Globalshortcut and other stop sending events with socket.emit after socket reconnect
2019-04-18 18:03:17 +01:00
Kevin Gaden
2a9c0e1d60 Fix BrowserWindow::SetMenu 2019-04-04 15:08:10 +02:00
Gabe Stocco
7dc3072b5f Adds additional new parameter to force a node install, instead of
skipping due to an existing node_modules folder. This is also implicitly
triggered by providing your own package.json file. This ensures that the
actual packages match the package.json.
2019-03-29 19:02:34 -07:00
Gabe Stocco
6642f9d505 Correct license information in package.json to match license file included with source. 2019-03-28 15:45:50 -07:00
Gabe Stocco
078ac99098 Revert version change. 2019-03-28 15:00:13 -07:00
Gabe Stocco
f7cc2a995f Adds three new command line options for build. Specifying the output path, and allowing specification of a package.json file to use. 2019-03-28 14:57:03 -07:00
Gabe Stocco
c0ee3b8859 Fixes directory change when running script. 2019-03-28 14:41:34 -07:00
Robert Muehsig
597df77508 Merge pull request #200 from yfrans/patch-1
Added Windows 32bit support for the start command
2019-01-19 21:36:21 +01:00
Robert Muehsig
f709f65f9e always invoke npm install 2019-01-15 22:21:25 +01:00
Robert Muehsig
71d2b88b02 fix build? 2019-01-15 20:54:32 +01:00
Gregor Biswanger
f4631c99f7 remove to listen on errors 2019-01-11 10:00:00 +01:00
Gregor Biswanger
04968d088b fix ElectronHostHook path, exception handling 2019-01-11 02:42:32 +01:00
Yossi Frances
5d446b23fa Added Windows 32bit support for the start command 2019-01-10 20:47:27 +02:00
Robert Muehsig
2b3eabf75a test 2019-01-09 23:04:56 +01:00
Robert Muehsig
27a5057bb0 fix build? 2019-01-09 00:06:40 +01:00
Robert Muehsig
28f0ffaf62 cleanup sample 2019-01-08 23:58:48 +01:00
Robert Muehsig
0f085fdb1d copy the right stuff and invoke npm 2019-01-08 23:56:19 +01:00
Robert Muehsig
7d8301af54 copy should be ok 2019-01-08 23:49:40 +01:00
Robert Muehsig
132b20b4ae adding the connector 2019-01-07 22:27:33 +01:00
Robert Muehsig
cca5f7f40d draft? 2019-01-07 20:59:02 +01:00
Gregor Biswanger
63c2bcdf7c prototype of electron host hook service and api implementation 2019-01-05 02:17:31 +01:00
Gregor Biswanger
cad371c221 implement Electron 4.0.0 support 2019-01-04 03:27:12 +01:00
Gregor Biswanger
f4efad299a fixed bug: X and Y options to not work #193 2019-01-03 20:20:21 +01:00
Robert Muehsig
17e4646d11 Merge pull request #199 from ElectronNET/bug/fix-vulnerabilities
"found 8 vulnerabilities (1 low, 5 moderate, 2 high)"
2019-01-02 23:55:03 +01:00
Robert Muehsig
977f389e2f found 8 vulnerabilities (1 low, 5 moderate, 2 high)
run `npm audit fix` to fix them, or `npm audit` for details
2019-01-02 23:39:47 +01:00
Robert Muehsig
b6ec73cb84 Merge pull request #198 from ElectronNET/dev/fix-firewall-triggers
Fix firewall triggers
2019-01-02 23:20:30 +01:00
Robert Muehsig
15499e38bf fix socket.io windows firewall trigger 2019-01-02 19:48:14 +01:00
Robert Muehsig
538bc02b54 WIP!
Swap portscanner package to a more windows firewall friendly version
fight against socket.io, which is the last part that triggers the firewall
2019-01-02 01:10:39 +01:00
Robert Muehsig
2fb3062d4b don't listen on 0.0.0.0 2019-01-01 22:56:22 +01:00
Robert Muehsig
8426c9cac2 Merge pull request #197 from ElectronNET/dev/cleanup-for-011
cleanups and licenseUrl for package fixed
2018-12-30 23:22:54 +01:00
Robert Muehsig
da4a8dfa9d cleanups and licenseUrl for package fixed 2018-12-30 23:18:18 +01:00
Robert Muehsig
a2efdb3670 Merge pull request #194 from ElectronNET/bug/fix-devDependencies-while-building
npm install without prod flag
2018-12-30 20:12:26 +01:00
Robert Muehsig
1ae940613c Fix 2018-12-28 22:25:14 +01:00
Robert Muehsig
117fd6e7f4 Merge pull request #192 from ElectronNET/Fix-Readme-After-GlobalTools
Fix readme after Global Tool usage
2018-12-27 19:10:38 +01:00
Robert Muehsig
f5434a086d Update README.md 2018-12-26 23:09:03 +01:00
Robert Muehsig
dc3eec37bb Update Changelog.md 2018-12-05 22:54:48 +01:00
Robert Muehsig
8c171ba948 0.0.10 2018-12-05 22:40:06 +01:00
Robert Muehsig
c1bd48b58d adding the resultcode to the output 2018-09-27 22:48:54 +02:00
Gregor Biswanger
c10e5b74bd Merge pull request #167 from smack0007/manifest-path
manifestJsonFilePath is now calculated with path.join instead of bein…
2018-09-26 22:46:39 +02:00
smack0007
0c024448b7 manifestJsonFilePath is now calculated with path.join instead of being a hard coded string. 2018-09-26 22:32:07 +02:00
Gregor Biswanger
ac9d346955 refactoring 2018-09-26 01:31:53 +02:00
Gregor Biswanger
524e6c8dff fix planned breaking API changes from Electron 4.0 2018-09-25 23:10:58 +02:00
Gregor Biswanger
17399f3f6c Merge pull request #162 from ElectronNET/dev/move-to-globaltool
CLI is now a dotnet tool
2018-09-25 18:33:24 +02:00
Robert Muehsig
d50984a465 path fix 2018-09-03 23:13:02 +02:00
Robert Muehsig
1b7dc7c0c4 next try 2018-09-03 22:59:19 +02:00
Robert Muehsig
c9d53d2fc1 draft 2018-08-30 21:54:42 +02:00
Robert Muehsig
e305029563 Update .travis.yml 2018-07-24 22:44:08 +02:00
Robert Muehsig
da643149bc Update .travis.yml 2018-07-24 22:42:09 +02:00
Robert Muehsig
c2d4821882 Update .travis.yml 2018-07-24 22:33:18 +02:00
Gregor Biswanger
344c5b7c13 packages update to Electron 2.0.5 2018-07-22 21:44:47 +02:00
Gregor Biswanger
dcd637ae0f fix migration problems 2018-07-22 21:35:44 +02:00
Gregor Biswanger
f832143135 Merge pull request #154 from manne/patch-1
uses correct project home url
2018-07-22 18:29:48 +02:00
Manuel Pfemeter
dc40a0ed9a uses correct project home url 2018-07-22 17:50:25 +02:00
Gregor Biswanger
3d65136337 Merge pull request #139 from deinok/updated-electron-version
Electron 2.0.2
2018-07-22 17:47:14 +02:00
Gregor Biswanger
b53442be89 Merge pull request #107 from ru-sh/master
WebContent.GetUrl() and LoadURLOptions.ExtraHeaders
2018-07-22 17:46:43 +02:00
Gregor Biswanger
a708ccfc22 Merge pull request #101 from ElectronNET/better-cwd
https://github.com/ElectronNET/Electron.NET/issues/72
2018-07-22 17:46:14 +02:00
Gregor Biswanger
65399c23fd Merge pull request #95 from mojinxun/master
fix: socket.connnect JS : Scope & Closures
2018-07-22 17:45:35 +02:00
yaofeng
85127be49e config 2018-07-16 14:07:51 +08:00
yaofeng
86aae5ee18 finish pack check 2018-07-14 15:55:09 +08:00
yaofeng
fcbefa62ca 中文问题编码 2018-07-14 13:50:45 +08:00
yaofeng
e7a9ee07e0 update manifestFile setting 2018-06-14 13:11:42 +08:00
yaofeng
8e38c1f79d add makeSingleInstance 2018-06-14 10:47:08 +08:00
yaofeng
a874243c9d loadingWindow add devTools 2018-06-13 15:12:41 +08:00
yaofeng
354b4f09e6 add loadingWindow 2018-06-13 15:03:12 +08:00
Raul Hidalgo Caballero
ff12da19f1 Electron 2.0.2 2018-06-06 16:57:38 +02:00
yaofeng
1bf274a73c 1. getWindowById(id) add undefined check
2. IpcMain add off
2018-05-31 11:05:36 +08:00
yaofeng
949741d992 getWindowById(id) add undefined check 2018-05-30 15:13:17 +08:00
yaofeng
e3eee0c32f 1 2018-05-30 10:38:41 +08:00
yaofeng
ef1f0ab330 registerIpcMainChannel remove channel 2018-05-07 17:18:17 +08:00
Robert Muehsig
5a676cb76a Merge pull request #123 from tomkerkhove/patch-1
Fix typo
2018-05-07 09:00:45 +02:00
Tom Kerkhove
44797e054c Fix typo 2018-05-07 08:07:04 +02:00
Robert Muehsig
11641c9424 Merge pull request #119 from 80er/master
added support for linux-arm platform
2018-04-19 21:57:18 +02:00
Marco Achtziger
c8254e2d84 added support for linux-arm platform 2018-04-19 21:14:00 +02:00
yaofeng
0997291484 fix: possible eventemitter memory leak delected
do: io.setMaxListeners(0);
2018-04-18 16:53:34 +08:00
Shakirov Ruslan
959def9c86 + WebContent.GetUrl()
+ LoadURLOptions.ExtraHeaders
2018-03-16 22:32:56 +03:00
yaofeng
e20dafbb66 resume csproj 2018-02-28 10:27:00 +08:00
Robert Muehsig
2e87bb3955 https://github.com/ElectronNET/Electron.NET/issues/72 2018-02-19 23:30:13 +01:00
Robert Muehsig
c4c0bbadea Update README.md 2018-02-19 23:11:12 +01:00
yaofeng
ad20230b20 Merge branch 'master' of https://github.com/mojinxun/Electron.NET 2018-02-09 23:22:28 +08:00
yaofeng
3ba46a3565 1 2018-02-09 23:22:03 +08:00
mojinxun
53c591f7b7 Merge pull request #1 from ElectronNET/master
fix: io.reconnect socket Closure
2018-02-09 23:16:20 +08:00
458 changed files with 23667 additions and 8849 deletions

12
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
# These are supported funding model platforms
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
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: https://donorbox.org/electron-net

27
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
<!-- Please search existing issues to avoid creating duplicates. -->
<!-- Which version of Electron.NET CLI and API are you using? -->
<!-- Please always try to use latest version before report. -->
* **Version**:
<!-- Which version of .NET Core and Node.js are you using (if applicable)? -->
<!-- What target are you building for? -->
* **Target**:
<!-- Enter your issue details below this comment. -->
<!-- If you want, you can donate to increase issue priority (https://donorbox.org/electron-net) -->
Steps to Reproduce:
1.
2.

View File

@@ -0,0 +1,13 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: Feature
assignees: ''
---
<!-- Please search existing feature request to avoid creating duplicates. -->
<!-- If you want, you can donate to increase feature request priority (https://donorbox.org/electron-net) -->
<!-- Describe the feature you'd like. -->

13
.github/ISSUE_TEMPLATE/question.md vendored Normal file
View File

@@ -0,0 +1,13 @@
---
name: Question
about: The issue tracker is not for questions. Please ask questions on https://stackoverflow.com/questions/tagged/electron.net
or via chat in https://gitter.im/ElectronNET/community.
title: ''
labels: question
assignees: ''
---
🚨 The issue tracker is not for questions 🚨
The issue tracker is not for questions. Please ask questions on https://stackoverflow.com/questions/tagged/electron.net or via chat in https://gitter.im/ElectronNET/community.

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

@@ -0,0 +1,47 @@
name: CI
on: [push, pull_request]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
6.0.x
7.0.x
- name: Build
run: ./build.sh
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
6.0.x
7.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
}

8
.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
@@ -260,3 +260,9 @@ paket-files/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Mac Only settings file
.DS_Store
# Nuke build tool
.nuke/temp

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

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

4
.nuke/parameters.json Normal file
View File

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

View File

@@ -1,7 +0,0 @@
language: csharp
mono: none
dotnet: 2.0.0
before_script:
- npm install electron-packager --global
script:
- ./buildAll.sh

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}/ElectronNET.CLI/ElectronNET.CLI.csproj"],
"problemMatcher": "$msCompile",
"group": {
"_id": "build",
"isDefault": false
}
}
]
}

View File

@@ -1,4 +1,313 @@
# not release
# 23.6.2
## ElectronNET.API
* Fixed escaping of URL (#735) @cosmo0
* Fixed huge memory waste in IpcMain.Once (#833) @Yuvix25
* Fixed enabling of accessibility support (#798) @dlanorok
* Updated `Display` to current spec (#828) @Yuvix25
* Changed `ZoomFactor` type from `int` to `double` (#754) @Yuvix25
* Added splash screen size config (#822) @NickRimmer
* Added OSX ARM architecture detection (#821) @sajmonr
* Added support for `did-navigate` event (#819) @NickRimmer
* Added support for `will-redirect` event (#819) @NickRimmer
* Added support for `did-fail-load` event (#819) @NickRimmer
* Added support for `did-start-navigation` event (#819) @NickRimmer
* Added support for `did-redirect-navigation` event (#819) @NickRimmer
* Added support for `dom-ready` event (#813) @softworkz
## ElectronNET.CLI
* (none)
## Infrastructure
* Changed build system to NUKE (#757) @FlorianRappl
* Updated target framework for host project (#753) @r-pankevicius
* Fixed typo in README (#800) @franpersanchez
# 23.6.1
## ElectronNET.CLI
* New Feature: Upgrade to .NET 6 support
## ElectronNET.API
* New Feature: Native Electron 23.2.0 support, but not all new API features included (we search contributors)
* New Feature: Upgrade to .NET 6 support
* New Feature: Changed Web-Socket .NET Library to [SocketIOClient](https://github.com/doghappy/socket.io-client-csharp)
* Breaking Changes: We removed deprecated API events/methods from ElectronNET.API [(More Details)](https://www.electronjs.org/docs/latest/breaking-changes)
# 13.5.1
ElectronNET.CLI:
* New Feature: Using exit code instead of seek for the term 'error' (thanks [TSrgy](https://github.com/TSrgy)) [\#562](https://github.com/ElectronNET/Electron.NET/pull/562)
* Fixed bug: Allow for property overrides to be passed in (thanks [danatcofo](https://github.com/danatcofo)) [\#531](https://github.com/ElectronNET/Electron.NET/pull/531)
Use `/p:propertyName=value` or `/property:propertyName=value` to pass in property overrides. This is equivalent to the `-p:` option documented here: [https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish)
* Fixed bug: Add ability to pass an argument for "Version" for both the "dotnet publish" and "electron-builder" commands (thanks [tub5](https://github.com/tub5)) [\#546](https://github.com/ElectronNET/Electron.NET/pull/546)
* Fixed bug: Version flag not persisting with the referenced executable (thanks [tub5](https://github.com/tub5)) [\#585](https://github.com/ElectronNET/Electron.NET/pull/585)
* Fixed bug: Changes PublishSingleFile default to false for NET5 compatibility (thanks [cristiangiagante](https://github.com/cristiangiagante)) [\#570](https://github.com/ElectronNET/Electron.NET/pull/570)
ElectronNET.API:
* New Feature: Native Electron 13.1.5 support, but not all new features (we search contributors)
* Breaking API Changes (from native Electron 13.1.5):
- `Shell.MoveItemToTrashAsync` renamed with `Shell.TrashItemAsync`
- The deprecated extension APIs have been removed: `BrowserWindow.GetAllExtensionsAsync()`, `BrowserWindow.RemoveExtension()`, `BrowserWindow.AddExtensionAsync()`. Use the session APIs instead: `Session.GetAllExtensionsAsync()`, `Session.RemoveExtension()`, `Session.LoadExtensionAsync()`.
* New Feature: singleInstance handle command line arguments [\#520](https://github.com/ElectronNET/Electron.NET/issues/520)
* New Feature: Add WebContents [insertCSS](https://www.electronjs.org/docs/api/web-contents#contentsinsertcsscss-options) functionality (thanks [nfichter](https://github.com/nfichter)) [\#559](https://github.com/ElectronNET/Electron.NET/pull/559)
* New Feature: Allow IpcMain to send IPC messages to BrowserViews (thanks [nfichter](https://github.com/nfichter)) [\#560](https://github.com/ElectronNET/Electron.NET/pull/560)
* New Feature: Add support for proxies that require basic username/password authentication (thanks [nfichter](https://github.com/nfichter)) [\#561](https://github.com/ElectronNET/Electron.NET/pull/561)
* New Feature: Add PostData to LoadURLOptions to allow http-posts in LoadURL calls (thanks [Funkrusha](https://github.com/Funkrusha)) [\#547](https://github.com/ElectronNET/Electron.NET/pull/547)
* Fixed bug: Fix splash screen interaction causing crashes, ghost dragging, and resizable behavior #540 (thanks [MiniguyBrendan](https://github.com/MiniguyBrendan)) [\#540](https://github.com/ElectronNET/Electron.NET/pull/540)
* Fixed bug: Vibrancy serialization fix (thanks [tantumalice](https://github.com/tantumalice)) [\#573](https://github.com/ElectronNET/Electron.NET/pull/573)
# 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)
# 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
@@ -9,12 +318,12 @@ ElectronNET.API:
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 build with Release configuration, but can be adjusted with the new params.
* .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 unfortunatly released a pre version of this on NuGet.
This version was skipped because we unfortunately released a pre-version of this on NuGet.
# 0.0.7
@@ -27,7 +336,7 @@ ElectronNET.CLI:
ElectronNET.CLI:
* nuget packages are now release bits and have the correct assembly verion
* nuget packages are now release bits and have the correct assembly version
* Version command
* better devCleanup.cmd
* Better Platform Support Issue - thanks to @Petermarcu

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;
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,45 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>..\artifacts</PackageOutputPath>
<PackageId>ElectronNET.API</PackageId>
<Authors>Gregor Biswanger, Robert Muehsig</Authors>
<Company />
<Product>Electron.NET</Product>
<PackageLicenseUrl>https://github.com/ElectronNET/Electron.NET/blob/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/ElectronNET/Electron.NET/</PackageProjectUrl>
<Description>Building cross platform electron based desktop apps with .NET Core and ASP.NET NET Core.
This package contains the API to access the "native" electron API.</Description>
<RepositoryUrl>https://github.com/ElectronNET/Electron.NET/</RepositoryUrl>
<PackageTags>electron aspnetcore</PackageTags>
<PackageReleaseNotes>Changelog: https://github.com/ElectronNET/Electron.NET/blob/master/Changelog.md</PackageReleaseNotes>
<PackageIconUrl>https://raw.githubusercontent.com/ElectronNET/Electron.NET/master/assets/images/electron.net-logo-square.png</PackageIconUrl>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\Debug\netcoreapp2.0\ElectronNET.API.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>bin\Release\netcoreapp2.0\ElectronNET.API.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\Debug\netcoreapp2.0\ElectronNET.API.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.0.0" />
<PackageReference Include="SocketIoClientDotNet" Version="1.0.3" />
</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,18 +0,0 @@
namespace ElectronNET.API
{
/// <summary>
///
/// </summary>
public enum DockBounceType
{
/// <summary>
/// The critical
/// </summary>
critical,
/// <summary>
/// The informational
/// </summary>
informational
}
}

View File

@@ -1,16 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class Error
{
/// <summary>
/// Gets or sets the stack.
/// </summary>
/// <value>
/// The stack.
/// </value>
public string Stack { get; set; }
}
}

View File

@@ -1,23 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public enum HighlightMode
{
/// <summary>
/// Highlight the tray icon when it is clicked and also when its context menu is open. This is the default.
/// </summary>
selection,
/// <summary>
/// Always highlight the tray icon.
/// </summary>
always,
/// <summary>
/// Never highlight the tray icon.
/// </summary>
never
}
}

View File

@@ -1,39 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class LoginItemSettings
{
/// <summary>
/// true if the app is set to open at login.
/// </summary>
public bool OpenAtLogin { get; set; }
/// <summary>
/// true if the app is set to open as hidden at login. This setting is only
/// supported on macOS.
/// </summary>
public bool OpenAsHidden { get; set; }
/// <summary>
/// true if the app was opened at login automatically. This setting is only
/// supported on macOS.
/// </summary>
public bool WasOpenedAtLogin { get; set; }
/// <summary>
/// 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 only supported on macOS.
/// </summary>
public bool WasOpenedAsHidden { get; set; }
/// <summary>
/// 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 only supported
/// on macOS.
/// </summary>
public bool RestoreState { get; set; }
}
}

View File

@@ -1,109 +0,0 @@
namespace ElectronNET.API.Entities
{
// TODO: Need some of real code :)
/// <summary>
///
/// </summary>
public class NativeImage
{
// public static NativeImage CreateEmpty()
// {
// throw new NotImplementedException();
// }
// public static NativeImage CreateFromBuffer(byte[] buffer)
// {
// throw new NotImplementedException();
// }
// public static NativeImage CreateFromBuffer(byte[] buffer, CreateFromBufferOptions options)
// {
// throw new NotImplementedException();
// }
// public static NativeImage CreateFromDataURL(string dataURL)
// {
// throw new NotImplementedException();
// }
// public static NativeImage CreateFromPath(string path)
// {
// throw new NotImplementedException();
// }
// public void AddRepresentation(AddRepresentationOptions options)
// {
// throw new NotImplementedException();
// }
// public NativeImage Crop(Rectangle rect)
// {
// throw new NotImplementedException();
// }
// public int GetAspectRatio()
// {
// throw new NotImplementedException();
// }
// public byte[] GetBitmap()
// {
// throw new NotImplementedException();
// }
// public byte[] GetBitmap(BitmapOptions options)
// {
// throw new NotImplementedException();
// }
// public byte[] GetNativeHandle()
// {
// throw new NotImplementedException();
// }
// public Size GetSize()
// {
// throw new NotImplementedException();
// }
// public bool IsEmpty()
// {
// throw new NotImplementedException();
// }
// public bool IsTemplateImage()
// {
// throw new NotImplementedException();
// }
// public NativeImage Resize(ResizeOptions options)
// {
// throw new NotImplementedException();
// }
// public void SetTemplateImage(bool option)
// {
// throw new NotImplementedException();
// }
// public byte[] ToBitmap(ToBitmapOptions options)
// {
// throw new NotImplementedException();
// }
// public string ToDataURL(ToDataURLOptions options)
// {
// throw new NotImplementedException();
// }
// public byte[] ToJPEG(int quality)
// {
// throw new NotImplementedException();
// }
// public byte[] ToPNG(ToPNGOptions options)
// {
// throw new NotImplementedException();
// }
}
}

View File

@@ -1,16 +0,0 @@
using System.ComponentModel;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class OpenExternalOptions
{
/// <summary>
/// true to bring the opened application to the foreground. The default is true.
/// </summary>
[DefaultValue(true)]
public bool Activate { get; set; } = true;
}
}

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,28 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ProcessMetric
{
/// <summary>
/// CPU usage of the process.
/// </summary>
public CPUUsage Cpu { get; set; }
/// <summary>
/// Memory information for the process.
/// </summary>
public MemoryInfo Memory {get; set;}
/// <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; }
}
}

View File

@@ -1,251 +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>
/// Manage files and URLs using their default applications.
/// </summary>
public sealed class Shell
{
private static Shell _shell;
private static object _syncRoot = new Object();
internal Shell() { }
internal static Shell Instance
{
get
{
if (_shell == null)
{
lock (_syncRoot)
{
if (_shell == null)
{
_shell = new Shell();
}
}
}
return _shell;
}
}
/// <summary>
/// Show the given file in a file manager. If possible, select the file.
/// </summary>
/// <param name="fullPath"></param>
/// <returns>Whether the item was successfully shown.</returns>
public Task<bool> ShowItemInFolderAsync(string fullPath)
{
var taskCompletionSource = new TaskCompletionSource<bool>();
BridgeConnector.Socket.On("shell-showItemInFolderCompleted", (success) =>
{
BridgeConnector.Socket.Off("shell-showItemInFolderCompleted");
taskCompletionSource.SetResult((bool)success);
});
BridgeConnector.Socket.Emit("shell-showItemInFolder", fullPath);
return taskCompletionSource.Task;
}
/// <summary>
/// Open the given file in the desktops default manner.
/// </summary>
/// <param name="fullPath"></param>
/// <returns>Whether the item was successfully opened.</returns>
public Task<bool> OpenItemAsync(string fullPath)
{
var taskCompletionSource = new TaskCompletionSource<bool>();
BridgeConnector.Socket.On("shell-openItemCompleted", (success) =>
{
BridgeConnector.Socket.Off("shell-openItemCompleted");
taskCompletionSource.SetResult((bool)success);
});
BridgeConnector.Socket.Emit("shell-openItem", fullPath);
return taskCompletionSource.Task;
}
/// <summary>
/// Open the given external protocol URL in the desktops default manner.
/// (For example, mailto: URLs in the users default mail agent).
/// </summary>
/// <param name="url"></param>
/// <returns>Whether an application was available to open the URL.
/// If callback is specified, always returns true.</returns>
public Task<bool> OpenExternalAsync(string url)
{
var taskCompletionSource = new TaskCompletionSource<bool>();
BridgeConnector.Socket.On("shell-openExternalCompleted", (success) =>
{
BridgeConnector.Socket.Off("shell-openExternalCompleted");
taskCompletionSource.SetResult((bool)success);
});
BridgeConnector.Socket.Emit("shell-openExternal", url);
return taskCompletionSource.Task;
}
/// <summary>
/// Open the given external protocol URL in the desktops default manner.
/// (For example, mailto: URLs in the users default mail agent).
/// </summary>
/// <param name="url"></param>
/// <param name="options">macOS only</param>
/// <returns>Whether an application was available to open the URL.
/// If callback is specified, always returns true.</returns>
public Task<bool> OpenExternalAsync(string url, OpenExternalOptions options)
{
var taskCompletionSource = new TaskCompletionSource<bool>();
BridgeConnector.Socket.On("shell-openExternalCompleted", (success) =>
{
BridgeConnector.Socket.Off("shell-openExternalCompleted");
taskCompletionSource.SetResult((bool)success);
});
BridgeConnector.Socket.Emit("shell-openExternal", url, JObject.FromObject(options, _jsonSerializer));
return taskCompletionSource.Task;
}
/// <summary>
/// Open the given external protocol URL in the desktops default manner.
/// (For example, mailto: URLs in the users default mail agent).
/// </summary>
/// <param name="url"></param>
/// <param name="options">macOS only</param>
/// <param name="action">macOS only</param>
/// <returns>Whether an application was available to open the URL.
/// If callback is specified, always returns true.</returns>
public Task<bool> OpenExternalAsync(string url, OpenExternalOptions options, Action<Error> action)
{
var taskCompletionSource = new TaskCompletionSource<bool>();
BridgeConnector.Socket.On("shell-openExternalCompleted", (success) =>
{
BridgeConnector.Socket.Off("shell-openExternalCompleted");
taskCompletionSource.SetResult((bool)success);
});
BridgeConnector.Socket.Off("shell-openExternalCallback");
BridgeConnector.Socket.On("shell-openExternalCallback", (args) => {
var urlKey = ((JArray)args).First.ToString();
var error = ((JArray)args).Last.ToObject<Error>();
if(_openExternalCallbacks.ContainsKey(urlKey))
{
_openExternalCallbacks[urlKey](error);
}
});
_openExternalCallbacks.Add(url, action);
BridgeConnector.Socket.Emit("shell-openExternal", url, JObject.FromObject(options, _jsonSerializer), true);
return taskCompletionSource.Task;
}
private Dictionary<string, Action<Error>> _openExternalCallbacks = new Dictionary<string, Action<Error>>();
/// <summary>
/// Move the given file to trash and returns a boolean status for the operation.
/// </summary>
/// <param name="fullPath"></param>
/// <returns> Whether the item was successfully moved to the trash.</returns>
public Task<bool> MoveItemToTrashAsync(string fullPath)
{
var taskCompletionSource = new TaskCompletionSource<bool>();
BridgeConnector.Socket.On("shell-moveItemToTrashCompleted", (success) =>
{
BridgeConnector.Socket.Off("shell-moveItemToTrashCompleted");
taskCompletionSource.SetResult((bool)success);
});
BridgeConnector.Socket.Emit("shell-moveItemToTrash", fullPath);
return taskCompletionSource.Task;
}
/// <summary>
/// Play the beep sound.
/// </summary>
public void Beep()
{
BridgeConnector.Socket.Emit("shell-beep");
}
/// <summary>
/// Creates or updates a shortcut link at shortcutPath.
/// </summary>
/// <param name="shortcutPath"></param>
/// <param name="operation"></param>
/// <param name="options"></param>
/// <returns>Whether the shortcut was created successfully.</returns>
public Task<bool> WriteShortcutLinkAsync(string shortcutPath, ShortcutLinkOperation operation, ShortcutDetails options)
{
var taskCompletionSource = new TaskCompletionSource<bool>();
BridgeConnector.Socket.On("shell-writeShortcutLinkCompleted", (success) =>
{
BridgeConnector.Socket.Off("shell-writeShortcutLinkCompleted");
taskCompletionSource.SetResult((bool)success);
});
BridgeConnector.Socket.Emit("shell-writeShortcutLink", shortcutPath, operation.ToString(), JObject.FromObject(options, _jsonSerializer));
return taskCompletionSource.Task;
}
/// <summary>
/// Resolves the shortcut link at shortcutPath.
///
/// An exception will be thrown when any error happens.
/// </summary>
/// <param name="shortcutPath"></param>
/// <returns></returns>
public Task<ShortcutDetails> ReadShortcutLinkAsync(string shortcutPath)
{
var taskCompletionSource = new TaskCompletionSource<ShortcutDetails>();
BridgeConnector.Socket.On("shell-readShortcutLinkCompleted", (shortcutDetails) =>
{
BridgeConnector.Socket.Off("shell-readShortcutLinkCompleted");
taskCompletionSource.SetResult((ShortcutDetails)shortcutDetails);
});
BridgeConnector.Socket.Emit("shell-readShortcutLink", shortcutPath);
return taskCompletionSource.Task;
}
private JsonSerializer _jsonSerializer = new JsonSerializer()
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
NullValueHandling = NullValueHandling.Ignore,
DefaultValueHandling = DefaultValueHandling.Ignore
};
}
}

View File

@@ -1,142 +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>
/// 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;
}
/// <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>
/// 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;
}
private JsonSerializer _jsonSerializer = new JsonSerializer()
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
NullValueHandling = NullValueHandling.Ignore,
DefaultValueHandling = DefaultValueHandling.Ignore
};
}
}

View File

@@ -1,40 +0,0 @@
using Microsoft.AspNetCore.Hosting;
using System;
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.UseContentRoot(AppDomain.CurrentDomain.BaseDirectory)
.UseUrls("http://0.0.0.0:" + BridgeSettings.WebPort);
}
return builder;
}
}
}

View File

@@ -1,129 +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.Linq;
using System.Threading.Tasks;
namespace ElectronNET.API
{
/// <summary>
///
/// </summary>
public sealed class WindowManager
{
private static WindowManager _windowManager;
private static object _syncRoot = new Object();
internal WindowManager() { }
internal static WindowManager Instance
{
get
{
if (_windowManager == null)
{
lock (_syncRoot)
{
if (_windowManager == null)
{
_windowManager = new WindowManager();
}
}
}
return _windowManager;
}
}
/// <summary>
/// Quit when all windows are closed. (Default is true)
/// </summary>
/// <value>
/// <c>true</c> if [quit window all closed]; otherwise, <c>false</c>.
/// </value>
public bool IsQuitOnWindowAllClosed
{
get { return _isQuitOnWindowAllClosed; }
set
{
BridgeConnector.Socket.Emit("quit-app-window-all-closed-event", value);
_isQuitOnWindowAllClosed = value;
}
}
private bool _isQuitOnWindowAllClosed = true;
/// <summary>
/// Gets the browser windows.
/// </summary>
/// <value>
/// The browser windows.
/// </value>
public IReadOnlyCollection<BrowserWindow> BrowserWindows { get { return _browserWindows.AsReadOnly(); } }
private List<BrowserWindow> _browserWindows = new List<BrowserWindow>();
/// <summary>
/// Creates the window asynchronous.
/// </summary>
/// <param name="loadUrl">The load URL.</param>
/// <returns></returns>
public async Task<BrowserWindow> CreateWindowAsync(string loadUrl = "http://localhost")
{
return await CreateWindowAsync(new BrowserWindowOptions(), loadUrl);
}
/// <summary>
/// Creates the window asynchronous.
/// </summary>
/// <param name="options">The options.</param>
/// <param name="loadUrl">The load URL.</param>
/// <returns></returns>
public Task<BrowserWindow> CreateWindowAsync(BrowserWindowOptions options, string loadUrl = "http://localhost")
{
var taskCompletionSource = new TaskCompletionSource<BrowserWindow>();
BridgeConnector.Socket.On("BrowserWindowCreated", (id) =>
{
BridgeConnector.Socket.Off("BrowserWindowCreated");
string windowId = id.ToString();
BrowserWindow browserWindow = new BrowserWindow(int.Parse(windowId));
_browserWindows.Add(browserWindow);
taskCompletionSource.SetResult(browserWindow);
});
BridgeConnector.Socket.Off("BrowserWindowClosed");
BridgeConnector.Socket.On("BrowserWindowClosed", (ids) =>
{
var browserWindowIds = ((JArray)ids).ToObject<int[]>();
for (int index = 0; index < _browserWindows.Count; index++)
{
if (!browserWindowIds.Contains(_browserWindows[index].Id))
{
_browserWindows.RemoveAt(index);
}
}
});
if (loadUrl.ToUpper() == "HTTP://LOCALHOST")
{
loadUrl = $"{loadUrl}:{BridgeSettings.WebPort}";
}
BridgeConnector.Socket.Emit("createBrowserWindow", JObject.FromObject(options, _jsonSerializer), loadUrl);
return taskCompletionSource.Task;
}
private JsonSerializer _jsonSerializer = new JsonSerializer()
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
NullValueHandling = NullValueHandling.Ignore,
DefaultValueHandling = DefaultValueHandling.Ignore
};
}
}

View File

@@ -1,145 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
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 +
"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";
public Task<bool> ExecuteAsync()
{
return Task.Run(() =>
{
Console.WriteLine("Build Electron Application...");
SimpleCommandLineParser parser = new SimpleCommandLineParser();
parser.Parse(_args);
var desiredPlatform = parser.Arguments[_paramTarget][0];
string specifiedFromCustom = string.Empty;
if (desiredPlatform == "custom" && parser.Arguments[_paramTarget].Length > 1)
{
specifiedFromCustom = parser.Arguments["target"][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);
}
Console.WriteLine("Executing dotnet publish in this directory: " + tempPath);
string tempBinPath = Path.Combine(tempPath, "bin");
Console.WriteLine($"Build ASP.NET Core App for {platformInfo.NetCorePublishRid} under {configuration}-Configuration...");
var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} -c {configuration} --output \"{tempBinPath}\"", Directory.GetCurrentDirectory());
if (resultCode != 0)
{
Console.WriteLine("Error occurred during dotnet publish.");
return false;
}
DeployEmbeddedElectronFiles.Do(tempPath);
var checkForNodeModulesDirPath = Path.Combine(tempPath, "node_modules");
if (Directory.Exists(checkForNodeModulesDirPath) == false)
{
Console.WriteLine("node_modules missing in: " + checkForNodeModulesDirPath);
Console.WriteLine("Start npm install...");
ProcessHelper.CmdExecute("npm install", tempPath);
Console.WriteLine("Start npm install electron-packager...");
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// Works proper on Windows...
ProcessHelper.CmdExecute("npm install electron-packager --global", tempPath);
}
else
{
// ToDo: find another solution or document it proper
// GH Issue https://github.com/electron-userland/electron-prebuilt/issues/48
Console.WriteLine("Electron Packager - make sure you invoke 'sudo npm install electron-packager --global' at " + tempPath + " manually. Sry.");
}
}
else
{
Console.WriteLine("Skip npm install, because node_modules directory exists in: " + checkForNodeModulesDirPath);
}
Console.WriteLine("Build Electron Desktop Application...");
string buildPath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "desktop");
Console.WriteLine("Executing electron magic in this directory: " + buildPath);
// ToDo: Need a solution for --asar support
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];
}
Console.WriteLine($"Package Electron App for Platform {platformInfo.ElectronPackerPlatform}...");
ProcessHelper.CmdExecute($"electron-packager . --platform={platformInfo.ElectronPackerPlatform} --arch={electronArch} {electronParams} --out=\"{buildPath}\" --overwrite", tempPath);
Console.WriteLine("... done");
return true;
});
}
}
}

View File

@@ -1,96 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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;
}
public Task<bool> ExecuteAsync()
{
return Task.Run(() =>
{
Console.WriteLine("Start Electron Desktop Application...");
string aspCoreProjectPath = "";
if (_args.Length > 0)
{
if (Directory.Exists(_args[0]))
{
aspCoreProjectPath = _args[0];
}
}
else
{
aspCoreProjectPath = Directory.GetCurrentDirectory();
}
string tempPath = Path.Combine(aspCoreProjectPath, "obj", "Host");
if (Directory.Exists(tempPath) == false)
{
Directory.CreateDirectory(tempPath);
}
var platformInfo = GetTargetPlatformInformation.Do(String.Empty, String.Empty);
string tempBinPath = Path.Combine(tempPath, "bin");
var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\"", aspCoreProjectPath);
if (resultCode != 0)
{
Console.WriteLine("Error occurred during dotnet publish.");
return false;
}
DeployEmbeddedElectronFiles.Do(tempPath);
var checkForNodeModulesDirPath = Path.Combine(tempPath, "node_modules");
if (Directory.Exists(checkForNodeModulesDirPath) == false)
{
Console.WriteLine("node_modules missing in: " + checkForNodeModulesDirPath);
Console.WriteLine("Start npm install...");
ProcessHelper.CmdExecute("npm install", tempPath);
}
else
{
Console.WriteLine("Skip npm install, because node_modules directory exists in: " + checkForNodeModulesDirPath);
}
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""", path);
}
else
{
Console.WriteLine("Invoke electron - in dir: " + path);
ProcessHelper.CmdExecute(@"./electron ""../../main.js""", path);
}
return true;
});
}
}
}

View File

@@ -1,84 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyName>dotnet-electronize</AssemblyName>
<PackageType>DotnetCliTool</PackageType>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>..\artifacts</PackageOutputPath>
<PackageId>ElectronNET.CLI</PackageId>
<Version>1.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 NET Core.
This package contains the dotnet tooling to electronize your application.</Description>
<PackageLicenseUrl>https://github.com/ElectronNET/Electron.NET/blob/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/ElectronNET/Electron.NET/</PackageProjectUrl>
<RepositoryUrl>https://github.com/ElectronNET/Electron.NET/</RepositoryUrl>
<PackageTags>electron aspnetcore</PackageTags>
<PackageReleaseNotes>Changelog: https://github.com/ElectronNET/Electron.NET/blob/master/Changelog.md</PackageReleaseNotes>
<PackageIconUrl>https://raw.githubusercontent.com/ElectronNET/Electron.NET/master/assets/images/electron.net-logo-square.png</PackageIconUrl>
</PropertyGroup>
<ItemGroup>
<None Remove="ElectronHost\package-lock.json" />
<None Remove="ElectronHost\package.json" />
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile></DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile></DocumentationFile>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="..\ElectronNET.Host\electron.manifest.json" Link="ElectronHost\electron.manifest.json" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\ElectronNET.Host\package-lock.json" Link="ElectronHost\package-lock.json" />
<EmbeddedResource Include="..\ElectronNET.Host\package.json" Link="ElectronHost\package.json" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\ElectronNET.Host\main.js" Link="ElectronHost\main.js" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\ElectronNET.Host\api\ipc.js" Link="ElectronHost\api\ipc.js" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\ElectronNET.Host\api\app.js" Link="ElectronHost\api\app.js" />
<EmbeddedResource Include="..\ElectronNET.Host\api\browserWindows.js" Link="ElectronHost\api\browserWindows.js" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\ElectronNET.Host\api\dialog.js" Link="ElectronHost\api\dialog.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" />
</ItemGroup>
<ItemGroup>
<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" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\ElectronNET.Host\api\clipboard.js" Link="ElectronHost\api\clipboard.js" />
</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,94 +0,0 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace ElectronNET.CLI
{
public class ProcessHelper
{
public static int CmdExecute(string command, string workingDirectoryPath, bool output = true, bool waitForExit = true)
{
using (Process cmd = new Process())
{
bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
if (isWindows)
{
cmd.StartInfo.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 (e.Data.ToLowerInvariant().Contains("error"))
{
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 (e.Data.ToLowerInvariant().Contains("error"))
{
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,8 +0,0 @@
{
"profiles": {
"ElectronNET.CLI": {
"commandName": "Project",
"commandLineArgs": "build \"C:\\Users\\Gregor\\Documents\\Visual Studio 2017\\Projects\\ElectronNET\\ElectronNET.WebApp\""
}
}
}

View File

@@ -1,16 +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",
"program": "${workspaceFolder}\\main.js",
"runtimeExecutable": "${workspaceFolder}\\node_modules\\.bin\\electron",
"sourceMaps": true
}
]
}

View File

@@ -1,258 +0,0 @@
"use strict";
exports.__esModule = true;
var isQuitWindowAllClosed = true;
module.exports = function (socket, app) {
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin' &&
isQuitWindowAllClosed) {
app.quit();
}
});
socket.on('quit-app-window-all-closed-event', function (quit) {
isQuitWindowAllClosed = quit;
});
socket.on('register-app-window-all-closed-event', function (id) {
app.on('window-all-closed', function () {
socket.emit('app-window-all-closed' + id);
});
});
socket.on('register-app-before-quit-event', function (id) {
app.on('before-quit', function (event) {
event.preventDefault();
socket.emit('app-before-quit' + id);
});
});
socket.on('register-app-will-quit-event', function (id) {
app.on('will-quit', function (event) {
event.preventDefault();
socket.emit('app-will-quit' + id);
});
});
socket.on('register-app-browser-window-blur-event', function (id) {
app.on('browser-window-blur', function () {
socket.emit('app-browser-window-blur' + id);
});
});
socket.on('register-app-browser-window-focus-event', function (id) {
app.on('browser-window-focus', function () {
socket.emit('app-browser-window-focus' + id);
});
});
socket.on('register-app-browser-window-created-event', function (id) {
app.on('browser-window-created', function () {
socket.emit('app-browser-window-created' + id);
});
});
socket.on('register-app-web-contents-created-event', function (id) {
app.on('web-contents-created', function () {
socket.emit('app-web-contents-created' + id);
});
});
socket.on('register-app-accessibility-support-changed-event', function (id) {
app.on('accessibility-support-changed', function (event, accessibilitySupportEnabled) {
socket.emit('app-accessibility-support-changed' + id, accessibilitySupportEnabled);
});
});
socket.on('appQuit', function () {
app.quit();
});
socket.on('appExit', function (exitCode) {
if (exitCode === void 0) { exitCode = 0; }
app.exit(exitCode);
});
socket.on('appRelaunch', function (options) {
app.relaunch(options);
});
socket.on('appFocus', function () {
app.focus();
});
socket.on('appHide', function () {
app.hide();
});
socket.on('appShow', function () {
app.show();
});
socket.on('appGetAppPath', function () {
var path = app.getAppPath();
socket.emit('appGetAppPathCompleted', path);
});
socket.on('appGetPath', function (name) {
var path = app.getPath(name);
socket.emit('appGetPathCompleted', path);
});
// const nativeImages = {};
// function addNativeImage(nativeImage: Electron.NativeImage) {
// if(Object.keys(nativeImages).length === 0) {
// nativeImage['1'] = nativeImage;
// } else {
// let indexCount = Object.keys(nativeImages).length + 1;
// nativeImage[indexCount] = nativeImage;
// }
// }
socket.on('appGetFileIcon', function (path, options) {
if (options) {
app.getFileIcon(path, options, function (error, nativeImage) {
socket.emit('appGetFileIconCompleted', [error, nativeImage]);
});
}
else {
app.getFileIcon(path, function (error, nativeImage) {
socket.emit('appGetFileIconCompleted', [error, nativeImage]);
});
}
});
socket.on('appSetPath', function (name, path) {
app.setPath(name, path);
});
socket.on('appGetVersion', function () {
var version = app.getVersion();
socket.emit('appGetVersionCompleted', version);
});
socket.on('appGetName', function () {
var name = app.getName();
socket.emit('appGetNameCompleted', name);
});
socket.on('appSetName', function (name) {
app.setName(name);
});
socket.on('appGetLocale', function () {
var locale = app.getLocale();
socket.emit('appGetLocaleCompleted', locale);
});
socket.on('appAddRecentDocument', function (path) {
app.addRecentDocument(path);
});
socket.on('appClearRecentDocuments', function () {
app.clearRecentDocuments();
});
socket.on('appSetAsDefaultProtocolClient', function (protocol, path, args) {
var success = app.setAsDefaultProtocolClient(protocol, path, args);
socket.emit('appSetAsDefaultProtocolClientCompleted', success);
});
socket.on('appRemoveAsDefaultProtocolClient', function (protocol, path, args) {
var success = app.removeAsDefaultProtocolClient(protocol, path, args);
socket.emit('appRemoveAsDefaultProtocolClientCompleted', success);
});
socket.on('appIsDefaultProtocolClient', function (protocol, path, args) {
var success = app.isDefaultProtocolClient(protocol, path, args);
socket.emit('appIsDefaultProtocolClientCompleted', success);
});
socket.on('appSetUserTasks', function (tasks) {
var success = app.setUserTasks(tasks);
socket.emit('appSetUserTasksCompleted', success);
});
socket.on('appGetJumpListSettings', function () {
var jumpListSettings = app.getJumpListSettings();
socket.emit('appGetJumpListSettingsCompleted', jumpListSettings);
});
socket.on('appSetJumpList', function (categories) {
app.setJumpList(categories);
});
socket.on('appMakeSingleInstance', function () {
var success = app.makeSingleInstance(function (args, workingDirectory) {
socket.emit('newInstanceOpened', [args, workingDirectory]);
});
socket.emit('appMakeSingleInstanceCompleted', success);
});
socket.on('appReleaseSingleInstance', function () {
app.releaseSingleInstance();
});
socket.on('appSetUserActivity', function (type, userInfo, webpageURL) {
app.setUserActivity(type, userInfo, webpageURL);
});
socket.on('appGetCurrentActivityType', function () {
var activityType = app.getCurrentActivityType();
socket.emit('appGetCurrentActivityTypeCompleted', activityType);
});
socket.on('appSetAppUserModelId', function (id) {
app.setAppUserModelId(id);
});
socket.on('appImportCertificate', function (options) {
app.importCertificate(options, function (result) {
socket.emit('appImportCertificateCompleted', result);
});
});
socket.on('appGetAppMetrics', function () {
var processMetrics = app.getAppMetrics();
socket.emit('appGetAppMetricsCompleted', processMetrics);
});
socket.on('appGetGpuFeatureStatus', function () {
// TS Workaround - TS say getGpuFeatureStatus - but it is getGPUFeatureStatus
var x = app;
var gpuFeatureStatus = x.getGPUFeatureStatus();
socket.emit('appGetGpuFeatureStatusCompleted', gpuFeatureStatus);
});
socket.on('appSetBadgeCount', function (count) {
var success = app.setBadgeCount(count);
socket.emit('appSetBadgeCountCompleted', success);
});
socket.on('appGetBadgeCount', function () {
var count = app.getBadgeCount();
socket.emit('appGetBadgeCountCompleted', count);
});
socket.on('appIsUnityRunning', function () {
var isUnityRunning = app.isUnityRunning();
socket.emit('appIsUnityRunningCompleted', isUnityRunning);
});
socket.on('appGetLoginItemSettings', function (options) {
var loginItemSettings = app.getLoginItemSettings(options);
socket.emit('appGetLoginItemSettingsCompleted', loginItemSettings);
});
socket.on('appSetLoginItemSettings', function (settings) {
app.setLoginItemSettings(settings);
});
socket.on('appIsAccessibilitySupportEnabled', function () {
var isAccessibilitySupportEnabled = app.isAccessibilitySupportEnabled();
socket.emit('appIsAccessibilitySupportEnabledCompleted', isAccessibilitySupportEnabled);
});
socket.on('appSetAboutPanelOptions', function (options) {
app.setAboutPanelOptions(options);
});
socket.on('appCommandLineAppendSwitch', function (theSwitch, value) {
app.commandLine.appendSwitch(theSwitch, value);
});
socket.on('appCommandLineAppendArgument', function (value) {
app.commandLine.appendArgument(value);
});
socket.on('appEnableMixedSandbox', function () {
app.enableMixedSandbox();
});
socket.on('appDockBounce', function (type) {
var id = app.dock.bounce(type);
socket.emit('appDockBounceCompleted', id);
});
socket.on('appDockCancelBounce', function (id) {
app.dock.cancelBounce(id);
});
socket.on('appDockDownloadFinished', function (filePath) {
app.dock.downloadFinished(filePath);
});
socket.on('appDockSetBadge', function (text) {
app.dock.setBadge(text);
});
socket.on('appDockGetBadge', function () {
var text = app.dock.getBadge();
socket.emit('appDockGetBadgeCompleted', text);
});
socket.on('appDockHide', function () {
app.dock.hide();
});
socket.on('appDockShow', function () {
app.dock.show();
});
socket.on('appDockIsVisible', function () {
var isVisible = app.dock.isVisible();
socket.emit('appDockIsVisibleCompleted', isVisible);
});
// TODO: Menü Lösung muss noch implementiert werden
socket.on('appDockSetMenu', function (menu) {
app.dock.setMenu(menu);
});
socket.on('appDockSetIcon', function (image) {
app.dock.setIcon(image);
});
};
//# sourceMappingURL=app.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,320 +0,0 @@
import { nativeImage as NativeImage } from 'electron';
let isQuitWindowAllClosed = true;
module.exports = (socket: SocketIO.Server, app: Electron.App) => {
// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin' &&
isQuitWindowAllClosed) {
app.quit();
}
});
socket.on('quit-app-window-all-closed-event', (quit) => {
isQuitWindowAllClosed = quit;
});
socket.on('register-app-window-all-closed-event', (id) => {
app.on('window-all-closed', () => {
socket.emit('app-window-all-closed' + id);
});
});
socket.on('register-app-before-quit-event', (id) => {
app.on('before-quit', (event) => {
event.preventDefault();
socket.emit('app-before-quit' + id);
});
});
socket.on('register-app-will-quit-event', (id) => {
app.on('will-quit', (event) => {
event.preventDefault();
socket.emit('app-will-quit' + id);
});
});
socket.on('register-app-browser-window-blur-event', (id) => {
app.on('browser-window-blur', () => {
socket.emit('app-browser-window-blur' + id);
});
});
socket.on('register-app-browser-window-focus-event', (id) => {
app.on('browser-window-focus', () => {
socket.emit('app-browser-window-focus' + id);
});
});
socket.on('register-app-browser-window-created-event', (id) => {
app.on('browser-window-created', () => {
socket.emit('app-browser-window-created' + id);
});
});
socket.on('register-app-web-contents-created-event', (id) => {
app.on('web-contents-created', () => {
socket.emit('app-web-contents-created' + id);
});
});
socket.on('register-app-accessibility-support-changed-event', (id) => {
app.on('accessibility-support-changed', (event, accessibilitySupportEnabled) => {
socket.emit('app-accessibility-support-changed' + id, accessibilitySupportEnabled);
});
});
socket.on('appQuit', () => {
app.quit();
});
socket.on('appExit', (exitCode = 0) => {
app.exit(exitCode);
});
socket.on('appRelaunch', (options) => {
app.relaunch(options);
});
socket.on('appFocus', () => {
app.focus();
});
socket.on('appHide', () => {
app.hide();
});
socket.on('appShow', () => {
app.show();
});
socket.on('appGetAppPath', () => {
const path = app.getAppPath();
socket.emit('appGetAppPathCompleted', path);
});
socket.on('appGetPath', (name) => {
const path = app.getPath(name);
socket.emit('appGetPathCompleted', path);
});
// const nativeImages = {};
// function addNativeImage(nativeImage: Electron.NativeImage) {
// if(Object.keys(nativeImages).length === 0) {
// nativeImage['1'] = nativeImage;
// } else {
// let indexCount = Object.keys(nativeImages).length + 1;
// nativeImage[indexCount] = nativeImage;
// }
// }
socket.on('appGetFileIcon', (path, options) => {
if (options) {
app.getFileIcon(path, options, (error, nativeImage) => {
socket.emit('appGetFileIconCompleted', [error, nativeImage]);
});
} else {
app.getFileIcon(path, (error, nativeImage) => {
socket.emit('appGetFileIconCompleted', [error, nativeImage]);
});
}
});
socket.on('appSetPath', (name, path) => {
app.setPath(name, path);
});
socket.on('appGetVersion', () => {
const version = app.getVersion();
socket.emit('appGetVersionCompleted', version);
});
socket.on('appGetName', () => {
const name = app.getName();
socket.emit('appGetNameCompleted', name);
});
socket.on('appSetName', (name) => {
app.setName(name);
});
socket.on('appGetLocale', () => {
const locale = app.getLocale();
socket.emit('appGetLocaleCompleted', locale);
});
socket.on('appAddRecentDocument', (path) => {
app.addRecentDocument(path);
});
socket.on('appClearRecentDocuments', () => {
app.clearRecentDocuments();
});
socket.on('appSetAsDefaultProtocolClient', (protocol, path, args) => {
const success = app.setAsDefaultProtocolClient(protocol, path, args);
socket.emit('appSetAsDefaultProtocolClientCompleted', success);
});
socket.on('appRemoveAsDefaultProtocolClient', (protocol, path, args) => {
const success = app.removeAsDefaultProtocolClient(protocol, path, args);
socket.emit('appRemoveAsDefaultProtocolClientCompleted', success);
});
socket.on('appIsDefaultProtocolClient', (protocol, path, args) => {
const success = app.isDefaultProtocolClient(protocol, path, args);
socket.emit('appIsDefaultProtocolClientCompleted', success);
});
socket.on('appSetUserTasks', (tasks) => {
const success = app.setUserTasks(tasks);
socket.emit('appSetUserTasksCompleted', success);
});
socket.on('appGetJumpListSettings', () => {
const jumpListSettings = app.getJumpListSettings();
socket.emit('appGetJumpListSettingsCompleted', jumpListSettings);
});
socket.on('appSetJumpList', (categories) => {
app.setJumpList(categories);
});
socket.on('appMakeSingleInstance', () => {
const success = app.makeSingleInstance((args, workingDirectory) => {
socket.emit('newInstanceOpened', [args, workingDirectory]);
});
socket.emit('appMakeSingleInstanceCompleted', success);
});
socket.on('appReleaseSingleInstance', () => {
app.releaseSingleInstance();
});
socket.on('appSetUserActivity', (type, userInfo, webpageURL) => {
app.setUserActivity(type, userInfo, webpageURL);
});
socket.on('appGetCurrentActivityType', () => {
const activityType = app.getCurrentActivityType();
socket.emit('appGetCurrentActivityTypeCompleted', activityType);
});
socket.on('appSetAppUserModelId', (id) => {
app.setAppUserModelId(id);
});
socket.on('appImportCertificate', (options) => {
app.importCertificate(options, (result) => {
socket.emit('appImportCertificateCompleted', result);
});
});
socket.on('appGetAppMetrics', () => {
const processMetrics = app.getAppMetrics();
socket.emit('appGetAppMetricsCompleted', processMetrics);
});
socket.on('appGetGpuFeatureStatus', () => {
// TS Workaround - TS say getGpuFeatureStatus - but it is getGPUFeatureStatus
let x = <any>app;
const gpuFeatureStatus = x.getGPUFeatureStatus();
socket.emit('appGetGpuFeatureStatusCompleted', gpuFeatureStatus);
});
socket.on('appSetBadgeCount', (count) => {
const success = app.setBadgeCount(count);
socket.emit('appSetBadgeCountCompleted', success);
});
socket.on('appGetBadgeCount', () => {
const count = app.getBadgeCount();
socket.emit('appGetBadgeCountCompleted', count);
});
socket.on('appIsUnityRunning', () => {
const isUnityRunning = app.isUnityRunning();
socket.emit('appIsUnityRunningCompleted', isUnityRunning);
});
socket.on('appGetLoginItemSettings', (options) => {
const loginItemSettings = app.getLoginItemSettings(options);
socket.emit('appGetLoginItemSettingsCompleted', loginItemSettings);
});
socket.on('appSetLoginItemSettings', (settings) => {
app.setLoginItemSettings(settings);
});
socket.on('appIsAccessibilitySupportEnabled', () => {
const isAccessibilitySupportEnabled = app.isAccessibilitySupportEnabled();
socket.emit('appIsAccessibilitySupportEnabledCompleted', isAccessibilitySupportEnabled);
});
socket.on('appSetAboutPanelOptions', (options) => {
app.setAboutPanelOptions(options);
});
socket.on('appCommandLineAppendSwitch', (theSwitch, value) => {
app.commandLine.appendSwitch(theSwitch, value);
});
socket.on('appCommandLineAppendArgument', (value) => {
app.commandLine.appendArgument(value);
});
socket.on('appEnableMixedSandbox', () => {
app.enableMixedSandbox();
});
socket.on('appDockBounce', (type) => {
const id = app.dock.bounce(type);
socket.emit('appDockBounceCompleted', id);
});
socket.on('appDockCancelBounce', (id) => {
app.dock.cancelBounce(id);
});
socket.on('appDockDownloadFinished', (filePath) => {
app.dock.downloadFinished(filePath);
});
socket.on('appDockSetBadge', (text) => {
app.dock.setBadge(text);
});
socket.on('appDockGetBadge', () => {
const text = app.dock.getBadge();
socket.emit('appDockGetBadgeCompleted', text);
});
socket.on('appDockHide', () => {
app.dock.hide();
});
socket.on('appDockShow', () => {
app.dock.show();
});
socket.on('appDockIsVisible', () => {
const isVisible = app.dock.isVisible();
socket.emit('appDockIsVisibleCompleted', isVisible);
});
// TODO: Menü Lösung muss noch implementiert werden
socket.on('appDockSetMenu', (menu) => {
app.dock.setMenu(menu);
});
socket.on('appDockSetIcon', (image) => {
app.dock.setIcon(image);
});
}

View File

@@ -1,530 +0,0 @@
"use strict";
exports.__esModule = true;
var electron_1 = require("electron");
var path = require('path');
var windows = [];
module.exports = function (socket) {
socket.on('register-browserWindow-ready-to-show', function (id) {
getWindowById(id).on('ready-to-show', function () {
socket.emit('browserWindow-ready-to-show' + id);
});
});
socket.on('register-browserWindow-page-title-updated', function (id) {
getWindowById(id).on('page-title-updated', function (event, title) {
socket.emit('browserWindow-page-title-updated' + id, title);
});
});
socket.on('register-browserWindow-close', function (id) {
getWindowById(id).on('close', function () {
socket.emit('browserWindow-close' + id);
});
});
socket.on('register-browserWindow-closed', function (id) {
getWindowById(id).on('closed', function () {
socket.emit('browserWindow-closed' + id);
});
});
socket.on('register-browserWindow-session-end', function (id) {
getWindowById(id).on('session-end', function () {
socket.emit('browserWindow-session-end' + id);
});
});
socket.on('register-browserWindow-unresponsive', function (id) {
getWindowById(id).on('unresponsive', function () {
socket.emit('browserWindow-unresponsive' + id);
});
});
socket.on('register-browserWindow-responsive', function (id) {
getWindowById(id).on('responsive', function () {
socket.emit('browserWindow-responsive' + id);
});
});
socket.on('register-browserWindow-blur', function (id) {
getWindowById(id).on('blur', function () {
socket.emit('browserWindow-blur' + id);
});
});
socket.on('register-browserWindow-focus', function (id) {
getWindowById(id).on('focus', function () {
socket.emit('browserWindow-focus' + id);
});
});
socket.on('register-browserWindow-show', function (id) {
getWindowById(id).on('show', function () {
socket.emit('browserWindow-show' + id);
});
});
socket.on('register-browserWindow-hide', function (id) {
getWindowById(id).on('hide', function () {
socket.emit('browserWindow-hide' + id);
});
});
socket.on('register-browserWindow-maximize', function (id) {
getWindowById(id).on('maximize', function () {
socket.emit('browserWindow-maximize' + id);
});
});
socket.on('register-browserWindow-unmaximize', function (id) {
getWindowById(id).on('unmaximize', function () {
socket.emit('browserWindow-unmaximize' + id);
});
});
socket.on('register-browserWindow-minimize', function (id) {
getWindowById(id).on('minimize', function () {
socket.emit('browserWindow-minimize' + id);
});
});
socket.on('register-browserWindow-restore', function (id) {
getWindowById(id).on('restore', function () {
socket.emit('browserWindow-restore' + id);
});
});
socket.on('register-browserWindow-resize', function (id) {
getWindowById(id).on('resize', function () {
socket.emit('browserWindow-resize' + id);
});
});
socket.on('register-browserWindow-move', function (id) {
getWindowById(id).on('move', function () {
socket.emit('browserWindow-move' + id);
});
});
socket.on('register-browserWindow-moved', function (id) {
getWindowById(id).on('moved', function () {
socket.emit('browserWindow-moved' + id);
});
});
socket.on('register-browserWindow-enter-full-screen', function (id) {
getWindowById(id).on('enter-full-screen', function () {
socket.emit('browserWindow-enter-full-screen' + id);
});
});
socket.on('register-browserWindow-leave-full-screen', function (id) {
getWindowById(id).on('leave-full-screen', function () {
socket.emit('browserWindow-leave-full-screen' + id);
});
});
socket.on('register-browserWindow-enter-html-full-screen', function (id) {
getWindowById(id).on('enter-html-full-screen', function () {
socket.emit('browserWindow-enter-html-full-screen' + id);
});
});
socket.on('register-browserWindow-leave-html-full-screen', function (id) {
getWindowById(id).on('leave-html-full-screen', function () {
socket.emit('browserWindow-leave-html-full-screen' + id);
});
});
socket.on('register-browserWindow-app-command', function (id) {
getWindowById(id).on('app-command', function (event, command) {
socket.emit('browserWindow-app-command' + id, command);
});
});
socket.on('register-browserWindow-scroll-touch-begin', function (id) {
getWindowById(id).on('scroll-touch-begin', function () {
socket.emit('browserWindow-scroll-touch-begin' + id);
});
});
socket.on('register-browserWindow-scroll-touch-end', function (id) {
getWindowById(id).on('scroll-touch-end', function () {
socket.emit('browserWindow-scroll-touch-end' + id);
});
});
socket.on('register-browserWindow-scroll-touch-edge', function (id) {
getWindowById(id).on('scroll-touch-edge', function () {
socket.emit('browserWindow-scroll-touch-edge' + id);
});
});
socket.on('register-browserWindow-swipe', function (id) {
getWindowById(id).on('swipe', function (event, direction) {
socket.emit('browserWindow-swipe' + id, direction);
});
});
socket.on('register-browserWindow-sheet-begin', function (id) {
getWindowById(id).on('sheet-begin', function () {
socket.emit('browserWindow-sheet-begin' + id);
});
});
socket.on('register-browserWindow-sheet-end', function (id) {
getWindowById(id).on('sheet-end', function () {
socket.emit('browserWindow-sheet-end' + id);
});
});
socket.on('register-browserWindow-new-window-for-tab', function (id) {
getWindowById(id).on('new-window-for-tab', function () {
socket.emit('browserWindow-new-window-for-tab' + id);
});
});
socket.on('createBrowserWindow', function (options, loadUrl) {
var window = new electron_1.BrowserWindow(options);
window.on('closed', function (sender) {
var _loop_1 = function () {
windowItem = windows[index];
try {
windowItem.id;
}
catch (error) {
if (error.message === 'Object has been destroyed') {
windows.splice(index, 1);
var ids_1 = [];
windows.forEach(function (x) { return ids_1.push(x.id); });
socket.emit('BrowserWindowClosed', ids_1);
}
}
};
var windowItem;
for (var index = 0; index < windows.length; index++) {
_loop_1();
}
});
if (loadUrl) {
window.loadURL(loadUrl);
}
windows.push(window);
socket.emit('BrowserWindowCreated', window.id);
});
socket.on('browserWindowDestroy', function (id) {
getWindowById(id).destroy();
});
socket.on('browserWindowClose', function (id) {
getWindowById(id).close();
});
socket.on('browserWindowFocus', function (id) {
getWindowById(id).focus();
});
socket.on('browserWindowBlur', function (id) {
getWindowById(id).blur();
});
socket.on('browserWindowIsFocused', function (id) {
var isFocused = getWindowById(id).isFocused();
socket.emit('browserWindow-isFocused-completed', isFocused);
});
socket.on('browserWindowIsDestroyed', function (id) {
var isDestroyed = getWindowById(id).isDestroyed();
socket.emit('browserWindow-isDestroyed-completed', isDestroyed);
});
socket.on('browserWindowShow', function (id) {
getWindowById(id).show();
});
socket.on('browserWindowShowInactive', function (id) {
getWindowById(id).showInactive();
});
socket.on('browserWindowHide', function (id) {
getWindowById(id).hide();
});
socket.on('browserWindowIsVisible', function (id) {
var isVisible = getWindowById(id).isVisible();
socket.emit('browserWindow-isVisible-completed', isVisible);
});
socket.on('browserWindowIsModal', function (id) {
var isModal = getWindowById(id).isModal();
socket.emit('browserWindow-isModal-completed', isModal);
});
socket.on('browserWindowMaximize', function (id) {
getWindowById(id).maximize();
});
socket.on('browserWindowUnmaximize', function (id) {
getWindowById(id).unmaximize();
});
socket.on('browserWindowIsMaximized', function (id) {
var isMaximized = getWindowById(id).isMaximized();
socket.emit('browserWindow-isMaximized-completed', isMaximized);
});
socket.on('browserWindowMinimize', function (id) {
getWindowById(id).minimize();
});
socket.on('browserWindowRestore', function (id) {
getWindowById(id).restore();
});
socket.on('browserWindowIsMinimized', function (id) {
var isMinimized = getWindowById(id).isMinimized();
socket.emit('browserWindow-isMinimized-completed', isMinimized);
});
socket.on('browserWindowSetFullScreen', function (id, fullscreen) {
getWindowById(id).setFullScreen(fullscreen);
});
socket.on('browserWindowIsFullScreen', function (id) {
var isFullScreen = getWindowById(id).isFullScreen();
socket.emit('browserWindow-isFullScreen-completed', isFullScreen);
});
socket.on('browserWindowSetAspectRatio', function (id, aspectRatio, extraSize) {
getWindowById(id).setAspectRatio(aspectRatio, extraSize);
});
socket.on('browserWindowPreviewFile', function (id, path, displayname) {
getWindowById(id).previewFile(path, displayname);
});
socket.on('browserWindowCloseFilePreview', function (id) {
getWindowById(id).closeFilePreview();
});
socket.on('browserWindowSetBounds', function (id, bounds, animate) {
getWindowById(id).setBounds(bounds, animate);
});
socket.on('browserWindowGetBounds', function (id) {
var rectangle = getWindowById(id).getBounds();
socket.emit('browserWindow-getBounds-completed', rectangle);
});
socket.on('browserWindowSetContentBounds', function (id, bounds, animate) {
getWindowById(id).setContentBounds(bounds, animate);
});
socket.on('browserWindowGetContentBounds', function (id) {
var rectangle = getWindowById(id).getContentBounds();
socket.emit('browserWindow-getContentBounds-completed', rectangle);
});
socket.on('browserWindowSetSize', function (id, width, height, animate) {
getWindowById(id).setSize(width, height, animate);
});
socket.on('browserWindowGetSize', function (id) {
var size = getWindowById(id).getSize();
socket.emit('browserWindow-getSize-completed', size);
});
socket.on('browserWindowSetContentSize', function (id, width, height, animate) {
getWindowById(id).setContentSize(width, height, animate);
});
socket.on('browserWindowGetContentSize', function (id) {
var size = getWindowById(id).getContentSize();
socket.emit('browserWindow-getContentSize-completed', size);
});
socket.on('browserWindowSetMinimumSize', function (id, width, height) {
getWindowById(id).setMinimumSize(width, height);
});
socket.on('browserWindowGetMinimumSize', function (id) {
var size = getWindowById(id).getMinimumSize();
socket.emit('browserWindow-getMinimumSize-completed', size);
});
socket.on('browserWindowSetMaximumSize', function (id, width, height) {
getWindowById(id).setMaximumSize(width, height);
});
socket.on('browserWindowGetMaximumSize', function (id) {
var size = getWindowById(id).getMaximumSize();
socket.emit('browserWindow-getMaximumSize-completed', size);
});
socket.on('browserWindowSetResizable', function (id, resizable) {
getWindowById(id).setResizable(resizable);
});
socket.on('browserWindowIsResizable', function (id) {
var resizable = getWindowById(id).isResizable();
socket.emit('browserWindow-isResizable-completed', resizable);
});
socket.on('browserWindowSetMovable', function (id, movable) {
getWindowById(id).setMovable(movable);
});
socket.on('browserWindowIsMovable', function (id) {
var movable = getWindowById(id).isMovable();
socket.emit('browserWindow-isMovable-completed', movable);
});
socket.on('browserWindowSetMinimizable', function (id, minimizable) {
getWindowById(id).setMinimizable(minimizable);
});
socket.on('browserWindowIsMinimizable', function (id) {
var minimizable = getWindowById(id).isMinimizable();
socket.emit('browserWindow-isMinimizable-completed', minimizable);
});
socket.on('browserWindowSetMaximizable', function (id, maximizable) {
getWindowById(id).setMaximizable(maximizable);
});
socket.on('browserWindowIsMaximizable', function (id) {
var maximizable = getWindowById(id).isMaximizable();
socket.emit('browserWindow-isMaximizable-completed', maximizable);
});
socket.on('browserWindowSetFullScreenable', function (id, fullscreenable) {
getWindowById(id).setFullScreenable(fullscreenable);
});
socket.on('browserWindowIsFullScreenable', function (id) {
var fullscreenable = getWindowById(id).isFullScreenable();
socket.emit('browserWindow-isFullScreenable-completed', fullscreenable);
});
socket.on('browserWindowSetClosable', function (id, closable) {
getWindowById(id).setClosable(closable);
});
socket.on('browserWindowIsClosable', function (id) {
var closable = getWindowById(id).isClosable();
socket.emit('browserWindow-isClosable-completed', closable);
});
socket.on('browserWindowSetAlwaysOnTop', function (id, flag, level, relativeLevel) {
getWindowById(id).setAlwaysOnTop(flag, level, relativeLevel);
});
socket.on('browserWindowIsAlwaysOnTop', function (id) {
var isAlwaysOnTop = getWindowById(id).isAlwaysOnTop();
socket.emit('browserWindow-isAlwaysOnTop-completed', isAlwaysOnTop);
});
socket.on('browserWindowCenter', function (id) {
getWindowById(id).center();
});
socket.on('browserWindowSetPosition', function (id, x, y, animate) {
getWindowById(id).setPosition(x, y, animate);
});
socket.on('browserWindowGetPosition', function (id) {
var position = getWindowById(id).getPosition();
socket.emit('browserWindow-getPosition-completed', position);
});
socket.on('browserWindowSetTitle', function (id, title) {
getWindowById(id).setTitle(title);
});
socket.on('browserWindowGetTitle', function (id) {
var title = getWindowById(id).getTitle();
socket.emit('browserWindow-getTitle-completed', title);
});
socket.on('browserWindowSetTitle', function (id, title) {
getWindowById(id).setTitle(title);
});
socket.on('browserWindowSetSheetOffset', function (id, offsetY, offsetX) {
if (offsetX) {
getWindowById(id).setSheetOffset(offsetY, offsetX);
}
else {
getWindowById(id).setSheetOffset(offsetY);
}
});
socket.on('browserWindowFlashFrame', function (id, flag) {
getWindowById(id).flashFrame(flag);
});
socket.on('browserWindowSetSkipTaskbar', function (id, skip) {
getWindowById(id).setSkipTaskbar(skip);
});
socket.on('browserWindowSetKiosk', function (id, flag) {
getWindowById(id).setKiosk(flag);
});
socket.on('browserWindowIsKiosk', function (id) {
var isKiosk = getWindowById(id).isKiosk();
socket.emit('browserWindow-isKiosk-completed', isKiosk);
});
socket.on('browserWindowSetRepresentedFilename', function (id, filename) {
getWindowById(id).setRepresentedFilename(filename);
});
socket.on('browserWindowGetRepresentedFilename', function (id) {
var pathname = getWindowById(id).getRepresentedFilename();
socket.emit('browserWindow-getRepresentedFilename-completed', pathname);
});
socket.on('browserWindowSetDocumentEdited', function (id, edited) {
getWindowById(id).setDocumentEdited(edited);
});
socket.on('browserWindowIsDocumentEdited', function (id) {
var edited = getWindowById(id).isDocumentEdited();
socket.emit('browserWindow-isDocumentEdited-completed', edited);
});
socket.on('browserWindowFocusOnWebView', function (id) {
getWindowById(id).focusOnWebView();
});
socket.on('browserWindowBlurWebView', function (id) {
getWindowById(id).blurWebView();
});
socket.on('browserWindowLoadURL', function (id, url, options) {
getWindowById(id).loadURL(url, options);
});
socket.on('browserWindowReload', function (id) {
getWindowById(id).reload();
});
socket.on('browserWindowSetMenu', function (id, menuItems) {
var menu = null;
if (menuItems) {
menu = electron_1.Menu.buildFromTemplate(menuItems);
addMenuItemClickConnector(menu.items, function (id) {
socket.emit("windowMenuItemClicked", id);
});
}
getWindowById(id).setMenu(menu);
});
function addMenuItemClickConnector(menuItems, callback) {
menuItems.forEach(function (item) {
if (item.submenu && item.submenu.items.length > 0) {
addMenuItemClickConnector(item.submenu.items, callback);
}
if ("id" in item && item.id) {
item.click = function () { callback(item.id); };
}
});
}
socket.on('browserWindowSetProgressBar', function (id, progress) {
getWindowById(id).setProgressBar(progress);
});
socket.on('browserWindowSetHasShadow', function (id, hasShadow) {
getWindowById(id).setHasShadow(hasShadow);
});
socket.on('browserWindowHasShadow', function (id) {
var hasShadow = getWindowById(id).hasShadow();
socket.emit('browserWindow-hasShadow-completed', hasShadow);
});
socket.on('browserWindowSetThumbarButtons', function (id, thumbarButtons) {
thumbarButtons.forEach(function (thumbarButton) {
var imagePath = path.join(__dirname.replace('api', ''), 'bin', thumbarButton.icon.toString());
thumbarButton.icon = electron_1.nativeImage.createFromPath(imagePath);
thumbarButton.click = function () {
socket.emit("thumbarButtonClicked", thumbarButton["id"]);
};
});
var success = getWindowById(id).setThumbarButtons(thumbarButtons);
socket.emit('browserWindowSetThumbarButtons-completed', success);
});
socket.on('browserWindowSetThumbnailClip', function (id, rectangle) {
getWindowById(id).setThumbnailClip(rectangle);
});
socket.on('browserWindowSetThumbnailToolTip', function (id, toolTip) {
getWindowById(id).setThumbnailToolTip(toolTip);
});
socket.on('browserWindowSetAppDetails', function (id, options) {
getWindowById(id).setAppDetails(options);
});
socket.on('browserWindowShowDefinitionForSelection', function (id) {
getWindowById(id).showDefinitionForSelection();
});
socket.on('browserWindowSetAutoHideMenuBar', function (id, hide) {
getWindowById(id).setAutoHideMenuBar(hide);
});
socket.on('browserWindowIsMenuBarAutoHide', function (id) {
var isMenuBarAutoHide = getWindowById(id).isMenuBarAutoHide();
socket.emit('browserWindow-isMenuBarAutoHide-completed', isMenuBarAutoHide);
});
socket.on('browserWindowSetMenuBarVisibility', function (id, visible) {
getWindowById(id).setMenuBarVisibility(visible);
});
socket.on('browserWindowIsMenuBarVisible', function (id) {
var isMenuBarVisible = getWindowById(id).isMenuBarVisible();
socket.emit('browserWindow-isMenuBarVisible-completed', isMenuBarVisible);
});
socket.on('browserWindowSetVisibleOnAllWorkspaces', function (id, visible) {
getWindowById(id).setVisibleOnAllWorkspaces(visible);
});
socket.on('browserWindowIsVisibleOnAllWorkspaces', function (id) {
var isVisibleOnAllWorkspaces = getWindowById(id).isVisibleOnAllWorkspaces();
socket.emit('browserWindow-isVisibleOnAllWorkspaces-completed', isVisibleOnAllWorkspaces);
});
socket.on('browserWindowSetIgnoreMouseEvents', function (id, ignore) {
getWindowById(id).setIgnoreMouseEvents(ignore);
});
socket.on('browserWindowSetContentProtection', function (id, enable) {
getWindowById(id).setContentProtection(enable);
});
socket.on('browserWindowSetFocusable', function (id, focusable) {
getWindowById(id).setFocusable(focusable);
});
socket.on('browserWindowSetParentWindow', function (id, parent) {
var browserWindow = electron_1.BrowserWindow.fromId(parent.id);
getWindowById(id).setParentWindow(browserWindow);
});
socket.on('browserWindowGetParentWindow', function (id) {
var browserWindow = getWindowById(id).getParentWindow();
socket.emit('browserWindow-getParentWindow-completed', browserWindow.id);
});
socket.on('browserWindowGetChildWindows', function (id) {
var browserWindows = getWindowById(id).getChildWindows();
var ids = [];
browserWindows.forEach(function (x) {
ids.push(x.id);
});
socket.emit('browserWindow-getChildWindows-completed', ids);
});
socket.on('browserWindowSetAutoHideCursor', function (id, autoHide) {
getWindowById(id).setAutoHideCursor(autoHide);
});
socket.on('browserWindowSetVibrancy', function (id, type) {
getWindowById(id).setVibrancy(type);
});
function getWindowById(id) {
for (var index = 0; index < windows.length; index++) {
var 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,51 +0,0 @@
"use strict";
exports.__esModule = true;
var electron_1 = require("electron");
module.exports = function (socket) {
socket.on('clipboard-readText', function (type) {
var text = electron_1.clipboard.readText(type);
socket.emit('clipboard-readText-Completed', text);
});
socket.on('clipboard-writeText', function (text, type) {
electron_1.clipboard.writeText(text, type);
});
socket.on('clipboard-readHTML', function (type) {
var content = electron_1.clipboard.readHTML(type);
socket.emit('clipboard-readHTML-Completed', content);
});
socket.on('clipboard-writeHTML', function (markup, type) {
electron_1.clipboard.writeHTML(markup, type);
});
socket.on('clipboard-readRTF', function (type) {
var content = electron_1.clipboard.readRTF(type);
socket.emit('clipboard-readRTF-Completed', content);
});
socket.on('clipboard-writeRTF', function (text, type) {
electron_1.clipboard.writeHTML(text, type);
});
socket.on('clipboard-readBookmark', function () {
var bookmark = electron_1.clipboard.readBookmark();
socket.emit('clipboard-readBookmark-Completed', bookmark);
});
socket.on('clipboard-writeBookmark', function (title, url, type) {
electron_1.clipboard.writeBookmark(title, url, type);
});
socket.on('clipboard-readFindText', function () {
var content = electron_1.clipboard.readFindText();
socket.emit('clipboard-readFindText-Completed', content);
});
socket.on('clipboard-writeFindText', function (text) {
electron_1.clipboard.writeFindText(text);
});
socket.on('clipboard-clear', function (type) {
electron_1.clipboard.clear(type);
});
socket.on('clipboard-availableFormats', function (type) {
var formats = electron_1.clipboard.availableFormats(type);
socket.emit('clipboard-availableFormats-Completed', formats);
});
socket.on('clipboard-write', function (data, type) {
electron_1.clipboard.write(data, type);
});
};
//# sourceMappingURL=clipboard.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["clipboard.ts"],"names":[],"mappings":";;AAAA,qCAAqC;AAErC,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IAErC,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,UAAC,IAAI;QACjC,IAAM,IAAI,GAAG,oBAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,UAAC,IAAI,EAAE,IAAI;QACxC,oBAAS,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,UAAC,IAAI;QACjC,IAAM,OAAO,GAAG,oBAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,UAAC,MAAM,EAAE,IAAI;QAC1C,oBAAS,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,UAAC,IAAI;QAChC,IAAM,OAAO,GAAG,oBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,UAAC,IAAI,EAAE,IAAI;QACvC,oBAAS,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE;QAChC,IAAM,QAAQ,GAAG,oBAAS,CAAC,YAAY,EAAE,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE,QAAQ,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,UAAC,KAAK,EAAE,GAAG,EAAE,IAAI;QAClD,oBAAS,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE;QAChC,IAAM,OAAO,GAAG,oBAAS,CAAC,YAAY,EAAE,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,UAAC,IAAI;QACtC,oBAAS,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,UAAC,IAAI;QAC9B,oBAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,UAAC,IAAI;QACzC,IAAM,OAAO,GAAG,oBAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACjD,MAAM,CAAC,IAAI,CAAC,sCAAsC,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,UAAC,IAAI,EAAE,IAAI;QACpC,oBAAS,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACP,CAAC,CAAA"}

View File

@@ -1,42 +0,0 @@
"use strict";
exports.__esModule = true;
var electron_1 = require("electron");
module.exports = function (socket) {
socket.on('showMessageBox', function (browserWindow, options, guid) {
if ("id" in browserWindow) {
var window = electron_1.BrowserWindow.fromId(browserWindow.id);
electron_1.dialog.showMessageBox(window, options, function (response, checkboxChecked) {
socket.emit('showMessageBoxComplete' + guid, [response, checkboxChecked]);
});
}
else {
var message = browserWindow;
var id_1 = guid || options;
electron_1.dialog.showMessageBox(browserWindow, function (response, checkboxChecked) {
socket.emit('showMessageBoxComplete' + id_1, [response, checkboxChecked]);
});
}
});
socket.on('showOpenDialog', function (browserWindow, options, guid) {
var window = electron_1.BrowserWindow.fromId(browserWindow.id);
electron_1.dialog.showOpenDialog(window, options, function (filePaths) {
socket.emit('showOpenDialogComplete' + guid, filePaths || []);
});
});
socket.on('showSaveDialog', function (browserWindow, options, guid) {
var window = electron_1.BrowserWindow.fromId(browserWindow.id);
electron_1.dialog.showSaveDialog(window, options, function (filename) {
socket.emit('showSaveDialogComplete' + guid, filename || '');
});
});
socket.on('showErrorBox', function (title, content) {
electron_1.dialog.showErrorBox(title, content);
});
socket.on('showCertificateTrustDialog', function (browserWindow, options, guid) {
var window = electron_1.BrowserWindow.fromId(browserWindow.id);
electron_1.dialog.showCertificateTrustDialog(window, options, function () {
socket.emit('showCertificateTrustDialogComplete' + guid);
});
});
};
//# sourceMappingURL=dialog.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["dialog.ts"],"names":[],"mappings":";;AAAA,qCAAiD;AAEjD,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,UAAC,aAAa,EAAE,OAAO,EAAE,IAAI;QACrD,EAAE,CAAC,CAAC,IAAI,IAAI,aAAa,CAAC,CAAC,CAAC;YACxB,IAAI,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YAEpD,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,UAAC,QAAQ,EAAE,eAAe;gBAC7D,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;YAC9E,CAAC,CAAC,CAAC;QACP,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,IAAI,OAAO,GAAG,aAAa,CAAC;YAC5B,IAAI,IAAE,GAAG,IAAI,IAAI,OAAO,CAAC;YACzB,iBAAM,CAAC,cAAc,CAAC,aAAa,EAAE,UAAC,QAAQ,EAAE,eAAe;gBAC3D,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAE,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;YAC5E,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,UAAC,aAAa,EAAE,OAAO,EAAE,IAAI;QACrD,IAAI,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACpD,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,UAAC,SAAS;YAC7C,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,UAAC,aAAa,EAAE,OAAO,EAAE,IAAI;QACrD,IAAI,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACpD,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,UAAC,QAAQ;YAC5C,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,OAAO;QACrC,iBAAM,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,UAAC,aAAa,EAAE,OAAO,EAAE,IAAI;QACjE,IAAI,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACpD,iBAAM,CAAC,0BAA0B,CAAC,MAAM,EAAE,OAAO,EAAE;YAC/C,MAAM,CAAC,IAAI,CAAC,oCAAoC,GAAG,IAAI,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAA"}

View File

@@ -1,44 +0,0 @@
import { BrowserWindow, dialog } from "electron";
module.exports = (socket: SocketIO.Server) => {
socket.on('showMessageBox', (browserWindow, options, guid) => {
if ("id" in browserWindow) {
var window = BrowserWindow.fromId(browserWindow.id);
dialog.showMessageBox(window, options, (response, checkboxChecked) => {
socket.emit('showMessageBoxComplete' + guid, [response, checkboxChecked]);
});
} else {
var message = browserWindow;
let id = guid || options;
dialog.showMessageBox(browserWindow, (response, checkboxChecked) => {
socket.emit('showMessageBoxComplete' + id, [response, checkboxChecked]);
});
}
});
socket.on('showOpenDialog', (browserWindow, options, guid) => {
var window = BrowserWindow.fromId(browserWindow.id);
dialog.showOpenDialog(window, options, (filePaths) => {
socket.emit('showOpenDialogComplete' + guid, filePaths || []);
});
});
socket.on('showSaveDialog', (browserWindow, options, guid) => {
var window = BrowserWindow.fromId(browserWindow.id);
dialog.showSaveDialog(window, options, (filename) => {
socket.emit('showSaveDialogComplete' + guid, filename || '');
});
});
socket.on('showErrorBox', (title, content) => {
dialog.showErrorBox(title, content);
});
socket.on('showCertificateTrustDialog', (browserWindow, options, guid) => {
var window = BrowserWindow.fromId(browserWindow.id);
dialog.showCertificateTrustDialog(window, options, () => {
socket.emit('showCertificateTrustDialogComplete' + guid);
});
});
}

View File

@@ -1,24 +0,0 @@
"use strict";
exports.__esModule = true;
var electron_1 = require("electron");
module.exports = function (socket) {
socket.on('globalShortcut-register', function (accelerator) {
electron_1.globalShortcut.register(accelerator, function () {
socket.emit('globalShortcut-pressed', accelerator);
});
});
socket.on('globalShortcut-isRegistered', function (accelerator) {
var isRegistered = electron_1.globalShortcut.isRegistered(accelerator);
socket.emit('globalShortcut-isRegisteredCompleted', isRegistered);
});
socket.on('globalShortcut-unregister', function (accelerator) {
electron_1.globalShortcut.unregister(accelerator);
});
socket.on('globalShortcut-unregisterAll', function () {
try {
electron_1.globalShortcut.unregisterAll();
}
catch (error) { }
});
};
//# sourceMappingURL=globalShortcut.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"globalShortcut.js","sourceRoot":"","sources":["globalShortcut.ts"],"names":[],"mappings":";;AAAA,qCAA0C;AAE1C,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,UAAC,WAAW;QAC7C,yBAAc,CAAC,QAAQ,CAAC,WAAW,EAAE;YACjC,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,WAAW,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE,UAAC,WAAW;QACjD,IAAM,YAAY,GAAG,yBAAc,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QAE9D,MAAM,CAAC,IAAI,CAAC,sCAAsC,EAAE,YAAY,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,UAAC,WAAW;QAC/C,yBAAc,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE;QACtC,IAAI,CAAC;YACD,yBAAc,CAAC,aAAa,EAAE,CAAC;QACnC,CAAC;QAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACP,CAAC,CAAA"}

View File

@@ -1,40 +0,0 @@
"use strict";
exports.__esModule = true;
var electron_1 = require("electron");
module.exports = function (socket) {
socket.on('registerIpcMainChannel', function (channel) {
electron_1.ipcMain.on(channel, function (event, args) {
socket.emit(channel, [event.preventDefault(), args]);
});
});
socket.on('registerSyncIpcMainChannel', function (channel) {
electron_1.ipcMain.on(channel, function (event, args) {
var x = socket;
x.removeAllListeners(channel + 'Sync');
socket.on(channel + 'Sync', function (result) {
event.returnValue = result;
});
socket.emit(channel, [event.preventDefault(), args]);
});
});
socket.on('registerOnceIpcMainChannel', function (channel) {
electron_1.ipcMain.once(channel, function (event, args) {
socket.emit(channel, [event.preventDefault(), args]);
});
});
socket.on('removeAllListenersIpcMainChannel', function (channel) {
electron_1.ipcMain.removeAllListeners(channel);
});
socket.on('sendToIpcRenderer', function (browserWindow, channel) {
var data = [];
for (var _i = 2; _i < arguments.length; _i++) {
data[_i - 2] = arguments[_i];
}
var window = electron_1.BrowserWindow.fromId(browserWindow.id);
if (window) {
(_a = window.webContents).send.apply(_a, [channel].concat(data));
}
var _a;
});
};
//# sourceMappingURL=ipc.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"ipc.js","sourceRoot":"","sources":["ipc.ts"],"names":[],"mappings":";;AAAA,qCAAkD;AAElD,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,UAAC,OAAO;QACxC,kBAAO,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,KAAK,EAAE,IAAI;YAC5B,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,UAAC,OAAO;QAC5C,kBAAO,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,KAAK,EAAE,IAAI;YAC5B,IAAI,CAAC,GAAQ,MAAM,CAAC;YACpB,CAAC,CAAC,kBAAkB,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;YACvC,MAAM,CAAC,EAAE,CAAC,OAAO,GAAG,MAAM,EAAE,UAAC,MAAM;gBAC/B,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC;YAC/B,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,UAAC,OAAO;QAC5C,kBAAO,CAAC,IAAI,CAAC,OAAO,EAAE,UAAC,KAAK,EAAE,IAAI;YAC9B,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,kCAAkC,EAAE,UAAC,OAAO;QAClD,kBAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,UAAC,aAAa,EAAE,OAAO;QAAE,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,6BAAO;;QAC3D,IAAM,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QAEtD,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACT,CAAA,KAAA,MAAM,CAAC,WAAW,CAAA,CAAC,IAAI,YAAC,OAAO,SAAK,IAAI,GAAE;QAC9C,CAAC;;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAA"}

View File

@@ -1,39 +0,0 @@
import { ipcMain, BrowserWindow } from 'electron';
module.exports = (socket: SocketIO.Server) => {
socket.on('registerIpcMainChannel', (channel) => {
ipcMain.on(channel, (event, args) => {
socket.emit(channel, [event.preventDefault(), args]);
});
});
socket.on('registerSyncIpcMainChannel', (channel) => {
ipcMain.on(channel, (event, args) => {
let x = <any>socket;
x.removeAllListeners(channel + 'Sync');
socket.on(channel + 'Sync', (result) => {
event.returnValue = result;
});
socket.emit(channel, [event.preventDefault(), args]);
});
});
socket.on('registerOnceIpcMainChannel', (channel) => {
ipcMain.once(channel, (event, args) => {
socket.emit(channel, [event.preventDefault(), args]);
});
});
socket.on('removeAllListenersIpcMainChannel', (channel) => {
ipcMain.removeAllListeners(channel);
});
socket.on('sendToIpcRenderer', (browserWindow, channel, ...data) => {
const window = BrowserWindow.fromId(browserWindow.id);
if (window) {
window.webContents.send(channel, ...data);
}
});
}

View File

@@ -1,52 +0,0 @@
"use strict";
exports.__esModule = true;
var electron_1 = require("electron");
var contextMenuItems = [];
module.exports = function (socket) {
socket.on('menu-setContextMenu', function (browserWindowId, menuItems) {
var menu = electron_1.Menu.buildFromTemplate(menuItems);
addContextMenuItemClickConnector(menu.items, browserWindowId, function (id, browserWindowId) {
socket.emit("contextMenuItemClicked", [id, browserWindowId]);
});
contextMenuItems.push({
menu: menu,
browserWindowId: browserWindowId
});
});
function addContextMenuItemClickConnector(menuItems, browserWindowId, callback) {
menuItems.forEach(function (item) {
if (item.submenu && item.submenu.items.length > 0) {
addContextMenuItemClickConnector(item.submenu.items, browserWindowId, callback);
}
if ("id" in item && item.id) {
item.click = function () { callback(item.id, browserWindowId); };
}
});
}
socket.on('menu-contextMenuPopup', function (browserWindowId) {
contextMenuItems.forEach(function (x) {
if (x.browserWindowId === browserWindowId) {
var browserWindow = electron_1.BrowserWindow.fromId(browserWindowId);
x.menu.popup(browserWindow);
}
});
});
socket.on('menu-setApplicationMenu', function (menuItems) {
var menu = electron_1.Menu.buildFromTemplate(menuItems);
addMenuItemClickConnector(menu.items, function (id) {
socket.emit("menuItemClicked", id);
});
electron_1.Menu.setApplicationMenu(menu);
});
function addMenuItemClickConnector(menuItems, callback) {
menuItems.forEach(function (item) {
if (item.submenu && item.submenu.items.length > 0) {
addMenuItemClickConnector(item.submenu.items, callback);
}
if ("id" in item && item.id) {
item.click = function () { callback(item.id); };
}
});
}
};
//# sourceMappingURL=menu.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"menu.js","sourceRoot":"","sources":["menu.ts"],"names":[],"mappings":";;AAAA,qCAA+C;AAC/C,IAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,UAAC,eAAe,EAAE,SAAS;QACxD,IAAM,IAAI,GAAG,eAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAE/C,gCAAgC,CAAC,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,UAAC,EAAE,EAAE,eAAe;YAC9E,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,gBAAgB,CAAC,IAAI,CAAC;YAClB,IAAI,EAAE,IAAI;YACV,eAAe,EAAE,eAAe;SACnC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,0CAA0C,SAAS,EAAE,eAAe,EAAE,QAAQ;QAC1E,SAAS,CAAC,OAAO,CAAC,UAAC,IAAI;YACnB,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;gBAChD,gCAAgC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;YACpF,CAAC;YAED,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC1B,IAAI,CAAC,KAAK,GAAG,cAAQ,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/D,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,UAAC,eAAe;QAC/C,gBAAgB,CAAC,OAAO,CAAC,UAAA,CAAC;YACtB,EAAE,CAAA,CAAC,CAAC,CAAC,eAAe,KAAK,eAAe,CAAC,CAAC,CAAC;gBACvC,IAAI,aAAa,GAAG,wBAAa,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;gBAC1D,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAChC,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,UAAC,SAAS;QAC3C,IAAM,IAAI,GAAG,eAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAE/C,yBAAyB,CAAC,IAAI,CAAC,KAAK,EAAE,UAAC,EAAE;YACrC,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QAEH,eAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,mCAAmC,SAAS,EAAE,QAAQ;QAClD,SAAS,CAAC,OAAO,CAAC,UAAC,IAAI;YACnB,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;gBAChD,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YAC5D,CAAC;YAED,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC1B,IAAI,CAAC,KAAK,GAAG,cAAQ,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9C,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAA"}

View File

@@ -1,49 +0,0 @@
"use strict";
exports.__esModule = true;
var electron_1 = require("electron");
var notifications = [];
module.exports = function (socket) {
socket.on('createNotification', function (options) {
var notification = new electron_1.Notification(options);
var haveEvent = false;
if (options.showID) {
haveEvent = true;
notification.on('show', function () {
socket.emit('NotificationEventShow', options.showID);
});
}
if (options.clickID) {
haveEvent = true;
notification.on('click', function () {
socket.emit('NotificationEventClick', options.clickID);
});
}
if (options.closeID) {
haveEvent = true;
notification.on('close', function () {
socket.emit('NotificationEventClose', options.closeID);
});
}
if (options.replyID) {
haveEvent = true;
notification.on('reply', function (event, value) {
socket.emit('NotificationEventReply', [options.replyID, value]);
});
}
if (options.actionID) {
haveEvent = true;
notification.on('action', function (event, value) {
socket.emit('NotificationEventAction', [options.actionID, value]);
});
}
if (haveEvent) {
notifications.push(notification);
}
notification.show();
});
socket.on('notificationIsSupported', function (options) {
var isSupported = electron_1.Notification.isSupported;
socket.emit('notificationIsSupportedComplete', isSupported);
});
};
//# sourceMappingURL=notification.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"notification.js","sourceRoot":"","sources":["notification.ts"],"names":[],"mappings":";;AAAA,qCAAwC;AACxC,IAAM,aAAa,GAA4B,EAAE,CAAC;AAElD,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,UAAC,OAAO;QACpC,IAAM,YAAY,GAAG,IAAI,uBAAY,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,SAAS,GAAG,KAAK,CAAC;QAEtB,EAAE,CAAA,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;YAChB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE;gBACpB,MAAM,CAAC,IAAI,CAAC,uBAAuB,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YACzD,CAAC,CAAC,CAAC;QACP,CAAC;QAED,EAAE,CAAA,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;YACjB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE;gBACrB,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YAC3D,CAAC,CAAC,CAAC;QACP,CAAC;QAED,EAAE,CAAA,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;YACjB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE;gBACrB,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YAC3D,CAAC,CAAC,CAAC;QACP,CAAC;QAED,EAAE,CAAA,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;YACjB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,KAAK,EAAE,KAAK;gBAClC,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;YACpE,CAAC,CAAC,CAAC;QACP,CAAC;QAED,EAAE,CAAA,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;YAClB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAC,KAAK,EAAE,KAAK;gBACnC,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;YACtE,CAAC,CAAC,CAAC;QACP,CAAC;QAED,EAAE,CAAA,CAAC,SAAS,CAAC,CAAC,CAAC;YACX,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACrC,CAAC;QAED,YAAY,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,UAAC,OAAO;QACzC,IAAM,WAAW,GAAG,uBAAY,CAAC,WAAW,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,iCAAiC,EAAE,WAAW,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACP,CAAC,CAAA"}

View File

@@ -1,55 +0,0 @@
import { Notification } from "electron";
const notifications: Electron.Notification[] = [];
module.exports = (socket: SocketIO.Server) => {
socket.on('createNotification', (options) => {
const notification = new Notification(options);
let haveEvent = false;
if(options.showID) {
haveEvent = true;
notification.on('show', () => {
socket.emit('NotificationEventShow', options.showID);
});
}
if(options.clickID) {
haveEvent = true;
notification.on('click', () => {
socket.emit('NotificationEventClick', options.clickID);
});
}
if(options.closeID) {
haveEvent = true;
notification.on('close', () => {
socket.emit('NotificationEventClose', options.closeID);
});
}
if(options.replyID) {
haveEvent = true;
notification.on('reply', (event, value) => {
socket.emit('NotificationEventReply', [options.replyID, value]);
});
}
if(options.actionID) {
haveEvent = true;
notification.on('action', (event, value) => {
socket.emit('NotificationEventAction', [options.actionID, value]);
});
}
if(haveEvent) {
notifications.push(notification);
}
notification.show();
});
socket.on('notificationIsSupported', (options) => {
const isSupported = Notification.isSupported;
socket.emit('notificationIsSupportedComplete', isSupported);
});
}

View File

@@ -1,45 +0,0 @@
"use strict";
exports.__esModule = true;
var electron_1 = require("electron");
module.exports = function (socket) {
socket.on('register-screen-display-added', function (id) {
electron_1.screen.on('display-added', function (event, display) {
socket.emit('screen-display-added-event' + id, display);
});
});
socket.on('register-screen-display-removed', function (id) {
electron_1.screen.on('display-removed', function (event, display) {
socket.emit('screen-display-removed-event' + id, display);
});
});
socket.on('register-screen-display-metrics-changed', function (id) {
electron_1.screen.on('display-metrics-changed', function (event, display, changedMetrics) {
socket.emit('screen-display-metrics-changed-event' + id, [display, changedMetrics]);
});
});
socket.on('screen-getCursorScreenPoint', function () {
var point = electron_1.screen.getCursorScreenPoint();
socket.emit('screen-getCursorScreenPointCompleted', point);
});
socket.on('screen-getMenuBarHeight', function () {
var height = electron_1.screen.getMenuBarHeight();
socket.emit('screen-getMenuBarHeightCompleted', height);
});
socket.on('screen-getPrimaryDisplay', function () {
var display = electron_1.screen.getPrimaryDisplay();
socket.emit('screen-getPrimaryDisplayCompleted', display);
});
socket.on('screen-getAllDisplays', function () {
var display = electron_1.screen.getAllDisplays();
socket.emit('screen-getAllDisplaysCompleted', display);
});
socket.on('screen-getDisplayNearestPoint', function (point) {
var display = electron_1.screen.getDisplayNearestPoint(point);
socket.emit('screen-getDisplayNearestPointCompleted', display);
});
socket.on('screen-getDisplayMatching', function (rectangle) {
var display = electron_1.screen.getDisplayMatching(rectangle);
socket.emit('screen-getDisplayMatchingCompleted', display);
});
};
//# sourceMappingURL=screen.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"screen.js","sourceRoot":"","sources":["screen.ts"],"names":[],"mappings":";;AAAA,qCAAkC;AAElC,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,+BAA+B,EAAE,UAAC,EAAE;QAC1C,iBAAM,CAAC,EAAE,CAAC,eAAe,EAAE,UAAC,KAAK,EAAE,OAAO;YACtC,MAAM,CAAC,IAAI,CAAC,4BAA4B,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iCAAiC,EAAE,UAAC,EAAE;QAC5C,iBAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,UAAC,KAAK,EAAE,OAAO;YACxC,MAAM,CAAC,IAAI,CAAC,8BAA8B,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yCAAyC,EAAE,UAAC,EAAE;QACpD,iBAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,UAAC,KAAK,EAAE,OAAO,EAAE,cAAc;YAChE,MAAM,CAAC,IAAI,CAAC,sCAAsC,GAAG,EAAE,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;QACxF,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE;QACrC,IAAI,KAAK,GAAG,iBAAM,CAAC,oBAAoB,EAAE,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE;QACjC,IAAI,MAAM,GAAG,iBAAM,CAAC,gBAAgB,EAAE,CAAC;QACvC,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,0BAA0B,EAAE;QAClC,IAAI,OAAO,GAAG,iBAAM,CAAC,iBAAiB,EAAE,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,mCAAmC,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE;QAC/B,IAAI,OAAO,GAAG,iBAAM,CAAC,cAAc,EAAE,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,+BAA+B,EAAE,UAAC,KAAK;QAC7C,IAAI,OAAO,GAAG,iBAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;QACnD,MAAM,CAAC,IAAI,CAAC,wCAAwC,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,UAAC,SAAS;QAC7C,IAAI,OAAO,GAAG,iBAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACnD,MAAM,CAAC,IAAI,CAAC,oCAAoC,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACP,CAAC,CAAA"}

View File

@@ -1,51 +0,0 @@
import { screen } from "electron";
module.exports = (socket: SocketIO.Server) => {
socket.on('register-screen-display-added', (id) => {
screen.on('display-added', (event, display) => {
socket.emit('screen-display-added-event' + id, display);
});
});
socket.on('register-screen-display-removed', (id) => {
screen.on('display-removed', (event, display) => {
socket.emit('screen-display-removed-event' + id, display);
});
});
socket.on('register-screen-display-metrics-changed', (id) => {
screen.on('display-metrics-changed', (event, display, changedMetrics) => {
socket.emit('screen-display-metrics-changed-event' + id, [display, changedMetrics]);
});
});
socket.on('screen-getCursorScreenPoint', () => {
var point = screen.getCursorScreenPoint();
socket.emit('screen-getCursorScreenPointCompleted', point);
});
socket.on('screen-getMenuBarHeight', () => {
var height = screen.getMenuBarHeight();
socket.emit('screen-getMenuBarHeightCompleted', height);
});
socket.on('screen-getPrimaryDisplay', () => {
var display = screen.getPrimaryDisplay();
socket.emit('screen-getPrimaryDisplayCompleted', display);
});
socket.on('screen-getAllDisplays', () => {
var display = screen.getAllDisplays();
socket.emit('screen-getAllDisplaysCompleted', display);
});
socket.on('screen-getDisplayNearestPoint', (point) => {
var display = screen.getDisplayNearestPoint(point);
socket.emit('screen-getDisplayNearestPointCompleted', display);
});
socket.on('screen-getDisplayMatching', (rectangle) => {
var display = screen.getDisplayMatching(rectangle);
socket.emit('screen-getDisplayMatchingCompleted', display);
});
}

View File

@@ -1,44 +0,0 @@
"use strict";
exports.__esModule = true;
var electron_1 = require("electron");
module.exports = function (socket) {
socket.on('shell-showItemInFolder', function (fullPath) {
var success = electron_1.shell.showItemInFolder(fullPath);
socket.emit('shell-showItemInFolderCompleted', success);
});
socket.on('shell-openItem', function (fullPath) {
var success = electron_1.shell.openItem(fullPath);
socket.emit('shell-openItemCompleted', success);
});
socket.on('shell-openExternal', function (url, options, callback) {
var success = false;
if (options && callback) {
success = electron_1.shell.openExternal(url, options, function (error) {
socket.emit('shell-openExternalCallback', [url, error]);
});
}
else if (options) {
success = electron_1.shell.openExternal(url, options);
}
else {
success = electron_1.shell.openExternal(url);
}
socket.emit('shell-openExternalCompleted', success);
});
socket.on('shell-moveItemToTrash', function (fullPath) {
var success = electron_1.shell.moveItemToTrash(fullPath);
socket.emit('shell-moveItemToTrashCompleted', success);
});
socket.on('shell-beep', function () {
electron_1.shell.beep();
});
socket.on('shell-writeShortcutLink', function (shortcutPath, operation, options) {
var success = electron_1.shell.writeShortcutLink(shortcutPath, operation, options);
socket.emit('shell-writeShortcutLinkCompleted', success);
});
socket.on('shell-readShortcutLink', function (shortcutPath) {
var shortcutDetails = electron_1.shell.readShortcutLink(shortcutPath);
socket.emit('shell-readShortcutLinkCompleted', shortcutDetails);
});
};
//# sourceMappingURL=shell.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"shell.js","sourceRoot":"","sources":["shell.ts"],"names":[],"mappings":";;AAAA,qCAAiC;AAEjC,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,UAAC,QAAQ;QACzC,IAAM,OAAO,GAAG,gBAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAEjD,MAAM,CAAC,IAAI,CAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,UAAC,QAAQ;QACjC,IAAM,OAAO,GAAG,gBAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAEzC,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,UAAC,GAAG,EAAE,OAAO,EAAE,QAAQ;QACnD,IAAI,OAAO,GAAG,KAAK,CAAC;QAEpB,EAAE,CAAC,CAAC,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC;YACtB,OAAO,GAAG,gBAAK,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,UAAC,KAAK;gBAC7C,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YAC5D,CAAC,CAAC,CAAC;QACP,CAAC;QAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YACjB,OAAO,GAAG,gBAAK,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,OAAO,GAAG,gBAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QACtC,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,UAAC,QAAQ;QACxC,IAAM,OAAO,GAAG,gBAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAEhD,MAAM,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE;QACpB,gBAAK,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,UAAC,YAAY,EAAE,SAAS,EAAE,OAAO;QAClE,IAAM,OAAO,GAAG,gBAAK,CAAC,iBAAiB,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAE1E,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,UAAC,YAAY;QAC7C,IAAM,eAAe,GAAG,gBAAK,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QAE7D,MAAM,CAAC,IAAI,CAAC,iCAAiC,EAAE,eAAe,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACP,CAAC,CAAA"}

View File

@@ -1,53 +0,0 @@
import { shell } from "electron";
module.exports = (socket: SocketIO.Server) => {
socket.on('shell-showItemInFolder', (fullPath) => {
const success = shell.showItemInFolder(fullPath);
socket.emit('shell-showItemInFolderCompleted', success);
});
socket.on('shell-openItem', (fullPath) => {
const success = shell.openItem(fullPath);
socket.emit('shell-openItemCompleted', success);
});
socket.on('shell-openExternal', (url, options, callback) => {
let success = false;
if (options && callback) {
success = shell.openExternal(url, options, (error) => {
socket.emit('shell-openExternalCallback', [url, error]);
});
} else if (options) {
success = shell.openExternal(url, options);
} else {
success = shell.openExternal(url);
}
socket.emit('shell-openExternalCompleted', success);
});
socket.on('shell-moveItemToTrash', (fullPath) => {
const success = shell.moveItemToTrash(fullPath);
socket.emit('shell-moveItemToTrashCompleted', success);
});
socket.on('shell-beep', () => {
shell.beep();
});
socket.on('shell-writeShortcutLink', (shortcutPath, operation, options) => {
const success = shell.writeShortcutLink(shortcutPath, operation, options);
socket.emit('shell-writeShortcutLinkCompleted', success);
});
socket.on('shell-readShortcutLink', (shortcutPath) => {
const shortcutDetails = shell.readShortcutLink(shortcutPath);
socket.emit('shell-readShortcutLinkCompleted', shortcutDetails);
});
}

View File

@@ -1,111 +0,0 @@
"use strict";
exports.__esModule = true;
var electron_1 = require("electron");
var path = require('path');
var tray;
module.exports = function (socket) {
socket.on('register-tray-click', function (id) {
if (tray) {
tray.on('click', function (event, bounds) {
socket.emit('tray-click-event' + id, [event.__proto__, bounds]);
});
}
});
socket.on('register-tray-right-click', function (id) {
if (tray) {
tray.on('right-click', function (event, bounds) {
socket.emit('tray-right-click-event' + id, [event.__proto__, bounds]);
});
}
});
socket.on('register-tray-double-click', function (id) {
if (tray) {
tray.on('double-click', function (event, bounds) {
socket.emit('tray-double-click-event' + id, [event.__proto__, bounds]);
});
}
});
socket.on('register-tray-balloon-show', function (id) {
if (tray) {
tray.on('balloon-show', function () {
socket.emit('tray-balloon-show-event' + id);
});
}
});
socket.on('register-tray-balloon-click', function (id) {
if (tray) {
tray.on('balloon-click', function () {
socket.emit('tray-balloon-click-event' + id);
});
}
});
socket.on('register-tray-balloon-closed', function (id) {
if (tray) {
tray.on('balloon-closed', function () {
socket.emit('tray-balloon-closed-event' + id);
});
}
});
socket.on('create-tray', function (image, menuItems) {
var menu = electron_1.Menu.buildFromTemplate(menuItems);
addMenuItemClickConnector(menu.items, function (id) {
socket.emit("trayMenuItemClicked", id);
});
var imagePath = path.join(__dirname.replace('api', ''), 'bin', image);
tray = new electron_1.Tray(imagePath);
tray.setContextMenu(menu);
});
socket.on('tray-destroy', function () {
if (tray) {
tray.destroy();
}
});
socket.on('tray-setImage', function (image) {
if (tray) {
tray.setImage(image);
}
});
socket.on('tray-setPressedImage', function (image) {
if (tray) {
var img = electron_1.nativeImage.createFromPath(image);
tray.setPressedImage(img);
}
});
socket.on('tray-setToolTip', function (toolTip) {
if (tray) {
tray.setToolTip(toolTip);
}
});
socket.on('tray-setTitle', function (title) {
if (tray) {
tray.setTitle(title);
}
});
socket.on('tray-setHighlightMode', function (mode) {
if (tray) {
tray.setHighlightMode(mode);
}
});
socket.on('tray-displayBalloon', function (options) {
if (tray) {
tray.displayBalloon(options);
}
});
socket.on('tray-isDestroyed', function () {
if (tray) {
var isDestroyed = tray.isDestroyed();
socket.emit('tray-isDestroyedCompleted', isDestroyed);
}
});
function addMenuItemClickConnector(menuItems, callback) {
menuItems.forEach(function (item) {
if (item.submenu && item.submenu.items.length > 0) {
addMenuItemClickConnector(item.submenu.items, callback);
}
if ("id" in item && item.id) {
item.click = function () { callback(item.id); };
}
});
}
};
//# sourceMappingURL=tray.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"tray.js","sourceRoot":"","sources":["tray.ts"],"names":[],"mappings":";;AAAA,qCAAmD;AACnD,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAI,IAAmB,CAAC;AAExB,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,UAAC,EAAE;QAChC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,KAAK,EAAE,MAAM;gBAC3B,MAAM,CAAC,IAAI,CAAC,kBAAkB,GAAG,EAAE,EAAE,CAAO,KAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YAC3E,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,UAAC,EAAE;QACtC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,UAAC,KAAK,EAAE,MAAM;gBACjC,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,EAAE,EAAE,CAAO,KAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YACjF,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,UAAC,EAAE;QACvC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,MAAM;gBAClC,MAAM,CAAC,IAAI,CAAC,yBAAyB,GAAG,EAAE,EAAE,CAAO,KAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YAClF,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,UAAC,EAAE;QACvC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE;gBACpB,MAAM,CAAC,IAAI,CAAC,yBAAyB,GAAG,EAAE,CAAC,CAAC;YAChD,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE,UAAC,EAAE;QACxC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,eAAe,EAAE;gBACrB,MAAM,CAAC,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC,CAAC;YACjD,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,UAAC,EAAE;QACzC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,gBAAgB,EAAE;gBACtB,MAAM,CAAC,IAAI,CAAC,2BAA2B,GAAG,EAAE,CAAC,CAAC;YAClD,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,aAAa,EAAE,UAAC,KAAK,EAAE,SAAS;QACtC,IAAM,IAAI,GAAG,eAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAE/C,yBAAyB,CAAC,IAAI,CAAC,KAAK,EAAE,UAAC,EAAE;YACrC,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;QAEH,IAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAExE,IAAI,GAAG,IAAI,eAAI,CAAC,SAAS,CAAC,CAAC;QAC3B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE;QACtB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,eAAe,EAAE,UAAC,KAAK;QAC7B,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,sBAAsB,EAAE,UAAC,KAAK;QACpC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,GAAG,GAAG,sBAAW,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YAC5C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,UAAC,OAAO;QACjC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,eAAe,EAAE,UAAC,KAAK;QAC7B,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,UAAC,IAAI;QACpC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,UAAC,OAAO;QACrC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,kBAAkB,EAAE;QAC1B,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YACrC,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE,WAAW,CAAC,CAAC;QAC1D,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,mCAAmC,SAAS,EAAE,QAAQ;QAClD,SAAS,CAAC,OAAO,CAAC,UAAC,IAAI;YACnB,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;gBAChD,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YAC5D,CAAC;YAED,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC1B,IAAI,CAAC,KAAK,GAAG,cAAQ,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9C,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAA"}

View File

@@ -1,128 +0,0 @@
import { Menu, Tray, nativeImage } from "electron";
const path = require('path');
let tray: Electron.Tray;
module.exports = (socket: SocketIO.Server) => {
socket.on('register-tray-click', (id) => {
if (tray) {
tray.on('click', (event, bounds) => {
socket.emit('tray-click-event' + id, [(<any>event).__proto__, bounds]);
});
}
});
socket.on('register-tray-right-click', (id) => {
if (tray) {
tray.on('right-click', (event, bounds) => {
socket.emit('tray-right-click-event' + id, [(<any>event).__proto__, bounds]);
});
}
});
socket.on('register-tray-double-click', (id) => {
if (tray) {
tray.on('double-click', (event, bounds) => {
socket.emit('tray-double-click-event' + id, [(<any>event).__proto__, bounds]);
});
}
});
socket.on('register-tray-balloon-show', (id) => {
if (tray) {
tray.on('balloon-show', () => {
socket.emit('tray-balloon-show-event' + id);
});
}
});
socket.on('register-tray-balloon-click', (id) => {
if (tray) {
tray.on('balloon-click', () => {
socket.emit('tray-balloon-click-event' + id);
});
}
});
socket.on('register-tray-balloon-closed', (id) => {
if (tray) {
tray.on('balloon-closed', () => {
socket.emit('tray-balloon-closed-event' + id);
});
}
});
socket.on('create-tray', (image, menuItems) => {
const menu = Menu.buildFromTemplate(menuItems);
addMenuItemClickConnector(menu.items, (id) => {
socket.emit("trayMenuItemClicked", id);
});
const imagePath = path.join(__dirname.replace('api', ''), 'bin', image);
tray = new Tray(imagePath);
tray.setContextMenu(menu);
});
socket.on('tray-destroy', () => {
if (tray) {
tray.destroy();
}
});
socket.on('tray-setImage', (image) => {
if (tray) {
tray.setImage(image);
}
});
socket.on('tray-setPressedImage', (image) => {
if (tray) {
let img = nativeImage.createFromPath(image);
tray.setPressedImage(img);
}
});
socket.on('tray-setToolTip', (toolTip) => {
if (tray) {
tray.setToolTip(toolTip);
}
});
socket.on('tray-setTitle', (title) => {
if (tray) {
tray.setTitle(title);
}
});
socket.on('tray-setHighlightMode', (mode) => {
if (tray) {
tray.setHighlightMode(mode);
}
});
socket.on('tray-displayBalloon', (options) => {
if (tray) {
tray.displayBalloon(options);
}
});
socket.on('tray-isDestroyed', () => {
if (tray) {
let isDestroyed = tray.isDestroyed();
socket.emit('tray-isDestroyedCompleted', isDestroyed);
}
});
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); };
}
});
}
}

View File

@@ -1,47 +0,0 @@
"use strict";
exports.__esModule = true;
var electron_1 = require("electron");
var fs = require('fs');
module.exports = function (socket) {
socket.on('register-webContents-crashed', function (id) {
var browserWindow = getWindowById(id);
browserWindow.webContents.removeAllListeners('crashed');
browserWindow.webContents.on('crashed', function (event, killed) {
socket.emit('webContents-crashed' + id, killed);
});
});
socket.on('register-webContents-didFinishLoad', function (id) {
var browserWindow = getWindowById(id);
browserWindow.webContents.removeAllListeners('did-finish-load');
browserWindow.webContents.on('did-finish-load', function () {
socket.emit('webContents-didFinishLoad' + id);
});
});
socket.on('webContentsOpenDevTools', function (id, options) {
if (options) {
getWindowById(id).webContents.openDevTools(options);
}
else {
getWindowById(id).webContents.openDevTools();
}
});
socket.on('webContents-printToPDF', function (id, options, path) {
getWindowById(id).webContents.printToPDF(options || {}, function (error, data) {
if (error) {
throw error;
}
fs.writeFile(path, data, function (error) {
if (error) {
socket.emit('webContents-printToPDF-completed', false);
}
else {
socket.emit('webContents-printToPDF-completed', true);
}
});
});
});
function getWindowById(id) {
return electron_1.BrowserWindow.fromId(id);
}
};
//# sourceMappingURL=webContents.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"webContents.js","sourceRoot":"","sources":["webContents.ts"],"names":[],"mappings":";;AAAA,qCAAyC;AACzC,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzB,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,UAAC,EAAE;QACzC,IAAI,aAAa,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;QAEtC,aAAa,CAAC,WAAW,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACxD,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,UAAC,KAAK,EAAE,MAAM;YAClD,MAAM,CAAC,IAAI,CAAC,qBAAqB,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oCAAoC,EAAE,UAAC,EAAE;QAC/C,IAAI,aAAa,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;QAEtC,aAAa,CAAC,WAAW,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;QAChE,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC,iBAAiB,EAAE;YAC5C,MAAM,CAAC,IAAI,CAAC,2BAA2B,GAAG,EAAE,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,UAAC,EAAE,EAAE,OAAO;QAC7C,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YACV,aAAa,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACxD,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,aAAa,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC;QACjD,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,UAAC,EAAE,EAAE,OAAO,EAAE,IAAI;QAClD,aAAa,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,IAAI,EAAE,EAAE,UAAC,KAAK,EAAE,IAAI;YAChE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,MAAM,KAAK,CAAC;YAChB,CAAC;YAED,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,UAAC,KAAK;gBAC7B,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;oBACV,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;gBACzD,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACN,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE,IAAI,CAAC,CAAC;gBACxD,CAAC;YACH,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,uBAAuB,EAAU;QAC7B,MAAM,CAAC,wBAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;AACL,CAAC,CAAC"}

View File

@@ -1,50 +0,0 @@
import { BrowserWindow } from 'electron';
const fs = require('fs');
module.exports = (socket: SocketIO.Server) => {
socket.on('register-webContents-crashed', (id) => {
var browserWindow = getWindowById(id);
browserWindow.webContents.removeAllListeners('crashed');
browserWindow.webContents.on('crashed', (event, killed) => {
socket.emit('webContents-crashed' + id, killed);
});
});
socket.on('register-webContents-didFinishLoad', (id) => {
let browserWindow = getWindowById(id);
browserWindow.webContents.removeAllListeners('did-finish-load');
browserWindow.webContents.on('did-finish-load', () => {
socket.emit('webContents-didFinishLoad' + id);
});
});
socket.on('webContentsOpenDevTools', (id, options) => {
if (options) {
getWindowById(id).webContents.openDevTools(options);
} else {
getWindowById(id).webContents.openDevTools();
}
});
socket.on('webContents-printToPDF', (id, options, path) => {
getWindowById(id).webContents.printToPDF(options || {}, (error, data) => {
if (error) {
throw error;
}
fs.writeFile(path, data, (error) => {
if (error) {
socket.emit('webContents-printToPDF-completed', false);
} else {
socket.emit('webContents-printToPDF-completed', true);
}
});
});
});
function getWindowById(id: number): Electron.BrowserWindow {
return BrowserWindow.fromId(id);
}
};

View File

@@ -1,3 +0,0 @@
{
"executable": "{{executable}}"
}

View File

@@ -1,67 +0,0 @@
const { app } = require('electron');
const fs = require('fs');
const path = require('path');
const process = require('child_process').spawn;
const portfinder = require('detect-port');
let io, browserWindows, ipc, apiProcess, loadURL;
let appApi, menu, dialog, notification, tray, webContents;
let globalShortcut, shell, screen, clipboard;
app.on('ready', () => {
portfinder(8000, (error, port) => {
startSocketApiBridge(port);
});
});
function startSocketApiBridge(port) {
io = require('socket.io')(port);
startAspCoreBackend(port);
io.on('connection', (socket) => {
console.log('ASP.NET Core Application connected...');
appApi = require('./api/app')(socket, app);
browserWindows = require('./api/browserWindows')(socket);
ipc = require('./api/ipc')(socket);
menu = require('./api/menu')(socket);
dialog = require('./api/dialog')(socket);
notification = require('./api/notification')(socket);
tray = require('./api/tray')(socket);
webContents = require('./api/webContents')(socket);
globalShortcut = require('./api/globalShortcut')(socket);
shell = require('./api/shell')(socket);
screen = require('./api/screen')(socket);
clipboard = require('./api/clipboard')(socket);
});
}
function startAspCoreBackend(electronPort) {
portfinder(8000, (error, electronWebPort) => {
loadURL = `http://localhost:${electronWebPort}`
const parameters = [`/electronPort=${electronPort}`, `/electronWebPort=${electronWebPort}`];
const manifestFile = require("./bin/electron.manifest.json");
let binaryFile = manifestFile.executable;
const os = require("os");
if(os.platform() === "win32") {
binaryFile = binaryFile + '.exe';
}
const binFilePath = path.join(__dirname, 'bin', binaryFile);
apiProcess = process(binFilePath, parameters);
apiProcess.stdout.on('data', (data) => {
var text = data.toString();
console.log(`stdout: ${data.toString()}`);
});
});
}
//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 (win === null) {
// createWindow();
// }
//});

File diff suppressed because it is too large Load Diff

View File

@@ -1,21 +0,0 @@
{
"name": "ElectronNET.Host",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"detect-port": "^1.2.1",
"electron": "^1.7.11",
"socket.io": "^2.0.3"
},
"devDependencies": {
"@types/electron": "^1.6.10",
"@types/socket.io": "^1.4.31"
}
}

View File

@@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace ElectronNET.WebApp.Controllers
{
public class AboutController : Controller
{
public IActionResult Index()
{
return View();
}
}
}

View File

@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Controllers\ManageWindowsController.cs" />
</ItemGroup>
<ItemGroup>
<Content Remove="Views\Windows\HandleErrorCrashes.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Assets\" />
<Folder Include="wwwroot\assets\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ElectronNET.API" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="ElectronNET.CLI" Version="*" />
</ItemGroup>
<ItemGroup>
<None Update="Assets\electron.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Assets\electron_32x32.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Update="electron.manifest.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View File

@@ -1,68 +0,0 @@
using ElectronNET.API;
using ElectronNET.API.Entities;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
namespace ElectronNET.WebApp
{
public class Startup
{
public IConfiguration Configuration { get; }
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
if(HybridSupport.IsElectronActive)
{
ElectronBootstrap();
}
}
public async void ElectronBootstrap()
{
var browserWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions
{
Width = 1152,
Height = 864,
Show = false
});
browserWindow.OnReadyToShow += () => browserWindow.Show();
browserWindow.SetTitle(Configuration["DemoTitleInSettings"]);
}
}
}

View File

@@ -1,115 +0,0 @@
<template class="task-template">
<section id="clipboard-section" class="section js-section u-category-system">
<header class="section-header">
<div class="section-wrapper">
<h1>
<svg class="section-icon"><use xlink:href="assets/img/icons.svg#icon-system"></use></svg>
Clipboard
</h1>
<h3>The <code>Electron.Clipboard</code> provides methods to perform copy and paste operations.</h3>
<p>This module also has methods for copying text as markup (HTML) to the clipboard.</p>
<p>You find the sample source code in <code>Controllers\ClipboardController.cs</code>.</p>
</div>
</header>
<div class="demo">
<div class="demo-wrapper">
<button id="copy-to-demo-toggle" class="js-container-target demo-toggle-button">
Copy
<div class="demo-meta u-avoid-clicks">Supports: Win, macOS, Linux <span class="demo-meta-divider">|</span> Process: Both</div>
</button>
<div class="demo-box">
<div class="demo-controls">
<button class="demo-button" id="copy-to">Copy</button>
<input class="demo-input" id="copy-to-input" aria-label="Click copy" placeholder="Click copy."></input>
</div>
<p>In this example we copy a phrase to the clipboard. After clicking 'Copy' use the text area to paste (CMD + V or CTRL + V) the phrase from the clipboard.</p>
<h5>Main Process (C#)</h5>
<pre><code class="csharp">Electron.IpcMain.On("copy-to", (text) =>
{
Electron.Clipboard.WriteText(text.ToString());
});</code></pre>
<div class="demo-protip">
<h2>ProTip</h2>
<strong>Electron.js Support in Electron.NET.</strong>
<p>The <code>clipboard</code> module is built into Electron.js (therefore you can use this in the renderer processes).</p>
<pre><code class="language-js">const clipboard = require('electron').clipboard;
const copyBtn = document.getElementById('copy-to');
const copyInput = document.getElementById('copy-to-input');
copyBtn.addEventListener('click', () => {
if (copyInput.value !== '') copyInput.value = '';
copyInput.placeholder = 'Copied! Paste here to see.';
clipboard.writeText('Electron Demo!');
})</code></pre>
</div>
</div>
</div>
</div>
<div class="demo">
<div class="demo-wrapper">
<button id="paste-to-demo-toggle" class="js-container-target demo-toggle-button">
Paste
<div class="demo-meta u-avoid-clicks">Supports: Win, macOS, Linux <span class="demo-meta-divider">|</span> Process: Both</div>
</button>
<div class="demo-box">
<div class="demo-controls">
<button class="demo-button" id="paste-to">Paste</button>
<span class="demo-response" id="paste-from"></span>
</div>
<p>In this example we copy a string to the clipboard and then paste the results into a message above.</p>
<h5>Main Process (C#)</h5>
<pre><code class="csharp">Electron.IpcMain.On("paste-to", async (text) =>
{
Electron.Clipboard.WriteText(text.ToString());
string pasteText = await Electron.Clipboard.ReadTextAsync();
var mainWindow = Electron.WindowManager.BrowserWindows.First();
Electron.IpcMain.Send(mainWindow, "paste-from", pasteText);
});</code></pre>
<div class="demo-protip">
<h2>ProTip</h2>
<strong>Electron.js Support in Electron.NET.</strong>
<p>The <code>clipboard</code> module is built into Electron.js (therefore you can use this in the renderer processes).</p>
<pre><code class="language-js">const clipboard = require('electron').clipboard;
const pasteBtn = document.getElementById('paste-to');
pasteBtn.addEventListener('click', () => {
clipboard.writeText('What a demo!');
const message = `Clipboard contents: ${clipboard.readText()}`;
document.getElementById('paste-from').innerHTML = message;
})</code></pre>
</div>
</div>
</div>
</div>
<script>
(function(){
const { ipcRenderer } = require("electron");
document.getElementById("copy-to").addEventListener("click", () => {
document.getElementById('copy-to-input').placeholder = 'Copied! Paste here to see.';
ipcRenderer.send("copy-to", "Electron.NET Demo!");
});
document.getElementById("paste-to").addEventListener("click", () => {
ipcRenderer.send("paste-to", "What a demo!");
});
ipcRenderer.on("paste-from", (sender, text) => {
const message = `Clipboard contents: ${text}`;
document.getElementById("paste-from").innerText = message;
});
}());
</script>
</section>
</template>

View File

@@ -1,3 +0,0 @@
{
"executable": "ElectronNET.WebApp"
}

View File

@@ -1,11 +0,0 @@
const demoBtns = document.querySelectorAll('.js-container-target');
// Listen for demo button clicks
Array.prototype.forEach.call(demoBtns, function (btn) {
btn.addEventListener('click', function (event) {
const parent = event.target.parentElement;
// Toggles the "is-open" class on the demo's parent element.
parent.classList.toggle('is-open');
})
})

View File

@@ -1,12 +0,0 @@
const links = document.querySelectorAll('link[rel="import"]')
// Import and add each page to the DOM
Array.prototype.forEach.call(links, function (link) {
let template = link.import.querySelector('.task-template')
let clone = document.importNode(template.content, true)
if (link.href.match('about.html')) {
document.querySelector('body').appendChild(clone)
} else {
document.querySelector('.content').appendChild(clone)
}
})

View File

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

View File

@@ -2,8 +2,7 @@
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="LocalDev" value="artifacts" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>

351
README.md
View File

@@ -1,15 +1,10 @@
[![Electron.NET Logo](https://github.com/ElectronNET/Electron.NET/blob/master/assets/images/electron.net-logo.png)](https://github.com/ElectronNET/Electron.NET)
[![Electron.NET Logo](https://github.com/ElectronNET/Electron.NET/raw/main/assets/images/electron.net-logo.png)](https://github.com/ElectronNET/Electron.NET)
[![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://donorbox.org/electron-net) [![Gitter](https://badges.gitter.im/ElectronNET/community.svg)](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build status](https://github.com/ElectronNET/Electron.NET/actions/workflows/ci.yml/badge.svg)](https://github.com/ElectronNET/Electron.NET/actions/workflows/ci.yml)
AppVeyor (Win/Linux): [![Build status](https://ci.appveyor.com/api/projects/status/q95h4xt14papwi05/branch/master?svg=true)](https://ci.appveyor.com/project/robertmuehsig/electron-net/branch/master)
Build cross platform desktop apps with .NET 6 and Blazor, ASP.NET Core (Razor Pages, MVC).
* Checkout AppVeyor Aritfacts: Contains the WebApp sample built for Windows & Linux!
Travis-CI (Win/macOS/Linux): [![Build Status](https://travis-ci.org/ElectronNET/Electron.NET.svg?branch=master)](https://travis-ci.org/ElectronNET/Electron.NET)
Build cross platform desktop apps with .NET Core 2.0 and ASP.NET NET Core.
Electron.NET is a __wrapper__ around a "normal" Electron application with an embedded ASP.NET Core application. Via our Electron.NET IPC bridge we can invoke Electron APIs from .NET.
Electron.NET is a __wrapper__ around a native Electron application with an embedded ASP.NET Core application. Via our Electron.NET IPC bridge we can invoke Electron APIs from .NET.
The CLI extensions hosts our toolset to build and start Electron.NET applications.
@@ -17,163 +12,315 @@ The CLI extensions hosts our toolset to build and start Electron.NET application
Well... there are lots of different approaches how to get a X-plat desktop app running. We thought it would be nice for .NET devs to use the ASP.NET Core environment and just embed it inside a pretty robust X-plat enviroment called Electron. Porting Electron to .NET is not a goal of this project, at least we don't have any clue how to do it. We just combine ASP.NET Core & Electron.
# NuGet:
## 📦 NuGet
* API [![NuGet](https://img.shields.io/nuget/v/ElectronNET.API.svg?style=flat-square)](https://www.nuget.org/packages/ElectronNET.API/)
* CLI [![NuGet](https://img.shields.io/nuget/v/ElectronNET.CLI.svg?style=flat-square)](https://www.nuget.org/packages/ElectronNET.CLI/)
[![NuGet](https://img.shields.io/nuget/v/ElectronNET.API.svg?style=flat-square) ElectronNET.API ](https://www.nuget.org/packages/ElectronNET.API/) | [![NuGet](https://img.shields.io/nuget/v/ElectronNET.CLI.svg?style=flat-square) ElectronNET.CLI](https://www.nuget.org/packages/ElectronNET.CLI/)
# Requirements to run:
## 🛠 Requirements to Run
The current Electron.NET CLI builds Windows/macOS/Linux binaries. Our API uses .NET Core 2.0, so our minimum base OS is the same as [.NET Core 2](https://github.com/dotnet/core/blob/master/release-notes/2.0/2.0-supported-os.md).
The current Electron.NET CLI builds Windows/macOS/Linux binaries. Our API uses .NET 6, so our minimum base OS is the same as [.NET 6](https://github.com/dotnet/core/blob/main/release-notes/6.0/supported-os.md).
# Usage:
Also you should have installed:
* npm [contained in nodejs (at least Version 16.17.1)](https://nodejs.org)
## 💬 Community
[![Gitter](https://badges.gitter.im/ElectronNET/community.svg)](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
Besides the chat on Gitter and the issues [discussed here](https://github.com/ElectronNET/Electron.NET/issues) you can also use [StackOverflow](https://stackoverflow.com/questions/tagged/electron.net) with the tag `electron.net`.
If you want to sponsor the further maintenance and development of this project [see the donate section](#🙏-donate).
## 👩‍🏫 Usage
To activate and communicate with the "native" (sort of native...) Electron API include the [ElectronNET.API NuGet package](https://www.nuget.org/packages/ElectronNET.API/) in your ASP.NET Core app.
````
```ps1
PM> Install-Package ElectronNET.API
````
## Program.cs
```
## Setup Using Minimal-API
You start Electron.NET up with an `UseElectron` WebHostBuilder-Extension and open the Electron Window:
### Program.cs
```csharp
using ElectronNET.API;
using ElectronNET.API.Entities;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseElectron(args);
// Is optional, but you can use the Electron.NET API-Classes directly with DI (relevant if you want more encoupled code)
builder.Services.AddElectron();
var app = builder.Build();
...
await app.StartAsync();
// Open the Electron-Window here
await Electron.WindowManager.CreateWindowAsync();
app.WaitForShutdown();
```
## Setup using Normal-API
### Program.cs
You start Electron.NET up with an `UseElectron` WebHostBuilder-Extension.
```csharp
public static IWebHost BuildWebHost(string[] args)
{
return WebHost.CreateDefaultBuilder(args)
.UseElectron(args)
.UseStartup<Startup>()
.Build();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseElectron(args);
webBuilder.UseStartup<Startup>();
});
```
## Startup.cs
### Startup.cs
Open the Electron Window in the Startup.cs file:
Open the Electron Window in the *Startup.cs* file:
```csharp
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
//...
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
// Open the Electron-Window here
Task.Run(async () => await Electron.WindowManager.CreateWindowAsync());
Electron.WindowManager.CreateWindowAsync();
}
```
__Please note:__ Currently it is important to use ASP.NET Core with MVC. If you are working with the dotnet CLI, use
## 🚀 Starting the Application
dotnet new mvc
## Start the Application
For the tooling you will need your dotnet-electronize package [ElectronNET.CLI NuGet package](https://www.nuget.org/packages/ElectronNET.CLI/). This package __must__ be referenced in the .csproj like this:
To start the application make sure you have installed the "[ElectronNET.CLI](https://www.nuget.org/packages/ElectronNET.CLI/)" packages as global tool:
```sh
dotnet tool install ElectronNET.CLI -g
```
<ItemGroup>
<DotNetCliToolReference Include="ElectronNET.CLI" Version="0.0.9" />
</ItemGroup>
```
Be aware of the version: The current version of the CLI is 0.0.9.
After you edited the .csproj-file, you need to restore your NuGet packages within your Project. Run the follwoing command in your ASP.NET Core folder:
```
dotnet restore
```
* Make sure you have __node.js v8.6.0__ and on __macOS/Linux__ the electron-packager installed!
sudo npm install electron-packager --global
At the first time, you need an Electron.NET project initialization. Type the following command in your ASP.NET Core folder:
```
dotnet electronize init
```sh
electronize init
```
* Now a electronnet.manifest.json should appear in your ASP.NET Core project
* Now run the following:
```sh
electronize start
```
dotnet electronize start
```
### Note
> Only the first electronize start is slow. The next will go on faster.
## Debug
### Note
> Only the first `electronize start` is slow. The next will go on faster.
## 🔭 Develop Electron.NET apps using a file watcher
The file watcher is included with version 8.31.1 of Electron.NET. For example, a file change can trigger compilation, test execution, or deployment. The Electron.NET window will automatically refresh and new code changes will be visible more quickly. The following Electron.NET CLI command is required:
```sh
electronize start /watch
```
### Note
> Only the first `electronize start` is slow. The next will go on faster.
## 🐞 Debugging the Application
Start your Electron.NET application with the Electron.NET CLI command. In Visual Studio attach to your running application instance. Go in the __Debug__ Menu and click on __Attach to Process...__. Sort by your projectname on the right and select it on the list.
## Usage of the Electron-API
## 📔 Usage of the Electron API
A complete documentation will follow. Until then take a look in the source code of the sample application:
[Electron.NET API Demos](https://github.com/ElectronNET/electron.net-api-demos)
In this YouTube video, we show you how you can create a new project, use the Electron.NET API, debug a application and build an executable desktop app for Windows: [Electron.NET - Getting Started](https://www.youtube.com/watch?v=nuM6AojRFHk)
## Build
## Building Release Artifacts
Here you need the Electron.NET CLI too. Type following command in your ASP.NET Core folder:
Here you need the Electron.NET CLI as well. Type the following command in your ASP.NET Core folder:
```
dotnet electronize build
```sh
electronize build /target win
```
In your default setting we just build the application for the OS you are running (Windows builds Windows, macOS builds macOS etc.), but this can be changed with:
There are additional platforms available:
```sh
electronize build /target win
electronize build /target osx
electronize build /target linux
```
dotnet electronize build win
dotnet electronize build osx
dotnet electronize build linux
Those three "default" targets will produce x64 packages for those platforms.
For certain NuGet packages or certain scenarios you may want to build a pure x86 application. To support those things you can define the desired [.NET Core runtime](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog), the [electron platform](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#platform) and [electron architecture](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#arch) like this:
```sh
electronize build /target custom "win7-x86;win32" /electron-arch ia32
```
The end result should be an electron app under your __/bin/desktop__ folder.
## Starter kits
There is a React/Typescript/MobX starter kit at https://github.com/yoDon/Electron.NET-React-Typescript-MobX
### Note
> macOS builds can't be created on Windows machines because they require symlinks that aren't supported on Windows (per [this Electron issue](https://github.com/electron-userland/electron-packager/issues/71)). macOS builds can be produced on either Linux or macOS machines.
## 🔄 Update
# Working with this Repo
After an update to the latest Electron.API package, an update to the latest Electron.CLI is always required. In addition, always update the CLI via NuGet:
This repository consists of the main parts (API & CLI) and it's own "playground" ASP.NET Core application. Both main parts produce local NuGet packages, that are versioned with 1.0.0. The first thing you will need is to run one of the buildAll scripts (.cmd for Windows, the other for macOS/Linux).
```sh
dotnet tool update ElectronNET.CLI -g
```
## 👨‍💻 Authors
* **[Gregor Biswanger](https://github.com/GregorBiswanger)** - (Microsoft MVP, Intel Black Belt and Intel Software Innovator) is a freelance lecturer, consultant, trainer, author and speaker. He is a consultant for large and medium-sized companies, organizations and agencies for software architecture, web- and cross-platform development. You can find Gregor often on the road attending or speaking at international conferences. - [Cross-Platform-Blog](http://www.cross-platform-blog.com) - Twitter [@BFreakout](https://www.twitter.com/BFreakout)
* **[Dr. Florian Rappl](https://github.com/FlorianRappl)** - Software Developer - from Munich, Germany. Microsoft MVP & Web Geek. - [The Art of Micro Frontends](https://microfrontends.art) - [Homepage](https://florian-rappl.de) - Twitter [@florianrappl](https://twitter.com/florianrappl)
* **[Robert Muehsig](https://github.com/robertmuehsig)** - Software Developer - from Dresden, Germany, now living & working in Switzerland. Microsoft MVP & Web Geek. - [codeinside Blog](https://blog.codeinside.eu) - Twitter [@robert0muehsig](https://twitter.com/robert0muehsig)
See also the list of [contributors](https://github.com/ElectronNET/Electron.NET/graphs/contributors) who participated in this project.
## 🙋‍♀️🙋‍♂ Contributing
Feel free to submit a pull request if you find any bugs (to see a list of active issues, visit the [Issues section](https://github.com/ElectronNET/Electron.NET/issues).
Please make sure all commits are properly documented.
## 🧪 Working with this Repo
This video provides an introduction to development for Electron.NET: [Electron.NET - Contributing Getting Started](https://youtu.be/Po-saU_Z6Ws)
This repository consists of the main parts (API & CLI) and it's own "playground" ASP.NET Core application. Both main parts produce local NuGet packages, that are versioned with 99.0.0. The first thing you will need is to run one of the build scripts (.cmd or .ps1 for Windows, the .sh for macOS/Linux).
If you look for pure __[demo projects](https://github.com/ElectronNET)__ checkout the other repositories.
The problem working with this repository is, that NuGet has a pretty aggressive cache, see [here for further information](https://github.com/ElectronNET/Electron.NET/wiki).
# Contributing
Feel free to submit a pull request if you find any bugs (to see a list of active issues, visit the [Issues section](https://github.com/ElectronNET/Electron.NET/issues).
Please make sure all commits are properly documented.
## 🙏 Donate
# Authors
We do this open source work in our free time. If you'd like us to invest more time on it, please [donate](https://donorbox.org/electron-net). Donation can be used to increase some issue priority. Thank you!
* **Gregor Biswanger** - (Microsoft MVP, Intel Black Belt and Intel Software Innovator) is a freelance lecturer, consultant, trainer, author and speaker. He is a consultant for large and medium-sized companies, organizations and agencies for software architecture, web- and cross-platform development. You can find Gregor often on the road attending or speaking at international conferences. - [Cross-Platform-Blog](http://www.cross-platform-blog.com) - Twitter [@BFreakout](https://www.twitter.com/BFreakout)
* **Robert Muehsig** - Software Developer - from Dresden, Germany, now living & working in Switzerland. Microsoft MVP & Web Geek. - [codeinside Blog](https://blog.codeinside.eu) - Twitter [@robert0muehsig](https://twitter.com/robert0muehsig)
See also the list of [contributors](https://github.com/ElectronNET/Electron.NET/graphs/contributors) who participated in this project.
# License
MIT-licensed
[![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://donorbox.org/electron-net)
Alternatively, consider using a GitHub sponsorship for the core maintainers:
- [Gregor Biswanger](https://github.com/sponsors/GregorBiswanger)
- [Florian Rappl](https://github.com/sponsors/FlorianRappl)
Any support appreciated! 🍻
## 🎉 License
MIT-licensed. See [LICENSE](./LICENSE) for details.
**Enjoy!**
## 📝 Important notes
### ElectronNET.API & ElectronNET.CLI Version 9.31.2
Make sure you also have the new Electron.NET API & CLI 9.31.2 version.
```sh
dotnet tool update ElectronNET.CLI -g
```
This now uses [electron-builder](https://www.electron.build/configuration/configuration) and the necessary configuration to build is made in the **electron.manifest.json** file (on the build part). In addition, own Electron.NET configurations are stored (on the root).
Please make sure that your **electron.manifest.json** file has the following new structure:
```json
{
"executable": "{{executable}}",
"splashscreen": {
"imageFile": ""
},
"name": "{{executable}}",
"author": "",
"singleInstance": false,
"build": {
"appId": "com.{{executable}}.app",
"productName": "{{executable}}",
"copyright": "Copyright © 2020",
"buildVersion": "1.0.0",
"compression": "maximum",
"directories": {
"output": "../../../bin/Desktop"
},
"extraResources": [
{
"from": "./bin",
"to": "bin",
"filter": ["**/*"]
}
],
"files": [
{
"from": "./ElectronHostHook/node_modules",
"to": "ElectronHostHook/node_modules",
"filter": ["**/*"]
},
"**/*"
]
}
}
```
### ElectronNET.CLI Version 0.0.9
In the Version 0.0.9 the CLI was not a global tool and needed to be registered like this in the *.csproj*:
```xml
<ItemGroup>
<DotNetCliToolReference Include="ElectronNET.CLI" Version="0.0.9" />
</ItemGroup>
```
After you edited the *.csproj* file, you need to restore your NuGet packages within your Project. Run the following command in your ASP.NET Core folder:
```sh
dotnet restore
```
If you still use this version you will need to invoke it like this:
```sh
electronize ...
```
### Node.js Integration
Electron.NET requires Node.js integration to be enabled for IPC to function. If you are not using the IPC functionality you can disable Node.js integration like so:
```csharp
WebPreferences wp = new WebPreferences();
wp.NodeIntegration = false;
BrowserWindowOptions browserWindowOptions = new BrowserWindowOptions
{
WebPreferences = wp
};
```
### Dependency Injection
ElectronNET.API can be added to your DI container within the `Startup` class. All of the modules available in Electron will be added as Singletons.
```csharp
using ElectronNET.API;
public void ConfigureServices(IServiceCollection services)
{
services.AddElectron();
}
```

View File

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

0
artifacts/.gitkeep Normal file
View File

View File

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

7
build.cmd Normal file
View File

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

69
build.ps1 Normal file
View File

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

62
build.sh Executable file
View File

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

View File

@@ -1,39 +0,0 @@
echo "Start building Electron.NET dev stack..."
echo "Restore & Build API"
cd ElectronNet.API
dotnet restore
dotnet build
cd ..
echo "Restore & Build CLI"
cd ElectronNet.CLI
dotnet restore
dotnet build
cd ..
echo "Restore & Build WebApp Demo"
cd ElectronNet.WebApp
dotnet restore
dotnet build
echo "Invoke electronize build in WebApp Demo"
echo "/target xxx (dev-build)"
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target custom win7-x86;win32 /dotnet-configuration Debug /electron-arch ia32 /electron-params "--prune=true "
echo "/target win (dev-build)"
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target win
echo "/target linux (dev-build)"
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target linux
echo "/target custom win7-x86;win32 (dev-build)"
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target custom win7-x86;win32
:: Be aware, that for non-electronnet-dev environments the correct
:: invoke command would be dotnet electronize ...
:: Not supported on Windows Systems, because of SymLinks...
:: echo "/target osx"
:: dotnet electronize build /target osx

View File

@@ -1,34 +0,0 @@
dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
echo "Start building Electron.NET dev stack..."
echo "Restore & Build API"
cd $dir/ElectronNET.API
dotnet restore
dotnet build
cd ..
echo "Restore & Build CLI"
cd $dir/ElectronNET.CLI
dotnet restore
dotnet build
cd ..
echo "Restore & Build WebApp Demo"
cd $dir/ElectronNET.WebApp
dotnet restore
dotnet build
echo "Invoke electronize build in WebApp Demo"
echo "/target win (dev-build)"
dotnet "$dir/ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target win
echo "/target linux (dev-build)"
dotnet "$dir/ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target linux
echo "/target osx (dev-build)"
dotnet "$dir/ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target osx
echo "/target custom win7-x86;win32 (dev-build)"
dotnet "$dir/ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target custom "win7-x86;win32"
# Be aware, that for non-electronnet-dev environments the correct
# invoke command would be dotnet electronize ...

View File

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

11
nuke/.editorconfig Normal file
View File

@@ -0,0 +1,11 @@
[*.cs]
dotnet_style_qualification_for_field = false:warning
dotnet_style_qualification_for_property = false:warning
dotnet_style_qualification_for_method = false:warning
dotnet_style_qualification_for_event = false:warning
dotnet_style_require_accessibility_modifiers = never:warning
csharp_style_expression_bodied_methods = true:silent
csharp_style_expression_bodied_properties = true:warning
csharp_style_expression_bodied_indexers = true:warning
csharp_style_expression_bodied_accessors = true:warning

340
nuke/Build.cs Normal file
View File

@@ -0,0 +1,340 @@
using Microsoft.Build.Exceptions;
using Nuke.Common;
using Nuke.Common.CI.GitHubActions;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.GitHub;
using Nuke.Common.Tools.NuGet;
using Nuke.Common.Utilities.Collections;
using Octokit;
using Octokit.Internal;
using Serilog;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.IO.PathConstruction;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
class Build : NukeBuild
{
/// Support plugins are available for:
/// - JetBrains ReSharper https://nuke.build/resharper
/// - JetBrains Rider https://nuke.build/rider
/// - Microsoft VisualStudio https://nuke.build/visualstudio
/// - Microsoft VSCode https://nuke.build/vscode
public static int Main () => Execute<Build>(x => x.RunUnitTests);
[Nuke.Common.Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
[Nuke.Common.Parameter("ReleaseNotesFilePath - To determine the SemanticVersion")]
readonly AbsolutePath ReleaseNotesFilePath = RootDirectory / "Changelog.md";
[Solution]
readonly Solution Solution;
string TargetProjectName => "ElectronNET";
string ApiTargetLibName => $"{TargetProjectName}.API";
string CliTargetLibName => $"{TargetProjectName}.CLI";
string DemoTargetLibName => $"{TargetProjectName}.WebApp";
AbsolutePath SourceDirectory => RootDirectory / "src";
AbsolutePath ResultDirectory => RootDirectory / "artifacts";
GitHubActions GitHubActions => GitHubActions.Instance;
IReadOnlyList<ReleaseNotes> ChangeLog { get; set; }
ReleaseNotes LatestReleaseNotes { get; set; }
SemVersion SemVersion { get; set; }
string Version { get; set; }
AbsolutePath[] Projects
{
get
{
var api = SourceDirectory / ApiTargetLibName / $"{ApiTargetLibName}.csproj";
var cli = SourceDirectory / CliTargetLibName / $"{CliTargetLibName}.csproj";
var projects = new[] { api, cli };
return projects;
}
}
protected override void OnBuildInitialized()
{
var parser = new ReleaseNotesParser();
Log.Debug("Reading ChangeLog {FilePath}...", ReleaseNotesFilePath);
ChangeLog = parser.Parse(File.ReadAllText(ReleaseNotesFilePath));
ChangeLog.NotNull("ChangeLog / ReleaseNotes could not be read!");
LatestReleaseNotes = ChangeLog.First();
LatestReleaseNotes.NotNull("LatestVersion could not be read!");
Log.Debug("Using LastestVersion from ChangeLog: {LatestVersion}", LatestReleaseNotes.Version);
SemVersion = LatestReleaseNotes.SemVersion;
Version = LatestReleaseNotes.Version.ToString();
if (GitHubActions != null)
{
Log.Debug("Add Version Postfix if under CI - GithubAction(s)...");
var buildNumber = GitHubActions.RunNumber;
if (ScheduledTargets.Contains(Default))
{
Version = $"{Version}-ci.{buildNumber}";
}
else if (ScheduledTargets.Contains(PrePublish))
{
Version = $"{Version}-alpha.{buildNumber}";
}
}
Log.Information("Building version: {Version}", Version);
}
Target Clean => _ => _
.Before(Restore)
.Executes(() =>
{
SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory);
});
Target Restore => _ => _
.Executes(() =>
{
Projects.ForEach(project =>
{
DotNetRestore(s => s
.SetProjectFile(project));
});
});
Target Compile => _ => _
.DependsOn(Restore)
.Executes(() =>
{
Projects.ForEach(project =>
{
DotNetBuild(s => s
.SetProjectFile(project)
.SetVersion(Version)
.SetConfiguration(Configuration)
.EnableNoRestore());
});
});
Target RunUnitTests => _ => _
.DependsOn(Compile)
.Executes(() =>
{
Projects.ForEach(project =>
{
DotNetTest(s => s
.SetProjectFile(project)
.SetConfiguration(Configuration)
.EnableNoRestore()
.EnableNoBuild());
});
});
Target CreatePackages => _ => _
.DependsOn(Compile)
.Executes(() =>
{
Projects.ForEach(project =>
{
DotNetPack(s => s
.SetProject(project)
.SetVersion(Version)
.SetConfiguration(Configuration)
.SetOutputDirectory(ResultDirectory)
.SetIncludeSymbols(true)
.SetSymbolPackageFormat("snupkg")
.EnableNoRestore()
);
});
});
Target CompileSample => _ => _
.DependsOn(Compile)
.Executes(() =>
{
var sample = SourceDirectory / DemoTargetLibName / $"{DemoTargetLibName}.csproj";
DotNetBuild(s => s.SetProjectFile(sample).SetConfiguration(Configuration));
});
Target ElectronizeGenericTargetSample => _ => _
.DependsOn(CompileSample)
.Executes(() =>
{
var sample = SourceDirectory / DemoTargetLibName;
var cli = SourceDirectory / CliTargetLibName / $"{CliTargetLibName}.csproj";
var args = "build /target custom win7-x86;win /dotnet-configuration Debug /electron-arch ia32 /electron-params \"--publish never\"";
DotNet($"run --project {cli} -- {args}", sample);
});
Target ElectronizeWindowsTargetSample => _ => _
.DependsOn(CompileSample)
.Executes(() =>
{
var sample = SourceDirectory / DemoTargetLibName;
var cli = SourceDirectory / CliTargetLibName / $"{CliTargetLibName}.csproj";
var args = "build /target win /electron-params \"--publish never\"";
DotNet($"run --project {cli} -- {args}", sample);
});
Target ElectronizeCustomWin7TargetSample => _ => _
.DependsOn(CompileSample)
.Executes(() =>
{
var sample = SourceDirectory / DemoTargetLibName;
var cli = SourceDirectory / CliTargetLibName / $"{CliTargetLibName}.csproj";
var args = "build /target custom win7-x86;win /electron-params \"--publish never\"";
DotNet($"run --project {cli} -- {args}", sample);
});
Target ElectronizeMacOsTargetSample => _ => _
.DependsOn(CompileSample)
.Executes(() =>
{
var sample = SourceDirectory / DemoTargetLibName;
var cli = SourceDirectory / CliTargetLibName / $"{CliTargetLibName}.csproj";
var args = "build /target osx /electron-params \"--publish never\"";
DotNet($"run --project {cli} -- {args}", sample);
});
Target ElectronizeLinuxTargetSample => _ => _
.DependsOn(CompileSample)
.Executes(() =>
{
var sample = SourceDirectory / DemoTargetLibName;
var cli = SourceDirectory / CliTargetLibName / $"{CliTargetLibName}.csproj";
var args = "build /target linux /electron-params \"--publish never\"";
DotNet($"run --project {cli} -- {args}", sample);
});
Target PublishPackages => _ => _
.DependsOn(CreatePackages)
.DependsOn(RunUnitTests)
.Executes(() =>
{
var apiKey = Environment.GetEnvironmentVariable("NUGET_API_KEY");
if (apiKey.IsNullOrEmpty())
{
throw new BuildAbortedException("Could not resolve the NuGet API key.");
}
foreach (var nupkg in GlobFiles(ResultDirectory, "*.nupkg"))
{
DotNetNuGetPush(s => s
.SetTargetPath(nupkg)
.SetSource("https://api.nuget.org/v3/index.json")
.SetApiKey(apiKey));
}
});
Target PublishPreRelease => _ => _
.DependsOn(PublishPackages)
.Executes(() =>
{
string gitHubToken;
if (GitHubActions != null)
{
gitHubToken = GitHubActions.Token;
}
else
{
gitHubToken = Environment.GetEnvironmentVariable("GITHUB_TOKEN");
}
if (gitHubToken.IsNullOrEmpty())
{
throw new BuildAbortedException("Could not resolve GitHub token.");
}
var credentials = new Credentials(gitHubToken);
GitHubTasks.GitHubClient = new GitHubClient(
new ProductHeaderValue(nameof(NukeBuild)),
new InMemoryCredentialStore(credentials));
GitHubTasks.GitHubClient.Repository.Release
.Create("ElectronNET", "Electron.NET", new NewRelease(Version)
{
Name = Version,
Body = String.Join(Environment.NewLine, LatestReleaseNotes.Notes),
Prerelease = true,
TargetCommitish = "develop",
});
});
Target PublishRelease => _ => _
.DependsOn(PublishPackages)
.Executes(() =>
{
string gitHubToken;
if (GitHubActions != null)
{
gitHubToken = GitHubActions.Token;
}
else
{
gitHubToken = Environment.GetEnvironmentVariable("GITHUB_TOKEN");
}
if (gitHubToken.IsNullOrEmpty())
{
throw new BuildAbortedException("Could not resolve GitHub token.");
}
var credentials = new Credentials(gitHubToken);
GitHubTasks.GitHubClient = new GitHubClient(
new ProductHeaderValue(nameof(NukeBuild)),
new InMemoryCredentialStore(credentials));
GitHubTasks.GitHubClient.Repository.Release
.Create("ElectronNET", "Electron.NET", new NewRelease(Version)
{
Name = Version,
Body = String.Join(Environment.NewLine, LatestReleaseNotes.Notes),
Prerelease = false,
TargetCommitish = "main",
});
});
Target Package => _ => _
.DependsOn(RunUnitTests)
.DependsOn(CreatePackages);
Target Default => _ => _
.DependsOn(Package);
Target Publish => _ => _
.DependsOn(PublishRelease);
Target PrePublish => _ => _
.DependsOn(PublishPreRelease);
}

16
nuke/Configuration.cs Normal file
View File

@@ -0,0 +1,16 @@
using System;
using System.ComponentModel;
using System.Linq;
using Nuke.Common.Tooling;
[TypeConverter(typeof(TypeConverter<Configuration>))]
public class Configuration : Enumeration
{
public static Configuration Debug = new Configuration { Value = nameof(Debug) };
public static Configuration Release = new Configuration { Value = nameof(Release) };
public static implicit operator string(Configuration configuration)
{
return configuration.Value;
}
}

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- This file prevents unintended imports of unrelated MSBuild files -->
<!-- Uncomment to include parent Directory.Build.props file -->
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />-->
</Project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- This file prevents unintended imports of unrelated MSBuild files -->
<!-- Uncomment to include parent Directory.Build.targets file -->
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />-->
</Project>

View File

@@ -0,0 +1,80 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
// ReSharper disable once CheckNamespace
/// <summary>
/// Contains extension methods for <see cref="System.String"/>.
/// </summary>
/// <remarks>
/// Original from Cake build tool source:
/// https://github.com/cake-build/cake/blob/9828d7b246d332054896e52ba56983822feb3f05/src/Cake.Core/Extensions/StringExtensions.cs
/// </remarks>
public static class StringExtensions
{
/// <summary>
/// Quotes the specified <see cref="System.String"/>.
/// </summary>
/// <param name="value">The string to quote.</param>
/// <returns>A quoted string.</returns>
public static string Quote(this string value)
{
if (!IsQuoted(value))
{
value = string.Concat("\"", value, "\"");
}
return value;
}
/// <summary>
/// Unquote the specified <see cref="System.String"/>.
/// </summary>
/// <param name="value">The string to unquote.</param>
/// <returns>An unquoted string.</returns>
public static string UnQuote(this string value)
{
if (IsQuoted(value))
{
value = value.Trim('"');
}
return value;
}
/// <summary>
/// Splits the <see cref="String"/> into lines.
/// </summary>
/// <param name="content">The string to split.</param>
/// <returns>The lines making up the provided string.</returns>
public static string[] SplitLines(this string content)
{
content = NormalizeLineEndings(content);
return content.Split(new[] { "\r\n" }, StringSplitOptions.None);
}
/// <summary>
/// Normalizes the line endings in a <see cref="String"/>.
/// </summary>
/// <param name="value">The string to normalize line endings in.</param>
/// <returns>A <see cref="String"/> with normalized line endings.</returns>
public static string NormalizeLineEndings(this string value)
{
if (value != null)
{
value = value.Replace("\r\n", "\n");
value = value.Replace("\r", string.Empty);
return value.Replace("\n", "\r\n");
}
return string.Empty;
}
private static bool IsQuoted(this string value)
{
return value.StartsWith("\"", StringComparison.OrdinalIgnoreCase)
&& value.EndsWith("\"", StringComparison.OrdinalIgnoreCase);
}
}

81
nuke/ReleaseNotes.cs Normal file
View File

@@ -0,0 +1,81 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Represent release notes.
/// </summary>
/// <remarks>
/// Original from Cake build tool source:
/// https://github.com/cake-build/cake/blob/9828d7b246d332054896e52ba56983822feb3f05/src/Cake.Common/ReleaseNotes.cs
/// </remarks>
public sealed class ReleaseNotes
{
private readonly List<string> _notes;
/// <summary>
/// Gets the version.
/// </summary>
/// <value>The version.</value>
public SemVersion SemVersion { get; }
/// <summary>
/// Gets the version.
/// </summary>
/// <value>The version.</value>
public Version Version { get; }
/// <summary>
/// Gets the release notes.
/// </summary>
/// <value>The release notes.</value>
public IReadOnlyList<string> Notes => _notes;
/// <summary>
/// Gets the raw text of the line that <see cref="Version"/> was extracted from.
/// </summary>
/// <value>The raw text of the Version line.</value>
public string RawVersionLine { get; }
/// <summary>
/// Initializes a new instance of the <see cref="ReleaseNotes"/> class.
/// </summary>
/// <param name="semVersion">The semantic version.</param>
/// <param name="notes">The notes.</param>
/// <param name="rawVersionLine">The raw text of the version line.</param>
public ReleaseNotes(SemVersion semVersion, IEnumerable<string> notes, string rawVersionLine)
: this(
semVersion?.AssemblyVersion ?? throw new ArgumentNullException(nameof(semVersion)),
semVersion,
notes,
rawVersionLine)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ReleaseNotes"/> class.
/// </summary>
/// <param name="version">The version.</param>
/// <param name="notes">The notes.</param>
/// <param name="rawVersionLine">The raw text of the version line.</param>
public ReleaseNotes(Version version, IEnumerable<string> notes, string rawVersionLine)
: this(
version ?? throw new ArgumentNullException(nameof(version)),
new SemVersion(version.Major, version.Minor, version.Build),
notes,
rawVersionLine)
{
}
private ReleaseNotes(Version version, SemVersion semVersion, IEnumerable<string> notes, string rawVersionLine)
{
Version = version ?? throw new ArgumentNullException(nameof(version));
SemVersion = semVersion ?? throw new ArgumentNullException(nameof(semVersion));
RawVersionLine = rawVersionLine;
_notes = new List<string>(notes ?? Enumerable.Empty<string>());
}
}

160
nuke/ReleaseNotesParser.cs Normal file
View File

@@ -0,0 +1,160 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Microsoft.Build.Exceptions;
/// <summary>
/// The release notes parser.
/// </summary>
/// <remarks>
/// Original from Cake build tool source:
/// https://github.com/cake-build/cake/blob/9828d7b246d332054896e52ba56983822feb3f05/src/Cake.Common/ReleaseNotesParser.cs
/// </remarks>
public sealed class ReleaseNotesParser
{
private readonly Regex _versionRegex;
/// <summary>
/// Initializes a new instance of the <see cref="ReleaseNotesParser"/> class.
/// </summary>
public ReleaseNotesParser()
{
_versionRegex = new Regex(@"(?<Version>\d+(\s*\.\s*\d+){0,3})(?<Release>-[a-z][0-9a-z-]*)?");
}
/// <summary>
/// Parses all release notes.
/// </summary>
/// <param name="content">The content.</param>
/// <returns>All release notes.</returns>
public IReadOnlyList<ReleaseNotes> Parse(string content)
{
if (content == null)
{
throw new ArgumentNullException(nameof(content));
}
var lines = content.SplitLines();
if (lines.Length > 0)
{
var line = lines[0].Trim();
if (line.StartsWith("#", StringComparison.OrdinalIgnoreCase))
{
return ParseComplexFormat(lines);
}
if (line.StartsWith("*", StringComparison.OrdinalIgnoreCase))
{
return ParseSimpleFormat(lines);
}
}
throw new BuildAbortedException("Unknown release notes format.");
}
private IReadOnlyList<ReleaseNotes> ParseComplexFormat(string[] lines)
{
var lineIndex = 0;
var result = new List<ReleaseNotes>();
while (true)
{
if (lineIndex >= lines.Length)
{
break;
}
// Create release notes.
var semVer = SemVersion.Zero;
var version = SemVersion.TryParse(lines[lineIndex], out semVer);
if (!version)
{
throw new BuildAbortedException("Could not parse version from release notes header.");
}
var rawVersionLine = lines[lineIndex];
// Increase the line index.
lineIndex++;
// Parse content.
var notes = new List<string>();
while (true)
{
// Sanity checks.
if (lineIndex >= lines.Length)
{
break;
}
if (lines[lineIndex].StartsWith("# ", StringComparison.OrdinalIgnoreCase))
{
break;
}
// Get the current line.
var line = (lines[lineIndex] ?? string.Empty).Trim();
if (!string.IsNullOrWhiteSpace(line))
{
notes.Add(line);
}
lineIndex++;
}
result.Add(new ReleaseNotes(semVer, notes, rawVersionLine));
}
return result.OrderByDescending(x => x.SemVersion).ToArray();
}
private IReadOnlyList<ReleaseNotes> ParseSimpleFormat(string[] lines)
{
var lineIndex = 0;
var result = new List<ReleaseNotes>();
while (true)
{
if (lineIndex >= lines.Length)
{
break;
}
// Trim the current line.
var line = (lines[lineIndex] ?? string.Empty);
if (string.IsNullOrWhiteSpace(line))
{
lineIndex++;
continue;
}
// Parse header.
var semVer = SemVersion.Zero;
var version = SemVersion.TryParse(lines[lineIndex], out semVer);
if (!version)
{
throw new BuildAbortedException("Could not parse version from release notes header.");
}
// Parse the description.
line = line.Substring(semVer.ToString().Length).Trim('-', ' ');
// Add the release notes to the result.
result.Add(new ReleaseNotes(semVer, new[] { line }, line));
lineIndex++;
}
return result.OrderByDescending(x => x.SemVersion).ToArray();
}
}

378
nuke/SemVersion.cs Normal file
View File

@@ -0,0 +1,378 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
/// <summary>
/// Class for representing semantic versions.
/// </summary>
/// <remarks>
/// Original from Cake build tool source:
/// https://github.com/cake-build/cake/blob/9828d7b246d332054896e52ba56983822feb3f05/src/Cake.Common/SemanticVersion.cs
/// </remarks>
public class SemVersion : IComparable, IComparable<SemVersion>, IEquatable<SemVersion>
{
/// <summary>
/// Gets the default version of a SemanticVersion.
/// </summary>
public static SemVersion Zero { get; } = new SemVersion(0, 0, 0, null, null, "0.0.0");
/// <summary>
/// Regex property for parsing a semantic version number.
/// </summary>
public static readonly Regex SemVerRegex =
new Regex(
@"(?<Major>0|(?:[1-9]\d*))(?:\.(?<Minor>0|(?:[1-9]\d*))(?:\.(?<Patch>0|(?:[1-9]\d*)))?(?:\-(?<PreRelease>[0-9A-Z\.-]+))?(?:\+(?<Meta>[0-9A-Z\.-]+))?)?",
RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
/// <summary>
/// Gets the major number of the version.
/// </summary>
public int Major { get; }
/// <summary>
/// Gets the minor number of the version.
/// </summary>
public int Minor { get; }
/// <summary>
/// Gets the patch number of the version.
/// </summary>
public int Patch { get; }
/// <summary>
/// Gets the prerelease of the version.
/// </summary>
public string PreRelease { get; }
/// <summary>
/// Gets the meta of the version.
/// </summary>
public string Meta { get; }
/// <summary>
/// Gets a value indicating whether semantic version is a prerelease or not.
/// </summary>
public bool IsPreRelease { get; }
/// <summary>
/// Gets a value indicating whether semantic version has meta or not.
/// </summary>
public bool HasMeta { get; }
/// <summary>
/// Gets the VersionString of the semantic version.
/// </summary>
public string VersionString { get; }
/// <summary>
/// Gets the AssemblyVersion of the semantic version.
/// </summary>
public Version AssemblyVersion { get; }
/// <summary>
/// Initializes a new instance of the <see cref="SemVersion"/> class.
/// </summary>
/// <param name="major">Major number.</param>
/// <param name="minor">Minor number.</param>
/// <param name="patch">Patch number.</param>
/// <param name="preRelease">Prerelease string.</param>
/// <param name="meta">Meta string.</param>
public SemVersion(int major, int minor, int patch, string preRelease = null, string meta = null) : this(major,
minor, patch, preRelease, meta, null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SemVersion"/> class.
/// </summary>
/// <param name="major">Major number.</param>
/// <param name="minor">Minor number.</param>
/// <param name="patch">Patch number.</param>
/// <param name="preRelease">Prerelease string.</param>
/// <param name="meta">Meta string.</param>
/// <param name="versionString">The complete version number.</param>
public SemVersion(int major, int minor, int patch, string preRelease, string meta, string versionString)
{
Major = major;
Minor = minor;
Patch = patch;
AssemblyVersion = new Version(major, minor, patch);
IsPreRelease = !string.IsNullOrEmpty(preRelease);
HasMeta = !string.IsNullOrEmpty(meta);
PreRelease = IsPreRelease ? preRelease : null;
Meta = HasMeta ? meta : null;
if (!string.IsNullOrEmpty(versionString))
{
VersionString = versionString;
}
else
{
var sb = new StringBuilder();
sb.AppendFormat(CultureInfo.InvariantCulture, "{0}.{1}.{2}", Major, Minor, Patch);
if (IsPreRelease)
{
sb.AppendFormat(CultureInfo.InvariantCulture, "-{0}", PreRelease);
}
if (HasMeta)
{
sb.AppendFormat(CultureInfo.InvariantCulture, "+{0}", Meta);
}
VersionString = sb.ToString();
}
}
/// <summary>
/// Method which tries to parse a semantic version string.
/// </summary>
/// <param name="version">the version that should be parsed.</param>
/// <param name="semVersion">the out parameter the parsed version should be stored in.</param>
/// <returns>Returns a boolean indicating if the parse was successful.</returns>
public static bool TryParse(string version,
out SemVersion semVersion)
{
semVersion = Zero;
if (string.IsNullOrEmpty(version))
{
return false;
}
var match = SemVerRegex.Match(version);
if (!match.Success)
{
return false;
}
if (!int.TryParse(
match.Groups["Major"].Value,
NumberStyles.Integer,
CultureInfo.InvariantCulture,
out var major) ||
!int.TryParse(
match.Groups["Minor"].Value,
NumberStyles.Integer,
CultureInfo.InvariantCulture,
out var minor) ||
!int.TryParse(
match.Groups["Patch"].Value,
NumberStyles.Integer,
CultureInfo.InvariantCulture,
out var patch))
{
return false;
}
semVersion = new SemVersion(
major,
minor,
patch,
match.Groups["PreRelease"]?.Value,
match.Groups["Meta"]?.Value,
version);
return true;
}
/// <summary>
/// Checks if two SemVersion objects are equal.
/// </summary>
/// <param name="other">the other SemVersion want to test equality to.</param>
/// <returns>A boolean indicating whether the objecst we're equal or not.</returns>
public bool Equals(SemVersion other)
{
return other is object
&& Major == other.Major
&& Minor == other.Minor
&& Patch == other.Patch
&& string.Equals(PreRelease, other.PreRelease, StringComparison.OrdinalIgnoreCase)
&& string.Equals(Meta, other.Meta, StringComparison.OrdinalIgnoreCase);
}
/// <summary>
/// Compares to SemVersion objects to and another.
/// </summary>
/// <param name="other">The SemVersion object we compare with.</param>
/// <returns>Return 0 if the objects are identical, 1 if the version is newer and -1 if the version is older.</returns>
public int CompareTo(SemVersion other)
{
if (other is null)
{
return 1;
}
if (Equals(other))
{
return 0;
}
if (Major > other.Major)
{
return 1;
}
if (Major < other.Major)
{
return -1;
}
if (Minor > other.Minor)
{
return 1;
}
if (Minor < other.Minor)
{
return -1;
}
if (Patch > other.Patch)
{
return 1;
}
if (Patch < other.Patch)
{
return -1;
}
if (IsPreRelease != other.IsPreRelease)
{
return other.IsPreRelease ? 1 : -1;
}
switch (StringComparer.InvariantCultureIgnoreCase.Compare(PreRelease, other.PreRelease))
{
case 1:
return 1;
case -1:
return -1;
default:
{
return (string.IsNullOrEmpty(Meta) != string.IsNullOrEmpty(other.Meta))
? string.IsNullOrEmpty(Meta) ? 1 : -1
: StringComparer.InvariantCultureIgnoreCase.Compare(Meta, other.Meta);
}
}
}
/// <summary>
/// Compares to SemVersion objects to and another.
/// </summary>
/// <param name="obj">The object we compare with.</param>
/// <returns>Return 0 if the objects are identical, 1 if the version is newer and -1 if the version is older.</returns>
public int CompareTo(object obj)
{
return (obj is SemVersion semVersion)
? CompareTo(semVersion)
: -1;
}
/// <summary>
/// Equals-method for the SemVersion class.
/// </summary>
/// <param name="obj">the other SemVersion want to test equality to.</param>
/// <returns>A boolean indicating whether the objecst we're equal or not.</returns>
public override bool Equals(object obj)
{
return (obj is SemVersion semVersion)
&& Equals(semVersion);
}
/// <summary>
/// Method for getting the hashcode of the SemVersion object.
/// </summary>
/// <returns>The hashcode of the SemVersion object.</returns>
public override int GetHashCode()
{
unchecked
{
var hashCode = Major;
hashCode = (hashCode * 397) ^ Minor;
hashCode = (hashCode * 397) ^ Patch;
hashCode = (hashCode * 397) ^
(PreRelease != null ? StringComparer.OrdinalIgnoreCase.GetHashCode(PreRelease) : 0);
hashCode = (hashCode * 397) ^ (Meta != null ? StringComparer.OrdinalIgnoreCase.GetHashCode(Meta) : 0);
return hashCode;
}
}
/// <summary>
/// Returns the string representation of an SemVersion object.
/// </summary>
/// <returns>The string representation of the object.</returns>
public override string ToString()
{
int[] verParts = { Major, Minor, Patch };
string ver = string.Join(".", verParts);
return $"{ver}{(IsPreRelease ? "-" : string.Empty)}{PreRelease}{Meta}";
}
/// <summary>
/// The greater than-operator for the SemVersion class.
/// </summary>
/// <param name="operand1">first SemVersion.</param>
/// <param name="operand2">second. SemVersion.</param>
/// <returns>A value indicating if the operand1 was greater than operand2.</returns>
public static bool operator >(SemVersion operand1, SemVersion operand2)
=> operand1 is { } && operand1.CompareTo(operand2) == 1;
/// <summary>
/// The less than-operator for the SemVersion class.
/// </summary>
/// <param name="operand1">first SemVersion.</param>
/// <param name="operand2">second. SemVersion.</param>
/// <returns>A value indicating if the operand1 was less than operand2.</returns>
public static bool operator <(SemVersion operand1, SemVersion operand2)
=> operand1 is { }
? operand1.CompareTo(operand2) == -1
: operand2 is { };
/// <summary>
/// The greater than or equal to-operator for the SemVersion class.
/// </summary>
/// <param name="operand1">first SemVersion.</param>
/// <param name="operand2">second. SemVersion.</param>
/// <returns>A value indicating if the operand1 was greater than or equal to operand2.</returns>
public static bool operator >=(SemVersion operand1, SemVersion operand2)
=> operand1 is { }
? operand1.CompareTo(operand2) >= 0
: operand2 is null;
/// <summary>
/// The lesser than or equal to-operator for the SemVersion class.
/// </summary>
/// <param name="operand1">first SemVersion.</param>
/// <param name="operand2">second. SemVersion.</param>
/// <returns>A value indicating if the operand1 was lesser than or equal to operand2.</returns>
public static bool operator <=(SemVersion operand1, SemVersion operand2)
=> operand1 is null || operand1.CompareTo(operand2) <= 0;
/// <summary>
/// The equal to-operator for the SemVersion class.
/// </summary>
/// <param name="operand1">first SemVersion.</param>
/// <param name="operand2">second. SemVersion.</param>
/// <returns>A value indicating if the operand1 was equal to operand2.</returns>
public static bool operator ==(SemVersion operand1, SemVersion operand2)
=> operand1?.Equals(operand2) ?? operand2 is null;
/// <summary>
/// The not equal to-operator for the SemVersion class.
/// </summary>
/// <param name="operand1">first SemVersion.</param>
/// <param name="operand2">second. SemVersion.</param>
/// <returns>A value indicating if the operand1 was not equal to operand2.</returns>
public static bool operator !=(SemVersion operand1, SemVersion operand2)
=> !(operand1?.Equals(operand2) ?? operand2 is null);
}

21
nuke/_build.csproj Normal file
View File

@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..</NukeRootDirectory>
<NukeScriptDirectory>..</NukeScriptDirectory>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nuke.Common" Version="6.2.1" />
</ItemGroup>
<ItemGroup>
<PackageDownload Include="NuGet.CommandLine" Version="[6.3.1]" />
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,621 @@
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

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

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