Compare commits

...

304 Commits

Author SHA1 Message Date
Florian Rappl
2910833e61 Corrected paths 2023-04-04 17:26:52 +02:00
Florian Rappl
42e816e85c Updated sample connector 2023-04-04 16:40:54 +02:00
Florian Rappl
03c08503cc Updated build system with template 2023-04-04 16:40:45 +02:00
Florian Rappl
555f0378b4 Improved code helpers 2023-04-04 15:40:24 +02:00
Florian Rappl
79580327bd Removed all warnings. 2023-04-04 15:11:12 +02:00
Florian Rappl
f6d17406cd Cleanup and improvements 2023-04-04 14:31:25 +02:00
Florian Rappl
9e79665690 Improved the README 2023-04-03 18:19:30 +02:00
Florian Rappl
9f98b5ca85 Modernized the host bridge 2023-04-03 18:16:59 +02: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
435 changed files with 18670 additions and 10335 deletions

2
.github/FUNDING.yml vendored
View File

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

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,8 +0,0 @@
language: csharp
mono: none
dist: xenial
dotnet: 3.0
before_script:
- export PATH="$PATH:/home/travis/.dotnet/tools"
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,19 +1,190 @@
# Not released
# 23.6.2
# 7.30.3
## ElectronNET.API
# Released
* Fixed escaping of URL (#735) @cosmo0
* Changed `ZoomFactor` type from `int` to `double` (#754) @Yuvix25
## ElectronNET.CLI
* (none)
## Infrastructure
* Changed build system to NUKE #757 @FlorianRappl
* Updated target framework for host project #753 @r-pankevicius
# 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:
* Different manifest file support [\#340](https://github.com/ElectronNET/Electron.NET/issues/340)
* 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`.
* Command Line support [\#337](https://github.com/ElectronNET/Electron.NET/issues/337)
* 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))

File diff suppressed because it is too large Load Diff

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,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,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,31 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class RemoveClientCertificate
{
/// <summary>
/// Origin of the server whose associated client certificate must be removed from
/// the cache.
/// </summary>
public string Origin { get; set; }
/// <summary>
/// clientCertificate.
/// </summary>
public string Type { get; set; }
/// <summary>
///
/// </summary>
/// <param name="origin">Origin of the server whose associated client certificate
/// must be removed from the cache.</param>
/// <param name="type">clientCertificate.</param>
public RemoveClientCertificate(string origin, string type)
{
Origin = origin;
Type = type;
}
}
}

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="errorAction">Action to get the error message.</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> errorAction)
{
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, errorAction);
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,169 +0,0 @@
using ElectronNET.API.Entities;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using System;
using System.Threading.Tasks;
namespace ElectronNET.API
{
/// <summary>
/// Render and control web pages.
/// </summary>
public class WebContents
{
/// <summary>
/// Gets the identifier.
/// </summary>
/// <value>
/// The identifier.
/// </value>
public int Id { get; private set; }
/// <summary>
/// Manage browser sessions, cookies, cache, proxy settings, etc.
/// </summary>
public Session Session { get; internal set; }
/// <summary>
/// Emitted when the renderer process crashes or is killed.
/// </summary>
public event Action<bool> OnCrashed
{
add
{
if (_crashed == null)
{
BridgeConnector.Socket.On("webContents-crashed" + Id, (killed) =>
{
_crashed((bool)killed);
});
BridgeConnector.Socket.Emit("register-webContents-crashed", Id);
}
_crashed += value;
}
remove
{
_crashed -= value;
if (_crashed == null)
BridgeConnector.Socket.Off("webContents-crashed" + Id);
}
}
private event Action<bool> _crashed;
/// <summary>
/// Emitted when the navigation is done, i.e. the spinner of the tab has
/// stopped spinning, and the onload event was dispatched.
/// </summary>
public event Action OnDidFinishLoad
{
add
{
if (_didFinishLoad == null)
{
BridgeConnector.Socket.On("webContents-didFinishLoad" + Id, () =>
{
_didFinishLoad();
});
BridgeConnector.Socket.Emit("register-webContents-didFinishLoad", Id);
}
_didFinishLoad += value;
}
remove
{
_didFinishLoad -= value;
if (_didFinishLoad == null)
BridgeConnector.Socket.Off("webContents-didFinishLoad" + Id);
}
}
private event Action _didFinishLoad;
internal WebContents(int id)
{
Id = id;
Session = new Session(id);
}
/// <summary>
/// Opens the devtools.
/// </summary>
public void OpenDevTools()
{
BridgeConnector.Socket.Emit("webContentsOpenDevTools", Id);
}
/// <summary>
/// Opens the devtools.
/// </summary>
/// <param name="openDevToolsOptions"></param>
public void OpenDevTools(OpenDevToolsOptions openDevToolsOptions)
{
BridgeConnector.Socket.Emit("webContentsOpenDevTools", Id, JObject.FromObject(openDevToolsOptions, _jsonSerializer));
}
/// <summary>
/// Prints window's web page as PDF with Chromium's preview printing custom
/// settings.The landscape will be ignored if @page CSS at-rule is used in the web page.
/// By default, an empty options will be regarded as: Use page-break-before: always;
/// CSS style to force to print to a new page.
/// </summary>
/// <param name="path"></param>
/// <param name="options"></param>
/// <returns>success</returns>
public Task<bool> PrintToPDFAsync(string path, PrintToPDFOptions options = null)
{
var taskCompletionSource = new TaskCompletionSource<bool>();
BridgeConnector.Socket.On("webContents-printToPDF-completed", (success) =>
{
BridgeConnector.Socket.Off("webContents-printToPDF-completed");
taskCompletionSource.SetResult((bool)success);
});
if(options == null)
{
BridgeConnector.Socket.Emit("webContents-printToPDF", Id, "", path);
}
else
{
BridgeConnector.Socket.Emit("webContents-printToPDF", Id, JObject.FromObject(options, _jsonSerializer), path);
}
return taskCompletionSource.Task;
}
/// <summary>
/// Is used to get the Url of the loaded page.
/// It's usefull if a web-server redirects you and you need to know where it redirects. For instance, It's useful in case of Implicit Authorization.
/// </summary>
/// <returns>URL of the loaded page</returns>
public Task<string> GetUrl()
{
var taskCompletionSource = new TaskCompletionSource<string>();
var eventString = "webContents-getUrl" + Id;
BridgeConnector.Socket.On(eventString, (url) =>
{
BridgeConnector.Socket.Off(eventString);
taskCompletionSource.SetResult((string)url);
});
BridgeConnector.Socket.Emit("webContents-getUrl", Id);
return taskCompletionSource.Task;
}
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://127.0.0.1:" + BridgeSettings.WebPort);
}
return builder;
}
}
}

View File

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

View File

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

View File

@@ -1,127 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using ElectronNET.CLI.Commands.Actions;
namespace ElectronNET.CLI.Commands
{
public class StartElectronCommand : ICommand
{
public const string COMMAND_NAME = "start";
public const string COMMAND_DESCRIPTION = "Start your ASP.NET Core Application with Electron, without package it as a single exe. Faster for development.";
public const string COMMAND_ARGUMENTS = "<Path> from ASP.NET Core Project.";
public static IList<CommandOption> CommandOptions { get; set; } = new List<CommandOption>();
private string[] _args;
public StartElectronCommand(string[] args)
{
_args = args;
}
private string _aspCoreProjectPath = "project-path";
private string _arguments = "args";
private string _manifest = "manifest";
public Task<bool> ExecuteAsync()
{
return Task.Run(() =>
{
Console.WriteLine("Start Electron Desktop Application...");
SimpleCommandLineParser parser = new SimpleCommandLineParser();
parser.Parse(_args);
string aspCoreProjectPath = "";
if (parser.Arguments.ContainsKey(_aspCoreProjectPath))
{
string projectPath = parser.Arguments[_aspCoreProjectPath].First();
if (Directory.Exists(projectPath))
{
aspCoreProjectPath = projectPath;
}
}
else
{
aspCoreProjectPath = Directory.GetCurrentDirectory();
}
string tempPath = Path.Combine(aspCoreProjectPath, "obj", "Host");
if (Directory.Exists(tempPath) == false)
{
Directory.CreateDirectory(tempPath);
}
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: " + resultCode);
return false;
}
DeployEmbeddedElectronFiles.Do(tempPath);
var nodeModulesDirPath = Path.Combine(tempPath, "node_modules");
Console.WriteLine("node_modules missing in: " + nodeModulesDirPath);
Console.WriteLine("Start npm install...");
ProcessHelper.CmdExecute("npm install", tempPath);
Console.WriteLine("ElectronHostHook handling started...");
string electronhosthookDir = Path.Combine(Directory.GetCurrentDirectory(), "ElectronHostHook");
if (Directory.Exists(electronhosthookDir))
{
string hosthookDir = Path.Combine(tempPath, "ElectronHostHook");
DirectoryCopy.Do(electronhosthookDir, hosthookDir, true, new List<string>() { "node_modules" });
Console.WriteLine("Start npm install for typescript & hosthooks...");
ProcessHelper.CmdExecute("npm install", hosthookDir);
// ToDo: Not sure if this runs under linux/macos
ProcessHelper.CmdExecute(@"npx tsc -p ../../ElectronHostHook", tempPath);
}
string arguments = "";
if (parser.Arguments.ContainsKey(_arguments))
{
arguments = string.Join(' ', parser.Arguments[_arguments]);
}
if (parser.Arguments.ContainsKey(_manifest))
{
arguments += " --manifest=" + parser.Arguments[_manifest].First();
}
string path = Path.Combine(tempPath, "node_modules", ".bin");
bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
if (isWindows)
{
Console.WriteLine("Invoke electron.cmd - in dir: " + path);
ProcessHelper.CmdExecute(@"electron.cmd ""..\..\main.js"" " + arguments, path);
}
else
{
Console.WriteLine("Invoke electron - in dir: " + path);
ProcessHelper.CmdExecute(@"./electron ""../../main.js"" " + arguments, path);
}
return true;
});
}
}
}

View File

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

View File

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

View File

@@ -1,8 +0,0 @@
{
"profiles": {
"ElectronNET.CLI": {
"commandName": "Project",
"commandLineArgs": "build \"C:\\Users\\Gregor\\Documents\\Visual Studio 2017\\Projects\\ElectronNET\\ElectronNET.WebApp\""
}
}
}

View File

@@ -1,91 +0,0 @@
# Created by https://www.gitignore.io/api/node
# Edit at https://www.gitignore.io/?templates=node
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# End of https://www.gitignore.io/api/node

View File

@@ -1,27 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Connector {
constructor(socket,
// @ts-ignore
app) {
this.socket = socket;
this.app = app;
}
on(key, javaScriptCode) {
this.socket.on(key, (...args) => {
const id = args.pop();
try {
javaScriptCode(...args, (data) => {
if (data) {
this.socket.emit(`${key}Complete${id}`, data);
}
});
}
catch (error) {
this.socket.emit(`${key}Error${id}`, `Host Hook Exception`, error);
}
});
}
}
exports.Connector = Connector;
//# sourceMappingURL=connector.js.map

View File

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

View File

@@ -1,21 +0,0 @@
export class Connector {
constructor(private socket: SocketIO.Socket,
// @ts-ignore
public app: Electron.App) { }
on(key: string, javaScriptCode: Function): void {
this.socket.on(key, (...args: any[]) => {
const id: string = args.pop();
try {
javaScriptCode(...args, (data) => {
if (data) {
this.socket.emit(`${key}Complete${id}`, data);
}
});
} catch (error) {
this.socket.emit(`${key}Error${id}`, `Host Hook Exception`, error);
}
});
}
}

View File

@@ -1,14 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const connector_1 = require("./connector");
class HookService extends connector_1.Connector {
constructor(socket, app) {
super(socket, app);
this.app = app;
}
onHostReady() {
// execute your own JavaScript Host logic here
}
}
exports.HookService = HookService;
//# sourceMappingURL=index.js.map

View File

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

View File

@@ -1,14 +0,0 @@
// @ts-ignore
import * as Electron from "electron";
import { Connector } from "./connector";
export class HookService extends Connector {
constructor(socket: SocketIO.Socket, public app: Electron.App) {
super(socket, app);
}
onHostReady(): void {
// execute your own JavaScript Host logic here
}
}

View File

@@ -1,19 +0,0 @@
{
"name": "electron-host-hook",
"version": "1.0.0",
"description": "Connector for Electron.NET projects.",
"repository": {
"url": "https://github.com/ElectronNET/Electron.NET"
},
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "Gregor Biswanger",
"license": "MIT",
"devDependencies": {
"@types/socket.io": "^2.1.2",
"typescript": "^3.4.5"
}
}

View File

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

View File

@@ -1,255 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
let isQuitWindowAllClosed = true, electronSocket;
module.exports = (socket, app) => {
electronSocket = socket;
// 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', () => {
electronSocket.emit('app-window-all-closed' + id);
});
});
socket.on('register-app-before-quit-event', (id) => {
app.on('before-quit', (event) => {
event.preventDefault();
electronSocket.emit('app-before-quit' + id);
});
});
socket.on('register-app-will-quit-event', (id) => {
app.on('will-quit', (event) => {
event.preventDefault();
electronSocket.emit('app-will-quit' + id);
});
});
socket.on('register-app-browser-window-blur-event', (id) => {
app.on('browser-window-blur', () => {
electronSocket.emit('app-browser-window-blur' + id);
});
});
socket.on('register-app-browser-window-focus-event', (id) => {
app.on('browser-window-focus', () => {
electronSocket.emit('app-browser-window-focus' + id);
});
});
socket.on('register-app-browser-window-created-event', (id) => {
app.on('browser-window-created', () => {
electronSocket.emit('app-browser-window-created' + id);
});
});
socket.on('register-app-web-contents-created-event', (id) => {
app.on('web-contents-created', () => {
electronSocket.emit('app-web-contents-created' + id);
});
});
socket.on('register-app-accessibility-support-changed-event', (id) => {
app.on('accessibility-support-changed', (event, accessibilitySupportEnabled) => {
electronSocket.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();
electronSocket.emit('appGetAppPathCompleted', path);
});
socket.on('appGetPath', (name) => {
const path = app.getPath(name);
electronSocket.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) => __awaiter(void 0, void 0, void 0, function* () {
let error = {};
if (options) {
const nativeImage = yield app.getFileIcon(path, options).catch((errorFileIcon) => error = errorFileIcon);
electronSocket.emit('appGetFileIconCompleted', [error, nativeImage]);
}
else {
const nativeImage = yield app.getFileIcon(path).catch((errorFileIcon) => error = errorFileIcon);
electronSocket.emit('appGetFileIconCompleted', [error, nativeImage]);
}
}));
socket.on('appSetPath', (name, path) => {
app.setPath(name, path);
});
socket.on('appGetVersion', () => {
const version = app.getVersion();
electronSocket.emit('appGetVersionCompleted', version);
});
socket.on('appGetName', () => {
const name = app.getName();
electronSocket.emit('appGetNameCompleted', name);
});
socket.on('appSetName', (name) => {
app.setName(name);
});
socket.on('appGetLocale', () => {
const locale = app.getLocale();
electronSocket.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);
electronSocket.emit('appSetAsDefaultProtocolClientCompleted', success);
});
socket.on('appRemoveAsDefaultProtocolClient', (protocol, path, args) => {
const success = app.removeAsDefaultProtocolClient(protocol, path, args);
electronSocket.emit('appRemoveAsDefaultProtocolClientCompleted', success);
});
socket.on('appIsDefaultProtocolClient', (protocol, path, args) => {
const success = app.isDefaultProtocolClient(protocol, path, args);
electronSocket.emit('appIsDefaultProtocolClientCompleted', success);
});
socket.on('appSetUserTasks', (tasks) => {
const success = app.setUserTasks(tasks);
electronSocket.emit('appSetUserTasksCompleted', success);
});
socket.on('appGetJumpListSettings', () => {
const jumpListSettings = app.getJumpListSettings();
electronSocket.emit('appGetJumpListSettingsCompleted', jumpListSettings);
});
socket.on('appSetJumpList', (categories) => {
app.setJumpList(categories);
});
socket.on('appRequestSingleInstanceLock', () => {
app.on('second-instance', (args, workingDirectory) => {
electronSocket.emit('secondInstance', [args, workingDirectory]);
});
const success = app.requestSingleInstanceLock();
electronSocket.emit('appRequestSingleInstanceLockCompleted', success);
});
socket.on('appReleaseSingleInstanceLock', () => {
app.releaseSingleInstanceLock();
});
socket.on('appSetUserActivity', (type, userInfo, webpageURL) => {
app.setUserActivity(type, userInfo, webpageURL);
});
socket.on('appGetCurrentActivityType', () => {
const activityType = app.getCurrentActivityType();
electronSocket.emit('appGetCurrentActivityTypeCompleted', activityType);
});
socket.on('appSetAppUserModelId', (id) => {
app.setAppUserModelId(id);
});
socket.on('appImportCertificate', (options) => {
app.importCertificate(options, (result) => {
electronSocket.emit('appImportCertificateCompleted', result);
});
});
socket.on('appGetAppMetrics', () => {
const processMetrics = app.getAppMetrics();
electronSocket.emit('appGetAppMetricsCompleted', processMetrics);
});
socket.on('appGetGpuFeatureStatus', () => {
const gpuFeatureStatus = app.getGPUFeatureStatus();
electronSocket.emit('appGetGpuFeatureStatusCompleted', gpuFeatureStatus);
});
socket.on('appSetBadgeCount', (count) => {
const success = app.setBadgeCount(count);
electronSocket.emit('appSetBadgeCountCompleted', success);
});
socket.on('appGetBadgeCount', () => {
const count = app.getBadgeCount();
electronSocket.emit('appGetBadgeCountCompleted', count);
});
socket.on('appIsUnityRunning', () => {
const isUnityRunning = app.isUnityRunning();
electronSocket.emit('appIsUnityRunningCompleted', isUnityRunning);
});
socket.on('appGetLoginItemSettings', (options) => {
const loginItemSettings = app.getLoginItemSettings(options);
electronSocket.emit('appGetLoginItemSettingsCompleted', loginItemSettings);
});
socket.on('appSetLoginItemSettings', (settings) => {
app.setLoginItemSettings(settings);
});
socket.on('appIsAccessibilitySupportEnabled', () => {
const isAccessibilitySupportEnabled = app.isAccessibilitySupportEnabled();
electronSocket.emit('appIsAccessibilitySupportEnabledCompleted', isAccessibilitySupportEnabled);
});
socket.on('appSetAboutPanelOptions', (options) => {
app.setAboutPanelOptions(options);
});
socket.on('appDockBounce', (type) => {
const id = app.dock.bounce(type);
electronSocket.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();
electronSocket.emit('appDockGetBadgeCompleted', text);
});
socket.on('appDockHide', () => {
app.dock.hide();
});
socket.on('appDockShow', () => {
app.dock.show();
});
socket.on('appDockIsVisible', () => {
const isVisible = app.dock.isVisible();
electronSocket.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);
});
};
//# sourceMappingURL=app.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,308 +0,0 @@
let isQuitWindowAllClosed = true, electronSocket;
export = (socket: SocketIO.Socket, app: Electron.App) => {
electronSocket = socket;
// 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', () => {
electronSocket.emit('app-window-all-closed' + id);
});
});
socket.on('register-app-before-quit-event', (id) => {
app.on('before-quit', (event) => {
event.preventDefault();
electronSocket.emit('app-before-quit' + id);
});
});
socket.on('register-app-will-quit-event', (id) => {
app.on('will-quit', (event) => {
event.preventDefault();
electronSocket.emit('app-will-quit' + id);
});
});
socket.on('register-app-browser-window-blur-event', (id) => {
app.on('browser-window-blur', () => {
electronSocket.emit('app-browser-window-blur' + id);
});
});
socket.on('register-app-browser-window-focus-event', (id) => {
app.on('browser-window-focus', () => {
electronSocket.emit('app-browser-window-focus' + id);
});
});
socket.on('register-app-browser-window-created-event', (id) => {
app.on('browser-window-created', () => {
electronSocket.emit('app-browser-window-created' + id);
});
});
socket.on('register-app-web-contents-created-event', (id) => {
app.on('web-contents-created', () => {
electronSocket.emit('app-web-contents-created' + id);
});
});
socket.on('register-app-accessibility-support-changed-event', (id) => {
app.on('accessibility-support-changed', (event, accessibilitySupportEnabled) => {
electronSocket.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();
electronSocket.emit('appGetAppPathCompleted', path);
});
socket.on('appGetPath', (name) => {
const path = app.getPath(name);
electronSocket.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', async (path, options) => {
let error = {};
if (options) {
const nativeImage = await app.getFileIcon(path, options).catch((errorFileIcon) => error = errorFileIcon);
electronSocket.emit('appGetFileIconCompleted', [error, nativeImage]);
} else {
const nativeImage = await app.getFileIcon(path).catch((errorFileIcon) => error = errorFileIcon);
electronSocket.emit('appGetFileIconCompleted', [error, nativeImage]);
}
});
socket.on('appSetPath', (name, path) => {
app.setPath(name, path);
});
socket.on('appGetVersion', () => {
const version = app.getVersion();
electronSocket.emit('appGetVersionCompleted', version);
});
socket.on('appGetName', () => {
const name = app.getName();
electronSocket.emit('appGetNameCompleted', name);
});
socket.on('appSetName', (name) => {
app.setName(name);
});
socket.on('appGetLocale', () => {
const locale = app.getLocale();
electronSocket.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);
electronSocket.emit('appSetAsDefaultProtocolClientCompleted', success);
});
socket.on('appRemoveAsDefaultProtocolClient', (protocol, path, args) => {
const success = app.removeAsDefaultProtocolClient(protocol, path, args);
electronSocket.emit('appRemoveAsDefaultProtocolClientCompleted', success);
});
socket.on('appIsDefaultProtocolClient', (protocol, path, args) => {
const success = app.isDefaultProtocolClient(protocol, path, args);
electronSocket.emit('appIsDefaultProtocolClientCompleted', success);
});
socket.on('appSetUserTasks', (tasks) => {
const success = app.setUserTasks(tasks);
electronSocket.emit('appSetUserTasksCompleted', success);
});
socket.on('appGetJumpListSettings', () => {
const jumpListSettings = app.getJumpListSettings();
electronSocket.emit('appGetJumpListSettingsCompleted', jumpListSettings);
});
socket.on('appSetJumpList', (categories) => {
app.setJumpList(categories);
});
socket.on('appRequestSingleInstanceLock', () => {
app.on('second-instance', (args, workingDirectory) => {
electronSocket.emit('secondInstance', [args, workingDirectory]);
});
const success = app.requestSingleInstanceLock();
electronSocket.emit('appRequestSingleInstanceLockCompleted', success);
});
socket.on('appReleaseSingleInstanceLock', () => {
app.releaseSingleInstanceLock();
});
socket.on('appSetUserActivity', (type, userInfo, webpageURL) => {
app.setUserActivity(type, userInfo, webpageURL);
});
socket.on('appGetCurrentActivityType', () => {
const activityType = app.getCurrentActivityType();
electronSocket.emit('appGetCurrentActivityTypeCompleted', activityType);
});
socket.on('appSetAppUserModelId', (id) => {
app.setAppUserModelId(id);
});
socket.on('appImportCertificate', (options) => {
app.importCertificate(options, (result) => {
electronSocket.emit('appImportCertificateCompleted', result);
});
});
socket.on('appGetAppMetrics', () => {
const processMetrics = app.getAppMetrics();
electronSocket.emit('appGetAppMetricsCompleted', processMetrics);
});
socket.on('appGetGpuFeatureStatus', () => {
const gpuFeatureStatus = app.getGPUFeatureStatus();
electronSocket.emit('appGetGpuFeatureStatusCompleted', gpuFeatureStatus);
});
socket.on('appSetBadgeCount', (count) => {
const success = app.setBadgeCount(count);
electronSocket.emit('appSetBadgeCountCompleted', success);
});
socket.on('appGetBadgeCount', () => {
const count = app.getBadgeCount();
electronSocket.emit('appGetBadgeCountCompleted', count);
});
socket.on('appIsUnityRunning', () => {
const isUnityRunning = app.isUnityRunning();
electronSocket.emit('appIsUnityRunningCompleted', isUnityRunning);
});
socket.on('appGetLoginItemSettings', (options) => {
const loginItemSettings = app.getLoginItemSettings(options);
electronSocket.emit('appGetLoginItemSettingsCompleted', loginItemSettings);
});
socket.on('appSetLoginItemSettings', (settings) => {
app.setLoginItemSettings(settings);
});
socket.on('appIsAccessibilitySupportEnabled', () => {
const isAccessibilitySupportEnabled = app.isAccessibilitySupportEnabled();
electronSocket.emit('appIsAccessibilitySupportEnabledCompleted', isAccessibilitySupportEnabled);
});
socket.on('appSetAboutPanelOptions', (options) => {
app.setAboutPanelOptions(options);
});
socket.on('appDockBounce', (type) => {
const id = app.dock.bounce(type);
electronSocket.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();
electronSocket.emit('appDockGetBadgeCompleted', text);
});
socket.on('appDockHide', () => {
app.dock.hide();
});
socket.on('appDockShow', () => {
app.dock.show();
});
socket.on('appDockIsVisible', () => {
const isVisible = app.dock.isVisible();
electronSocket.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,112 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
const electron_updater_1 = require("electron-updater");
const path = require('path');
let electronSocket;
module.exports = (socket) => {
electronSocket = socket;
// Events ********
socket.on('register-autoUpdater-error-event', (id) => {
electron_updater_1.autoUpdater.on('error', (error) => {
electronSocket.emit('autoUpdater-error' + id, error.message);
});
});
socket.on('register-autoUpdater-checking-for-update-event', (id) => {
electron_updater_1.autoUpdater.on('checking-for-update', () => {
electronSocket.emit('autoUpdater-checking-for-update' + id);
});
});
socket.on('register-autoUpdater-update-available-event', (id) => {
electron_updater_1.autoUpdater.on('update-available', (updateInfo) => {
electronSocket.emit('autoUpdater-update-available' + id, updateInfo);
});
});
socket.on('register-autoUpdater-update-not-available-event', (id) => {
electron_updater_1.autoUpdater.on('update-not-available', (updateInfo) => {
electronSocket.emit('autoUpdater-update-not-available' + id, updateInfo);
});
});
socket.on('register-autoUpdater-download-progress-event', (id) => {
electron_updater_1.autoUpdater.on('download-progress', (progressInfo) => {
electronSocket.emit('autoUpdater-download-progress' + id, progressInfo);
});
});
socket.on('register-autoUpdater-update-downloaded-event', (id) => {
electron_updater_1.autoUpdater.on('update-downloaded', (updateInfo) => {
electronSocket.emit('autoUpdater-update-downloaded' + id, updateInfo);
});
});
// Properties *****
socket.on('autoUpdater-autoDownload-get', () => {
electronSocket.emit('autoUpdater-autoDownload-get-reply', electron_updater_1.autoUpdater.autoDownload);
});
socket.on('autoUpdater-autoDownload-set', (value) => {
electron_updater_1.autoUpdater.autoDownload = value;
});
socket.on('autoUpdater-autoInstallOnAppQuit-get', () => {
electronSocket.emit('autoUpdater-autoInstallOnAppQuit-get-reply', electron_updater_1.autoUpdater.autoInstallOnAppQuit);
});
socket.on('autoUpdater-autoInstallOnAppQuit-set', (value) => {
electron_updater_1.autoUpdater.autoInstallOnAppQuit = value;
});
socket.on('autoUpdater-allowPrerelease-get', () => {
electronSocket.emit('autoUpdater-allowPrerelease-get-reply', electron_updater_1.autoUpdater.allowPrerelease);
});
socket.on('autoUpdater-allowPrerelease-set', (value) => {
electron_updater_1.autoUpdater.allowPrerelease = value;
});
socket.on('autoUpdater-fullChangelog-get', () => {
electronSocket.emit('autoUpdater-fullChangelog-get-reply', electron_updater_1.autoUpdater.fullChangelog);
});
socket.on('autoUpdater-fullChangelog-set', (value) => {
electron_updater_1.autoUpdater.fullChangelog = value;
});
socket.on('autoUpdater-allowDowngrade-get', () => {
electronSocket.emit('autoUpdater-allowDowngrade-get-reply', electron_updater_1.autoUpdater.allowDowngrade);
});
socket.on('autoUpdater-allowDowngrade-set', (value) => {
electron_updater_1.autoUpdater.allowDowngrade = value;
});
socket.on('autoUpdater-updateConfigPath-get', () => {
electronSocket.emit('autoUpdater-updateConfigPath-get-reply', electron_updater_1.autoUpdater.updateConfigPath || '');
});
socket.on('autoUpdater-updateConfigPath-set', (value) => {
electron_updater_1.autoUpdater.updateConfigPath = value;
});
socket.on('autoUpdater-channel-get', () => {
electronSocket.emit('autoUpdater-channel-get-reply', electron_updater_1.autoUpdater.channel || '');
});
socket.on('autoUpdater-channel-set', (value) => {
electron_updater_1.autoUpdater.channel = value;
});
// Methods ********
socket.on('autoUpdaterCheckForUpdatesAndNotify', (guid) => __awaiter(void 0, void 0, void 0, function* () {
const updateCheckResult = yield electron_updater_1.autoUpdater.checkForUpdatesAndNotify();
electronSocket.emit('autoUpdaterCheckForUpdatesAndNotifyComplete' + guid, updateCheckResult);
}));
socket.on('autoUpdaterCheckForUpdates', (guid) => __awaiter(void 0, void 0, void 0, function* () {
// autoUpdater.updateConfigPath = path.join(__dirname, 'dev-app-update.yml');
const updateCheckResult = yield electron_updater_1.autoUpdater.checkForUpdates();
electronSocket.emit('autoUpdaterCheckForUpdatesComplete' + guid, updateCheckResult);
}));
socket.on('autoUpdaterQuitAndInstall', (isSilent, isForceRunAfter) => __awaiter(void 0, void 0, void 0, function* () {
electron_updater_1.autoUpdater.quitAndInstall(isSilent, isForceRunAfter);
}));
socket.on('autoUpdaterDownloadUpdate', (guid) => __awaiter(void 0, void 0, void 0, function* () {
const downloadedPath = yield electron_updater_1.autoUpdater.downloadUpdate();
electronSocket.emit('autoUpdaterDownloadUpdateComplete' + guid, downloadedPath);
}));
socket.on('autoUpdaterGetFeedURL', (guid) => __awaiter(void 0, void 0, void 0, function* () {
const feedUrl = yield electron_updater_1.autoUpdater.getFeedURL();
electronSocket.emit('autoUpdaterGetFeedURLComplete' + guid, feedUrl || '');
}));
};
//# sourceMappingURL=autoUpdater.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"autoUpdater.js","sourceRoot":"","sources":["autoUpdater.ts"],"names":[],"mappings":"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"}

View File

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

View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

@@ -1,52 +0,0 @@
"use strict";
const electron_1 = require("electron");
let electronSocket;
module.exports = (socket) => {
electronSocket = socket;
socket.on('clipboard-readText', (type) => {
const text = electron_1.clipboard.readText(type);
electronSocket.emit('clipboard-readText-Completed', text);
});
socket.on('clipboard-writeText', (text, type) => {
electron_1.clipboard.writeText(text, type);
});
socket.on('clipboard-readHTML', (type) => {
const content = electron_1.clipboard.readHTML(type);
electronSocket.emit('clipboard-readHTML-Completed', content);
});
socket.on('clipboard-writeHTML', (markup, type) => {
electron_1.clipboard.writeHTML(markup, type);
});
socket.on('clipboard-readRTF', (type) => {
const content = electron_1.clipboard.readRTF(type);
electronSocket.emit('clipboard-readRTF-Completed', content);
});
socket.on('clipboard-writeRTF', (text, type) => {
electron_1.clipboard.writeHTML(text, type);
});
socket.on('clipboard-readBookmark', () => {
const bookmark = electron_1.clipboard.readBookmark();
electronSocket.emit('clipboard-readBookmark-Completed', bookmark);
});
socket.on('clipboard-writeBookmark', (title, url, type) => {
electron_1.clipboard.writeBookmark(title, url, type);
});
socket.on('clipboard-readFindText', () => {
const content = electron_1.clipboard.readFindText();
electronSocket.emit('clipboard-readFindText-Completed', content);
});
socket.on('clipboard-writeFindText', (text) => {
electron_1.clipboard.writeFindText(text);
});
socket.on('clipboard-clear', (type) => {
electron_1.clipboard.clear(type);
});
socket.on('clipboard-availableFormats', (type) => {
const formats = electron_1.clipboard.availableFormats(type);
electronSocket.emit('clipboard-availableFormats-Completed', formats);
});
socket.on('clipboard-write', (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,uCAAqC;AACrC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE;QACrC,MAAM,IAAI,GAAG,oBAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtC,cAAc,CAAC,IAAI,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QAC5C,oBAAS,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,oBAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzC,cAAc,CAAC,IAAI,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;QAC9C,oBAAS,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,IAAI,EAAE,EAAE;QACpC,MAAM,OAAO,GAAG,oBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACxC,cAAc,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QAC3C,oBAAS,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACrC,MAAM,QAAQ,GAAG,oBAAS,CAAC,YAAY,EAAE,CAAC;QAC1C,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,QAAQ,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACtD,oBAAS,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACrC,MAAM,OAAO,GAAG,oBAAS,CAAC,YAAY,EAAE,CAAC;QACzC,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,IAAI,EAAE,EAAE;QAC1C,oBAAS,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE;QAClC,oBAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,CAAC,IAAI,EAAE,EAAE;QAC7C,MAAM,OAAO,GAAG,oBAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACjD,cAAc,CAAC,IAAI,CAAC,sCAAsC,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QACxC,oBAAS,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}

View File

@@ -1,63 +0,0 @@
import { clipboard } from 'electron';
let electronSocket;
export = (socket: SocketIO.Socket) => {
electronSocket = socket;
socket.on('clipboard-readText', (type) => {
const text = clipboard.readText(type);
electronSocket.emit('clipboard-readText-Completed', text);
});
socket.on('clipboard-writeText', (text, type) => {
clipboard.writeText(text, type);
});
socket.on('clipboard-readHTML', (type) => {
const content = clipboard.readHTML(type);
electronSocket.emit('clipboard-readHTML-Completed', content);
});
socket.on('clipboard-writeHTML', (markup, type) => {
clipboard.writeHTML(markup, type);
});
socket.on('clipboard-readRTF', (type) => {
const content = clipboard.readRTF(type);
electronSocket.emit('clipboard-readRTF-Completed', content);
});
socket.on('clipboard-writeRTF', (text, type) => {
clipboard.writeHTML(text, type);
});
socket.on('clipboard-readBookmark', () => {
const bookmark = clipboard.readBookmark();
electronSocket.emit('clipboard-readBookmark-Completed', bookmark);
});
socket.on('clipboard-writeBookmark', (title, url, type) => {
clipboard.writeBookmark(title, url, type);
});
socket.on('clipboard-readFindText', () => {
const content = clipboard.readFindText();
electronSocket.emit('clipboard-readFindText-Completed', content);
});
socket.on('clipboard-writeFindText', (text) => {
clipboard.writeFindText(text);
});
socket.on('clipboard-clear', (type) => {
clipboard.clear(type);
});
socket.on('clipboard-availableFormats', (type) => {
const formats = clipboard.availableFormats(type);
electronSocket.emit('clipboard-availableFormats-Completed', formats);
});
socket.on('clipboard-write', (data, type) => {
clipboard.write(data, type);
});
};

View File

@@ -1,20 +0,0 @@
"use strict";
let electronSocket;
module.exports = (socket, app) => {
electronSocket = socket;
socket.on('appCommandLineAppendSwitch', (the_switch, value) => {
app.commandLine.appendSwitch(the_switch, value);
});
socket.on('appCommandLineAppendArgument', (value) => {
app.commandLine.appendArgument(value);
});
socket.on('appCommandLineHasSwitch', (value) => {
const hasSwitch = app.commandLine.hasSwitch(value);
electronSocket.emit('appCommandLineHasSwitchCompleted', hasSwitch);
});
socket.on('appCommandLineGetSwitchValue', (the_switch) => {
const value = app.commandLine.getSwitchValue(the_switch);
electronSocket.emit('appCommandLineGetSwitchValueCompleted', value);
});
};
//# sourceMappingURL=commandLine.js.map

View File

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

View File

@@ -1,23 +0,0 @@
let electronSocket;
export = (socket: SocketIO.Socket, app: Electron.App) => {
electronSocket = socket;
socket.on('appCommandLineAppendSwitch', (the_switch: string, value: string) => {
app.commandLine.appendSwitch(the_switch, value);
});
socket.on('appCommandLineAppendArgument', (value: string) => {
app.commandLine.appendArgument(value);
});
socket.on('appCommandLineHasSwitch', (value: string) => {
const hasSwitch = app.commandLine.hasSwitch(value);
electronSocket.emit('appCommandLineHasSwitchCompleted', hasSwitch);
});
socket.on('appCommandLineGetSwitchValue', (the_switch: string) => {
const value = app.commandLine.getSwitchValue(the_switch);
electronSocket.emit('appCommandLineGetSwitchValueCompleted', value);
});
};

View File

@@ -1,46 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
const electron_1 = require("electron");
let electronSocket;
module.exports = (socket) => {
electronSocket = socket;
socket.on('showMessageBox', (browserWindow, options, guid) => __awaiter(void 0, void 0, void 0, function* () {
if ('id' in browserWindow) {
const window = electron_1.BrowserWindow.fromId(browserWindow.id);
const messageBoxReturnValue = yield electron_1.dialog.showMessageBox(window, options);
electronSocket.emit('showMessageBoxComplete' + guid, [messageBoxReturnValue.response, messageBoxReturnValue.checkboxChecked]);
}
else {
const id = guid || options;
const messageBoxReturnValue = yield electron_1.dialog.showMessageBox(browserWindow);
electronSocket.emit('showMessageBoxComplete' + id, [messageBoxReturnValue.response, messageBoxReturnValue.checkboxChecked]);
}
}));
socket.on('showOpenDialog', (browserWindow, options, guid) => __awaiter(void 0, void 0, void 0, function* () {
const window = electron_1.BrowserWindow.fromId(browserWindow.id);
const openDialogReturnValue = yield electron_1.dialog.showOpenDialog(window, options);
electronSocket.emit('showOpenDialogComplete' + guid, openDialogReturnValue.filePaths || []);
}));
socket.on('showSaveDialog', (browserWindow, options, guid) => __awaiter(void 0, void 0, void 0, function* () {
const window = electron_1.BrowserWindow.fromId(browserWindow.id);
const saveDialogReturnValue = yield electron_1.dialog.showSaveDialog(window, options);
electronSocket.emit('showSaveDialogComplete' + guid, saveDialogReturnValue.filePath || '');
}));
socket.on('showErrorBox', (title, content) => {
electron_1.dialog.showErrorBox(title, content);
});
socket.on('showCertificateTrustDialog', (browserWindow, options, guid) => __awaiter(void 0, void 0, void 0, function* () {
const window = electron_1.BrowserWindow.fromId(browserWindow.id);
yield electron_1.dialog.showCertificateTrustDialog(window, options);
electronSocket.emit('showCertificateTrustDialogComplete' + guid);
}));
};
//# sourceMappingURL=dialog.js.map

View File

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

View File

@@ -1,44 +0,0 @@
import { BrowserWindow, dialog } from 'electron';
let electronSocket;
export = (socket: SocketIO.Socket) => {
electronSocket = socket;
socket.on('showMessageBox', async (browserWindow, options, guid) => {
if ('id' in browserWindow) {
const window = BrowserWindow.fromId(browserWindow.id);
const messageBoxReturnValue = await dialog.showMessageBox(window, options);
electronSocket.emit('showMessageBoxComplete' + guid, [messageBoxReturnValue.response, messageBoxReturnValue.checkboxChecked]);
} else {
const id = guid || options;
const messageBoxReturnValue = await dialog.showMessageBox(browserWindow);
electronSocket.emit('showMessageBoxComplete' + id, [messageBoxReturnValue.response, messageBoxReturnValue.checkboxChecked]);
}
});
socket.on('showOpenDialog', async (browserWindow, options, guid) => {
const window = BrowserWindow.fromId(browserWindow.id);
const openDialogReturnValue = await dialog.showOpenDialog(window, options);
electronSocket.emit('showOpenDialogComplete' + guid, openDialogReturnValue.filePaths || []);
});
socket.on('showSaveDialog', async (browserWindow, options, guid) => {
const window = BrowserWindow.fromId(browserWindow.id);
const saveDialogReturnValue = await dialog.showSaveDialog(window, options);
electronSocket.emit('showSaveDialogComplete' + guid, saveDialogReturnValue.filePath || '');
});
socket.on('showErrorBox', (title, content) => {
dialog.showErrorBox(title, content);
});
socket.on('showCertificateTrustDialog', async (browserWindow, options, guid) => {
const window = BrowserWindow.fromId(browserWindow.id);
await dialog.showCertificateTrustDialog(window, options);
electronSocket.emit('showCertificateTrustDialogComplete' + guid);
});
};

View File

@@ -1,25 +0,0 @@
"use strict";
const electron_1 = require("electron");
let electronSocket;
module.exports = (socket) => {
electronSocket = socket;
socket.on('globalShortcut-register', (accelerator) => {
electron_1.globalShortcut.register(accelerator, () => {
electronSocket.emit('globalShortcut-pressed', accelerator);
});
});
socket.on('globalShortcut-isRegistered', (accelerator) => {
const isRegistered = electron_1.globalShortcut.isRegistered(accelerator);
electronSocket.emit('globalShortcut-isRegisteredCompleted', isRegistered);
});
socket.on('globalShortcut-unregister', (accelerator) => {
electron_1.globalShortcut.unregister(accelerator);
});
socket.on('globalShortcut-unregisterAll', () => {
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,uCAA0C;AAC1C,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,WAAW,EAAE,EAAE;QACjD,yBAAc,CAAC,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;YACtC,cAAc,CAAC,IAAI,CAAC,wBAAwB,EAAE,WAAW,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE,CAAC,WAAW,EAAE,EAAE;QACrD,MAAM,YAAY,GAAG,yBAAc,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QAE9D,cAAc,CAAC,IAAI,CAAC,sCAAsC,EAAE,YAAY,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,CAAC,WAAW,EAAE,EAAE;QACnD,yBAAc,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QAC3C,IAAI;YACA,yBAAc,CAAC,aAAa,EAAE,CAAC;SAClC;QAAC,OAAO,KAAK,EAAE,GAAG;IACvB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}

View File

@@ -1,27 +0,0 @@
import { globalShortcut } from 'electron';
let electronSocket;
export = (socket: SocketIO.Socket) => {
electronSocket = socket;
socket.on('globalShortcut-register', (accelerator) => {
globalShortcut.register(accelerator, () => {
electronSocket.emit('globalShortcut-pressed', accelerator);
});
});
socket.on('globalShortcut-isRegistered', (accelerator) => {
const isRegistered = globalShortcut.isRegistered(accelerator);
electronSocket.emit('globalShortcut-isRegisteredCompleted', isRegistered);
});
socket.on('globalShortcut-unregister', (accelerator) => {
globalShortcut.unregister(accelerator);
});
socket.on('globalShortcut-unregisterAll', () => {
try {
globalShortcut.unregisterAll();
} catch (error) { }
});
};

View File

@@ -1,36 +0,0 @@
"use strict";
const electron_1 = require("electron");
let electronSocket;
module.exports = (socket) => {
electronSocket = socket;
socket.on('registerIpcMainChannel', (channel) => {
electron_1.ipcMain.on(channel, (event, args) => {
electronSocket.emit(channel, [event.preventDefault(), args]);
});
});
socket.on('registerSyncIpcMainChannel', (channel) => {
electron_1.ipcMain.on(channel, (event, args) => {
const x = socket;
x.removeAllListeners(channel + 'Sync');
socket.on(channel + 'Sync', (result) => {
event.returnValue = result;
});
electronSocket.emit(channel, [event.preventDefault(), args]);
});
});
socket.on('registerOnceIpcMainChannel', (channel) => {
electron_1.ipcMain.once(channel, (event, args) => {
electronSocket.emit(channel, [event.preventDefault(), args]);
});
});
socket.on('removeAllListenersIpcMainChannel', (channel) => {
electron_1.ipcMain.removeAllListeners(channel);
});
socket.on('sendToIpcRenderer', (browserWindow, channel, ...data) => {
const window = electron_1.BrowserWindow.fromId(browserWindow.id);
if (window) {
window.webContents.send(channel, ...data);
}
});
};
//# sourceMappingURL=ipc.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"ipc.js","sourceRoot":"","sources":["ipc.ts"],"names":[],"mappings":";AAAA,uCAAkD;AAClD,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,CAAC,OAAO,EAAE,EAAE;QAC5C,kBAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAChC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,CAAC,OAAO,EAAE,EAAE;QAChD,kBAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAChC,MAAM,CAAC,GAAQ,MAAM,CAAC;YACtB,CAAC,CAAC,kBAAkB,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;YACvC,MAAM,CAAC,EAAE,CAAC,OAAO,GAAG,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;gBACnC,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC;YAC/B,CAAC,CAAC,CAAC;YAEH,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,CAAC,OAAO,EAAE,EAAE;QAChD,kBAAO,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAClC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,kCAAkC,EAAE,CAAC,OAAO,EAAE,EAAE;QACtD,kBAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE;QAC/D,MAAM,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QAEtD,IAAI,MAAM,EAAE;YACR,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;SAC7C;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}

View File

@@ -1,41 +0,0 @@
import { ipcMain, BrowserWindow } from 'electron';
let electronSocket;
export = (socket: SocketIO.Socket) => {
electronSocket = socket;
socket.on('registerIpcMainChannel', (channel) => {
ipcMain.on(channel, (event, args) => {
electronSocket.emit(channel, [event.preventDefault(), args]);
});
});
socket.on('registerSyncIpcMainChannel', (channel) => {
ipcMain.on(channel, (event, args) => {
const x = <any>socket;
x.removeAllListeners(channel + 'Sync');
socket.on(channel + 'Sync', (result) => {
event.returnValue = result;
});
electronSocket.emit(channel, [event.preventDefault(), args]);
});
});
socket.on('registerOnceIpcMainChannel', (channel) => {
ipcMain.once(channel, (event, args) => {
electronSocket.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,53 +0,0 @@
"use strict";
const electron_1 = require("electron");
const contextMenuItems = [];
let electronSocket;
module.exports = (socket) => {
electronSocket = socket;
socket.on('menu-setContextMenu', (browserWindowId, menuItems) => {
const menu = electron_1.Menu.buildFromTemplate(menuItems);
addContextMenuItemClickConnector(menu.items, browserWindowId, (id, browserWindowId) => {
electronSocket.emit('contextMenuItemClicked', [id, browserWindowId]);
});
contextMenuItems.push({
menu: menu,
browserWindowId: browserWindowId
});
});
function addContextMenuItemClickConnector(menuItems, browserWindowId, callback) {
menuItems.forEach((item) => {
if (item.submenu && item.submenu.items.length > 0) {
addContextMenuItemClickConnector(item.submenu.items, browserWindowId, callback);
}
if ('id' in item && item.id) {
item.click = () => { callback(item.id, browserWindowId); };
}
});
}
socket.on('menu-contextMenuPopup', (browserWindowId) => {
contextMenuItems.forEach(x => {
if (x.browserWindowId === browserWindowId) {
const browserWindow = electron_1.BrowserWindow.fromId(browserWindowId);
x.menu.popup(browserWindow);
}
});
});
socket.on('menu-setApplicationMenu', (menuItems) => {
const menu = electron_1.Menu.buildFromTemplate(menuItems);
addMenuItemClickConnector(menu.items, (id) => {
electronSocket.emit('menuItemClicked', id);
});
electron_1.Menu.setApplicationMenu(menu);
});
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); };
}
});
}
};
//# sourceMappingURL=menu.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"menu.js","sourceRoot":"","sources":["menu.ts"],"names":[],"mappings":"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"}

View File

@@ -1,62 +0,0 @@
import { Menu, BrowserWindow } from 'electron';
const contextMenuItems = [];
let electronSocket;
export = (socket: SocketIO.Socket) => {
electronSocket = socket;
socket.on('menu-setContextMenu', (browserWindowId, menuItems) => {
const menu = Menu.buildFromTemplate(menuItems);
addContextMenuItemClickConnector(menu.items, browserWindowId, (id, browserWindowId) => {
electronSocket.emit('contextMenuItemClicked', [id, browserWindowId]);
});
contextMenuItems.push({
menu: menu,
browserWindowId: browserWindowId
});
});
function addContextMenuItemClickConnector(menuItems, browserWindowId, callback) {
menuItems.forEach((item) => {
if (item.submenu && item.submenu.items.length > 0) {
addContextMenuItemClickConnector(item.submenu.items, browserWindowId, callback);
}
if ('id' in item && item.id) {
item.click = () => { callback(item.id, browserWindowId); };
}
});
}
socket.on('menu-contextMenuPopup', (browserWindowId) => {
contextMenuItems.forEach(x => {
if (x.browserWindowId === browserWindowId) {
const browserWindow = BrowserWindow.fromId(browserWindowId);
x.menu.popup(browserWindow);
}
});
});
socket.on('menu-setApplicationMenu', (menuItems) => {
const menu = Menu.buildFromTemplate(menuItems);
addMenuItemClickConnector(menu.items, (id) => {
electronSocket.emit('menuItemClicked', id);
});
Menu.setApplicationMenu(menu);
});
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,50 +0,0 @@
"use strict";
const electron_1 = require("electron");
const notifications = [];
let electronSocket;
module.exports = (socket) => {
electronSocket = socket;
socket.on('createNotification', (options) => {
const notification = new electron_1.Notification(options);
let haveEvent = false;
if (options.showID) {
haveEvent = true;
notification.on('show', () => {
electronSocket.emit('NotificationEventShow', options.showID);
});
}
if (options.clickID) {
haveEvent = true;
notification.on('click', () => {
electronSocket.emit('NotificationEventClick', options.clickID);
});
}
if (options.closeID) {
haveEvent = true;
notification.on('close', () => {
electronSocket.emit('NotificationEventClose', options.closeID);
});
}
if (options.replyID) {
haveEvent = true;
notification.on('reply', (event, value) => {
electronSocket.emit('NotificationEventReply', [options.replyID, value]);
});
}
if (options.actionID) {
haveEvent = true;
notification.on('action', (event, value) => {
electronSocket.emit('NotificationEventAction', [options.actionID, value]);
});
}
if (haveEvent) {
notifications.push(notification);
}
notification.show();
});
socket.on('notificationIsSupported', () => {
const isSupported = electron_1.Notification.isSupported;
electronSocket.emit('notificationIsSupportedComplete', isSupported);
});
};
//# sourceMappingURL=notification.js.map

View File

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

View File

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

View File

@@ -1,46 +0,0 @@
"use strict";
const electron_1 = require("electron");
let electronSocket;
module.exports = (socket) => {
electronSocket = socket;
socket.on('register-screen-display-added', (id) => {
electron_1.screen.on('display-added', (event, display) => {
electronSocket.emit('screen-display-added-event' + id, display);
});
});
socket.on('register-screen-display-removed', (id) => {
electron_1.screen.on('display-removed', (event, display) => {
electronSocket.emit('screen-display-removed-event' + id, display);
});
});
socket.on('register-screen-display-metrics-changed', (id) => {
electron_1.screen.on('display-metrics-changed', (event, display, changedMetrics) => {
electronSocket.emit('screen-display-metrics-changed-event' + id, [display, changedMetrics]);
});
});
socket.on('screen-getCursorScreenPoint', () => {
const point = electron_1.screen.getCursorScreenPoint();
electronSocket.emit('screen-getCursorScreenPointCompleted', point);
});
socket.on('screen-getMenuBarHeight', () => {
const height = electron_1.screen.getPrimaryDisplay().workArea;
electronSocket.emit('screen-getMenuBarHeightCompleted', height);
});
socket.on('screen-getPrimaryDisplay', () => {
const display = electron_1.screen.getPrimaryDisplay();
electronSocket.emit('screen-getPrimaryDisplayCompleted', display);
});
socket.on('screen-getAllDisplays', () => {
const display = electron_1.screen.getAllDisplays();
electronSocket.emit('screen-getAllDisplaysCompleted', display);
});
socket.on('screen-getDisplayNearestPoint', (point) => {
const display = electron_1.screen.getDisplayNearestPoint(point);
electronSocket.emit('screen-getDisplayNearestPointCompleted', display);
});
socket.on('screen-getDisplayMatching', (rectangle) => {
const display = electron_1.screen.getDisplayMatching(rectangle);
electronSocket.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,uCAAkC;AAClC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,+BAA+B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC9C,iBAAM,CAAC,EAAE,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC1C,cAAc,CAAC,IAAI,CAAC,4BAA4B,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iCAAiC,EAAE,CAAC,EAAE,EAAE,EAAE;QAChD,iBAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC5C,cAAc,CAAC,IAAI,CAAC,8BAA8B,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yCAAyC,EAAE,CAAC,EAAE,EAAE,EAAE;QACxD,iBAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE;YACpE,cAAc,CAAC,IAAI,CAAC,sCAAsC,GAAG,EAAE,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;QAChG,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QAC1C,MAAM,KAAK,GAAG,iBAAM,CAAC,oBAAoB,EAAE,CAAC;QAC5C,cAAc,CAAC,IAAI,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACtC,MAAM,MAAM,GAAG,iBAAM,CAAC,iBAAiB,EAAE,CAAC,QAAQ,CAAC;QACnD,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACvC,MAAM,OAAO,GAAG,iBAAM,CAAC,iBAAiB,EAAE,CAAC;QAC3C,cAAc,CAAC,IAAI,CAAC,mCAAmC,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QACpC,MAAM,OAAO,GAAG,iBAAM,CAAC,cAAc,EAAE,CAAC;QACxC,cAAc,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,+BAA+B,EAAE,CAAC,KAAK,EAAE,EAAE;QACjD,MAAM,OAAO,GAAG,iBAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;QACrD,cAAc,CAAC,IAAI,CAAC,wCAAwC,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,CAAC,SAAS,EAAE,EAAE;QACjD,MAAM,OAAO,GAAG,iBAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACrD,cAAc,CAAC,IAAI,CAAC,oCAAoC,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}

View File

@@ -1,53 +0,0 @@
import { screen } from 'electron';
let electronSocket;
export = (socket: SocketIO.Socket) => {
electronSocket = socket;
socket.on('register-screen-display-added', (id) => {
screen.on('display-added', (event, display) => {
electronSocket.emit('screen-display-added-event' + id, display);
});
});
socket.on('register-screen-display-removed', (id) => {
screen.on('display-removed', (event, display) => {
electronSocket.emit('screen-display-removed-event' + id, display);
});
});
socket.on('register-screen-display-metrics-changed', (id) => {
screen.on('display-metrics-changed', (event, display, changedMetrics) => {
electronSocket.emit('screen-display-metrics-changed-event' + id, [display, changedMetrics]);
});
});
socket.on('screen-getCursorScreenPoint', () => {
const point = screen.getCursorScreenPoint();
electronSocket.emit('screen-getCursorScreenPointCompleted', point);
});
socket.on('screen-getMenuBarHeight', () => {
const height = screen.getPrimaryDisplay().workArea;
electronSocket.emit('screen-getMenuBarHeightCompleted', height);
});
socket.on('screen-getPrimaryDisplay', () => {
const display = screen.getPrimaryDisplay();
electronSocket.emit('screen-getPrimaryDisplayCompleted', display);
});
socket.on('screen-getAllDisplays', () => {
const display = screen.getAllDisplays();
electronSocket.emit('screen-getAllDisplaysCompleted', display);
});
socket.on('screen-getDisplayNearestPoint', (point) => {
const display = screen.getDisplayNearestPoint(point);
electronSocket.emit('screen-getDisplayNearestPointCompleted', display);
});
socket.on('screen-getDisplayMatching', (rectangle) => {
const display = screen.getDisplayMatching(rectangle);
electronSocket.emit('screen-getDisplayMatchingCompleted', display);
});
};

View File

@@ -1,46 +0,0 @@
"use strict";
const electron_1 = require("electron");
let electronSocket;
module.exports = (socket) => {
electronSocket = socket;
socket.on('shell-showItemInFolder', (fullPath) => {
const success = electron_1.shell.showItemInFolder(fullPath);
electronSocket.emit('shell-showItemInFolderCompleted', success);
});
socket.on('shell-openItem', (fullPath) => {
const success = electron_1.shell.openItem(fullPath);
electronSocket.emit('shell-openItemCompleted', success);
});
socket.on('shell-openExternal', (url, options) => {
let success = true;
if (options) {
electron_1.shell.openExternal(url, options).catch((error) => {
success = false;
electronSocket.emit('shell-openExternalCallback', [url, error]);
});
}
else {
electron_1.shell.openExternal(url).catch((error) => {
success = false;
electronSocket.emit('shell-openExternalCallback', [url, error]);
});
}
electronSocket.emit('shell-openExternalCompleted', success);
});
socket.on('shell-moveItemToTrash', (fullPath) => {
const success = electron_1.shell.moveItemToTrash(fullPath);
electronSocket.emit('shell-moveItemToTrashCompleted', success);
});
socket.on('shell-beep', () => {
electron_1.shell.beep();
});
socket.on('shell-writeShortcutLink', (shortcutPath, operation, options) => {
const success = electron_1.shell.writeShortcutLink(shortcutPath, operation, options);
electronSocket.emit('shell-writeShortcutLinkCompleted', success);
});
socket.on('shell-readShortcutLink', (shortcutPath) => {
const shortcutDetails = electron_1.shell.readShortcutLink(shortcutPath);
electronSocket.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,uCAAiC;AACjC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,CAAC,QAAQ,EAAE,EAAE;QAC7C,MAAM,OAAO,GAAG,gBAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAEjD,cAAc,CAAC,IAAI,CAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,CAAC,QAAQ,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,gBAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAEzC,cAAc,CAAC,IAAI,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;QAC7C,IAAI,OAAO,GAAG,IAAI,CAAC;QAEnB,IAAI,OAAO,EAAE;YACT,gBAAK,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC7C,OAAO,GAAG,KAAK,CAAC;gBAChB,cAAc,CAAC,IAAI,CAAC,4BAA4B,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YACpE,CAAC,CAAC,CAAC;SACN;aAAM;YACH,gBAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBACpC,OAAO,GAAG,KAAK,CAAC;gBAChB,cAAc,CAAC,IAAI,CAAC,4BAA4B,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YACpE,CAAC,CAAC,CAAC;SACN;QAED,cAAc,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,CAAC,QAAQ,EAAE,EAAE;QAC5C,MAAM,OAAO,GAAG,gBAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAEhD,cAAc,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE;QACzB,gBAAK,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;QACtE,MAAM,OAAO,GAAG,gBAAK,CAAC,iBAAiB,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAE1E,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,CAAC,YAAY,EAAE,EAAE;QACjD,MAAM,eAAe,GAAG,gBAAK,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QAE7D,cAAc,CAAC,IAAI,CAAC,iCAAiC,EAAE,eAAe,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}

View File

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

View File

@@ -1,106 +0,0 @@
"use strict";
const electron_1 = require("electron");
let tray;
let electronSocket;
module.exports = (socket) => {
electronSocket = socket;
socket.on('register-tray-click', (id) => {
if (tray) {
tray.on('click', (event, bounds) => {
electronSocket.emit('tray-click-event' + id, [event.__proto__, bounds]);
});
}
});
socket.on('register-tray-right-click', (id) => {
if (tray) {
tray.on('right-click', (event, bounds) => {
electronSocket.emit('tray-right-click-event' + id, [event.__proto__, bounds]);
});
}
});
socket.on('register-tray-double-click', (id) => {
if (tray) {
tray.on('double-click', (event, bounds) => {
electronSocket.emit('tray-double-click-event' + id, [event.__proto__, bounds]);
});
}
});
socket.on('register-tray-balloon-show', (id) => {
if (tray) {
tray.on('balloon-show', () => {
electronSocket.emit('tray-balloon-show-event' + id);
});
}
});
socket.on('register-tray-balloon-click', (id) => {
if (tray) {
tray.on('balloon-click', () => {
electronSocket.emit('tray-balloon-click-event' + id);
});
}
});
socket.on('register-tray-balloon-closed', (id) => {
if (tray) {
tray.on('balloon-closed', () => {
electronSocket.emit('tray-balloon-closed-event' + id);
});
}
});
socket.on('create-tray', (image, menuItems) => {
const menu = electron_1.Menu.buildFromTemplate(menuItems);
addMenuItemClickConnector(menu.items, (id) => {
electronSocket.emit('trayMenuItemClicked', id);
});
const trayIcon = electron_1.nativeImage.createFromPath(image);
tray = new electron_1.Tray(trayIcon);
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) {
const img = electron_1.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-displayBalloon', (options) => {
if (tray) {
tray.displayBalloon(options);
}
});
socket.on('tray-isDestroyed', () => {
if (tray) {
const isDestroyed = tray.isDestroyed();
electronSocket.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); };
}
});
}
};
//# sourceMappingURL=tray.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"tray.js","sourceRoot":"","sources":["tray.ts"],"names":[],"mappings":"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"}

View File

@@ -1,123 +0,0 @@
import { Menu, Tray, nativeImage } from 'electron';
let tray: Electron.Tray;
let electronSocket;
export = (socket: SocketIO.Socket) => {
electronSocket = socket;
socket.on('register-tray-click', (id) => {
if (tray) {
tray.on('click', (event, bounds) => {
electronSocket.emit('tray-click-event' + id, [(<any>event).__proto__, bounds]);
});
}
});
socket.on('register-tray-right-click', (id) => {
if (tray) {
tray.on('right-click', (event, bounds) => {
electronSocket.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) => {
electronSocket.emit('tray-double-click-event' + id, [(<any>event).__proto__, bounds]);
});
}
});
socket.on('register-tray-balloon-show', (id) => {
if (tray) {
tray.on('balloon-show', () => {
electronSocket.emit('tray-balloon-show-event' + id);
});
}
});
socket.on('register-tray-balloon-click', (id) => {
if (tray) {
tray.on('balloon-click', () => {
electronSocket.emit('tray-balloon-click-event' + id);
});
}
});
socket.on('register-tray-balloon-closed', (id) => {
if (tray) {
tray.on('balloon-closed', () => {
electronSocket.emit('tray-balloon-closed-event' + id);
});
}
});
socket.on('create-tray', (image, menuItems) => {
const menu = Menu.buildFromTemplate(menuItems);
addMenuItemClickConnector(menu.items, (id) => {
electronSocket.emit('trayMenuItemClicked', id);
});
const trayIcon = nativeImage.createFromPath(image);
tray = new Tray(trayIcon);
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) {
const 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-displayBalloon', (options) => {
if (tray) {
tray.displayBalloon(options);
}
});
socket.on('tray-isDestroyed', () => {
if (tray) {
const isDestroyed = tray.isDestroyed();
electronSocket.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,144 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
const electron_1 = require("electron");
const fs = require('fs');
let electronSocket;
module.exports = (socket) => {
electronSocket = socket;
socket.on('register-webContents-crashed', (id) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.removeAllListeners('crashed');
browserWindow.webContents.on('crashed', (event, killed) => {
electronSocket.emit('webContents-crashed' + id, killed);
});
});
socket.on('register-webContents-didFinishLoad', (id) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.removeAllListeners('did-finish-load');
browserWindow.webContents.on('did-finish-load', () => {
electronSocket.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) => __awaiter(void 0, void 0, void 0, function* () {
const buffer = yield getWindowById(id).webContents.printToPDF(options);
fs.writeFile(path, buffer, (error) => {
if (error) {
electronSocket.emit('webContents-printToPDF-completed', false);
}
else {
electronSocket.emit('webContents-printToPDF-completed', true);
}
});
}));
socket.on('webContents-getUrl', function (id) {
const browserWindow = getWindowById(id);
electronSocket.emit('webContents-getUrl' + id, browserWindow.webContents.getURL());
});
socket.on('webContents-session-allowNTLMCredentialsForDomains', (id, domains) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.session.allowNTLMCredentialsForDomains(domains);
});
socket.on('webContents-session-clearAuthCache', (id, options, guid) => __awaiter(void 0, void 0, void 0, function* () {
const browserWindow = getWindowById(id);
yield browserWindow.webContents.session.clearAuthCache(options);
electronSocket.emit('webContents-session-clearAuthCache-completed' + guid);
}));
socket.on('webContents-session-clearCache', (id, guid) => __awaiter(void 0, void 0, void 0, function* () {
const browserWindow = getWindowById(id);
yield browserWindow.webContents.session.clearCache();
electronSocket.emit('webContents-session-clearCache-completed' + guid);
}));
socket.on('webContents-session-clearHostResolverCache', (id, guid) => __awaiter(void 0, void 0, void 0, function* () {
const browserWindow = getWindowById(id);
yield browserWindow.webContents.session.clearHostResolverCache();
electronSocket.emit('webContents-session-clearHostResolverCache-completed' + guid);
}));
socket.on('webContents-session-clearStorageData', (id, guid) => __awaiter(void 0, void 0, void 0, function* () {
const browserWindow = getWindowById(id);
yield browserWindow.webContents.session.clearStorageData({});
electronSocket.emit('webContents-session-clearStorageData-completed' + guid);
}));
socket.on('webContents-session-clearStorageData-options', (id, options, guid) => __awaiter(void 0, void 0, void 0, function* () {
const browserWindow = getWindowById(id);
yield browserWindow.webContents.session.clearStorageData(options);
electronSocket.emit('webContents-session-clearStorageData-options-completed' + guid);
}));
socket.on('webContents-session-createInterruptedDownload', (id, options) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.session.createInterruptedDownload(options);
});
socket.on('webContents-session-disableNetworkEmulation', (id) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.session.disableNetworkEmulation();
});
socket.on('webContents-session-enableNetworkEmulation', (id, options) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.session.enableNetworkEmulation(options);
});
socket.on('webContents-session-flushStorageData', (id) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.session.flushStorageData();
});
socket.on('webContents-session-getBlobData', (id, identifier, guid) => __awaiter(void 0, void 0, void 0, function* () {
const browserWindow = getWindowById(id);
const buffer = yield browserWindow.webContents.session.getBlobData(identifier);
electronSocket.emit('webContents-session-getBlobData-completed' + guid, buffer.buffer);
}));
socket.on('webContents-session-getCacheSize', (id, guid) => __awaiter(void 0, void 0, void 0, function* () {
const browserWindow = getWindowById(id);
const size = yield browserWindow.webContents.session.getCacheSize();
electronSocket.emit('webContents-session-getCacheSize-completed' + guid, size);
}));
socket.on('webContents-session-getPreloads', (id, guid) => {
const browserWindow = getWindowById(id);
const preloads = browserWindow.webContents.session.getPreloads();
electronSocket.emit('webContents-session-getPreloads-completed' + guid, preloads);
});
socket.on('webContents-session-getUserAgent', (id, guid) => {
const browserWindow = getWindowById(id);
const userAgent = browserWindow.webContents.session.getUserAgent();
electronSocket.emit('webContents-session-getUserAgent-completed' + guid, userAgent);
});
socket.on('webContents-session-resolveProxy', (id, url, guid) => __awaiter(void 0, void 0, void 0, function* () {
const browserWindow = getWindowById(id);
const proxy = yield browserWindow.webContents.session.resolveProxy(url);
electronSocket.emit('webContents-session-resolveProxy-completed' + guid, proxy);
}));
socket.on('webContents-session-setDownloadPath', (id, path) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.session.setDownloadPath(path);
});
socket.on('webContents-session-setPreloads', (id, preloads) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.session.setPreloads(preloads);
});
socket.on('webContents-session-setProxy', (id, configuration, guid) => __awaiter(void 0, void 0, void 0, function* () {
const browserWindow = getWindowById(id);
yield browserWindow.webContents.session.setProxy(configuration);
electronSocket.emit('webContents-session-setProxy-completed' + guid);
}));
socket.on('webContents-session-setUserAgent', (id, userAgent, acceptLanguages) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.session.setUserAgent(userAgent, acceptLanguages);
});
function getWindowById(id) {
return electron_1.BrowserWindow.fromId(id);
}
};
//# sourceMappingURL=webContents.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,170 +0,0 @@
import { BrowserWindow } from 'electron';
const fs = require('fs');
let electronSocket;
export = (socket: SocketIO.Socket) => {
electronSocket = socket;
socket.on('register-webContents-crashed', (id) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.removeAllListeners('crashed');
browserWindow.webContents.on('crashed', (event, killed) => {
electronSocket.emit('webContents-crashed' + id, killed);
});
});
socket.on('register-webContents-didFinishLoad', (id) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.removeAllListeners('did-finish-load');
browserWindow.webContents.on('did-finish-load', () => {
electronSocket.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', async (id, options = {}, path) => {
const buffer = await getWindowById(id).webContents.printToPDF(options);
fs.writeFile(path, buffer, (error) => {
if (error) {
electronSocket.emit('webContents-printToPDF-completed', false);
} else {
electronSocket.emit('webContents-printToPDF-completed', true);
}
});
});
socket.on('webContents-getUrl', function (id) {
const browserWindow = getWindowById(id);
electronSocket.emit('webContents-getUrl' + id, browserWindow.webContents.getURL());
});
socket.on('webContents-session-allowNTLMCredentialsForDomains', (id, domains) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.session.allowNTLMCredentialsForDomains(domains);
});
socket.on('webContents-session-clearAuthCache', async (id, options, guid) => {
const browserWindow = getWindowById(id);
await browserWindow.webContents.session.clearAuthCache(options);
electronSocket.emit('webContents-session-clearAuthCache-completed' + guid);
});
socket.on('webContents-session-clearCache', async (id, guid) => {
const browserWindow = getWindowById(id);
await browserWindow.webContents.session.clearCache();
electronSocket.emit('webContents-session-clearCache-completed' + guid);
});
socket.on('webContents-session-clearHostResolverCache', async (id, guid) => {
const browserWindow = getWindowById(id);
await browserWindow.webContents.session.clearHostResolverCache();
electronSocket.emit('webContents-session-clearHostResolverCache-completed' + guid);
});
socket.on('webContents-session-clearStorageData', async (id, guid) => {
const browserWindow = getWindowById(id);
await browserWindow.webContents.session.clearStorageData({});
electronSocket.emit('webContents-session-clearStorageData-completed' + guid);
});
socket.on('webContents-session-clearStorageData-options', async (id, options, guid) => {
const browserWindow = getWindowById(id);
await browserWindow.webContents.session.clearStorageData(options);
electronSocket.emit('webContents-session-clearStorageData-options-completed' + guid);
});
socket.on('webContents-session-createInterruptedDownload', (id, options) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.session.createInterruptedDownload(options);
});
socket.on('webContents-session-disableNetworkEmulation', (id) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.session.disableNetworkEmulation();
});
socket.on('webContents-session-enableNetworkEmulation', (id, options) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.session.enableNetworkEmulation(options);
});
socket.on('webContents-session-flushStorageData', (id) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.session.flushStorageData();
});
socket.on('webContents-session-getBlobData', async (id, identifier, guid) => {
const browserWindow = getWindowById(id);
const buffer = await browserWindow.webContents.session.getBlobData(identifier);
electronSocket.emit('webContents-session-getBlobData-completed' + guid, buffer.buffer);
});
socket.on('webContents-session-getCacheSize', async (id, guid) => {
const browserWindow = getWindowById(id);
const size = await browserWindow.webContents.session.getCacheSize();
electronSocket.emit('webContents-session-getCacheSize-completed' + guid, size);
});
socket.on('webContents-session-getPreloads', (id, guid) => {
const browserWindow = getWindowById(id);
const preloads = browserWindow.webContents.session.getPreloads();
electronSocket.emit('webContents-session-getPreloads-completed' + guid, preloads);
});
socket.on('webContents-session-getUserAgent', (id, guid) => {
const browserWindow = getWindowById(id);
const userAgent = browserWindow.webContents.session.getUserAgent();
electronSocket.emit('webContents-session-getUserAgent-completed' + guid, userAgent);
});
socket.on('webContents-session-resolveProxy', async (id, url, guid) => {
const browserWindow = getWindowById(id);
const proxy = await browserWindow.webContents.session.resolveProxy(url);
electronSocket.emit('webContents-session-resolveProxy-completed' + guid, proxy);
});
socket.on('webContents-session-setDownloadPath', (id, path) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.session.setDownloadPath(path);
});
socket.on('webContents-session-setPreloads', (id, preloads) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.session.setPreloads(preloads);
});
socket.on('webContents-session-setProxy', async (id, configuration, guid) => {
const browserWindow = getWindowById(id);
await browserWindow.webContents.session.setProxy(configuration);
electronSocket.emit('webContents-session-setProxy-completed' + guid);
});
socket.on('webContents-session-setUserAgent', (id, userAgent, acceptLanguages) => {
const browserWindow = getWindowById(id);
browserWindow.webContents.session.setUserAgent(userAgent, acceptLanguages);
});
function getWindowById(id: number): Electron.BrowserWindow {
return BrowserWindow.fromId(id);
}
};

View File

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

View File

@@ -1,183 +0,0 @@
const { app } = require('electron');
const { BrowserWindow } = require('electron');
const path = require('path');
const process = require('child_process').spawn;
const portscanner = require('portscanner');
const imageSize = require('image-size');
let io, server, browserWindows, ipc, apiProcess, loadURL;
let appApi, menu, dialogApi, notification, tray, webContents;
let globalShortcut, shellApi, screen, clipboard, autoUpdater;
let commandLine;
let splashScreen, hostHook;
let manifestJsonFileName = 'electron.manifest.json';
if(app.commandLine.hasSwitch('manifest')) {
manifestJsonFileName = app.commandLine.getSwitchValue('manifest');
};
const currentBinPath = path.join(__dirname.replace('app.asar', ''), 'bin');
const manifestJsonFilePath = path.join(currentBinPath, manifestJsonFileName);
const manifestJsonFile = require(manifestJsonFilePath);
if (manifestJsonFile.singleInstance || manifestJsonFile.aspCoreBackendPort) {
const mainInstance = app.requestSingleInstanceLock();
app.on('second-instance', () => {
const windows = BrowserWindow.getAllWindows();
if (windows.length) {
if (windows[0].isMinimized()) {
windows[0].restore();
}
windows[0].focus();
}
});
if (!mainInstance) {
app.quit();
}
}
app.on('ready', () => {
if (isSplashScreenEnabled()) {
startSplashScreen();
}
// hostname needs to belocalhost, otherwise Windows Firewall will be triggered.
portscanner.findAPortNotInUse(8000, 65535, 'localhost', function (error, port) {
console.log('Electron Socket IO Port: ' + port);
startSocketApiBridge(port);
});
});
function isSplashScreenEnabled() {
if (manifestJsonFile.hasOwnProperty('splashscreen')) {
if (manifestJsonFile.splashscreen.hasOwnProperty('imageFile')) {
return Boolean(manifestJsonFile.splashscreen.imageFile);
}
}
return false;
}
function startSplashScreen() {
let imageFile = path.join(currentBinPath, manifestJsonFile.splashscreen.imageFile);
imageSize(imageFile, (error, dimensions) => {
if (error) {
console.log(`load splashscreen error:`);
console.log(error);
throw new Error(error.message);
}
splashScreen = new BrowserWindow({
width: dimensions.width,
height: dimensions.height,
transparent: true,
center: true,
frame: false,
alwaysOnTop: true,
skipTaskbar: true,
show: true
});
app.once('browser-window-focus', () => {
app.once('browser-window-focus', () => {
splashScreen.destroy();
});
});
const loadSplashscreenUrl = path.join(__dirname, 'splashscreen', 'index.html') + '?imgPath=' + imageFile;
splashScreen.loadURL('file://' + loadSplashscreenUrl);
splashScreen.once('closed', () => {
splashScreen = null;
});
});
}
function startSocketApiBridge(port) {
// instead of 'require('socket.io')(port);' we need to use this workaround
// otherwise the Windows Firewall will be triggered
server = require('http').createServer();
io = require('socket.io')();
io.attach(server);
server.listen(port, 'localhost');
server.on('listening', function () {
console.log('Electron Socket started on port %s at %s', server.address().port, server.address().address);
// Now that socket connection is established, we can guarantee port will not be open for portscanner
startAspCoreBackend(port);
});
io.on('connection', (socket) => {
global['electronsocket'] = socket;
global['electronsocket'].setMaxListeners(0);
console.log('ASP.NET Core Application connected...', 'global.electronsocket', global['electronsocket'].id, new Date());
appApi = require('./api/app')(socket, app);
browserWindows = require('./api/browserWindows')(socket, app);
commandLine = require('./api/commandLine')(socket, app);
autoUpdater = require('./api/autoUpdater')(socket);
ipc = require('./api/ipc')(socket);
menu = require('./api/menu')(socket);
dialogApi = require('./api/dialog')(socket);
notification = require('./api/notification')(socket);
tray = require('./api/tray')(socket);
webContents = require('./api/webContents')(socket);
globalShortcut = require('./api/globalShortcut')(socket);
shellApi = require('./api/shell')(socket);
screen = require('./api/screen')(socket);
clipboard = require('./api/clipboard')(socket);
try {
const hostHookScriptFilePath = path.join(__dirname, 'ElectronHostHook', 'index.js');
if (isModuleAvailable(hostHookScriptFilePath) && hostHook === undefined) {
const { HookService } = require(hostHookScriptFilePath);
hostHook = new HookService(socket, app);
hostHook.onHostReady();
}
} catch (error) {
console.log(error.message);
}
});
}
function isModuleAvailable(name) {
try {
require.resolve(name);
return true;
} catch (e) { }
return false;
}
function startAspCoreBackend(electronPort) {
if(manifestJsonFile.aspCoreBackendPort) {
startBackend(manifestJsonFile.aspCoreBackendPort)
} else {
// hostname needs to be localhost, otherwise Windows Firewall will be triggered.
portscanner.findAPortNotInUse(electronPort + 1, 65535, 'localhost', function (error, electronWebPort) {
startBackend(electronWebPort);
});
}
function startBackend(aspCoreBackendPort) {
console.log('ASP.NET Core Port: ' + aspCoreBackendPort);
loadURL = `http://localhost:${aspCoreBackendPort}`;
const parameters = [`/electronPort=${electronPort}`, `/electronWebPort=${aspCoreBackendPort}`];
let binaryFile = manifestJsonFile.executable;
const os = require('os');
if (os.platform() === 'win32') {
binaryFile = binaryFile + '.exe';
}
let binFilePath = path.join(currentBinPath, binaryFile);
var options = { cwd: currentBinPath };
apiProcess = process(binFilePath, parameters, options);
apiProcess.stdout.on('data', (data) => {
console.log(`stdout: ${data.toString()}`);
});
}
}

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
{"name":"electron.net.host","version":"1.0.0","description":"Electron-Host for Electron.NET.","repository":{"url":"https://github.com/ElectronNET/Electron.NET"},"main":"main.js","author":"Gregor Biswanger","license":"MIT","scripts":{"start":"tsc -p ."},"dependencies":{"electron-updater":"^4.0.6","image-size":"^0.7.4","portscanner":"^2.2.0","socket.io":"^2.2.0"},"devDependencies":{"@types/node":"^10.14.4","@types/socket.io":"^2.1.2","electron":"^7.1.2","tslint":"^5.20.1","typescript":"^3.7.2"}}

View File

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

View File

@@ -1,12 +0,0 @@
using Microsoft.AspNetCore.Mvc;
namespace ElectronNET.WebApp.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
}
}

View File

@@ -1,91 +0,0 @@
# Created by https://www.gitignore.io/api/node
# Edit at https://www.gitignore.io/?templates=node
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# End of https://www.gitignore.io/api/node

View File

@@ -1,27 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Connector {
constructor(socket,
// @ts-ignore
app) {
this.socket = socket;
this.app = app;
}
on(key, javaScriptCode) {
this.socket.on(key, (...args) => {
const id = args.pop();
try {
javaScriptCode(...args, (data) => {
if (data) {
this.socket.emit(`${key}Complete${id}`, data);
}
});
}
catch (error) {
this.socket.emit(`${key}Error${id}`, `Host Hook Exception`, error);
}
});
}
}
exports.Connector = Connector;
//# sourceMappingURL=connector.js.map

View File

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

View File

@@ -1,21 +0,0 @@
export class Connector {
constructor(private socket: SocketIO.Socket,
// @ts-ignore
public app: Electron.App) { }
on(key: string, javaScriptCode: Function): void {
this.socket.on(key, (...args: any[]) => {
const id: string = args.pop();
try {
javaScriptCode(...args, (data) => {
if (data) {
this.socket.emit(`${key}Complete${id}`, data);
}
});
} catch (error) {
this.socket.emit(`${key}Error${id}`, `Host Hook Exception`, error);
}
});
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,21 +0,0 @@
// @ts-ignore
import * as Electron from "electron";
import { Connector } from "./connector";
import { ExcelCreator } from "./excelCreator";
export class HookService extends Connector {
constructor(socket: SocketIO.Socket, public app: Electron.App) {
super(socket, app);
}
onHostReady(): void {
// execute your own JavaScript Host logic here
this.on("create-excel-file", async (path, done) => {
const excelCreator: ExcelCreator = new ExcelCreator();
const result: string = await excelCreator.create(path);
done(result);
});
}
}

View File

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

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,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-2023 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

283
README.md
View File

@@ -1,17 +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)
[![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)
Build cross platform desktop apps with .NET 6 and Blazor, ASP.NET Core (Razor Pages, MVC).
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)
* Checkout AppVeyor Artifacts: 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.2 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.
@@ -19,131 +12,150 @@ 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 3.0, so our minimum base OS is the same as [.NET Core 3.0](https://github.com/dotnet/core/blob/master/release-notes/3.0/3.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).
Also you should have installed:
* npm
* npm [contained in nodejs (at least Version 16.17.1)](https://nodejs.org)
# Community
## 💬 Community
[![Gitter](https://badges.gitter.im/ElectronNET/community.svg)](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
# Usage:
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 wont 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)
.UseStartup<Startup>()
.UseElectron(args)
.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 ConfigureServices(IServiceCollection services)
{
services.AddMvc(option => option.EnableEndpointRouting = false);
}
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
```
dotnet new mvc
```
## Start the Application
## 🚀 Starting the Application
To start the application make sure you have installed the "[ElectronNET.CLI](https://www.nuget.org/packages/ElectronNET.CLI/)" packages as global tool:
```
```sh
dotnet tool install ElectronNET.CLI -g
```
At the first time, you need an Electron.NET project initialization. Type the following command in your ASP.NET Core folder:
```
```sh
electronize init
```
* Now a electronnet.manifest.json should appear in your ASP.NET Core project
* Now run the following:
```
```sh
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 as well. Type the following command in your ASP.NET Core folder:
```
```sh
electronize build /target win
```
There are additional platforms available:
```
```sh
electronize build /target win
electronize build /target osx
electronize build /target linux
@@ -153,60 +165,98 @@ Those three "default" targets will produce x64 packages for those platforms.
For certain NuGet packages or certain scenarios you may want to build a pure x86 application. To support those things you can define the desired [.NET Core runtime](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog), the [electron platform](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#platform) and [electron architecture](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#arch) like this:
```
electronize build /target custom win7-x86;win32 /electron-arch ia32
```sh
electronize build /target custom "win7-x86;win32" /electron-arch ia32
```
The end result should be an electron app under your __/bin/desktop__ folder.
### Note
> macOS builds can't be created on Windows machines because they require symlinks that aren't supported on Windows (per [this Electron issue](https://github.com/electron-userland/electron-packager/issues/71)). macOS builds can be produced on either Linux or macOS machines.
# Working with this Repo
> 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)).
This repository consists of the main parts (API & CLI) and it's own "playground" ASP.NET Core application. Both main parts produce local NuGet packages, that are versioned with 99.0.0. The first thing you will need is to run one of the buildAll scripts (.cmd for Windows, the other for macOS/Linux).
Consequently, macOS builds can be produced on either Linux or macOS machines.
## 🔄 Update
After an update to the latest Electron.API package, an update to the latest Electron.CLI is always required.
In addition, always update the CLI via NuGet:
```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.
# Authors
* **Gregor Biswanger** - (Microsoft MVP, Intel Black Belt and Intel Software Innovator) is a freelance lecturer, consultant, trainer, author and speaker. He is a consultant for large and medium-sized companies, organizations and agencies for software architecture, web- and cross-platform development. You can find Gregor often on the road attending or speaking at international conferences. - [Cross-Platform-Blog](http://www.cross-platform-blog.com) - Twitter [@BFreakout](https://www.twitter.com/BFreakout)
* **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.
## Donate
## 🙏 Donate
We do this open source work in our free time. If you'd like us to invest more time on it, please [donate](https://donorbox.org/electron-net). Donation can be used to increase some issue priority. Thank you!
# 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
# Important notes
### ElectronNET.API & ElectronNET.CLI Version 9.31.2
## ElectronNET.API & ElectronNET.CLI Version 5.22.12
Make sure you also have the new Electron.NET CLI 5.22.12 version. 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. In addition, own Electron.NET configurations are stored. Please make sure that your **electron.manifest.json** file has the following new structure:
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 © 2019",
"copyright": "Copyright © 2020",
"buildVersion": "1.0.0",
"compression": "maximum",
"directories": {
@@ -231,31 +281,31 @@ Make sure you also have the new Electron.NET CLI 5.22.12 version. This now uses
}
```
## ElectronNET.CLI Version 0.0.9
### ElectronNET.CLI Version 0.0.9
In the Version 0.0.9 the CLI was not a global tool and needed to be registred like this in the .csproj:
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" />
<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:
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:
```
dotnet electronize ...
```sh
electronize ...
```
## Node Integration
Electron.NET requires Node Integration to be enabled for IPC to function. If you are not using the IPC functionality you can disable Node Integration like so:
### 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();
@@ -263,6 +313,19 @@ 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();
}
```

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