mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-04 13:44:47 +00:00
Compare commits
252 Commits
8.31.2
...
23.6.2-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77b7141513 | ||
|
|
dbf85c6f14 | ||
|
|
c67f117bc7 | ||
|
|
9746edb936 | ||
|
|
23f4d39a30 | ||
|
|
05ac4a1886 | ||
|
|
33ac4edbe3 | ||
|
|
e5f9bae64f | ||
|
|
437404d6cc | ||
|
|
1ae2f1de93 | ||
|
|
6bfd0c33af | ||
|
|
6311d55a75 | ||
|
|
7b522c1779 | ||
|
|
b1c08f5865 | ||
|
|
a3f19055b9 | ||
|
|
ef9a95d9e9 | ||
|
|
2367035acd | ||
|
|
3470a70572 | ||
|
|
1365918efd | ||
|
|
e909de54af | ||
|
|
a2514ed5bc | ||
|
|
b453278803 | ||
|
|
a244382383 | ||
|
|
a82e714ef8 | ||
|
|
b339485fdc | ||
|
|
551635867d | ||
|
|
941b8cf5c2 | ||
|
|
06b01f75da | ||
|
|
e4b1f6586e | ||
|
|
0657a274d4 | ||
|
|
e3acc79c4f | ||
|
|
73c1d1cd46 | ||
|
|
c2a8c627b9 | ||
|
|
1862094861 | ||
|
|
0ad89c7d22 | ||
|
|
0af664b8a6 | ||
|
|
afcd113675 | ||
|
|
0e22ee3fd3 | ||
|
|
ce0cdf39c6 | ||
|
|
305544ab42 | ||
|
|
78d9d601b1 | ||
|
|
fdd643ba48 | ||
|
|
29a257251f | ||
|
|
3676db89d3 | ||
|
|
29011189f8 | ||
|
|
9d7d859764 | ||
|
|
5cdda5595a | ||
|
|
62fe944ae3 | ||
|
|
617eb15df8 | ||
|
|
bff71dc86a | ||
|
|
f0280f420a | ||
|
|
9f7809810f | ||
|
|
e610c96550 | ||
|
|
f3bd3d07d5 | ||
|
|
0e8cfec689 | ||
|
|
c1b3d422d5 | ||
|
|
fc12363e11 | ||
|
|
02f2fd770c | ||
|
|
5ee1918bb4 | ||
|
|
2213c61746 | ||
|
|
3cdff747fe | ||
|
|
476cc9e505 | ||
|
|
fb8ca94e8e | ||
|
|
c94702fc60 | ||
|
|
cd9e06d5db | ||
|
|
613f0a05b3 | ||
|
|
de2ce85a5c | ||
|
|
e5d47e077b | ||
|
|
ac77ccce9f | ||
|
|
504cc59760 | ||
|
|
0ee7097f31 | ||
|
|
2d93d959f7 | ||
|
|
a4d261a4e7 | ||
|
|
3838fe8971 | ||
|
|
b5e69f5dda | ||
|
|
55a3f10d37 | ||
|
|
7e494518f3 | ||
|
|
4596492cd9 | ||
|
|
dd5bfd3961 | ||
|
|
5d907864d8 | ||
|
|
30941df39c | ||
|
|
3588a8696d | ||
|
|
876bb98d92 | ||
|
|
427b57a002 | ||
|
|
cc0b15c61e | ||
|
|
8a0276daf9 | ||
|
|
e94196504e | ||
|
|
6076c727d1 | ||
|
|
300dc49dde | ||
|
|
ce0f3fd61e | ||
|
|
12f5eae65c | ||
|
|
3ef44cf878 | ||
|
|
41fa8e9e74 | ||
|
|
49e21de465 | ||
|
|
d2f6308dd2 | ||
|
|
f06b95803f | ||
|
|
b9feff3436 | ||
|
|
335489d2d9 | ||
|
|
6fe0c6f085 | ||
|
|
f82d185865 | ||
|
|
550e2c2625 | ||
|
|
61f54ebd55 | ||
|
|
c8c818a77a | ||
|
|
fc590f55d8 | ||
|
|
5fbe01df30 | ||
|
|
dbf4d0f720 | ||
|
|
f996b3023e | ||
|
|
7f62e7299b | ||
|
|
b803e42a73 | ||
|
|
da1838db60 | ||
|
|
8af1f50b88 | ||
|
|
c4f2188c62 | ||
|
|
e73655bd68 | ||
|
|
758424d3ce | ||
|
|
7518acb3c2 | ||
|
|
5522addc0b | ||
|
|
7f204c2a42 | ||
|
|
de13f49bb6 | ||
|
|
bca37228d9 | ||
|
|
e17a36f7cb | ||
|
|
deccebb582 | ||
|
|
776ccc21e8 | ||
|
|
d0c92cac85 | ||
|
|
b525bf1a9a | ||
|
|
6337cac588 | ||
|
|
5d4509babe | ||
|
|
3eef85cddf | ||
|
|
3f582d6c4e | ||
|
|
18c5a65d6d | ||
|
|
f8bbb138d8 | ||
|
|
7880d56e4c | ||
|
|
c16a888699 | ||
|
|
814e046d5c | ||
|
|
d2457203bc | ||
|
|
a70304948a | ||
|
|
a49b2ce278 | ||
|
|
1577146187 | ||
|
|
d61f20dd67 | ||
|
|
f7217b417f | ||
|
|
e136ed4127 | ||
|
|
7489543c75 | ||
|
|
cbf3032617 | ||
|
|
68c54b9917 | ||
|
|
26d10fca38 | ||
|
|
bd15587079 | ||
|
|
42613f5b56 | ||
|
|
62117df108 | ||
|
|
f68ea25cba | ||
|
|
4e9de2abfa | ||
|
|
a08d274dc1 | ||
|
|
3dea16798b | ||
|
|
bf8c7c8fa1 | ||
|
|
06724f6eae | ||
|
|
83e579d44b | ||
|
|
ed67aa8072 | ||
|
|
f1ceaa208e | ||
|
|
5e005499ef | ||
|
|
975e4020dc | ||
|
|
15ce35a7d9 | ||
|
|
de1637672a | ||
|
|
6b75f63135 | ||
|
|
8f92d3986f | ||
|
|
ca7414b8e6 | ||
|
|
37ae869dcb | ||
|
|
3420ee2de4 | ||
|
|
0a76e951eb | ||
|
|
4db316eb15 | ||
|
|
a867f23220 | ||
|
|
490440c23a | ||
|
|
519fb53c00 | ||
|
|
12388541ab | ||
|
|
8c8115f3bd | ||
|
|
4286bc4f45 | ||
|
|
886f839482 | ||
|
|
96abbd161c | ||
|
|
9baf1528ac | ||
|
|
380441c2c8 | ||
|
|
a66375e37c | ||
|
|
606d00de5a | ||
|
|
b3266cd93f | ||
|
|
cb36e34dc3 | ||
|
|
db7a5ff868 | ||
|
|
a030e3cbe7 | ||
|
|
b98c570b9d | ||
|
|
d106c6b193 | ||
|
|
c95bbe7ab2 | ||
|
|
258710bc52 | ||
|
|
9ddb1b195e | ||
|
|
eee84d214e | ||
|
|
1ab48350e1 | ||
|
|
874bc8eb94 | ||
|
|
7aa2268a81 | ||
|
|
b08222bddc | ||
|
|
c5c822a028 | ||
|
|
ce4ef03636 | ||
|
|
641864b946 | ||
|
|
c6d67a9145 | ||
|
|
fabd25a89e | ||
|
|
029b077602 | ||
|
|
0329530815 | ||
|
|
58ab180c94 | ||
|
|
a03dc1d195 | ||
|
|
76dcdc4137 | ||
|
|
2b415e5b59 | ||
|
|
94055b985f | ||
|
|
596aa68c70 | ||
|
|
485bce08d7 | ||
|
|
2ba49dbd6a | ||
|
|
39c3e92128 | ||
|
|
c552a04347 | ||
|
|
1541553ed1 | ||
|
|
52b850092c | ||
|
|
cac9cfcec8 | ||
|
|
4ad39ba4c1 | ||
|
|
95acbd5dea | ||
|
|
95f9a59431 | ||
|
|
d409c3a0f9 | ||
|
|
6d0fbde5ad | ||
|
|
b113532a86 | ||
|
|
b043688f7f | ||
|
|
3b3e38f1bf | ||
|
|
9502eb787a | ||
|
|
4a9b6fa9c1 | ||
|
|
fb308ed1c6 | ||
|
|
d51a481e50 | ||
|
|
bb3d073fae | ||
|
|
8c250ae83e | ||
|
|
a5543bfe60 | ||
|
|
c40affb32e | ||
|
|
e9331728b4 | ||
|
|
92b0388300 | ||
|
|
f4ea6df204 | ||
|
|
b027ca7c66 | ||
|
|
0573e92ed5 | ||
|
|
672e3b86fd | ||
|
|
b7960eb772 | ||
|
|
bbab114c54 | ||
|
|
e77f48b2c5 | ||
|
|
8fe60bfcda | ||
|
|
09fa662ed1 | ||
|
|
7f2269c4bd | ||
|
|
05de4071d1 | ||
|
|
169abc2376 | ||
|
|
12a3f2689e | ||
|
|
14587463e7 | ||
|
|
6690b4a76e | ||
|
|
c8e51ef21b | ||
|
|
96a5189f14 | ||
|
|
13fcedc3a0 | ||
|
|
c12c26b491 | ||
|
|
6ddce85bdd | ||
|
|
df02855471 |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -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
47
.github/workflows/ci.yml
vendored
Normal 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
8
.gitignore
vendored
@@ -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
144
.nuke/build.schema.json
Normal 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
4
.nuke/parameters.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"$schema": "./build.schema.json",
|
||||
"Solution": "src/ElectronNET.sln"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
language: csharp
|
||||
mono: none
|
||||
dist: xenial
|
||||
dotnet: 3.1
|
||||
before_script:
|
||||
- export PATH="$PATH:/home/travis/.dotnet/tools"
|
||||
script:
|
||||
- ./buildAll.sh
|
||||
32
.vscode/tasks.json
vendored
32
.vscode/tasks.json
vendored
@@ -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
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
138
Changelog.md
138
Changelog.md
@@ -1,4 +1,138 @@
|
||||
# Not released
|
||||
# 23.6.2
|
||||
|
||||
## ElectronNET.API
|
||||
|
||||
* 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
|
||||
|
||||
@@ -15,8 +149,6 @@ ElectronNET.API:
|
||||
* New Feature: Update menu items for context menu and system tray on-the-fly. [\#270](https://github.com/ElectronNET/Electron.NET/pull/270)
|
||||
|
||||
|
||||
# Released
|
||||
|
||||
# 8.31.1
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
@@ -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
@@ -1,13 +0,0 @@
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class BrowserViewConstructorOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// See BrowserWindow.
|
||||
/// </summary>
|
||||
public WebPreferences WebPreferences { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public enum DockBounceType
|
||||
{
|
||||
/// <summary>
|
||||
/// The critical
|
||||
/// </summary>
|
||||
critical,
|
||||
|
||||
/// <summary>
|
||||
/// The informational
|
||||
/// </summary>
|
||||
informational
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 desktop’s 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 desktop’s default manner.
|
||||
/// (For example, mailto: URLs in the user’s 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 desktop’s default manner.
|
||||
/// (For example, mailto: URLs in the user’s 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 desktop’s default manner.
|
||||
/// (For example, mailto: URLs in the user’s 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
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,268 +0,0 @@
|
||||
using ElectronNET.API.Entities;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
/// <summary>
|
||||
/// Render and control web pages.
|
||||
/// </summary>
|
||||
public class WebContents
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the identifier.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The identifier.
|
||||
/// </value>
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Manage browser sessions, cookies, cache, proxy settings, etc.
|
||||
/// </summary>
|
||||
public Session Session { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when the renderer process crashes or is killed.
|
||||
/// </summary>
|
||||
public event Action<bool> OnCrashed
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_crashed == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-crashed" + Id, (killed) =>
|
||||
{
|
||||
_crashed((bool)killed);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-crashed", Id);
|
||||
}
|
||||
_crashed += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_crashed -= value;
|
||||
|
||||
if (_crashed == null)
|
||||
BridgeConnector.Socket.Off("webContents-crashed" + Id);
|
||||
}
|
||||
}
|
||||
|
||||
private event Action<bool> _crashed;
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when the navigation is done, i.e. the spinner of the tab has
|
||||
/// stopped spinning, and the onload event was dispatched.
|
||||
/// </summary>
|
||||
public event Action OnDidFinishLoad
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_didFinishLoad == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-didFinishLoad" + Id, () =>
|
||||
{
|
||||
_didFinishLoad();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-didFinishLoad", Id);
|
||||
}
|
||||
_didFinishLoad += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_didFinishLoad -= value;
|
||||
|
||||
if (_didFinishLoad == null)
|
||||
BridgeConnector.Socket.Off("webContents-didFinishLoad" + Id);
|
||||
}
|
||||
}
|
||||
|
||||
private event Action _didFinishLoad;
|
||||
|
||||
internal WebContents(int id)
|
||||
{
|
||||
Id = id;
|
||||
Session = new Session(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the devtools.
|
||||
/// </summary>
|
||||
public void OpenDevTools()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("webContentsOpenDevTools", Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the devtools.
|
||||
/// </summary>
|
||||
/// <param name="openDevToolsOptions"></param>
|
||||
public void OpenDevTools(OpenDevToolsOptions openDevToolsOptions)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("webContentsOpenDevTools", Id, JObject.FromObject(openDevToolsOptions, _jsonSerializer));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get system printers.
|
||||
/// </summary>
|
||||
/// <returns>printers</returns>
|
||||
public Task<PrinterInfo[]> GetPrintersAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<PrinterInfo[]>();
|
||||
|
||||
BridgeConnector.Socket.On("webContents-getPrinters-completed", (printers) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("webContents-getPrinters-completed");
|
||||
|
||||
taskCompletionSource.SetResult(((Newtonsoft.Json.Linq.JArray)printers).ToObject<PrinterInfo[]>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("webContents-getPrinters", Id);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prints window's web page.
|
||||
/// </summary>
|
||||
/// <param name="options"></param>
|
||||
/// <returns>success</returns>
|
||||
public Task<bool> PrintAsync(PrintOptions options = null)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("webContents-print-completed", (success) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("webContents-print-completed");
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
if(options == null)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("webContents-print", Id, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
BridgeConnector.Socket.Emit("webContents-print", Id, JObject.FromObject(options, _jsonSerializer));
|
||||
}
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prints window's web page as PDF with Chromium's preview printing custom
|
||||
/// settings.The landscape will be ignored if @page CSS at-rule is used in the web page.
|
||||
/// By default, an empty options will be regarded as: Use page-break-before: always;
|
||||
/// CSS style to force to print to a new page.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <returns>success</returns>
|
||||
public Task<bool> PrintToPDFAsync(string path, PrintToPDFOptions options = null)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("webContents-printToPDF-completed", (success) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("webContents-printToPDF-completed");
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
if(options == null)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("webContents-printToPDF", Id, "", path);
|
||||
}
|
||||
else
|
||||
{
|
||||
BridgeConnector.Socket.Emit("webContents-printToPDF", Id, JObject.FromObject(options, _jsonSerializer), path);
|
||||
}
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is used to get the Url of the loaded page.
|
||||
/// It's usefull if a web-server redirects you and you need to know where it redirects. For instance, It's useful in case of Implicit Authorization.
|
||||
/// </summary>
|
||||
/// <returns>URL of the loaded page</returns>
|
||||
public Task<string> GetUrl()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
|
||||
var eventString = "webContents-getUrl" + Id;
|
||||
BridgeConnector.Socket.On(eventString, (url) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off(eventString);
|
||||
taskCompletionSource.SetResult((string)url);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("webContents-getUrl", Id);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The async method will resolve when the page has finished loading,
|
||||
/// and rejects if the page fails to load.
|
||||
///
|
||||
/// A noop rejection handler is already attached, which avoids unhandled rejection
|
||||
/// errors.
|
||||
///
|
||||
/// Loads the `url` in the window. The `url` must contain the protocol prefix, e.g.
|
||||
/// the `http://` or `file://`. If the load should bypass http cache then use the
|
||||
/// `pragma` header to achieve it.
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
public Task LoadURLAsync(string url)
|
||||
{
|
||||
return LoadURLAsync(url, new LoadURLOptions());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The async method will resolve when the page has finished loading,
|
||||
/// and rejects if the page fails to load.
|
||||
///
|
||||
/// A noop rejection handler is already attached, which avoids unhandled rejection
|
||||
/// errors.
|
||||
///
|
||||
/// Loads the `url` in the window. The `url` must contain the protocol prefix, e.g.
|
||||
/// the `http://` or `file://`. If the load should bypass http cache then use the
|
||||
/// `pragma` header to achieve it.
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="options"></param>
|
||||
public Task LoadURLAsync(string url, LoadURLOptions options)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<object>();
|
||||
|
||||
BridgeConnector.Socket.On("webContents-loadURL-complete" + Id, () =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("webContents-loadURL-complete" + Id);
|
||||
BridgeConnector.Socket.Off("webContents-loadURL-error" + Id);
|
||||
taskCompletionSource.SetResult(null);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.On("webContents-loadURL-error" + Id, (error) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("webContents-loadURL-error" + Id);
|
||||
taskCompletionSource.SetException(new InvalidOperationException(error.ToString()));
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("webContents-loadURL", Id, url, JObject.FromObject(options, _jsonSerializer));
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
private JsonSerializer _jsonSerializer = new JsonSerializer()
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
DefaultValueHandling = DefaultValueHandling.Ignore
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"profiles": {
|
||||
"ElectronNET.CLI": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "start /project-path \"C:\\Users\\Rizvi\\source\\repos\\Electron.NET\\ElectronNET.WebApp\" /watch"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"}
|
||||
@@ -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"}
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"autoUpdater.js","sourceRoot":"","sources":["autoUpdater.ts"],"names":[],"mappings":";AAAA,uDAA+C;AAC/C,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,cAAc,GAAG,MAAM,CAAC;IAExB,kBAAkB;IAElB,MAAM,CAAC,EAAE,CAAC,kCAAkC,EAAE,CAAC,EAAE,EAAE,EAAE;QACjD,8BAAW,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAC9B,cAAc,CAAC,IAAI,CAAC,mBAAmB,GAAG,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gDAAgD,EAAE,CAAC,EAAE,EAAE,EAAE;QAC/D,8BAAW,CAAC,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;YACvC,cAAc,CAAC,IAAI,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6CAA6C,EAAE,CAAC,EAAE,EAAE,EAAE;QAC5D,8BAAW,CAAC,EA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E,KAAK,EAAE,EAAE;QACtD,kBAAkB,CAAC,EAAE,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,UAAU;QACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE;gBAC5C,OAAO,KAAK,CAAC;aAChB;YACD,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;SAC5B;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,SAAS,kBAAkB,CAAC,EAAU;QAClC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACtD,MAAM,eAAe,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;YAC5C,IAAI,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE;gBAC3B,OAAO,eAAe,CAAC;aAC1B;SACJ;IACL,CAAC;AACL,CAAC,CAAC"}
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["clipboard.ts"],"names":[],"mappings":";AAAA,uCAAkD;AAClD,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE;QACrC,MAAM,IAAI,GAAG,oBAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtC,cAAc,CAAC,IAAI,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC,CAAC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,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"}
|
||||
@@ -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
|
||||
@@ -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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gB,CAAC,YAAY,CAAC,CAAC;QAE7D,cAAc,CAAC,IAAI,CAAC,iCAAiC,EAAE,eAAe,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -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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AE;YACN,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YACvC,cAAc,CAAC,IAAI,CAAC,2BAA2B,EAAE,WAAW,CAAC,CAAC;SACjE;IACL,CAAC,CAAC,CAAC;IAEH,SAAS,yBAAyB,CAAC,SAAS,EAAE,QAAQ;QAClD,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACvB,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC/C,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;aAC3D;YAED,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE;gBACzB,IAAI,CAAC,KAAK,GAAG,GAAG,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aAC7C;QACL,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC"}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,195 +0,0 @@
|
||||
import { BrowserWindow, BrowserView } 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-getPrinters', async (id) => {
|
||||
const printers = await getWindowById(id).webContents.getPrinters();
|
||||
electronSocket.emit('webContents-getPrinters-completed', printers);
|
||||
});
|
||||
|
||||
socket.on('webContents-print', async (id, options = {}) => {
|
||||
await getWindowById(id).webContents.print(options);
|
||||
electronSocket.emit('webContents-print-completed', true);
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
socket.on('webContents-loadURL', (id, url, options) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.loadURL(url, options).then(() => {
|
||||
electronSocket.emit('webContents-loadURL-complete' + id);
|
||||
}).catch((error) => {
|
||||
console.error(error);
|
||||
electronSocket.emit('webContents-loadURL-error' + id, error);
|
||||
});
|
||||
});
|
||||
|
||||
function getWindowById(id: number): Electron.BrowserWindow | Electron.BrowserView {
|
||||
|
||||
if (id >= 1000) {
|
||||
return BrowserView.fromId(id - 1000);
|
||||
}
|
||||
|
||||
return BrowserWindow.fromId(id);
|
||||
}
|
||||
};
|
||||
@@ -1,257 +0,0 @@
|
||||
const { app } = require('electron');
|
||||
const { BrowserWindow } = require('electron');
|
||||
const path = require('path');
|
||||
const cProcess = require('child_process').spawn;
|
||||
const portscanner = require('portscanner');
|
||||
const imageSize = require('image-size');
|
||||
let io, server, browserWindows, ipc, apiProcess, loadURL;
|
||||
let appApi, menu, dialogApi, notification, tray, webContents;
|
||||
let globalShortcut, shellApi, screen, clipboard, autoUpdater;
|
||||
let commandLine, browserView;
|
||||
let splashScreen, hostHook;
|
||||
let mainWindowId;
|
||||
|
||||
let manifestJsonFileName = 'electron.manifest.json';
|
||||
let watchable = false;
|
||||
if (app.commandLine.hasSwitch('manifest')) {
|
||||
manifestJsonFileName = app.commandLine.getSwitchValue('manifest');
|
||||
};
|
||||
|
||||
if (app.commandLine.hasSwitch('watch')) {
|
||||
watchable = true;
|
||||
};
|
||||
|
||||
let currentBinPath = path.join(__dirname.replace('app.asar', ''), 'bin');
|
||||
let manifestJsonFilePath = path.join(currentBinPath, manifestJsonFileName);
|
||||
|
||||
// if watch is enabled lets change the path
|
||||
if (watchable) {
|
||||
currentBinPath = path.join(__dirname, '../../'); // go to project directory
|
||||
manifestJsonFilePath = path.join(currentBinPath, manifestJsonFileName);
|
||||
}
|
||||
|
||||
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.error(error);
|
||||
|
||||
throw new Error(error.message);
|
||||
}
|
||||
|
||||
splashScreen = new BrowserWindow({
|
||||
width: dimensions.width,
|
||||
height: dimensions.height,
|
||||
transparent: true,
|
||||
center: true,
|
||||
frame: false,
|
||||
closable: false,
|
||||
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
|
||||
if (watchable) {
|
||||
startAspCoreBackendWithWatch(port);
|
||||
} else {
|
||||
startAspCoreBackend(port);
|
||||
}
|
||||
});
|
||||
|
||||
// prototype
|
||||
app['mainWindowURL'] = "";
|
||||
app['mainWindow'] = null;
|
||||
|
||||
io.on('connection', (socket) => {
|
||||
|
||||
// we need to remove previously cache instances
|
||||
// otherwise it will fire the same event multiple depends how many time
|
||||
// live reload watch happen.
|
||||
socket.on('disconnect', function () {
|
||||
console.log('Got disconnect!');
|
||||
delete require.cache[require.resolve('./api/app')];
|
||||
delete require.cache[require.resolve('./api/browserWindows')];
|
||||
delete require.cache[require.resolve('./api/commandLine')];
|
||||
delete require.cache[require.resolve('./api/autoUpdater')];
|
||||
delete require.cache[require.resolve('./api/ipc')];
|
||||
delete require.cache[require.resolve('./api/menu')];
|
||||
delete require.cache[require.resolve('./api/dialog')];
|
||||
delete require.cache[require.resolve('./api/notification')];
|
||||
delete require.cache[require.resolve('./api/tray')];
|
||||
delete require.cache[require.resolve('./api/webContents')];
|
||||
delete require.cache[require.resolve('./api/globalShortcut')];
|
||||
delete require.cache[require.resolve('./api/shell')];
|
||||
delete require.cache[require.resolve('./api/screen')];
|
||||
delete require.cache[require.resolve('./api/clipboard')];
|
||||
delete require.cache[require.resolve('./api/browserView')];
|
||||
});
|
||||
|
||||
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);
|
||||
browserView = require('./api/browserView')(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.error(error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function isModuleAvailable(name) {
|
||||
try {
|
||||
require.resolve(name);
|
||||
return true;
|
||||
} catch (e) { }
|
||||
return false;
|
||||
}
|
||||
|
||||
function startAspCoreBackend(electronPort) {
|
||||
if (manifestJsonFile.aspCoreBackendPort) {
|
||||
startBackend(manifestJsonFile.aspCoreBackendPort)
|
||||
} else {
|
||||
// hostname needs to be localhost, otherwise Windows Firewall will be triggered.
|
||||
portscanner.findAPortNotInUse(electronPort + 1, 65535, 'localhost', function (error, electronWebPort) {
|
||||
startBackend(electronWebPort);
|
||||
});
|
||||
}
|
||||
|
||||
function startBackend(aspCoreBackendPort) {
|
||||
console.log('ASP.NET Core Port: ' + aspCoreBackendPort);
|
||||
loadURL = `http://localhost:${aspCoreBackendPort}`;
|
||||
const parameters = [`/electronPort=${electronPort}`, `/electronWebPort=${aspCoreBackendPort}`];
|
||||
let binaryFile = manifestJsonFile.executable;
|
||||
|
||||
const os = require('os');
|
||||
if (os.platform() === 'win32') {
|
||||
binaryFile = binaryFile + '.exe';
|
||||
}
|
||||
|
||||
let binFilePath = path.join(currentBinPath, binaryFile);
|
||||
var options = { cwd: currentBinPath };
|
||||
apiProcess = cProcess(binFilePath, parameters, options);
|
||||
|
||||
apiProcess.stdout.on('data', (data) => {
|
||||
console.log(`stdout: ${data.toString()}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function startAspCoreBackendWithWatch(electronPort) {
|
||||
if (manifestJsonFile.aspCoreBackendPort) {
|
||||
startBackend(manifestJsonFile.aspCoreBackendPort)
|
||||
} else {
|
||||
// hostname needs to be localhost, otherwise Windows Firewall will be triggered.
|
||||
portscanner.findAPortNotInUse(electronPort + 1, 65535, 'localhost', function (error, electronWebPort) {
|
||||
startBackend(electronWebPort);
|
||||
});
|
||||
}
|
||||
|
||||
function startBackend(aspCoreBackendPort) {
|
||||
console.log('ASP.NET Core Watch Port: ' + aspCoreBackendPort);
|
||||
loadURL = `http://localhost:${aspCoreBackendPort}`;
|
||||
const parameters = ['watch', 'run', `/electronPort=${electronPort}`, `/electronWebPort=${aspCoreBackendPort}`];
|
||||
|
||||
var options = {
|
||||
cwd: currentBinPath,
|
||||
env: process.env,
|
||||
};
|
||||
apiProcess = cProcess('dotnet', parameters, options);
|
||||
|
||||
apiProcess.stdout.on('data', (data) => {
|
||||
console.log(`stdout: ${data.toString()}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
1453
ElectronNET.Host/package-lock.json
generated
1453
ElectronNET.Host/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,28 +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": {
|
||||
"dasherize": "^2.0.0",
|
||||
"electron-updater": "^4.2.5",
|
||||
"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": "^8.2.3",
|
||||
"tslint": "^6.1.1",
|
||||
"typescript": "^3.8.3"
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ElectronNET.WebApp.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"}
|
||||
@@ -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"}
|
||||
@@ -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"}
|
||||
@@ -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');
|
||||
})
|
||||
})
|
||||
@@ -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)
|
||||
}
|
||||
})
|
||||
2
LICENSE
2
LICENSE
@@ -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
|
||||
|
||||
196
README.md
196
README.md
@@ -1,17 +1,10 @@
|
||||
[](https://github.com/ElectronNET/Electron.NET)
|
||||
[](https://github.com/ElectronNET/Electron.NET)
|
||||
|
||||
[](https://donorbox.org/electron-net)
|
||||
[](https://donorbox.org/electron-net) [](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [](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): [](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): [](https://travis-ci.org/ElectronNET/Electron.NET)
|
||||
|
||||
Build cross platform desktop apps with .NET Core 3.1 and ASP.NET NET Core (Razor Pages, MVC), Blazor.
|
||||
|
||||
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,122 +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 [](https://www.nuget.org/packages/ElectronNET.API/)
|
||||
* CLI [](https://www.nuget.org/packages/ElectronNET.CLI/)
|
||||
[ ElectronNET.API ](https://www.nuget.org/packages/ElectronNET.API/) | [ 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.1, so our minimum base OS is the same as [.NET Core 3.1](https://github.com/dotnet/core/blob/master/release-notes/3.1/3.1-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 [contained in nodejs](https://nodejs.org)
|
||||
* npm [contained in nodejs (at least Version 16.17.1)](https://nodejs.org)
|
||||
|
||||
## 💬 Community
|
||||
|
||||
[](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
|
||||
## 🙏 Donate
|
||||
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`.
|
||||
|
||||
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!
|
||||
|
||||
[](https://donorbox.org/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
|
||||
````
|
||||
```
|
||||
|
||||
## 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 IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseElectron(args);
|
||||
webBuilder.UseStartup<Startup>();
|
||||
});
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseElectron(args);
|
||||
webBuilder.UseStartup<Startup>();
|
||||
});
|
||||
```
|
||||
|
||||
### Startup.cs
|
||||
|
||||
Open the Electron Window in the Startup.cs file:
|
||||
Open the Electron Window in the *Startup.cs* file:
|
||||
|
||||
```csharp
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
...
|
||||
//...
|
||||
|
||||
// Open the Electron-Window here
|
||||
Task.Run(async () => await Electron.WindowManager.CreateWindowAsync());
|
||||
Electron.WindowManager.CreateWindowAsync();
|
||||
}
|
||||
```
|
||||
|
||||
## 🚀 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.
|
||||
|
||||
> 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.
|
||||
|
||||
## 🐞 Debug
|
||||
> 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
|
||||
@@ -144,30 +165,42 @@ 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.
|
||||
|
||||
## 🔄 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** - (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)
|
||||
* **[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 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).
|
||||
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.
|
||||
|
||||
@@ -179,24 +212,34 @@ We do this open source work in our free time. If you'd like us to invest more ti
|
||||
|
||||
[](https://donorbox.org/electron-net)
|
||||
|
||||
Alternatively, consider using a GitHub sponsorship for the core maintainers:
|
||||
|
||||
- [Gregor Biswanger](https://github.com/sponsors/GregorBiswanger)
|
||||
- [Florian Rappl](https://github.com/sponsors/FlorianRappl)
|
||||
|
||||
Any support appreciated! 🍻
|
||||
|
||||
## 🎉 License
|
||||
MIT-licensed
|
||||
|
||||
MIT-licensed. See [LICENSE](./LICENSE) for details.
|
||||
|
||||
**Enjoy!**
|
||||
|
||||
|
||||
## 📝 Important notes
|
||||
|
||||
### ElectronNET.API & ElectronNET.CLI Version 8.31.1
|
||||
### ElectronNET.API & ElectronNET.CLI Version 9.31.2
|
||||
|
||||
Make sure you also have the new Electron.NET API & CLI 8.31.1 version.
|
||||
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:
|
||||
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": {
|
||||
@@ -235,29 +278,29 @@ dotnet tool update ElectronNET.CLI -g
|
||||
|
||||
### 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:
|
||||
|
||||
```
|
||||
```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();
|
||||
@@ -265,6 +308,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();
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
version: 1.0.{build}
|
||||
image: Visual Studio 2019
|
||||
build_script:
|
||||
- cmd: buildAll.cmd
|
||||
pull_requests:
|
||||
do_not_increment_build_number: true
|
||||
artifacts:
|
||||
- path: ElectronNET.WebApp\bin\desktop
|
||||
name: Desktop
|
||||
0
artifacts/.gitkeep
Normal file
0
artifacts/.gitkeep
Normal file
@@ -1 +0,0 @@
|
||||
Dummy file to ensure this directory is available after cloning
|
||||
7
build.cmd
Normal file
7
build.cmd
Normal file
@@ -0,0 +1,7 @@
|
||||
:; set -eo pipefail
|
||||
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
|
||||
:; ${SCRIPT_DIR}/build.sh "$@"
|
||||
:; exit $?
|
||||
|
||||
@ECHO OFF
|
||||
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %*
|
||||
69
build.ps1
Normal file
69
build.ps1
Normal file
@@ -0,0 +1,69 @@
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
|
||||
[string[]]$BuildArguments
|
||||
)
|
||||
|
||||
Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)"
|
||||
|
||||
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 }
|
||||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
|
||||
###########################################################################
|
||||
# CONFIGURATION
|
||||
###########################################################################
|
||||
|
||||
$BuildProjectFile = "$PSScriptRoot\nuke\_build.csproj"
|
||||
$TempDirectory = "$PSScriptRoot\\.nuke\temp"
|
||||
|
||||
$DotNetGlobalFile = "$PSScriptRoot\\global.json"
|
||||
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
|
||||
$DotNetChannel = "Current"
|
||||
|
||||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
|
||||
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
|
||||
$env:DOTNET_MULTILEVEL_LOOKUP = 0
|
||||
|
||||
###########################################################################
|
||||
# EXECUTION
|
||||
###########################################################################
|
||||
|
||||
function ExecSafe([scriptblock] $cmd) {
|
||||
& $cmd
|
||||
if ($LASTEXITCODE) { exit $LASTEXITCODE }
|
||||
}
|
||||
|
||||
# If dotnet CLI is installed globally and it matches requested version, use for execution
|
||||
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
|
||||
$(dotnet --version) -and $LASTEXITCODE -eq 0) {
|
||||
$env:DOTNET_EXE = (Get-Command "dotnet").Path
|
||||
}
|
||||
else {
|
||||
# Download install script
|
||||
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
|
||||
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
|
||||
|
||||
# If global.json exists, load expected version
|
||||
if (Test-Path $DotNetGlobalFile) {
|
||||
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
|
||||
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
|
||||
$DotNetVersion = $DotNetGlobal.sdk.version
|
||||
}
|
||||
}
|
||||
|
||||
# Install by channel or version
|
||||
$DotNetDirectory = "$TempDirectory\dotnet-win"
|
||||
if (!(Test-Path variable:DotNetVersion)) {
|
||||
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
|
||||
} else {
|
||||
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
|
||||
}
|
||||
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
|
||||
}
|
||||
|
||||
Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"
|
||||
|
||||
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
|
||||
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }
|
||||
62
build.sh
Executable file
62
build.sh
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
bash --version 2>&1 | head -n 1
|
||||
|
||||
set -eo pipefail
|
||||
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
|
||||
|
||||
###########################################################################
|
||||
# CONFIGURATION
|
||||
###########################################################################
|
||||
|
||||
BUILD_PROJECT_FILE="$SCRIPT_DIR/nuke/_build.csproj"
|
||||
TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp"
|
||||
|
||||
DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
|
||||
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
|
||||
DOTNET_CHANNEL="Current"
|
||||
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
export DOTNET_MULTILEVEL_LOOKUP=0
|
||||
|
||||
###########################################################################
|
||||
# EXECUTION
|
||||
###########################################################################
|
||||
|
||||
function FirstJsonValue {
|
||||
perl -nle 'print $1 if m{"'"$1"'": "([^"]+)",?}' <<< "${@:2}"
|
||||
}
|
||||
|
||||
# If dotnet CLI is installed globally and it matches requested version, use for execution
|
||||
if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then
|
||||
export DOTNET_EXE="$(command -v dotnet)"
|
||||
else
|
||||
# Download install script
|
||||
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
|
||||
mkdir -p "$TEMP_DIRECTORY"
|
||||
curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL"
|
||||
chmod +x "$DOTNET_INSTALL_FILE"
|
||||
|
||||
# If global.json exists, load expected version
|
||||
if [[ -f "$DOTNET_GLOBAL_FILE" ]]; then
|
||||
DOTNET_VERSION=$(FirstJsonValue "version" "$(cat "$DOTNET_GLOBAL_FILE")")
|
||||
if [[ "$DOTNET_VERSION" == "" ]]; then
|
||||
unset DOTNET_VERSION
|
||||
fi
|
||||
fi
|
||||
|
||||
# Install by channel or version
|
||||
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
|
||||
if [[ -z ${DOTNET_VERSION+x} ]]; then
|
||||
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path
|
||||
else
|
||||
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
|
||||
fi
|
||||
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
|
||||
fi
|
||||
|
||||
echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)"
|
||||
|
||||
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
|
||||
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"
|
||||
45
buildAll.cmd
45
buildAll.cmd
@@ -1,45 +0,0 @@
|
||||
echo "Start building Electron.NET dev stack..."
|
||||
|
||||
echo "Restore & Build API"
|
||||
cd ElectronNet.API
|
||||
dotnet restore
|
||||
dotnet build
|
||||
cd ..
|
||||
echo "Restore & Build CLI"
|
||||
cd ElectronNet.CLI
|
||||
dotnet restore
|
||||
dotnet build
|
||||
cd ..
|
||||
echo "Restore & Build WebApp Demo"
|
||||
cd ElectronNet.WebApp
|
||||
dotnet restore
|
||||
dotnet build
|
||||
|
||||
echo "Invoke electronize build in WebApp Demo"
|
||||
|
||||
echo "Install CLI"
|
||||
|
||||
dotnet tool uninstall ElectronNET.CLI -g
|
||||
dotnet tool install ElectronNET.CLI -g
|
||||
|
||||
echo "/target xxx (dev-build)"
|
||||
electronize build /target custom win7-x86;win /dotnet-configuration Debug /electron-arch ia32 /electron-params "--publish never"
|
||||
|
||||
echo "/target win (dev-build)"
|
||||
electronize build /target win /electron-params "--publish never"
|
||||
|
||||
echo "/target custom win7-x86;win (dev-build)"
|
||||
|
||||
electronize build /target custom win7-x86;win /electron-params "--publish never"
|
||||
|
||||
:: Be aware, that for non-electronnet-dev environments the correct
|
||||
:: invoke command would be dotnet electronize ...
|
||||
|
||||
:: Not supported on Windows Systems, because of SymLinks...
|
||||
:: echo "/target osx"
|
||||
:: dotnet electronize build /target osx
|
||||
|
||||
:: Linux and Mac is not supported on with this buildAll.cmd test file, because the electron bundler does some strange stuff
|
||||
:: Help welcome!
|
||||
:: echo "/target linux (dev-build)"
|
||||
:: electronize build /target linux /electron-params "--publish never"
|
||||
39
buildAll.sh
39
buildAll.sh
@@ -1,39 +0,0 @@
|
||||
dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
||||
echo "Start building Electron.NET dev stack..."
|
||||
echo "Restore & Build API"
|
||||
cd $dir/ElectronNET.API
|
||||
dotnet restore
|
||||
dotnet build
|
||||
cd ..
|
||||
|
||||
echo "Restore & Build CLI"
|
||||
cd $dir/ElectronNET.CLI
|
||||
dotnet restore
|
||||
dotnet build
|
||||
cd ..
|
||||
|
||||
echo "Restore & Build WebApp Demo"
|
||||
cd $dir/ElectronNET.WebApp
|
||||
dotnet restore
|
||||
dotnet build
|
||||
|
||||
echo "Install CLI as dotnet tool"
|
||||
|
||||
dotnet tool uninstall ElectronNET.CLI -g
|
||||
dotnet tool install ElectronNET.CLI -g
|
||||
|
||||
echo "Invoke electronize build in WebApp Demo"
|
||||
echo "/target win (dev-build)"
|
||||
electronize build /target win
|
||||
|
||||
echo "/target linux (dev-build)"
|
||||
electronize build /target linux
|
||||
|
||||
echo "/target osx (dev-build)"
|
||||
electronize build /target osx
|
||||
|
||||
echo "/target custom win7-x86;win (dev-build)"
|
||||
electronize build /target custom "win7-x86;win"
|
||||
|
||||
# Be aware, that for non-electronnet-dev environments the correct
|
||||
# invoke command would be dotnet electronize ...
|
||||
@@ -1,14 +0,0 @@
|
||||
set ENETVER=8.31.1
|
||||
echo "Start building Electron.NET dev stack..."
|
||||
echo "Restore & Build API"
|
||||
cd ElectronNet.API
|
||||
dotnet restore
|
||||
dotnet build --configuration Release --force /property:Version=%ENETVER%
|
||||
dotnet pack /p:Version=%ENETVER% --configuration Release --force --output "%~dp0artifacts"
|
||||
cd ..
|
||||
echo "Restore & Build CLI"
|
||||
cd ElectronNet.CLI
|
||||
dotnet restore
|
||||
dotnet build --configuration Release --force /property:Version=%ENETVER%
|
||||
dotnet pack /p:Version=%ENETVER% --configuration Release --force --output "%~dp0artifacts"
|
||||
cd ..
|
||||
@@ -1,15 +0,0 @@
|
||||
echo "Start building Electron.NET dev stack..."
|
||||
|
||||
echo "Restore & Build API"
|
||||
cd ElectronNET.API && \
|
||||
dotnet restore && \
|
||||
dotnet build --configuration Release --force /property:Version=5.22.12 && \
|
||||
dotnet pack /p:Version=5.22.12 --configuration Release --force --output "%~dp0artifacts";
|
||||
|
||||
cd ../;
|
||||
|
||||
echo "Restore & Build CLI"
|
||||
cd ElectronNET.CLI && \
|
||||
dotnet restore && \
|
||||
dotnet build --configuration Release --force /property:Version=5.22.12 && \
|
||||
dotnet pack /p:Version=5.22.12 --configuration Release --force --output "%~dp0artifacts";
|
||||
11
nuke/.editorconfig
Normal file
11
nuke/.editorconfig
Normal file
@@ -0,0 +1,11 @@
|
||||
[*.cs]
|
||||
dotnet_style_qualification_for_field = false:warning
|
||||
dotnet_style_qualification_for_property = false:warning
|
||||
dotnet_style_qualification_for_method = false:warning
|
||||
dotnet_style_qualification_for_event = false:warning
|
||||
dotnet_style_require_accessibility_modifiers = never:warning
|
||||
|
||||
csharp_style_expression_bodied_methods = true:silent
|
||||
csharp_style_expression_bodied_properties = true:warning
|
||||
csharp_style_expression_bodied_indexers = true:warning
|
||||
csharp_style_expression_bodied_accessors = true:warning
|
||||
340
nuke/Build.cs
Normal file
340
nuke/Build.cs
Normal file
@@ -0,0 +1,340 @@
|
||||
using Microsoft.Build.Exceptions;
|
||||
using Nuke.Common;
|
||||
using Nuke.Common.CI.GitHubActions;
|
||||
using Nuke.Common.IO;
|
||||
using Nuke.Common.ProjectModel;
|
||||
using Nuke.Common.Tools.DotNet;
|
||||
using Nuke.Common.Tools.GitHub;
|
||||
using Nuke.Common.Tools.NuGet;
|
||||
using Nuke.Common.Utilities.Collections;
|
||||
using Octokit;
|
||||
using Octokit.Internal;
|
||||
using Serilog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using static Nuke.Common.IO.FileSystemTasks;
|
||||
using static Nuke.Common.IO.PathConstruction;
|
||||
using static Nuke.Common.Tools.DotNet.DotNetTasks;
|
||||
|
||||
class Build : NukeBuild
|
||||
{
|
||||
/// Support plugins are available for:
|
||||
/// - JetBrains ReSharper https://nuke.build/resharper
|
||||
/// - JetBrains Rider https://nuke.build/rider
|
||||
/// - Microsoft VisualStudio https://nuke.build/visualstudio
|
||||
/// - Microsoft VSCode https://nuke.build/vscode
|
||||
|
||||
public static int Main () => Execute<Build>(x => x.RunUnitTests);
|
||||
|
||||
[Nuke.Common.Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
|
||||
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
|
||||
|
||||
[Nuke.Common.Parameter("ReleaseNotesFilePath - To determine the SemanticVersion")]
|
||||
readonly AbsolutePath ReleaseNotesFilePath = RootDirectory / "Changelog.md";
|
||||
|
||||
[Solution]
|
||||
readonly Solution Solution;
|
||||
|
||||
string TargetProjectName => "ElectronNET";
|
||||
|
||||
string ApiTargetLibName => $"{TargetProjectName}.API";
|
||||
|
||||
string CliTargetLibName => $"{TargetProjectName}.CLI";
|
||||
|
||||
string DemoTargetLibName => $"{TargetProjectName}.WebApp";
|
||||
|
||||
AbsolutePath SourceDirectory => RootDirectory / "src";
|
||||
|
||||
AbsolutePath ResultDirectory => RootDirectory / "artifacts";
|
||||
|
||||
GitHubActions GitHubActions => GitHubActions.Instance;
|
||||
|
||||
IReadOnlyList<ReleaseNotes> ChangeLog { get; set; }
|
||||
|
||||
ReleaseNotes LatestReleaseNotes { get; set; }
|
||||
|
||||
SemVersion SemVersion { get; set; }
|
||||
|
||||
string Version { get; set; }
|
||||
|
||||
AbsolutePath[] Projects
|
||||
{
|
||||
get
|
||||
{
|
||||
var api = SourceDirectory / ApiTargetLibName / $"{ApiTargetLibName}.csproj";
|
||||
var cli = SourceDirectory / CliTargetLibName / $"{CliTargetLibName}.csproj";
|
||||
var projects = new[] { api, cli };
|
||||
return projects;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnBuildInitialized()
|
||||
{
|
||||
var parser = new ReleaseNotesParser();
|
||||
|
||||
Log.Debug("Reading ChangeLog {FilePath}...", ReleaseNotesFilePath);
|
||||
ChangeLog = parser.Parse(File.ReadAllText(ReleaseNotesFilePath));
|
||||
ChangeLog.NotNull("ChangeLog / ReleaseNotes could not be read!");
|
||||
|
||||
LatestReleaseNotes = ChangeLog.First();
|
||||
LatestReleaseNotes.NotNull("LatestVersion could not be read!");
|
||||
|
||||
Log.Debug("Using LastestVersion from ChangeLog: {LatestVersion}", LatestReleaseNotes.Version);
|
||||
SemVersion = LatestReleaseNotes.SemVersion;
|
||||
Version = LatestReleaseNotes.Version.ToString();
|
||||
|
||||
if (GitHubActions != null)
|
||||
{
|
||||
Log.Debug("Add Version Postfix if under CI - GithubAction(s)...");
|
||||
|
||||
var buildNumber = GitHubActions.RunNumber;
|
||||
|
||||
if (ScheduledTargets.Contains(Default))
|
||||
{
|
||||
Version = $"{Version}-ci.{buildNumber}";
|
||||
}
|
||||
else if (ScheduledTargets.Contains(PrePublish))
|
||||
{
|
||||
Version = $"{Version}-alpha.{buildNumber}";
|
||||
}
|
||||
}
|
||||
|
||||
Log.Information("Building version: {Version}", Version);
|
||||
}
|
||||
|
||||
Target Clean => _ => _
|
||||
.Before(Restore)
|
||||
.Executes(() =>
|
||||
{
|
||||
SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory);
|
||||
});
|
||||
|
||||
Target Restore => _ => _
|
||||
.Executes(() =>
|
||||
{
|
||||
Projects.ForEach(project =>
|
||||
{
|
||||
DotNetRestore(s => s
|
||||
.SetProjectFile(project));
|
||||
});
|
||||
});
|
||||
|
||||
Target Compile => _ => _
|
||||
.DependsOn(Restore)
|
||||
.Executes(() =>
|
||||
{
|
||||
Projects.ForEach(project =>
|
||||
{
|
||||
DotNetBuild(s => s
|
||||
.SetProjectFile(project)
|
||||
.SetVersion(Version)
|
||||
.SetConfiguration(Configuration)
|
||||
.EnableNoRestore());
|
||||
});
|
||||
});
|
||||
|
||||
Target RunUnitTests => _ => _
|
||||
.DependsOn(Compile)
|
||||
.Executes(() =>
|
||||
{
|
||||
Projects.ForEach(project =>
|
||||
{
|
||||
DotNetTest(s => s
|
||||
.SetProjectFile(project)
|
||||
.SetConfiguration(Configuration)
|
||||
.EnableNoRestore()
|
||||
.EnableNoBuild());
|
||||
});
|
||||
});
|
||||
|
||||
Target CreatePackages => _ => _
|
||||
.DependsOn(Compile)
|
||||
.Executes(() =>
|
||||
{
|
||||
Projects.ForEach(project =>
|
||||
{
|
||||
DotNetPack(s => s
|
||||
.SetProject(project)
|
||||
.SetVersion(Version)
|
||||
.SetConfiguration(Configuration)
|
||||
.SetOutputDirectory(ResultDirectory)
|
||||
.SetIncludeSymbols(true)
|
||||
.SetSymbolPackageFormat("snupkg")
|
||||
.EnableNoRestore()
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Target CompileSample => _ => _
|
||||
.DependsOn(Compile)
|
||||
.Executes(() =>
|
||||
{
|
||||
var sample = SourceDirectory / DemoTargetLibName / $"{DemoTargetLibName}.csproj";
|
||||
DotNetBuild(s => s.SetProjectFile(sample).SetConfiguration(Configuration));
|
||||
});
|
||||
|
||||
Target ElectronizeGenericTargetSample => _ => _
|
||||
.DependsOn(CompileSample)
|
||||
.Executes(() =>
|
||||
{
|
||||
var sample = SourceDirectory / DemoTargetLibName;
|
||||
var cli = SourceDirectory / CliTargetLibName / $"{CliTargetLibName}.csproj";
|
||||
var args = "build /target custom win7-x86;win /dotnet-configuration Debug /electron-arch ia32 /electron-params \"--publish never\"";
|
||||
|
||||
DotNet($"run --project {cli} -- {args}", sample);
|
||||
});
|
||||
|
||||
Target ElectronizeWindowsTargetSample => _ => _
|
||||
.DependsOn(CompileSample)
|
||||
.Executes(() =>
|
||||
{
|
||||
var sample = SourceDirectory / DemoTargetLibName;
|
||||
var cli = SourceDirectory / CliTargetLibName / $"{CliTargetLibName}.csproj";
|
||||
var args = "build /target win /electron-params \"--publish never\"";
|
||||
|
||||
DotNet($"run --project {cli} -- {args}", sample);
|
||||
});
|
||||
|
||||
Target ElectronizeCustomWin7TargetSample => _ => _
|
||||
.DependsOn(CompileSample)
|
||||
.Executes(() =>
|
||||
{
|
||||
var sample = SourceDirectory / DemoTargetLibName;
|
||||
var cli = SourceDirectory / CliTargetLibName / $"{CliTargetLibName}.csproj";
|
||||
var args = "build /target custom win7-x86;win /electron-params \"--publish never\"";
|
||||
|
||||
DotNet($"run --project {cli} -- {args}", sample);
|
||||
});
|
||||
|
||||
Target ElectronizeMacOsTargetSample => _ => _
|
||||
.DependsOn(CompileSample)
|
||||
.Executes(() =>
|
||||
{
|
||||
var sample = SourceDirectory / DemoTargetLibName;
|
||||
var cli = SourceDirectory / CliTargetLibName / $"{CliTargetLibName}.csproj";
|
||||
var args = "build /target osx /electron-params \"--publish never\"";
|
||||
|
||||
DotNet($"run --project {cli} -- {args}", sample);
|
||||
});
|
||||
|
||||
Target ElectronizeLinuxTargetSample => _ => _
|
||||
.DependsOn(CompileSample)
|
||||
.Executes(() =>
|
||||
{
|
||||
var sample = SourceDirectory / DemoTargetLibName;
|
||||
var cli = SourceDirectory / CliTargetLibName / $"{CliTargetLibName}.csproj";
|
||||
var args = "build /target linux /electron-params \"--publish never\"";
|
||||
|
||||
DotNet($"run --project {cli} -- {args}", sample);
|
||||
});
|
||||
|
||||
Target PublishPackages => _ => _
|
||||
.DependsOn(CreatePackages)
|
||||
.DependsOn(RunUnitTests)
|
||||
.Executes(() =>
|
||||
{
|
||||
var apiKey = Environment.GetEnvironmentVariable("NUGET_API_KEY");
|
||||
|
||||
|
||||
if (apiKey.IsNullOrEmpty())
|
||||
{
|
||||
throw new BuildAbortedException("Could not resolve the NuGet API key.");
|
||||
}
|
||||
|
||||
foreach (var nupkg in GlobFiles(ResultDirectory, "*.nupkg"))
|
||||
{
|
||||
DotNetNuGetPush(s => s
|
||||
.SetTargetPath(nupkg)
|
||||
.SetSource("https://api.nuget.org/v3/index.json")
|
||||
.SetApiKey(apiKey));
|
||||
}
|
||||
});
|
||||
|
||||
Target PublishPreRelease => _ => _
|
||||
.DependsOn(PublishPackages)
|
||||
.Executes(() =>
|
||||
{
|
||||
string gitHubToken;
|
||||
|
||||
if (GitHubActions != null)
|
||||
{
|
||||
gitHubToken = GitHubActions.Token;
|
||||
}
|
||||
else
|
||||
{
|
||||
gitHubToken = Environment.GetEnvironmentVariable("GITHUB_TOKEN");
|
||||
}
|
||||
|
||||
if (gitHubToken.IsNullOrEmpty())
|
||||
{
|
||||
throw new BuildAbortedException("Could not resolve GitHub token.");
|
||||
}
|
||||
|
||||
var credentials = new Credentials(gitHubToken);
|
||||
|
||||
GitHubTasks.GitHubClient = new GitHubClient(
|
||||
new ProductHeaderValue(nameof(NukeBuild)),
|
||||
new InMemoryCredentialStore(credentials));
|
||||
|
||||
GitHubTasks.GitHubClient.Repository.Release
|
||||
.Create("ElectronNET", "Electron.NET", new NewRelease(Version)
|
||||
{
|
||||
Name = Version,
|
||||
Body = String.Join(Environment.NewLine, LatestReleaseNotes.Notes),
|
||||
Prerelease = true,
|
||||
TargetCommitish = "develop",
|
||||
});
|
||||
});
|
||||
|
||||
Target PublishRelease => _ => _
|
||||
.DependsOn(PublishPackages)
|
||||
.Executes(() =>
|
||||
{
|
||||
string gitHubToken;
|
||||
|
||||
if (GitHubActions != null)
|
||||
{
|
||||
gitHubToken = GitHubActions.Token;
|
||||
}
|
||||
else
|
||||
{
|
||||
gitHubToken = Environment.GetEnvironmentVariable("GITHUB_TOKEN");
|
||||
}
|
||||
|
||||
if (gitHubToken.IsNullOrEmpty())
|
||||
{
|
||||
throw new BuildAbortedException("Could not resolve GitHub token.");
|
||||
}
|
||||
|
||||
var credentials = new Credentials(gitHubToken);
|
||||
|
||||
GitHubTasks.GitHubClient = new GitHubClient(
|
||||
new ProductHeaderValue(nameof(NukeBuild)),
|
||||
new InMemoryCredentialStore(credentials));
|
||||
|
||||
GitHubTasks.GitHubClient.Repository.Release
|
||||
.Create("ElectronNET", "Electron.NET", new NewRelease(Version)
|
||||
{
|
||||
Name = Version,
|
||||
Body = String.Join(Environment.NewLine, LatestReleaseNotes.Notes),
|
||||
Prerelease = false,
|
||||
TargetCommitish = "main",
|
||||
});
|
||||
});
|
||||
|
||||
Target Package => _ => _
|
||||
.DependsOn(RunUnitTests)
|
||||
.DependsOn(CreatePackages);
|
||||
|
||||
Target Default => _ => _
|
||||
.DependsOn(Package);
|
||||
|
||||
Target Publish => _ => _
|
||||
.DependsOn(PublishRelease);
|
||||
|
||||
Target PrePublish => _ => _
|
||||
.DependsOn(PublishPreRelease);
|
||||
}
|
||||
16
nuke/Configuration.cs
Normal file
16
nuke/Configuration.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using Nuke.Common.Tooling;
|
||||
|
||||
[TypeConverter(typeof(TypeConverter<Configuration>))]
|
||||
public class Configuration : Enumeration
|
||||
{
|
||||
public static Configuration Debug = new Configuration { Value = nameof(Debug) };
|
||||
public static Configuration Release = new Configuration { Value = nameof(Release) };
|
||||
|
||||
public static implicit operator string(Configuration configuration)
|
||||
{
|
||||
return configuration.Value;
|
||||
}
|
||||
}
|
||||
8
nuke/Directory.Build.props
Normal file
8
nuke/Directory.Build.props
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<!-- This file prevents unintended imports of unrelated MSBuild files -->
|
||||
<!-- Uncomment to include parent Directory.Build.props file -->
|
||||
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />-->
|
||||
|
||||
</Project>
|
||||
8
nuke/Directory.Build.targets
Normal file
8
nuke/Directory.Build.targets
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<!-- This file prevents unintended imports of unrelated MSBuild files -->
|
||||
<!-- Uncomment to include parent Directory.Build.targets file -->
|
||||
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />-->
|
||||
|
||||
</Project>
|
||||
80
nuke/Extensions/StringExtensions.cs
Normal file
80
nuke/Extensions/StringExtensions.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
/// <summary>
|
||||
/// Contains extension methods for <see cref="System.String"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Original from Cake build tool source:
|
||||
/// https://github.com/cake-build/cake/blob/9828d7b246d332054896e52ba56983822feb3f05/src/Cake.Core/Extensions/StringExtensions.cs
|
||||
/// </remarks>
|
||||
public static class StringExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Quotes the specified <see cref="System.String"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">The string to quote.</param>
|
||||
/// <returns>A quoted string.</returns>
|
||||
public static string Quote(this string value)
|
||||
{
|
||||
if (!IsQuoted(value))
|
||||
{
|
||||
value = string.Concat("\"", value, "\"");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unquote the specified <see cref="System.String"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">The string to unquote.</param>
|
||||
/// <returns>An unquoted string.</returns>
|
||||
public static string UnQuote(this string value)
|
||||
{
|
||||
if (IsQuoted(value))
|
||||
{
|
||||
value = value.Trim('"');
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Splits the <see cref="String"/> into lines.
|
||||
/// </summary>
|
||||
/// <param name="content">The string to split.</param>
|
||||
/// <returns>The lines making up the provided string.</returns>
|
||||
public static string[] SplitLines(this string content)
|
||||
{
|
||||
content = NormalizeLineEndings(content);
|
||||
return content.Split(new[] { "\r\n" }, StringSplitOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Normalizes the line endings in a <see cref="String"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">The string to normalize line endings in.</param>
|
||||
/// <returns>A <see cref="String"/> with normalized line endings.</returns>
|
||||
public static string NormalizeLineEndings(this string value)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
value = value.Replace("\r\n", "\n");
|
||||
value = value.Replace("\r", string.Empty);
|
||||
return value.Replace("\n", "\r\n");
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private static bool IsQuoted(this string value)
|
||||
{
|
||||
return value.StartsWith("\"", StringComparison.OrdinalIgnoreCase)
|
||||
&& value.EndsWith("\"", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
81
nuke/ReleaseNotes.cs
Normal file
81
nuke/ReleaseNotes.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
/// <summary>
|
||||
/// Represent release notes.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Original from Cake build tool source:
|
||||
/// https://github.com/cake-build/cake/blob/9828d7b246d332054896e52ba56983822feb3f05/src/Cake.Common/ReleaseNotes.cs
|
||||
/// </remarks>
|
||||
public sealed class ReleaseNotes
|
||||
{
|
||||
private readonly List<string> _notes;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the version.
|
||||
/// </summary>
|
||||
/// <value>The version.</value>
|
||||
public SemVersion SemVersion { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the version.
|
||||
/// </summary>
|
||||
/// <value>The version.</value>
|
||||
public Version Version { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the release notes.
|
||||
/// </summary>
|
||||
/// <value>The release notes.</value>
|
||||
public IReadOnlyList<string> Notes => _notes;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the raw text of the line that <see cref="Version"/> was extracted from.
|
||||
/// </summary>
|
||||
/// <value>The raw text of the Version line.</value>
|
||||
public string RawVersionLine { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ReleaseNotes"/> class.
|
||||
/// </summary>
|
||||
/// <param name="semVersion">The semantic version.</param>
|
||||
/// <param name="notes">The notes.</param>
|
||||
/// <param name="rawVersionLine">The raw text of the version line.</param>
|
||||
public ReleaseNotes(SemVersion semVersion, IEnumerable<string> notes, string rawVersionLine)
|
||||
: this(
|
||||
semVersion?.AssemblyVersion ?? throw new ArgumentNullException(nameof(semVersion)),
|
||||
semVersion,
|
||||
notes,
|
||||
rawVersionLine)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ReleaseNotes"/> class.
|
||||
/// </summary>
|
||||
/// <param name="version">The version.</param>
|
||||
/// <param name="notes">The notes.</param>
|
||||
/// <param name="rawVersionLine">The raw text of the version line.</param>
|
||||
public ReleaseNotes(Version version, IEnumerable<string> notes, string rawVersionLine)
|
||||
: this(
|
||||
version ?? throw new ArgumentNullException(nameof(version)),
|
||||
new SemVersion(version.Major, version.Minor, version.Build),
|
||||
notes,
|
||||
rawVersionLine)
|
||||
{
|
||||
}
|
||||
|
||||
private ReleaseNotes(Version version, SemVersion semVersion, IEnumerable<string> notes, string rawVersionLine)
|
||||
{
|
||||
Version = version ?? throw new ArgumentNullException(nameof(version));
|
||||
SemVersion = semVersion ?? throw new ArgumentNullException(nameof(semVersion));
|
||||
RawVersionLine = rawVersionLine;
|
||||
_notes = new List<string>(notes ?? Enumerable.Empty<string>());
|
||||
}
|
||||
}
|
||||
160
nuke/ReleaseNotesParser.cs
Normal file
160
nuke/ReleaseNotesParser.cs
Normal file
@@ -0,0 +1,160 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Build.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// The release notes parser.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Original from Cake build tool source:
|
||||
/// https://github.com/cake-build/cake/blob/9828d7b246d332054896e52ba56983822feb3f05/src/Cake.Common/ReleaseNotesParser.cs
|
||||
/// </remarks>
|
||||
public sealed class ReleaseNotesParser
|
||||
{
|
||||
private readonly Regex _versionRegex;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ReleaseNotesParser"/> class.
|
||||
/// </summary>
|
||||
public ReleaseNotesParser()
|
||||
{
|
||||
_versionRegex = new Regex(@"(?<Version>\d+(\s*\.\s*\d+){0,3})(?<Release>-[a-z][0-9a-z-]*)?");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses all release notes.
|
||||
/// </summary>
|
||||
/// <param name="content">The content.</param>
|
||||
/// <returns>All release notes.</returns>
|
||||
public IReadOnlyList<ReleaseNotes> Parse(string content)
|
||||
{
|
||||
if (content == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(content));
|
||||
}
|
||||
|
||||
var lines = content.SplitLines();
|
||||
if (lines.Length > 0)
|
||||
{
|
||||
var line = lines[0].Trim();
|
||||
|
||||
if (line.StartsWith("#", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ParseComplexFormat(lines);
|
||||
}
|
||||
|
||||
if (line.StartsWith("*", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ParseSimpleFormat(lines);
|
||||
}
|
||||
}
|
||||
|
||||
throw new BuildAbortedException("Unknown release notes format.");
|
||||
}
|
||||
|
||||
private IReadOnlyList<ReleaseNotes> ParseComplexFormat(string[] lines)
|
||||
{
|
||||
var lineIndex = 0;
|
||||
var result = new List<ReleaseNotes>();
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (lineIndex >= lines.Length)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Create release notes.
|
||||
var semVer = SemVersion.Zero;
|
||||
var version = SemVersion.TryParse(lines[lineIndex], out semVer);
|
||||
if (!version)
|
||||
{
|
||||
throw new BuildAbortedException("Could not parse version from release notes header.");
|
||||
}
|
||||
|
||||
var rawVersionLine = lines[lineIndex];
|
||||
|
||||
// Increase the line index.
|
||||
lineIndex++;
|
||||
|
||||
// Parse content.
|
||||
var notes = new List<string>();
|
||||
|
||||
while (true)
|
||||
{
|
||||
// Sanity checks.
|
||||
if (lineIndex >= lines.Length)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (lines[lineIndex].StartsWith("# ", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Get the current line.
|
||||
var line = (lines[lineIndex] ?? string.Empty).Trim();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(line))
|
||||
{
|
||||
notes.Add(line);
|
||||
}
|
||||
|
||||
lineIndex++;
|
||||
}
|
||||
|
||||
result.Add(new ReleaseNotes(semVer, notes, rawVersionLine));
|
||||
}
|
||||
|
||||
return result.OrderByDescending(x => x.SemVersion).ToArray();
|
||||
}
|
||||
|
||||
private IReadOnlyList<ReleaseNotes> ParseSimpleFormat(string[] lines)
|
||||
{
|
||||
var lineIndex = 0;
|
||||
var result = new List<ReleaseNotes>();
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (lineIndex >= lines.Length)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Trim the current line.
|
||||
var line = (lines[lineIndex] ?? string.Empty);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(line))
|
||||
{
|
||||
lineIndex++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Parse header.
|
||||
var semVer = SemVersion.Zero;
|
||||
var version = SemVersion.TryParse(lines[lineIndex], out semVer);
|
||||
|
||||
if (!version)
|
||||
{
|
||||
throw new BuildAbortedException("Could not parse version from release notes header.");
|
||||
}
|
||||
|
||||
// Parse the description.
|
||||
line = line.Substring(semVer.ToString().Length).Trim('-', ' ');
|
||||
|
||||
// Add the release notes to the result.
|
||||
result.Add(new ReleaseNotes(semVer, new[] { line }, line));
|
||||
|
||||
lineIndex++;
|
||||
}
|
||||
|
||||
return result.OrderByDescending(x => x.SemVersion).ToArray();
|
||||
}
|
||||
}
|
||||
378
nuke/SemVersion.cs
Normal file
378
nuke/SemVersion.cs
Normal file
@@ -0,0 +1,378 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
/// <summary>
|
||||
/// Class for representing semantic versions.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Original from Cake build tool source:
|
||||
/// https://github.com/cake-build/cake/blob/9828d7b246d332054896e52ba56983822feb3f05/src/Cake.Common/SemanticVersion.cs
|
||||
/// </remarks>
|
||||
public class SemVersion : IComparable, IComparable<SemVersion>, IEquatable<SemVersion>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the default version of a SemanticVersion.
|
||||
/// </summary>
|
||||
public static SemVersion Zero { get; } = new SemVersion(0, 0, 0, null, null, "0.0.0");
|
||||
|
||||
/// <summary>
|
||||
/// Regex property for parsing a semantic version number.
|
||||
/// </summary>
|
||||
public static readonly Regex SemVerRegex =
|
||||
new Regex(
|
||||
@"(?<Major>0|(?:[1-9]\d*))(?:\.(?<Minor>0|(?:[1-9]\d*))(?:\.(?<Patch>0|(?:[1-9]\d*)))?(?:\-(?<PreRelease>[0-9A-Z\.-]+))?(?:\+(?<Meta>[0-9A-Z\.-]+))?)?",
|
||||
RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the major number of the version.
|
||||
/// </summary>
|
||||
public int Major { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the minor number of the version.
|
||||
/// </summary>
|
||||
public int Minor { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the patch number of the version.
|
||||
/// </summary>
|
||||
public int Patch { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the prerelease of the version.
|
||||
/// </summary>
|
||||
public string PreRelease { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the meta of the version.
|
||||
/// </summary>
|
||||
public string Meta { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether semantic version is a prerelease or not.
|
||||
/// </summary>
|
||||
public bool IsPreRelease { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether semantic version has meta or not.
|
||||
/// </summary>
|
||||
public bool HasMeta { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the VersionString of the semantic version.
|
||||
/// </summary>
|
||||
public string VersionString { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the AssemblyVersion of the semantic version.
|
||||
/// </summary>
|
||||
public Version AssemblyVersion { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SemVersion"/> class.
|
||||
/// </summary>
|
||||
/// <param name="major">Major number.</param>
|
||||
/// <param name="minor">Minor number.</param>
|
||||
/// <param name="patch">Patch number.</param>
|
||||
/// <param name="preRelease">Prerelease string.</param>
|
||||
/// <param name="meta">Meta string.</param>
|
||||
public SemVersion(int major, int minor, int patch, string preRelease = null, string meta = null) : this(major,
|
||||
minor, patch, preRelease, meta, null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SemVersion"/> class.
|
||||
/// </summary>
|
||||
/// <param name="major">Major number.</param>
|
||||
/// <param name="minor">Minor number.</param>
|
||||
/// <param name="patch">Patch number.</param>
|
||||
/// <param name="preRelease">Prerelease string.</param>
|
||||
/// <param name="meta">Meta string.</param>
|
||||
/// <param name="versionString">The complete version number.</param>
|
||||
public SemVersion(int major, int minor, int patch, string preRelease, string meta, string versionString)
|
||||
{
|
||||
Major = major;
|
||||
Minor = minor;
|
||||
Patch = patch;
|
||||
AssemblyVersion = new Version(major, minor, patch);
|
||||
IsPreRelease = !string.IsNullOrEmpty(preRelease);
|
||||
HasMeta = !string.IsNullOrEmpty(meta);
|
||||
PreRelease = IsPreRelease ? preRelease : null;
|
||||
Meta = HasMeta ? meta : null;
|
||||
|
||||
if (!string.IsNullOrEmpty(versionString))
|
||||
{
|
||||
VersionString = versionString;
|
||||
}
|
||||
else
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendFormat(CultureInfo.InvariantCulture, "{0}.{1}.{2}", Major, Minor, Patch);
|
||||
|
||||
if (IsPreRelease)
|
||||
{
|
||||
sb.AppendFormat(CultureInfo.InvariantCulture, "-{0}", PreRelease);
|
||||
}
|
||||
|
||||
if (HasMeta)
|
||||
{
|
||||
sb.AppendFormat(CultureInfo.InvariantCulture, "+{0}", Meta);
|
||||
}
|
||||
|
||||
VersionString = sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method which tries to parse a semantic version string.
|
||||
/// </summary>
|
||||
/// <param name="version">the version that should be parsed.</param>
|
||||
/// <param name="semVersion">the out parameter the parsed version should be stored in.</param>
|
||||
/// <returns>Returns a boolean indicating if the parse was successful.</returns>
|
||||
public static bool TryParse(string version,
|
||||
out SemVersion semVersion)
|
||||
{
|
||||
semVersion = Zero;
|
||||
|
||||
if (string.IsNullOrEmpty(version))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var match = SemVerRegex.Match(version);
|
||||
if (!match.Success)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!int.TryParse(
|
||||
match.Groups["Major"].Value,
|
||||
NumberStyles.Integer,
|
||||
CultureInfo.InvariantCulture,
|
||||
out var major) ||
|
||||
!int.TryParse(
|
||||
match.Groups["Minor"].Value,
|
||||
NumberStyles.Integer,
|
||||
CultureInfo.InvariantCulture,
|
||||
out var minor) ||
|
||||
!int.TryParse(
|
||||
match.Groups["Patch"].Value,
|
||||
NumberStyles.Integer,
|
||||
CultureInfo.InvariantCulture,
|
||||
out var patch))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
semVersion = new SemVersion(
|
||||
major,
|
||||
minor,
|
||||
patch,
|
||||
match.Groups["PreRelease"]?.Value,
|
||||
match.Groups["Meta"]?.Value,
|
||||
version);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if two SemVersion objects are equal.
|
||||
/// </summary>
|
||||
/// <param name="other">the other SemVersion want to test equality to.</param>
|
||||
/// <returns>A boolean indicating whether the objecst we're equal or not.</returns>
|
||||
public bool Equals(SemVersion other)
|
||||
{
|
||||
return other is object
|
||||
&& Major == other.Major
|
||||
&& Minor == other.Minor
|
||||
&& Patch == other.Patch
|
||||
&& string.Equals(PreRelease, other.PreRelease, StringComparison.OrdinalIgnoreCase)
|
||||
&& string.Equals(Meta, other.Meta, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compares to SemVersion objects to and another.
|
||||
/// </summary>
|
||||
/// <param name="other">The SemVersion object we compare with.</param>
|
||||
/// <returns>Return 0 if the objects are identical, 1 if the version is newer and -1 if the version is older.</returns>
|
||||
public int CompareTo(SemVersion other)
|
||||
{
|
||||
if (other is null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Equals(other))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (Major > other.Major)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Major < other.Major)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (Minor > other.Minor)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Minor < other.Minor)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (Patch > other.Patch)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Patch < other.Patch)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (IsPreRelease != other.IsPreRelease)
|
||||
{
|
||||
return other.IsPreRelease ? 1 : -1;
|
||||
}
|
||||
|
||||
switch (StringComparer.InvariantCultureIgnoreCase.Compare(PreRelease, other.PreRelease))
|
||||
{
|
||||
case 1:
|
||||
return 1;
|
||||
|
||||
case -1:
|
||||
return -1;
|
||||
|
||||
default:
|
||||
{
|
||||
return (string.IsNullOrEmpty(Meta) != string.IsNullOrEmpty(other.Meta))
|
||||
? string.IsNullOrEmpty(Meta) ? 1 : -1
|
||||
: StringComparer.InvariantCultureIgnoreCase.Compare(Meta, other.Meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compares to SemVersion objects to and another.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object we compare with.</param>
|
||||
/// <returns>Return 0 if the objects are identical, 1 if the version is newer and -1 if the version is older.</returns>
|
||||
public int CompareTo(object obj)
|
||||
{
|
||||
return (obj is SemVersion semVersion)
|
||||
? CompareTo(semVersion)
|
||||
: -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equals-method for the SemVersion class.
|
||||
/// </summary>
|
||||
/// <param name="obj">the other SemVersion want to test equality to.</param>
|
||||
/// <returns>A boolean indicating whether the objecst we're equal or not.</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return (obj is SemVersion semVersion)
|
||||
&& Equals(semVersion);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method for getting the hashcode of the SemVersion object.
|
||||
/// </summary>
|
||||
/// <returns>The hashcode of the SemVersion object.</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
var hashCode = Major;
|
||||
hashCode = (hashCode * 397) ^ Minor;
|
||||
hashCode = (hashCode * 397) ^ Patch;
|
||||
hashCode = (hashCode * 397) ^
|
||||
(PreRelease != null ? StringComparer.OrdinalIgnoreCase.GetHashCode(PreRelease) : 0);
|
||||
hashCode = (hashCode * 397) ^ (Meta != null ? StringComparer.OrdinalIgnoreCase.GetHashCode(Meta) : 0);
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string representation of an SemVersion object.
|
||||
/// </summary>
|
||||
/// <returns>The string representation of the object.</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
int[] verParts = { Major, Minor, Patch };
|
||||
string ver = string.Join(".", verParts);
|
||||
return $"{ver}{(IsPreRelease ? "-" : string.Empty)}{PreRelease}{Meta}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The greater than-operator for the SemVersion class.
|
||||
/// </summary>
|
||||
/// <param name="operand1">first SemVersion.</param>
|
||||
/// <param name="operand2">second. SemVersion.</param>
|
||||
/// <returns>A value indicating if the operand1 was greater than operand2.</returns>
|
||||
public static bool operator >(SemVersion operand1, SemVersion operand2)
|
||||
=> operand1 is { } && operand1.CompareTo(operand2) == 1;
|
||||
|
||||
/// <summary>
|
||||
/// The less than-operator for the SemVersion class.
|
||||
/// </summary>
|
||||
/// <param name="operand1">first SemVersion.</param>
|
||||
/// <param name="operand2">second. SemVersion.</param>
|
||||
/// <returns>A value indicating if the operand1 was less than operand2.</returns>
|
||||
public static bool operator <(SemVersion operand1, SemVersion operand2)
|
||||
=> operand1 is { }
|
||||
? operand1.CompareTo(operand2) == -1
|
||||
: operand2 is { };
|
||||
|
||||
/// <summary>
|
||||
/// The greater than or equal to-operator for the SemVersion class.
|
||||
/// </summary>
|
||||
/// <param name="operand1">first SemVersion.</param>
|
||||
/// <param name="operand2">second. SemVersion.</param>
|
||||
/// <returns>A value indicating if the operand1 was greater than or equal to operand2.</returns>
|
||||
public static bool operator >=(SemVersion operand1, SemVersion operand2)
|
||||
=> operand1 is { }
|
||||
? operand1.CompareTo(operand2) >= 0
|
||||
: operand2 is null;
|
||||
|
||||
/// <summary>
|
||||
/// The lesser than or equal to-operator for the SemVersion class.
|
||||
/// </summary>
|
||||
/// <param name="operand1">first SemVersion.</param>
|
||||
/// <param name="operand2">second. SemVersion.</param>
|
||||
/// <returns>A value indicating if the operand1 was lesser than or equal to operand2.</returns>
|
||||
public static bool operator <=(SemVersion operand1, SemVersion operand2)
|
||||
=> operand1 is null || operand1.CompareTo(operand2) <= 0;
|
||||
|
||||
/// <summary>
|
||||
/// The equal to-operator for the SemVersion class.
|
||||
/// </summary>
|
||||
/// <param name="operand1">first SemVersion.</param>
|
||||
/// <param name="operand2">second. SemVersion.</param>
|
||||
/// <returns>A value indicating if the operand1 was equal to operand2.</returns>
|
||||
public static bool operator ==(SemVersion operand1, SemVersion operand2)
|
||||
=> operand1?.Equals(operand2) ?? operand2 is null;
|
||||
|
||||
/// <summary>
|
||||
/// The not equal to-operator for the SemVersion class.
|
||||
/// </summary>
|
||||
/// <param name="operand1">first SemVersion.</param>
|
||||
/// <param name="operand2">second. SemVersion.</param>
|
||||
/// <returns>A value indicating if the operand1 was not equal to operand2.</returns>
|
||||
public static bool operator !=(SemVersion operand1, SemVersion operand2)
|
||||
=> !(operand1?.Equals(operand2) ?? operand2 is null);
|
||||
}
|
||||
21
nuke/_build.csproj
Normal file
21
nuke/_build.csproj
Normal file
@@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace></RootNamespace>
|
||||
<NoWarn>CS0649;CS0169</NoWarn>
|
||||
<NukeRootDirectory>..</NukeRootDirectory>
|
||||
<NukeScriptDirectory>..</NukeScriptDirectory>
|
||||
<NukeTelemetryVersion>1</NukeTelemetryVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Nuke.Common" Version="6.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageDownload Include="NuGet.CommandLine" Version="[6.3.1]" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
3
package-lock.json
generated
3
package-lock.json
generated
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"lockfileVersion": 1
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,9 @@
|
||||
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
|
||||
@@ -182,11 +185,48 @@ namespace ElectronNET.API
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The current application version
|
||||
/// </summary>
|
||||
public Task<SemVer> CurrentVersionAsync
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run<SemVer>(() =>
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<SemVer>();
|
||||
|
||||
BridgeConnector.Socket.On("autoUpdater-currentVersion-get-reply", (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdater-currentVersion-get-reply");
|
||||
SemVer version = ((JObject)result).ToObject<SemVer>();
|
||||
taskCompletionSource.SetResult(version);
|
||||
});
|
||||
BridgeConnector.Socket.Emit("autoUpdater-currentVersion-get");
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the update channel. Not applicable for GitHub.
|
||||
/// Doesn’t return channel from the update configuration, only if was previously set.
|
||||
/// </summary>
|
||||
[Obsolete("Use the asynchronous version ChannelAsync instead")]
|
||||
public string Channel
|
||||
{
|
||||
get
|
||||
{
|
||||
return ChannelAsync.Result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the update channel. Not applicable for GitHub.
|
||||
/// Doesn’t return channel from the update configuration, only if was previously set.
|
||||
/// </summary>
|
||||
public Task<string> ChannelAsync
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -199,11 +239,45 @@ namespace ElectronNET.API
|
||||
BridgeConnector.Socket.Off("autoUpdater-channel-get-reply");
|
||||
taskCompletionSource.SetResult(result.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("autoUpdater-channel-get");
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}).Result;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The request headers.
|
||||
/// </summary>
|
||||
public Task<Dictionary<string, string>> RequestHeadersAsync
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<Dictionary<string, string>>();
|
||||
BridgeConnector.Socket.On("autoUpdater-requestHeaders-get-reply", (headers) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdater-requestHeaders-get-reply");
|
||||
Dictionary<string, string> result = ((JObject)headers).ToObject<Dictionary<string, string>>();
|
||||
taskCompletionSource.SetResult(result);
|
||||
});
|
||||
BridgeConnector.Socket.Emit("autoUpdater-requestHeaders-get");
|
||||
return taskCompletionSource.Task;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The request headers.
|
||||
/// </summary>
|
||||
public Dictionary<string, string> RequestHeaders
|
||||
{
|
||||
set
|
||||
{
|
||||
BridgeConnector.Socket.Emit("autoUpdater-requestHeaders-set", JObject.FromObject(value, _jsonSerializer));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,9 +490,26 @@ namespace ElectronNET.API
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
|
||||
BridgeConnector.Socket.On("autoUpdaterCheckForUpdatesComplete" + guid, (updateCheckResult) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesComplete" + guid);
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesError" + guid);
|
||||
taskCompletionSource.SetResult(JObject.Parse(updateCheckResult.ToString()).ToObject<UpdateCheckResult>());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
taskCompletionSource.SetException(ex);
|
||||
}
|
||||
});
|
||||
BridgeConnector.Socket.On("autoUpdaterCheckForUpdatesError" + guid, (error) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesComplete" + guid);
|
||||
taskCompletionSource.SetResult(JObject.Parse(updateCheckResult.ToString()).ToObject<UpdateCheckResult>());
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesError" + guid);
|
||||
string message = "An error occurred in CheckForUpdatesAsync";
|
||||
if (error != null && !string.IsNullOrEmpty(error.ToString()))
|
||||
message = JsonConvert.SerializeObject(error);
|
||||
taskCompletionSource.SetException(new Exception(message));
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("autoUpdaterCheckForUpdates", guid);
|
||||
@@ -438,9 +529,29 @@ namespace ElectronNET.API
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
|
||||
BridgeConnector.Socket.On("autoUpdaterCheckForUpdatesAndNotifyComplete" + guid, (updateCheckResult) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesAndNotifyComplete" + guid);
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesAndNotifyError" + guid);
|
||||
if (updateCheckResult == null)
|
||||
taskCompletionSource.SetResult(null);
|
||||
else
|
||||
taskCompletionSource.SetResult(JObject.Parse(updateCheckResult.ToString()).ToObject<UpdateCheckResult>());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
taskCompletionSource.SetException(ex);
|
||||
}
|
||||
});
|
||||
BridgeConnector.Socket.On("autoUpdaterCheckForUpdatesAndNotifyError" + guid, (error) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesAndNotifyComplete" + guid);
|
||||
taskCompletionSource.SetResult(JObject.Parse(updateCheckResult.ToString()).ToObject<UpdateCheckResult>());
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesAndNotifyError" + guid);
|
||||
string message = "An error occurred in autoUpdaterCheckForUpdatesAndNotify";
|
||||
if (error != null)
|
||||
message = JsonConvert.SerializeObject(error);
|
||||
taskCompletionSource.SetException(new Exception(message));
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("autoUpdaterCheckForUpdatesAndNotify", guid);
|
||||
@@ -501,5 +612,10 @@ namespace ElectronNET.API
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
private readonly JsonSerializer _jsonSerializer = new JsonSerializer()
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver()
|
||||
};
|
||||
}
|
||||
}
|
||||
33
src/ElectronNET.API/BridgeConnector.cs
Normal file
33
src/ElectronNET.API/BridgeConnector.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
internal static class BridgeConnector
|
||||
{
|
||||
private static SocketIoFacade _socket;
|
||||
private static readonly object SyncRoot = new();
|
||||
|
||||
public static SocketIoFacade Socket
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_socket == null)
|
||||
{
|
||||
lock (SyncRoot)
|
||||
{
|
||||
if (_socket == null)
|
||||
{
|
||||
|
||||
string socketUrl = HybridSupport.IsElectronActive
|
||||
? $"http://localhost:{BridgeSettings.SocketPort}"
|
||||
: "http://localhost";
|
||||
|
||||
_socket = new SocketIoFacade(socketUrl);
|
||||
_socket.Connect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _socket;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,6 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ElectronNET.API
|
||||
@@ -29,30 +26,6 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public WebContents WebContents { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the view is destroyed.
|
||||
/// </summary>
|
||||
public Task<bool> IsDestroyedAsync
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run<bool>(() =>
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("browserView-isDestroyed-reply", (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserView-isDestroyed-reply");
|
||||
taskCompletionSource.SetResult((bool)result);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("browserView-isDestroyed", Id);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resizes and moves the view to the supplied bounds relative to the window.
|
||||
///
|
||||
@@ -83,8 +56,6 @@ namespace ElectronNET.API
|
||||
}
|
||||
}
|
||||
|
||||
internal Action<BrowserView> Destroyed;
|
||||
|
||||
/// <summary>
|
||||
/// BrowserView
|
||||
/// </summary>
|
||||
@@ -97,18 +68,6 @@ namespace ElectronNET.API
|
||||
WebContents = new WebContents(id + 1000);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Force closing the view, the `unload` and `beforeunload` events won't be emitted
|
||||
/// for the web page.After you're done with a view, call this function in order to
|
||||
/// free memory and other resources as soon as possible.
|
||||
/// </summary>
|
||||
public void Destroy()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("browserView-destroy", Id);
|
||||
|
||||
Destroyed?.Invoke(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// (experimental)
|
||||
/// </summary>
|
||||
2256
src/ElectronNET.API/BrowserWindow.cs
Normal file
2256
src/ElectronNET.API/BrowserWindow.cs
Normal file
File diff suppressed because it is too large
Load Diff
54
src/ElectronNET.API/Converter/ModifierTypeListConverter.cs
Normal file
54
src/ElectronNET.API/Converter/ModifierTypeListConverter.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ElectronNET.API.Entities;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace ElectronNET.API.Converter;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class ModifierTypeListConverter : JsonConverter<List<ModifierType>>
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="reader"></param>
|
||||
/// <param name="objectType"></param>
|
||||
/// <param name="existingValue"></param>
|
||||
/// <param name="hasExistingValue"></param>
|
||||
/// <param name="serializer"></param>
|
||||
/// <returns></returns>
|
||||
public override List<ModifierType> ReadJson(JsonReader reader, Type objectType, List<ModifierType> existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||
{
|
||||
var token = JToken.Load(reader);
|
||||
|
||||
if (token.Type == JTokenType.Null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return token.ToObject<List<string>>().Select(m => (ModifierType)Enum.Parse(typeof(ModifierType), m)).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="writer"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="serializer"></param>
|
||||
public override void WriteJson(JsonWriter writer, List<ModifierType> value, JsonSerializer serializer)
|
||||
{
|
||||
writer.WriteStartArray();
|
||||
|
||||
foreach (var modifier in value)
|
||||
{
|
||||
writer.WriteValue(modifier.ToString());
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
}
|
||||
154
src/ElectronNET.API/Cookies.cs
Normal file
154
src/ElectronNET.API/Cookies.cs
Normal file
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.API.Entities;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
/// <summary>
|
||||
/// Query and modify a session's cookies.
|
||||
/// </summary>
|
||||
public class Cookies
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the identifier.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The identifier.
|
||||
/// </value>
|
||||
public int Id { get; private set; }
|
||||
|
||||
internal Cookies(int id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when a cookie is changed because it was added, edited, removed, or expired.
|
||||
/// </summary>
|
||||
public event Action<Cookie, CookieChangedCause, bool> OnChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_changed == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-session-cookies-changed" + Id, (args) =>
|
||||
{
|
||||
Cookie cookie = ((JArray)args)[0].ToObject<Cookie>();
|
||||
CookieChangedCause cause = ((JArray)args)[1].ToObject<CookieChangedCause>();
|
||||
bool removed = ((JArray)args)[2].ToObject<bool>();
|
||||
_changed(cookie, cause, removed);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-session-cookies-changed", Id);
|
||||
}
|
||||
_changed += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_changed -= value;
|
||||
|
||||
if (_changed == null)
|
||||
BridgeConnector.Socket.Off("webContents-session-cookies-changed" + Id);
|
||||
}
|
||||
}
|
||||
|
||||
private event Action<Cookie, CookieChangedCause, bool> _changed;
|
||||
|
||||
/// <summary>
|
||||
/// Sends a request to get all cookies matching filter, and resolves a callack with the response.
|
||||
/// </summary>
|
||||
/// <param name="filter">
|
||||
/// </param>
|
||||
/// <returns>A task which resolves an array of cookie objects.</returns>
|
||||
public Task<Cookie[]> GetAsync(CookieFilter filter)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<Cookie[]>();
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
|
||||
BridgeConnector.Socket.On("webContents-session-cookies-get-completed" + guid, (cookies) =>
|
||||
{
|
||||
Cookie[] result = ((JArray)cookies).ToObject<Cookie[]>();
|
||||
|
||||
BridgeConnector.Socket.Off("webContents-session-cookies-get-completed" + guid);
|
||||
taskCompletionSource.SetResult(result);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("webContents-session-cookies-get", Id, JObject.FromObject(filter, _jsonSerializer), guid);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="details"></param>
|
||||
/// <returns></returns>
|
||||
public Task SetAsync(CookieDetails details)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<object>();
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
|
||||
BridgeConnector.Socket.On("webContents-session-cookies-set-completed" + guid, () =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("webContents-session-cookies-set-completed" + guid);
|
||||
taskCompletionSource.SetResult(null);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("webContents-session-cookies-set", Id, JObject.FromObject(details, _jsonSerializer), guid);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the cookies matching url and name
|
||||
/// </summary>
|
||||
/// <param name="url">The URL associated with the cookie.</param>
|
||||
/// <param name="name">The name of cookie to remove.</param>
|
||||
/// <returns>A task which resolves when the cookie has been removed</returns>
|
||||
public Task RemoveAsync(string url, string name)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<object>();
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
|
||||
BridgeConnector.Socket.On("webContents-session-cookies-remove-completed" + guid, () =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("webContents-session-cookies-remove-completed" + guid);
|
||||
taskCompletionSource.SetResult(null);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("webContents-session-cookies-remove", Id, url, name, guid);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes any unwritten cookies data to disk.
|
||||
/// </summary>
|
||||
/// <returns>A task which resolves when the cookie store has been flushed</returns>
|
||||
public Task FlushStoreAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<object>();
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
|
||||
BridgeConnector.Socket.On("webContents-session-cookies-flushStore-completed" + guid, () =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("webContents-session-cookies-flushStore-completed" + guid);
|
||||
taskCompletionSource.SetResult(null);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("webContents-session-cookies-flushStore", Id, guid);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
private JsonSerializer _jsonSerializer = new JsonSerializer()
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
DefaultValueHandling = DefaultValueHandling.Ignore
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
@@ -56,12 +55,7 @@ namespace ElectronNET.API
|
||||
BridgeConnector.Socket.Off("showOpenDialogComplete" + guid);
|
||||
|
||||
var result = ((JArray)filePaths).ToObject<string[]>();
|
||||
var list = new List<string>();
|
||||
foreach (var item in result)
|
||||
{
|
||||
list.Add(HttpUtility.UrlDecode(item));
|
||||
}
|
||||
taskCompletionSource.SetResult(list.ToArray());
|
||||
taskCompletionSource.SetResult(result);
|
||||
});
|
||||
|
||||
|
||||
232
src/ElectronNET.API/Dock.cs
Normal file
232
src/ElectronNET.API/Dock.cs
Normal file
@@ -0,0 +1,232 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.API.Entities;
|
||||
using ElectronNET.API.Extensions;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
/// <summary>
|
||||
/// Control your app in the macOS dock.
|
||||
/// </summary>
|
||||
public sealed class Dock
|
||||
{
|
||||
private static Dock _dock;
|
||||
private static object _syncRoot = new object();
|
||||
|
||||
internal Dock()
|
||||
{
|
||||
}
|
||||
|
||||
internal static Dock Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_dock == null)
|
||||
{
|
||||
lock (_syncRoot)
|
||||
{
|
||||
if (_dock == null)
|
||||
{
|
||||
_dock = new Dock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _dock;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When <see cref="DockBounceType.Critical"/> is passed, the dock icon will bounce until either the application becomes
|
||||
/// active or the request is canceled. When <see cref="DockBounceType.Informational"/> is passed, the dock icon will bounce
|
||||
/// for one second. However, the request remains active until either the application becomes active or the request is canceled.
|
||||
/// <para/>
|
||||
/// Note: This method can only be used while the app is not focused; when the app is focused it will return -1.
|
||||
/// </summary>
|
||||
/// <param name="type">Can be critical or informational. The default is informational.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Return an ID representing the request.</returns>
|
||||
public async Task<int> BounceAsync(DockBounceType type, CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<int>();
|
||||
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
|
||||
{
|
||||
BridgeConnector.Socket.On("dock-bounce-completed", (id) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("dock-bounce-completed");
|
||||
taskCompletionSource.SetResult((int) id);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("dock-bounce", type.GetDescription());
|
||||
|
||||
return await taskCompletionSource.Task
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancel the bounce of id.
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the request.</param>
|
||||
public void CancelBounce(int id)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("dock-cancelBounce", id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bounces the Downloads stack if the filePath is inside the Downloads folder.
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
public void DownloadFinished(string filePath)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("dock-downloadFinished", filePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the string to be displayed in the dock’s badging area.
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
public void SetBadge(string text)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("dock-setBadge", text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the string to be displayed in the dock’s badging area.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The badge string of the dock.</returns>
|
||||
public async Task<string> GetBadgeAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
|
||||
{
|
||||
BridgeConnector.Socket.On("dock-getBadge-completed", (text) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("dock-getBadge-completed");
|
||||
taskCompletionSource.SetResult((string) text);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("dock-getBadge");
|
||||
|
||||
return await taskCompletionSource.Task
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hides the dock icon.
|
||||
/// </summary>
|
||||
public void Hide()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("dock-hide");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shows the dock icon.
|
||||
/// </summary>
|
||||
public void Show()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("dock-show");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the dock icon is visible. The app.dock.show() call is asynchronous
|
||||
/// so this method might not return true immediately after that call.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Whether the dock icon is visible.</returns>
|
||||
public async Task<bool> IsVisibleAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
|
||||
{
|
||||
BridgeConnector.Socket.On("dock-isVisible-completed", (isVisible) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("dock-isVisible-completed");
|
||||
taskCompletionSource.SetResult((bool) isVisible);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("dock-isVisible");
|
||||
|
||||
return await taskCompletionSource.Task
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the dock menu items.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The menu items.
|
||||
/// </value>
|
||||
public IReadOnlyCollection<MenuItem> MenuItems { get { return _items.AsReadOnly(); } }
|
||||
private List<MenuItem> _items = new List<MenuItem>();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the application's dock menu.
|
||||
/// </summary>
|
||||
public void SetMenu(MenuItem[] menuItems)
|
||||
{
|
||||
menuItems.AddMenuItemsId();
|
||||
BridgeConnector.Socket.Emit("dock-setMenu", JArray.FromObject(menuItems, _jsonSerializer));
|
||||
_items.AddRange(menuItems);
|
||||
|
||||
BridgeConnector.Socket.Off("dockMenuItemClicked");
|
||||
BridgeConnector.Socket.On("dockMenuItemClicked", (id) => {
|
||||
MenuItem menuItem = _items.GetMenuItem(id.ToString());
|
||||
menuItem?.Click();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TODO: Menu (macOS) still to be implemented
|
||||
/// Gets the application's dock menu.
|
||||
/// </summary>
|
||||
public async Task<Menu> GetMenu(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<Menu>();
|
||||
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
|
||||
{
|
||||
BridgeConnector.Socket.On("dock-getMenu-completed", (menu) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("dock-getMenu-completed");
|
||||
taskCompletionSource.SetResult(((JObject)menu).ToObject<Menu>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("dock-getMenu");
|
||||
|
||||
return await taskCompletionSource.Task
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the image associated with this dock icon.
|
||||
/// </summary>
|
||||
/// <param name="image"></param>
|
||||
public void SetIcon(string image)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("dock-setIcon", image);
|
||||
}
|
||||
|
||||
private JsonSerializer _jsonSerializer = new JsonSerializer()
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -73,5 +73,20 @@
|
||||
/// <c>electronize add HostHook</c>
|
||||
/// </summary>
|
||||
public static HostHook HostHook { get { return HostHook.Instance; } }
|
||||
|
||||
/// <summary>
|
||||
/// Allows you to execute native Lock and Unlock process.
|
||||
/// </summary>
|
||||
public static PowerMonitor PowerMonitor { get { return PowerMonitor.Instance; } }
|
||||
|
||||
/// <summary>
|
||||
/// Read and respond to changes in Chromium's native color theme.
|
||||
/// </summary>
|
||||
public static NativeTheme NativeTheme { get { return NativeTheme.Instance; } }
|
||||
|
||||
/// <summary>
|
||||
/// Control your app in the macOS dock.
|
||||
/// </summary>
|
||||
public static Dock Dock { get { return Dock.Instance; } }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<PackageOutputPath>..\artifacts</PackageOutputPath>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<PackageOutputPath>..\..\artifacts</PackageOutputPath>
|
||||
<PackageId>ElectronNET.API</PackageId>
|
||||
<Authors>Gregor Biswanger, Robert Muehsig</Authors>
|
||||
<Authors>Gregor Biswanger, Florian Rappl</Authors>
|
||||
<Company />
|
||||
<Product>Electron.NET</Product>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
@@ -16,16 +14,14 @@ This package contains the API to access the "native" electron API.</Description>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||
<PackageTags>electron aspnetcore</PackageTags>
|
||||
<PackageReleaseNotes>Changelog: https://github.com/ElectronNET/Electron.NET/blob/master/Changelog.md</PackageReleaseNotes>
|
||||
<PackageReleaseNotes>Changelog: https://github.com/ElectronNET/Electron.NET/blob/main/Changelog.md</PackageReleaseNotes>
|
||||
<PackageIcon>PackageIcon.png</PackageIcon>
|
||||
<Version>99.0.0.0</Version>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="PackageIcon.png" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(OS)' == 'Windows_NT'">
|
||||
<Exec Command="$(ProjectDir)devCleanup.cmd" IgnoreExitCode="true" />
|
||||
</Target>
|
||||
@@ -33,15 +29,19 @@ This package contains the API to access the "native" electron API.</Description>
|
||||
<Exec Command="$(ProjectDir)devCleanup.sh" IgnoreExitCode="true" />
|
||||
</Target>
|
||||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19367-01">
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="SocketIoClientDotNet" Version="1.0.5" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="SocketIOClient" Version="3.0.8" />
|
||||
<PackageReference Include="SocketIOClient.Newtonsoft.Json" Version="3.0.7" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.410601">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// About panel options.
|
||||
/// </summary>
|
||||
public class AboutPanelOptions
|
||||
{
|
||||
@@ -20,14 +20,29 @@
|
||||
/// </summary>
|
||||
public string Copyright { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The app's build version number.
|
||||
/// </summary>
|
||||
public string Version { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Credit information.
|
||||
/// </summary>
|
||||
public string Credits { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The app's build version number.
|
||||
/// List of app authors.
|
||||
/// </summary>
|
||||
public string Version { get; set; }
|
||||
public string[] Authors { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The app's website.
|
||||
/// </summary>
|
||||
public string Website { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Path to the app's icon. On Linux, will be shown as 64x64 pixels while retaining aspect ratio.
|
||||
/// </summary>
|
||||
public string IconPath { get; set; }
|
||||
}
|
||||
}
|
||||
18
src/ElectronNET.API/Entities/Blob.cs
Normal file
18
src/ElectronNET.API/Entities/Blob.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class Blob : IPostData
|
||||
{
|
||||
/// <summary>
|
||||
/// The object represents a Blob
|
||||
/// </summary>
|
||||
public string Type { get; } = "blob";
|
||||
|
||||
/// <summary>
|
||||
/// The UUID of the Blob being uploaded
|
||||
/// </summary>
|
||||
public string BlobUUID { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class BrowserViewConstructorOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// See BrowserWindow.
|
||||
/// </summary>
|
||||
public WebPreferences WebPreferences { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A proxy to set on creation in the format host:port.
|
||||
/// The proxy can be alternatively set using the BrowserView.WebContents.SetProxyAsync function.
|
||||
/// </summary>
|
||||
public string Proxy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The credentials of the Proxy in the format username:password.
|
||||
/// These will only be used if the Proxy field is also set.
|
||||
/// </summary>
|
||||
public string ProxyCredentials { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -258,5 +258,17 @@ namespace ElectronNET.API.Entities
|
||||
/// Settings of web page's features.
|
||||
/// </summary>
|
||||
public WebPreferences WebPreferences { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A proxy to set on creation in the format host:port.
|
||||
/// The proxy can be alternatively set using the BrowserWindow.WebContents.SetProxyAsync function.
|
||||
/// </summary>
|
||||
public string Proxy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The credentials of the Proxy in the format username:password.
|
||||
/// These will only be used if the Proxy field is also set.
|
||||
/// </summary>
|
||||
public string ProxyCredentials { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,15 @@
|
||||
/// </summary>
|
||||
public class CPUUsage
|
||||
{
|
||||
/// <summary>
|
||||
/// Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
|
||||
/// </summary>
|
||||
public int PercentCPUUsage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of average idle cpu wakeups per second since the last call to
|
||||
/// getCPUUsage.First call returns 0.
|
||||
/// </summary>
|
||||
public int IdleWakeupsPerSecond { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
|
||||
/// </summary>
|
||||
public int PercentCPUUsage { get; set; }
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user