mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-04 05:34:51 +00:00
Compare commits
521 Commits
0.0.9
...
23.6.2-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d22532488e | ||
|
|
30558dea5f | ||
|
|
464eaca593 | ||
|
|
df3bd122df | ||
|
|
eabcc3a6b6 | ||
|
|
2b5435381f | ||
|
|
0d63383899 | ||
|
|
f31fe19652 | ||
|
|
0a80367e3e | ||
|
|
34761456ad | ||
|
|
e4e96bbcc4 | ||
|
|
1253df3d9a | ||
|
|
b8b634beb3 | ||
|
|
94dc82ec62 | ||
|
|
53ccf4d302 | ||
|
|
bf0bdc8386 | ||
|
|
73a3e331dc | ||
|
|
a15db713ad | ||
|
|
e2d03d6818 | ||
|
|
0dc8369fb3 | ||
|
|
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 | ||
|
|
68ee626d07 | ||
|
|
fd5801ffdc | ||
|
|
df02855471 | ||
|
|
b6417d0718 | ||
|
|
6f1f7cbc5e | ||
|
|
aec0da6075 | ||
|
|
c9f0c43bc9 | ||
|
|
b87d7f9899 | ||
|
|
fa51cdd72c | ||
|
|
9b270755d0 | ||
|
|
c5db735773 | ||
|
|
88f5995f40 | ||
|
|
042cd7e6cb | ||
|
|
cb096212f9 | ||
|
|
0363dc8924 | ||
|
|
8cf5053512 | ||
|
|
32046adfb5 | ||
|
|
003a9d0d35 | ||
|
|
db6bed43dc | ||
|
|
80d160a71c | ||
|
|
01d938fb1a | ||
|
|
00eb9869dc | ||
|
|
2987e3143d | ||
|
|
20ca72b794 | ||
|
|
a0e0cc3bbc | ||
|
|
e295558258 | ||
|
|
e67f6c500b | ||
|
|
23015a9f3d | ||
|
|
7daac2d04e | ||
|
|
71955b9181 | ||
|
|
a619b6e5c9 | ||
|
|
3ba3fa6414 | ||
|
|
11fbd6b259 | ||
|
|
073eb0e00d | ||
|
|
c0bf257b55 | ||
|
|
62b37d059f | ||
|
|
ca8f4c454c | ||
|
|
d660dff871 | ||
|
|
c17720a4d7 | ||
|
|
274552f52b | ||
|
|
1e3fe6183c | ||
|
|
88b04377a7 | ||
|
|
92356d3587 | ||
|
|
a3c452eea5 | ||
|
|
68288d9d73 | ||
|
|
022221307c | ||
|
|
ffc6353bf2 | ||
|
|
f4d8144a8b | ||
|
|
30d49ff6e8 | ||
|
|
db9d3b1484 | ||
|
|
a788d71530 | ||
|
|
f5e2abfdb4 | ||
|
|
42f09de7b5 | ||
|
|
72d1f4b2b9 | ||
|
|
d2b3c28f91 | ||
|
|
94c4cd82b0 | ||
|
|
600bc1a41b | ||
|
|
4e8e771293 | ||
|
|
4014ef7a4d | ||
|
|
364db7dc25 | ||
|
|
3dda18ac9a | ||
|
|
7f92ffa20e | ||
|
|
b69d4d23bf | ||
|
|
eb4144053d | ||
|
|
239d914747 | ||
|
|
5af8e489b9 | ||
|
|
b6fb1cb0bf | ||
|
|
aa98b85f18 | ||
|
|
af74d24f50 | ||
|
|
2240ffca82 | ||
|
|
f64b780a27 | ||
|
|
fbc5b93513 | ||
|
|
14d02706c0 | ||
|
|
2c14693430 | ||
|
|
54ff11acf5 | ||
|
|
b7e7ace6f3 | ||
|
|
1f7908a0f1 | ||
|
|
cafffde339 | ||
|
|
6fbba52edd | ||
|
|
8dd5d1561a | ||
|
|
25f35e34fe | ||
|
|
f1eaffb203 | ||
|
|
69ca5d6f9e | ||
|
|
5cd11a8110 | ||
|
|
c343b19a60 | ||
|
|
b3bb3ceb97 | ||
|
|
e25b89ff6a | ||
|
|
28be0dd209 | ||
|
|
8bf10c370c | ||
|
|
a32b50f86f | ||
|
|
a781234d05 | ||
|
|
8b66bdd7cb | ||
|
|
ba64639c1d | ||
|
|
5157561dc6 | ||
|
|
bbecd86cce | ||
|
|
bd99da560b | ||
|
|
9278402d65 | ||
|
|
9bc1b46810 | ||
|
|
d2956e6f2f | ||
|
|
da4e930478 | ||
|
|
8e9f7b016a | ||
|
|
10e95afa5c | ||
|
|
68505f8feb | ||
|
|
c91884a520 | ||
|
|
ccf0a4c73b | ||
|
|
660663d9c1 | ||
|
|
36ee9c4dd7 | ||
|
|
9f7c99db53 | ||
|
|
b9ba162a88 | ||
|
|
ad399f50ee | ||
|
|
428e53e265 | ||
|
|
0a02b7140b | ||
|
|
f6ea0dd8dc | ||
|
|
dc8987de5a | ||
|
|
dc73be0c81 | ||
|
|
4dc8f189f9 | ||
|
|
5ec179af5d | ||
|
|
802b1acf68 | ||
|
|
07a0bc9c7d | ||
|
|
43028afc02 | ||
|
|
d3d73611b7 | ||
|
|
6d31c41479 | ||
|
|
98a549560f | ||
|
|
8a3b9951fa | ||
|
|
552b4331b2 | ||
|
|
38785f9b18 | ||
|
|
886b4b81a5 | ||
|
|
e6b6f990d7 | ||
|
|
a2ada57292 | ||
|
|
0cede6131e | ||
|
|
ce52988aac | ||
|
|
3a52680a54 | ||
|
|
6d28e57f04 | ||
|
|
a2cdabf8cb | ||
|
|
25ab81ca8f | ||
|
|
5ba54ab40b | ||
|
|
cca8110c38 | ||
|
|
06f43032b4 | ||
|
|
0709d61120 | ||
|
|
aa09af8ad6 | ||
|
|
e90ef9e48d | ||
|
|
6d076fb99a | ||
|
|
131d1d9dd1 | ||
|
|
e5132e8198 | ||
|
|
6a7c60fdb5 | ||
|
|
8605fab9a7 | ||
|
|
c03d6e8976 | ||
|
|
5e0ef7edb5 | ||
|
|
5300609360 | ||
|
|
ed6ebe90b1 | ||
|
|
4e95322468 | ||
|
|
412f628422 | ||
|
|
3cb92169dd | ||
|
|
aea2c7aff5 | ||
|
|
ba16c4e032 | ||
|
|
8b5bb636f3 | ||
|
|
0fac6ae1cd | ||
|
|
24d1f6f844 | ||
|
|
73f7e5a7b2 | ||
|
|
01d1397a60 | ||
|
|
77e7280b1f | ||
|
|
8d6a5a757e | ||
|
|
f2e0808ede | ||
|
|
aa7efbad4b | ||
|
|
d0c52a1364 | ||
|
|
4235aa4677 | ||
|
|
8a3c86abc0 | ||
|
|
eda9b08cac | ||
|
|
a5cee6e6d5 | ||
|
|
4db0ac0ebb | ||
|
|
2a9c0e1d60 | ||
|
|
7dc3072b5f | ||
|
|
6642f9d505 | ||
|
|
078ac99098 | ||
|
|
f7cc2a995f | ||
|
|
c0ee3b8859 | ||
|
|
597df77508 | ||
|
|
f709f65f9e | ||
|
|
71d2b88b02 | ||
|
|
f4631c99f7 | ||
|
|
04968d088b | ||
|
|
5d446b23fa | ||
|
|
2b3eabf75a | ||
|
|
27a5057bb0 | ||
|
|
28f0ffaf62 | ||
|
|
0f085fdb1d | ||
|
|
7d8301af54 | ||
|
|
132b20b4ae | ||
|
|
cca5f7f40d | ||
|
|
63c2bcdf7c | ||
|
|
cad371c221 | ||
|
|
f4efad299a | ||
|
|
17e4646d11 | ||
|
|
977f389e2f | ||
|
|
b6ec73cb84 | ||
|
|
15499e38bf | ||
|
|
538bc02b54 | ||
|
|
2fb3062d4b | ||
|
|
8426c9cac2 | ||
|
|
da4a8dfa9d | ||
|
|
a2efdb3670 | ||
|
|
1ae940613c | ||
|
|
117fd6e7f4 | ||
|
|
f5434a086d | ||
|
|
dc3eec37bb | ||
|
|
8c171ba948 | ||
|
|
c1bd48b58d | ||
|
|
c10e5b74bd | ||
|
|
0c024448b7 | ||
|
|
ac9d346955 | ||
|
|
524e6c8dff | ||
|
|
17399f3f6c | ||
|
|
d50984a465 | ||
|
|
1b7dc7c0c4 | ||
|
|
c9d53d2fc1 | ||
|
|
e305029563 | ||
|
|
da643149bc | ||
|
|
c2d4821882 | ||
|
|
344c5b7c13 | ||
|
|
dcd637ae0f | ||
|
|
f832143135 | ||
|
|
dc40a0ed9a | ||
|
|
3d65136337 | ||
|
|
b53442be89 | ||
|
|
a708ccfc22 | ||
|
|
65399c23fd | ||
|
|
85127be49e | ||
|
|
86aae5ee18 | ||
|
|
fcbefa62ca | ||
|
|
e7a9ee07e0 | ||
|
|
8e38c1f79d | ||
|
|
a874243c9d | ||
|
|
354b4f09e6 | ||
|
|
ff12da19f1 | ||
|
|
1bf274a73c | ||
|
|
949741d992 | ||
|
|
e3eee0c32f | ||
|
|
ef1f0ab330 | ||
|
|
5a676cb76a | ||
|
|
44797e054c | ||
|
|
11641c9424 | ||
|
|
c8254e2d84 | ||
|
|
0997291484 | ||
|
|
959def9c86 | ||
|
|
e20dafbb66 | ||
|
|
2e87bb3955 | ||
|
|
c4c0bbadea | ||
|
|
ad20230b20 | ||
|
|
3ba46a3565 | ||
|
|
53c591f7b7 |
12
.github/FUNDING.yml
vendored
Normal file
12
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [GregorBiswanger, FlorianRappl]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: https://donorbox.org/electron-net
|
||||
27
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
27
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- Please search existing issues to avoid creating duplicates. -->
|
||||
|
||||
<!-- Which version of Electron.NET CLI and API are you using? -->
|
||||
<!-- Please always try to use latest version before report. -->
|
||||
* **Version**:
|
||||
|
||||
<!-- Which version of .NET Core and Node.js are you using (if applicable)? -->
|
||||
|
||||
<!-- What target are you building for? -->
|
||||
* **Target**:
|
||||
|
||||
<!-- Enter your issue details below this comment. -->
|
||||
<!-- If you want, you can donate to increase issue priority (https://donorbox.org/electron-net) -->
|
||||
|
||||
Steps to Reproduce:
|
||||
|
||||
1.
|
||||
2.
|
||||
13
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
13
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: Feature
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- Please search existing feature request to avoid creating duplicates. -->
|
||||
|
||||
<!-- If you want, you can donate to increase feature request priority (https://donorbox.org/electron-net) -->
|
||||
<!-- Describe the feature you'd like. -->
|
||||
13
.github/ISSUE_TEMPLATE/question.md
vendored
Normal file
13
.github/ISSUE_TEMPLATE/question.md
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
name: Question
|
||||
about: The issue tracker is not for questions. Please ask questions on https://stackoverflow.com/questions/tagged/electron.net
|
||||
or via chat in https://gitter.im/ElectronNET/community.
|
||||
title: ''
|
||||
labels: question
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
🚨 The issue tracker is not for questions 🚨
|
||||
|
||||
The issue tracker is not for questions. Please ask questions on https://stackoverflow.com/questions/tagged/electron.net or via chat in https://gitter.im/ElectronNET/community.
|
||||
47
.github/workflows/ci.yml
vendored
Normal file
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,7 +0,0 @@
|
||||
language: csharp
|
||||
mono: none
|
||||
dotnet: 2.0.0
|
||||
before_script:
|
||||
- npm install electron-packager --global
|
||||
script:
|
||||
- ./buildAll.sh
|
||||
32
.vscode/tasks.json
vendored
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
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
317
Changelog.md
317
Changelog.md
@@ -1,4 +1,313 @@
|
||||
# not release
|
||||
# 23.6.2
|
||||
|
||||
## ElectronNET.API
|
||||
|
||||
* Fixed escaping of URL (#735) @cosmo0
|
||||
* Fixed huge memory waste in IpcMain.Once (#833) @Yuvix25
|
||||
* Fixed enabling of accessibility support (#798) @dlanorok
|
||||
* Updated `Display` to current spec (#828) @Yuvix25
|
||||
* Changed `ZoomFactor` type from `int` to `double` (#754) @Yuvix25
|
||||
* Added splash screen size config (#822) @NickRimmer
|
||||
* Added OSX ARM architecture detection (#821) @sajmonr
|
||||
* Added support for `did-navigate` event (#819) @NickRimmer
|
||||
* Added support for `will-redirect` event (#819) @NickRimmer
|
||||
* Added support for `did-fail-load` event (#819) @NickRimmer
|
||||
* Added support for `did-start-navigation` event (#819) @NickRimmer
|
||||
* Added support for `did-redirect-navigation` event (#819) @NickRimmer
|
||||
* Added support for `dom-ready` event (#813) @softworkz
|
||||
|
||||
## ElectronNET.CLI
|
||||
|
||||
* (none)
|
||||
|
||||
## Infrastructure
|
||||
|
||||
* Changed build system to NUKE (#757) @FlorianRappl
|
||||
* Updated target framework for host project (#753) @r-pankevicius
|
||||
* Fixed typo in README (#800) @franpersanchez
|
||||
|
||||
# 23.6.1
|
||||
|
||||
## ElectronNET.CLI
|
||||
|
||||
* New Feature: Upgrade to .NET 6 support
|
||||
|
||||
## ElectronNET.API
|
||||
|
||||
* New Feature: Native Electron 23.2.0 support, but not all new API features included (we search contributors)
|
||||
* New Feature: Upgrade to .NET 6 support
|
||||
* New Feature: Changed Web-Socket .NET Library to [SocketIOClient](https://github.com/doghappy/socket.io-client-csharp)
|
||||
* Breaking Changes: We removed deprecated API events/methods from ElectronNET.API [(More Details)](https://www.electronjs.org/docs/latest/breaking-changes)
|
||||
|
||||
# 13.5.1
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
* New Feature: Using exit code instead of seek for the term 'error' (thanks [TSrgy](https://github.com/TSrgy)) [\#562](https://github.com/ElectronNET/Electron.NET/pull/562)
|
||||
* Fixed bug: Allow for property overrides to be passed in (thanks [danatcofo](https://github.com/danatcofo)) [\#531](https://github.com/ElectronNET/Electron.NET/pull/531)
|
||||
Use `/p:propertyName=value` or `/property:propertyName=value` to pass in property overrides. This is equivalent to the `-p:` option documented here: [https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish)
|
||||
* Fixed bug: Add ability to pass an argument for "Version" for both the "dotnet publish" and "electron-builder" commands (thanks [tub5](https://github.com/tub5)) [\#546](https://github.com/ElectronNET/Electron.NET/pull/546)
|
||||
* Fixed bug: Version flag not persisting with the referenced executable (thanks [tub5](https://github.com/tub5)) [\#585](https://github.com/ElectronNET/Electron.NET/pull/585)
|
||||
* Fixed bug: Changes PublishSingleFile default to false for NET5 compatibility (thanks [cristiangiagante](https://github.com/cristiangiagante)) [\#570](https://github.com/ElectronNET/Electron.NET/pull/570)
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* New Feature: Native Electron 13.1.5 support, but not all new features (we search contributors)
|
||||
* Breaking API Changes (from native Electron 13.1.5):
|
||||
- `Shell.MoveItemToTrashAsync` renamed with `Shell.TrashItemAsync`
|
||||
- The deprecated extension APIs have been removed: `BrowserWindow.GetAllExtensionsAsync()`, `BrowserWindow.RemoveExtension()`, `BrowserWindow.AddExtensionAsync()`. Use the session APIs instead: `Session.GetAllExtensionsAsync()`, `Session.RemoveExtension()`, `Session.LoadExtensionAsync()`.
|
||||
* New Feature: singleInstance handle command line arguments [\#520](https://github.com/ElectronNET/Electron.NET/issues/520)
|
||||
* New Feature: Add WebContents [insertCSS](https://www.electronjs.org/docs/api/web-contents#contentsinsertcsscss-options) functionality (thanks [nfichter](https://github.com/nfichter)) [\#559](https://github.com/ElectronNET/Electron.NET/pull/559)
|
||||
* New Feature: Allow IpcMain to send IPC messages to BrowserViews (thanks [nfichter](https://github.com/nfichter)) [\#560](https://github.com/ElectronNET/Electron.NET/pull/560)
|
||||
* New Feature: Add support for proxies that require basic username/password authentication (thanks [nfichter](https://github.com/nfichter)) [\#561](https://github.com/ElectronNET/Electron.NET/pull/561)
|
||||
* New Feature: Add PostData to LoadURLOptions to allow http-posts in LoadURL calls (thanks [Funkrusha](https://github.com/Funkrusha)) [\#547](https://github.com/ElectronNET/Electron.NET/pull/547)
|
||||
* Fixed bug: Fix splash screen interaction causing crashes, ghost dragging, and resizable behavior #540 (thanks [MiniguyBrendan](https://github.com/MiniguyBrendan)) [\#540](https://github.com/ElectronNET/Electron.NET/pull/540)
|
||||
* Fixed bug: Vibrancy serialization fix (thanks [tantumalice](https://github.com/tantumalice)) [\#573](https://github.com/ElectronNET/Electron.NET/pull/573)
|
||||
|
||||
# 11.5.1
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
* New Feature: Added new build and start commandline options for single exe (thanks [nathanwienand](https://github.com/nathanwienand)) [\#506](https://github.com/ElectronNET/Electron.NET/pull/506)
|
||||
* New Feature: Set a description of the app in `electron.manifest.json` (thanks [BurtsevC](https://github.com/BurtsevC)) [\#433](https://github.com/ElectronNET/Electron.NET/pull/433)
|
||||
* New Feature: Set a target for the start command (thanks [gabecook](https://github.com/gabecook)) [\#463](https://github.com/ElectronNET/Electron.NET/pull/463)
|
||||
* New Feature: `electronize init` support for F# projects (thanks [kojo12228](https://github.com/kojo12228)) [\#457](https://github.com/ElectronNET/Electron.NET/pull/457)
|
||||
* New Feature: Linux support for the buildAll.sh (thanks [duncanawoods](https://github.com/duncanawoods)) [\#465](https://github.com/ElectronNET/Electron.NET/pull/465)
|
||||
* Fixed bug: ERR_UNKNOWN_URL_SCHEME by intercepting file:// protocol (thanks [duncanawoods](https://github.com/duncanawoods)) [\#467](https://github.com/ElectronNET/Electron.NET/pull/467)
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* New Feature: Native Electron 11.1.1 support, but not all new features (we search contributors)
|
||||
* Breaking API Changes (from native Electron 11.0): - Removed: BrowserView.{destroy, fromId, fromWebContents, getAllViews} and id property of BrowserView
|
||||
* New Feature: Upgrade to .NET 5 (thanks [scottkuhl](https://github.com/scottkuhl)) [\#509](https://github.com/ElectronNET/Electron.NET/pull/509)
|
||||
* New Feature: Extension Method for adding the Electron static class members to the standard MS DI Containers, this is a QOL issue only. `services.AddElectron()` (thanks [danatcofo](https://github.com/danatcofo )) [\#528](https://github.com/ElectronNET/Electron.NET/pull/528)
|
||||
* New Feature: SetMenu completed for the Dock (MacOS) (thanks [danatcofo](https://github.com/danatcofo )) [\#528](https://github.com/ElectronNET/Electron.NET/pull/528)
|
||||
|
||||
Example for the Dock Menu
|
||||
|
||||
`Electron.Dock.SetMenu(new [] {
|
||||
new MenuItem {
|
||||
Label = "Dock Menu Item",
|
||||
Click = () => {
|
||||
// do something
|
||||
}
|
||||
},
|
||||
});`
|
||||
|
||||
Example for consuming the activate event (MacOs only)
|
||||
|
||||
`Electron.App.On("activate", obj => {
|
||||
var hasWindows = (bool)obj;
|
||||
// do something
|
||||
});`
|
||||
|
||||
* New Feature: On and Once implementations for the App and Tray to cover the plethora of events that are not mapped explicitly in those two modules. (thanks [danatcofo](https://github.com/danatcofo )) [\#528](https://github.com/ElectronNET/Electron.NET/pull/528)
|
||||
* New Feature: Adding the `EnableRemoteModule` property to the WebPreferences object. As of Electron 10, this property defaulted to false and without it exposed you can't use the remote module within a window. (thanks [danatcofo](https://github.com/danatcofo )) [\#528](https://github.com/ElectronNET/Electron.NET/pull/528)
|
||||
* New Feature: Adding a configurable default electron port. (thanks [aarong-av](https://github.com/aarong-av)) [\#505](https://github.com/ElectronNET/Electron.NET/pull/505)
|
||||
* New Feature: Added support for launching the application with a file on MacOS (thanks [dlitty](https://github.com/dlitty)) [\#478](https://github.com/ElectronNET/Electron.NET/pull/478)
|
||||
* Improved: Avoid Blocking Calls in App and AutoUpdater (thanks [freosc](https://github.com/freosc)) [\#474](https://github.com/ElectronNET/Electron.NET/pull/474)
|
||||
* Fixed bug: Maintain references between socket.io connection events (thanks [danatcofo](https://github.com/danatcofo )) [\#468](https://github.com/ElectronNET/Electron.NET/pull/486)
|
||||
* Fixed bug: Set default WebPreferences.DefaultFontSize (thanks [duncanawoods](https://github.com/duncanawoods)) [\#468](https://github.com/ElectronNET/Electron.NET/pull/468)
|
||||
|
||||
# 9.31.2
|
||||
|
||||
* Electron-Builder fixed for Windows builds.
|
||||
|
||||
# 9.31.1
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
* New Feature: Added config parameter (thanks [konstantingross](https://github.com/konstantingross)) [\#409](https://github.com/ElectronNET/Electron.NET/pull/409)
|
||||
* New Feature: Set the configuration environment with the electron.manifest.json file.
|
||||
* Fixed bug: Custom user path removed and replaced by the correct directory with VS macro (When ElectronNET.CLI is the Startup Project, press F5 (Debug) and the ElectronNET.WebApp starts correctly without error!) (thanks [konstantingross](https://github.com/konstantingross)) [\#409](https://github.com/ElectronNET/Electron.NET/pull/409)
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* New Feature: Native Electron 9.0.3 support, but not all new features (we search contributors)
|
||||
* New Feature: PowerMonitor API Support (thanks [gustavo-lara-molina](https://github.com/gustavo-lara-molina)) [\#399](https://github.com/ElectronNET/Electron.NET/pull/399) [\#423](https://github.com/ElectronNET/Electron.NET/pull/423)
|
||||
* New Feature: NativeTheme API Support (thanks [konstantingross](https://github.com/konstantingross)) [\#402](https://github.com/ElectronNET/Electron.NET/pull/402)
|
||||
* New Feature: Cookie API Support (thanks [freosc](https://github.com/freosc)) [\#413](https://github.com/ElectronNET/Electron.NET/pull/413)
|
||||
* Changed Feature: Removed dock methods from App API and moved to Dock API (thanks [konstantingross](https://github.com/konstantingross)) [\#422](https://github.com/ElectronNET/Electron.NET/pull/422)
|
||||
* App-Api Enhancement: MenuItems with Submenus need an submenu type workaround [\#412](https://github.com/ElectronNET/Electron.NET/issues/412)
|
||||
* App-Api Enhancement: Added UserAgentFallback (thanks [Mandrakia](https://github.com/Mandrakia)) [\#406](https://github.com/ElectronNET/Electron.NET/pull/406)
|
||||
* App-Api Enhancement: Summaries rewritten, new App.IsReady / App.HasSingleInstanceLock property, App.Ready event, App.Focus with force parameter method, many parameters changes (thanks [konstantingross](https://github.com/konstantingross)) [\#415](https://github.com/ElectronNET/Electron.NET/pull/415) [\#422](https://github.com/ElectronNET/Electron.NET/pull/422)
|
||||
* App-Api Enhancement: New App.IsReady property and App.Ready event (thanks [konstantingross](https://github.com/konstantingross)) [\#415](https://github.com/ElectronNET/Electron.NET/pull/415)
|
||||
* Shell-Api Enhancement: API fixes for Electron 9.0.0 / Added missing parameters / Summaries rewritten (thanks [konstantingross](https://github.com/konstantingross)) [\#417](https://github.com/ElectronNET/Electron.NET/pull/417) [\#418](https://github.com/ElectronNET/Electron.NET/pull/418)
|
||||
* Notification-Api Enhancement: Added missing properties in Notifications (thanks [konstantingross](https://github.com/konstantingross)) [\#410](https://github.com/ElectronNET/Electron.NET/pull/410)
|
||||
* BrowserWindows-Api Enhancement: Add missing API call for SetProgressBar options (thanks [konstantingross](https://github.com/konstantingross)) [\#416](https://github.com/ElectronNET/Electron.NET/pull/416)
|
||||
* BrowserWindow Enhancement: Add BrowserWindow.GetNativeWindowHandle() (thanks [kdlslyv](https://github.com/kdlslyv)) [\#429](https://github.com/ElectronNET/Electron.NET/pull/429)
|
||||
* HostHook-Api Enhancement: HostHook.CallAsync should use TaskCompletionSource.SetException instead of throwing exception (thanks [Fre V](https://github.com/freosc)) [\#430](https://github.com/ElectronNET/Electron.NET/pull/430)
|
||||
* MacOS Enhancement: Application exit logic (thanks [dafergu2](https://github.com/dafergu2)) [\#405](https://github.com/ElectronNET/Electron.NET/pull/405)
|
||||
* Fixed bug: ElectronNET.API.Entities.WebPreferences.ContextIsolation [DefaultValue(true)] [\#411](https://github.com/ElectronNET/Electron.NET/issues/411)
|
||||
|
||||
ElectronNET.WebApp (internal use):
|
||||
* Improvement debugging and testing new API calls (without install ElectronNET.CLI) (thanks [konstantingross](https://github.com/konstantingross)) [\#425](https://github.com/ElectronNET/Electron.NET/pull/425)
|
||||
* Fixed bug: Cannot find modules in ElectronHostHook (thanks [konstantingross](https://github.com/konstantingross)) [\#425](https://github.com/ElectronNET/Electron.NET/pull/425)
|
||||
|
||||
Thank you for donation [Phil Seeman](https://github.com/mpnow) ❤
|
||||
|
||||
# 8.31.2
|
||||
|
||||
ElectronNET.CLI:
|
||||
* New Feature: Deactivate PublishReadyToRun for build or start [\#395](https://github.com/ElectronNET/Electron.NET/issues/395)
|
||||
|
||||
`electronize build /target win /PublishReadyToRun false`
|
||||
`electronize start /PublishReadyToRun false`
|
||||
* Fixed bug: Application window doesn't open after packaging [\#387](https://github.com/ElectronNET/Electron.NET/issues/387)
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* New Feature: NativeImage Support (thanks [ThrDev](https://github.com/ThrDev)) [\#394](https://github.com/ElectronNET/Electron.NET/pull/394)
|
||||
* New Feature: Update menu items for context menu and system tray on-the-fly. [\#270](https://github.com/ElectronNET/Electron.NET/pull/270)
|
||||
|
||||
|
||||
# 8.31.1
|
||||
|
||||
ElectronNET.CLI:
|
||||
* New Feature: Set a name and author of the app in `electron.manifest.json` [\#348](https://github.com/ElectronNET/Electron.NET/issues/348#issuecomment-615977950) [\#310](https://github.com/ElectronNET/Electron.NET/issues/310#issuecomment-617361086)
|
||||
* New Feature: Live reload (thanks [syedadeel2](https://github.com/syedadeel2)) [\#390](https://github.com/ElectronNET/Electron.NET/pull/390)
|
||||
`electronize start /watch`
|
||||
* New Feature: Every new window will created with an clear cache [\#273](https://github.com/ElectronNET/Electron.NET/issues/273)
|
||||
`electronize start /clear-cache`
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* New Feature: Native Electron 8.2.3 support, but not all new features (we search contributors)
|
||||
* New Feature: We incease the startup time for ~25-36% [\#356](https://github.com/ElectronNET/Electron.NET/issues/356)
|
||||
* New Feature: Added print capability (thanks [x-xx-o](https://github.com/x-xx-o)) [\#355](https://github.com/ElectronNET/Electron.NET/pull/355)
|
||||
* New Feature: BrowserView API [\#371](https://github.com/ElectronNET/Electron.NET/issues/371)
|
||||
* Changed App.GetNameAsync and App.SetNameAsync to the App.Name Property [\#350](https://github.com/ElectronNET/Electron.NET/issues/350)
|
||||
* Fixed bug: Splash Screen disappearing on click [\#357](https://github.com/ElectronNET/Electron.NET/issues/357)
|
||||
* Fixed bug: Start MenuRole enum at 1 (thanks [jjuback](https://github.com/jjuback)) [\#369](https://github.com/ElectronNET/Electron.NET/pull/369)
|
||||
* Fixed bug: BridgeConnector not connected (spam console) [\#347](https://github.com/ElectronNET/Electron.NET/issues/347)
|
||||
* Fixed bug: BrowserWindowOptions is not setting Width and Height properly [\#373](https://github.com/ElectronNET/Electron.NET/issues/373)
|
||||
* Fixed bug: IpcMain.Once(string) is not one time use, is not removing listener [\#366](https://github.com/ElectronNET/Electron.NET/issues/366)
|
||||
* Fixed bug: IpcMain.RemoveAllListeners(string) is not removing the listeners [\#365](https://github.com/ElectronNET/Electron.NET/issues/365)
|
||||
* Fixed bug: GetLoginItemSettingsAsync does not work [\#352](https://github.com/ElectronNET/Electron.NET/issues/352)
|
||||
* Fixed bug: Using OnReadyToShow to display the main window in Blazor does not seem to work with Show set to false [\#361](https://github.com/ElectronNET/Electron.NET/issues/361)
|
||||
* Fixed bug: Unable to disable WebSecurity along with NodeIntegration enabled [\#389](https://github.com/ElectronNET/Electron.NET/issues/389)
|
||||
|
||||
# 7.30.2
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
* New Feature: Different manifest file support [\#340](https://github.com/ElectronNET/Electron.NET/issues/340)
|
||||
* Create a additional manifest file: `electronize init /manifest test`
|
||||
* Start the app with your additional manifest file: `electronize start /manifest electron.manifest.test.json`
|
||||
* Build the app with your additional manifest file: `electronize build /target win /manifest electron.manifest.test.json`.
|
||||
|
||||
* New Feature: Command Line support [\#337](https://github.com/ElectronNET/Electron.NET/issues/337)
|
||||
* You can start the app with: `electronize start /args --dog=woof --test=true`
|
||||
* Or as binary: `myapp.exe /args --dog=woof --test=true`
|
||||
* Fixed bug: Start process with listen port 8000 error. [\#308](https://github.com/ElectronNET/Electron.NET/issues/308) (thanks [thecodejedi](https://github.com/thecodejedi))
|
||||
* Fixed bug: `electronize build` with no arguments would throw a `KeyNotFoundException`. (thanks [jamiebrynes7](https://github.com/jamiebrynes7))
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* New Feature: Electron 7.1.2 support, but not all new features (we search contributors) [\#341](https://github.com/ElectronNET/Electron.NET/issues/341)
|
||||
* New Feature: Electron.App.CommandLine API [\#337](https://github.com/ElectronNET/Electron.NET/issues/337)
|
||||
* New Feature: Support of BrowserWindow.AddExtension, BrowserWindow.RemoveExtension, BrowserWindow.GetExtensions (thanks [Daddoon](https://github.com/Daddoon))
|
||||
|
||||
Thank you for donation [robertmclaws](https://github.com/robertmclaws) ❤
|
||||
|
||||
# 5.30.1
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
* Move to .NET Core 3.0
|
||||
* Use npm npx instead of global installations (thanks [jimbuck](https://github.com/jimbuck))
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* Move to .NET Core 3.0
|
||||
* New Feature: Add BrowserWindow.RemoveMenu() (thanks [hack2root](https://github.com/hack2root))
|
||||
|
||||
Thanks to [MaherJendoubi](https://github.com/MaherJendoubi), [kant2002](https://github.com/kant2002), [raz-canva](https://github.com/raz-canva) and [Daddoon](https://github.com/Daddoon) to give .NET Core 3.0 feedback!
|
||||
# 5.22.14
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
* Fixed bug: Build fails with latest electron-builder version [\#288](https://github.com/ElectronNET/Electron.NET/issues/288)
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* New Feature: Full support for Auto Updater [(Based on electron-updater - Version 4.0.6)](https://www.electron.build/auto-update)
|
||||
* New Feature: Support for set a custom static Port to ASP.NET Backend [\#155](https://github.com/ElectronNET/Electron.NET/issues/155)
|
||||
* Fixed bug: Electron tray icon TypeError ([Electron original issue](https://github.com/electron/electron/issues/7657)) (thanks [Tum4ik](https://github.com/Tum4ik))
|
||||
* Fixed bug: Wrong tray icon path in the application built via `electronize build` command (thanks [Tum4ik](https://github.com/Tum4ik))
|
||||
* Fixed bug: fix async issue where same port is considered open [\#261](https://github.com/ElectronNET/Electron.NET/issues/261) (thanks [netpoetica](https://github.com/netpoetica))
|
||||
|
||||
ElectronNET.WebApp:
|
||||
|
||||
* Fixed usage of the `Electron.Tray.Show` according fixed bugs in the ElectronNET.CLI (thanks [Tum4ik](https://github.com/Tum4ik))
|
||||
|
||||
# 5.22.13
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* Fixed bug: Menu Item visibility [\#257](https://github.com/ElectronNET/Electron.NET/issues/257)
|
||||
* Fixed bug: electron.manifest.json - singleInstance not working [\#258](https://github.com/ElectronNET/Electron.NET/issues/258)
|
||||
* Fixed security issue: ASP.NET Core process is now bound to 127.0.0.1 instead of the broader localhost [\#258](https://github.com/ElectronNET/Electron.NET/pull/266)
|
||||
|
||||
# 5.22.12
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
* New Feature: Changed from **electron packager** to [**electron builder**](https://www.electron.build/)
|
||||
* New Feature: 'add hosthook' command for add a ElectronHostHook-Directory
|
||||
* Fixed bug: 'Unexpected firewall warnings' [\#181](https://github.com/ElectronNET/Electron.NET/issues/181)
|
||||
* Fixed bug: 'found 8 vulnerabilities (1 low, 5 moderate, 2 high)' [\#199](https://github.com/ElectronNET/Electron.NET/pull/199)
|
||||
* Merged pull request: Call electronize from the Path instead of via dotnet in launchSettings.json [\#243](https://github.com/ElectronNET/Electron.NET/pull/243) (thanks [grbd](https://github.com/grbd))
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* New Feature: Electron 5.0.1 support, but not all new features
|
||||
* New Feature: Auto Updater [(Based on electron-updater)](https://www.electron.build/auto-update)
|
||||
* New Feature: Splashscreen-Support
|
||||
* New Feature: HostHook-API for execute own TypeScript/JavaScript code on native Electron Main-Process
|
||||
* New Feature: Session-API functions
|
||||
* Fixed bug: Node process running after stopping app [\#96](https://github.com/ElectronNET/Electron.NET/issues/96)
|
||||
* Fixed bug: 'X and Y options to not work on Windows 10' [\#193](https://github.com/ElectronNET/Electron.NET/issues/193)
|
||||
* Fixed bug: Unable to clear cache [\#66](https://github.com/ElectronNET/Electron.NET/issues/66)
|
||||
* Merged pull request: Fix BrowserWindow::SetMenu [\#231](https://github.com/ElectronNET/Electron.NET/pull/231) thanks (thanks [CodeKenpachi](https://github.com/CodeKenpachi))
|
||||
* Merged pull request: FIX application hangs after socket reconnect [\#233](https://github.com/ElectronNET/Electron.NET/pull/233) (thanks [pedromrpinto](https://github.com/pedromrpinto))
|
||||
* Merged pull request: Reduce chance of detecting false positives when scanning subprocesses for errors. [\#236](https://github.com/ElectronNET/Electron.NET/pull/236) (thanks [BorisTheBrave](https://github.com/BorisTheBrave))
|
||||
* Merged pull request: Updates the C# API to accept floating point as in JS. [\#240](https://github.com/ElectronNET/Electron.NET/pull/240) (thanks [BorisTheBrave](https://github.com/BorisTheBrave))
|
||||
* Merged pull request: buildReleaseNuGetPackages should leave you in the same directory you … [\#241](https://github.com/ElectronNET/Electron.NET/pull/241) (thanks [BorisTheBrave](https://github.com/BorisTheBrave))
|
||||
|
||||
ElectronNET.WebApp:
|
||||
|
||||
* Implemented a sample for the new HostHook-API
|
||||
* Fixed bug: 'Electron.NET API Demo: unable to copy code?' [\#247](https://github.com/ElectronNET/Electron.NET/issues/247)
|
||||
|
||||
# 0.0.11
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
* Invoke 'npm install' without --prod flag to install needed devDependencies as well.
|
||||
* Enable SourceLink
|
||||
* NuGet Package License Information updated (deprecation of licenseUrl)
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* Documentation added for WebContents.GetUrl()
|
||||
* Enable SourceLink
|
||||
* NuGet Package License Information updated (deprecation of licenseUrl)
|
||||
|
||||
# 0.0.10
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* manifestJsonFilePath fixed (thanks @smack0007)
|
||||
* Use Electron release 3.0.0 and updated packages (thanks @deinok)
|
||||
* fixes for Socket interaction (thanks @mojinxun)
|
||||
* Fixing SingleInstances (thanks @yaofeng)
|
||||
* Enhance WebContent.GetUrl (thanks @ru-sh)
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
* Show Resultcode for better debugging when using Build/Start Command
|
||||
* ElectronNET.CLI is now a global dotnet tool
|
||||
|
||||
# 0.0.9
|
||||
|
||||
@@ -9,12 +318,12 @@ ElectronNET.API:
|
||||
ElectronNET.CLI:
|
||||
|
||||
* More options on the 'build' command, e.g. for a 32bit debug build with electron prune: build /target custom win7-x86;win32 /dotnet-configuration Debug /electron-arch ia32 /electron-params "--prune=true "
|
||||
* .NET Core project is now build with Release configuration, but can be adjusted with the new params.
|
||||
* .NET Core project is now built with Release configuration but can be adjusted with the new params.
|
||||
* Be aware: "Breaking" (but because of the alpha status of this project, we won't use SemVer)
|
||||
|
||||
# 0.0.8
|
||||
|
||||
This version was skipped because we unfortunatly released a pre version of this on NuGet.
|
||||
This version was skipped because we unfortunately released a pre-version of this on NuGet.
|
||||
|
||||
# 0.0.7
|
||||
|
||||
@@ -27,7 +336,7 @@ ElectronNET.CLI:
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
* nuget packages are now release bits and have the correct assembly verion
|
||||
* nuget packages are now release bits and have the correct assembly version
|
||||
* Version command
|
||||
* better devCleanup.cmd
|
||||
* Better Platform Support Issue - thanks to @Petermarcu
|
||||
|
||||
@@ -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,45 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<PackageOutputPath>..\artifacts</PackageOutputPath>
|
||||
<PackageId>ElectronNET.API</PackageId>
|
||||
<Authors>Gregor Biswanger, Robert Muehsig</Authors>
|
||||
<Company />
|
||||
<Product>Electron.NET</Product>
|
||||
<PackageLicenseUrl>https://github.com/ElectronNET/Electron.NET/blob/master/LICENSE</PackageLicenseUrl>
|
||||
<PackageProjectUrl>https://github.com/ElectronNET/Electron.NET/</PackageProjectUrl>
|
||||
<Description>Building cross platform electron based desktop apps with .NET Core and ASP.NET NET Core.
|
||||
This package contains the API to access the "native" electron API.</Description>
|
||||
<RepositoryUrl>https://github.com/ElectronNET/Electron.NET/</RepositoryUrl>
|
||||
<PackageTags>electron aspnetcore</PackageTags>
|
||||
<PackageReleaseNotes>Changelog: https://github.com/ElectronNET/Electron.NET/blob/master/Changelog.md</PackageReleaseNotes>
|
||||
<PackageIconUrl>https://raw.githubusercontent.com/ElectronNET/Electron.NET/master/assets/images/electron.net-logo-square.png</PackageIconUrl>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DocumentationFile>bin\Debug\netcoreapp2.0\ElectronNET.API.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DocumentationFile>bin\Release\netcoreapp2.0\ElectronNET.API.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DocumentationFile>bin\Debug\netcoreapp2.0\ElectronNET.API.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.0.0" />
|
||||
<PackageReference Include="SocketIoClientDotNet" Version="1.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(OS)' == 'Windows_NT'">
|
||||
<Exec Command="$(ProjectDir)devCleanup.cmd" IgnoreExitCode="true" />
|
||||
</Target>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(OS)' != 'Windows_NT'">
|
||||
<Exec Command="$(ProjectDir)devCleanup.sh" IgnoreExitCode="true" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -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,23 +0,0 @@
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public enum HighlightMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Highlight the tray icon when it is clicked and also when its context menu is open. This is the default.
|
||||
/// </summary>
|
||||
selection,
|
||||
|
||||
/// <summary>
|
||||
/// Always highlight the tray icon.
|
||||
/// </summary>
|
||||
always,
|
||||
|
||||
/// <summary>
|
||||
/// Never highlight the tray icon.
|
||||
/// </summary>
|
||||
never
|
||||
}
|
||||
}
|
||||
@@ -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,109 +0,0 @@
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
// TODO: Need some of real code :)
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class NativeImage
|
||||
{
|
||||
// public static NativeImage CreateEmpty()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public static NativeImage CreateFromBuffer(byte[] buffer)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public static NativeImage CreateFromBuffer(byte[] buffer, CreateFromBufferOptions options)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public static NativeImage CreateFromDataURL(string dataURL)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public static NativeImage CreateFromPath(string path)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public void AddRepresentation(AddRepresentationOptions options)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public NativeImage Crop(Rectangle rect)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public int GetAspectRatio()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public byte[] GetBitmap()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public byte[] GetBitmap(BitmapOptions options)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public byte[] GetNativeHandle()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public Size GetSize()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public bool IsEmpty()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public bool IsTemplateImage()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public NativeImage Resize(ResizeOptions options)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public void SetTemplateImage(bool option)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public byte[] ToBitmap(ToBitmapOptions options)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public string ToDataURL(ToDataURLOptions options)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public byte[] ToJPEG(int quality)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public byte[] ToPNG(ToPNGOptions options)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -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,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="action">macOS only</param>
|
||||
/// <returns>Whether an application was available to open the URL.
|
||||
/// If callback is specified, always returns true.</returns>
|
||||
public Task<bool> OpenExternalAsync(string url, OpenExternalOptions options, Action<Error> action)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("shell-openExternalCompleted", (success) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("shell-openExternalCompleted");
|
||||
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Off("shell-openExternalCallback");
|
||||
BridgeConnector.Socket.On("shell-openExternalCallback", (args) => {
|
||||
var urlKey = ((JArray)args).First.ToString();
|
||||
var error = ((JArray)args).Last.ToObject<Error>();
|
||||
|
||||
if(_openExternalCallbacks.ContainsKey(urlKey))
|
||||
{
|
||||
_openExternalCallbacks[urlKey](error);
|
||||
}
|
||||
});
|
||||
|
||||
_openExternalCallbacks.Add(url, action);
|
||||
|
||||
BridgeConnector.Socket.Emit("shell-openExternal", url, JObject.FromObject(options, _jsonSerializer), true);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
private Dictionary<string, Action<Error>> _openExternalCallbacks = new Dictionary<string, Action<Error>>();
|
||||
|
||||
/// <summary>
|
||||
/// Move the given file to trash and returns a boolean status for the operation.
|
||||
/// </summary>
|
||||
/// <param name="fullPath"></param>
|
||||
/// <returns> Whether the item was successfully moved to the trash.</returns>
|
||||
public Task<bool> MoveItemToTrashAsync(string fullPath)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("shell-moveItemToTrashCompleted", (success) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("shell-moveItemToTrashCompleted");
|
||||
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("shell-moveItemToTrash", fullPath);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Play the beep sound.
|
||||
/// </summary>
|
||||
public void Beep()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("shell-beep");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates or updates a shortcut link at shortcutPath.
|
||||
/// </summary>
|
||||
/// <param name="shortcutPath"></param>
|
||||
/// <param name="operation"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <returns>Whether the shortcut was created successfully.</returns>
|
||||
public Task<bool> WriteShortcutLinkAsync(string shortcutPath, ShortcutLinkOperation operation, ShortcutDetails options)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("shell-writeShortcutLinkCompleted", (success) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("shell-writeShortcutLinkCompleted");
|
||||
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("shell-writeShortcutLink", shortcutPath, operation.ToString(), JObject.FromObject(options, _jsonSerializer));
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the shortcut link at shortcutPath.
|
||||
///
|
||||
/// An exception will be thrown when any error happens.
|
||||
/// </summary>
|
||||
/// <param name="shortcutPath"></param>
|
||||
/// <returns></returns>
|
||||
public Task<ShortcutDetails> ReadShortcutLinkAsync(string shortcutPath)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<ShortcutDetails>();
|
||||
|
||||
BridgeConnector.Socket.On("shell-readShortcutLinkCompleted", (shortcutDetails) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("shell-readShortcutLinkCompleted");
|
||||
|
||||
taskCompletionSource.SetResult((ShortcutDetails)shortcutDetails);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("shell-readShortcutLink", shortcutPath);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
private JsonSerializer _jsonSerializer = new JsonSerializer()
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
DefaultValueHandling = DefaultValueHandling.Ignore
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
using ElectronNET.API.Entities;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
/// <summary>
|
||||
/// Render and control web pages.
|
||||
/// </summary>
|
||||
public class WebContents
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the identifier.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The identifier.
|
||||
/// </value>
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when the renderer process crashes or is killed.
|
||||
/// </summary>
|
||||
public event Action<bool> OnCrashed
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_crashed == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-crashed" + Id, (killed) =>
|
||||
{
|
||||
_crashed((bool)killed);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-crashed", Id);
|
||||
}
|
||||
_crashed += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_crashed -= value;
|
||||
|
||||
if (_crashed == null)
|
||||
BridgeConnector.Socket.Off("webContents-crashed" + Id);
|
||||
}
|
||||
}
|
||||
|
||||
private event Action<bool> _crashed;
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when the navigation is done, i.e. the spinner of the tab has
|
||||
/// stopped spinning, and the onload event was dispatched.
|
||||
/// </summary>
|
||||
public event Action OnDidFinishLoad
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_didFinishLoad == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-didFinishLoad" + Id, () =>
|
||||
{
|
||||
_didFinishLoad();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-didFinishLoad", Id);
|
||||
}
|
||||
_didFinishLoad += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_didFinishLoad -= value;
|
||||
|
||||
if (_didFinishLoad == null)
|
||||
BridgeConnector.Socket.Off("webContents-didFinishLoad" + Id);
|
||||
}
|
||||
}
|
||||
|
||||
private event Action _didFinishLoad;
|
||||
|
||||
internal WebContents(int id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the devtools.
|
||||
/// </summary>
|
||||
public void OpenDevTools()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("webContentsOpenDevTools", Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the devtools.
|
||||
/// </summary>
|
||||
/// <param name="openDevToolsOptions"></param>
|
||||
public void OpenDevTools(OpenDevToolsOptions openDevToolsOptions)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("webContentsOpenDevTools", Id, JObject.FromObject(openDevToolsOptions, _jsonSerializer));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prints window's web page as PDF with Chromium's preview printing custom
|
||||
/// settings.The landscape will be ignored if @page CSS at-rule is used in the web page.
|
||||
/// By default, an empty options will be regarded as: Use page-break-before: always;
|
||||
/// CSS style to force to print to a new page.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <returns>success</returns>
|
||||
public Task<bool> PrintToPDFAsync(string path, PrintToPDFOptions options = null)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("webContents-printToPDF-completed", (success) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("webContents-printToPDF-completed");
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
if(options == null)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("webContents-printToPDF", Id, "", path);
|
||||
}
|
||||
else
|
||||
{
|
||||
BridgeConnector.Socket.Emit("webContents-printToPDF", Id, JObject.FromObject(options, _jsonSerializer), path);
|
||||
}
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
private JsonSerializer _jsonSerializer = new JsonSerializer()
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
DefaultValueHandling = DefaultValueHandling.Ignore
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using System;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class WebHostBuilderExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Use a Electron support for this .NET Core Project.
|
||||
/// </summary>
|
||||
/// <param name="builder">The builder.</param>
|
||||
/// <param name="args">The arguments.</param>
|
||||
/// <returns></returns>
|
||||
public static IWebHostBuilder UseElectron(this IWebHostBuilder builder, string[] args)
|
||||
{
|
||||
foreach (string argument in args)
|
||||
{
|
||||
if (argument.ToUpper().Contains("ELECTRONPORT"))
|
||||
{
|
||||
BridgeSettings.SocketPort = argument.ToUpper().Replace("/ELECTRONPORT=", "");
|
||||
Console.WriteLine("Use Electron Port: " + BridgeSettings.SocketPort);
|
||||
} else if(argument.ToUpper().Contains("ELECTRONWEBPORT"))
|
||||
{
|
||||
BridgeSettings.WebPort = argument.ToUpper().Replace("/ELECTRONWEBPORT=", "");
|
||||
}
|
||||
}
|
||||
|
||||
if(HybridSupport.IsElectronActive)
|
||||
{
|
||||
builder.UseContentRoot(AppDomain.CurrentDomain.BaseDirectory)
|
||||
.UseUrls("http://0.0.0.0:" + BridgeSettings.WebPort);
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
using ElectronNET.API.Entities;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public sealed class WindowManager
|
||||
{
|
||||
private static WindowManager _windowManager;
|
||||
private static object _syncRoot = new Object();
|
||||
|
||||
internal WindowManager() { }
|
||||
|
||||
internal static WindowManager Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_windowManager == null)
|
||||
{
|
||||
lock (_syncRoot)
|
||||
{
|
||||
if (_windowManager == null)
|
||||
{
|
||||
_windowManager = new WindowManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _windowManager;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Quit when all windows are closed. (Default is true)
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if [quit window all closed]; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
public bool IsQuitOnWindowAllClosed
|
||||
{
|
||||
get { return _isQuitOnWindowAllClosed; }
|
||||
set
|
||||
{
|
||||
BridgeConnector.Socket.Emit("quit-app-window-all-closed-event", value);
|
||||
_isQuitOnWindowAllClosed = value;
|
||||
}
|
||||
}
|
||||
private bool _isQuitOnWindowAllClosed = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the browser windows.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The browser windows.
|
||||
/// </value>
|
||||
public IReadOnlyCollection<BrowserWindow> BrowserWindows { get { return _browserWindows.AsReadOnly(); } }
|
||||
private List<BrowserWindow> _browserWindows = new List<BrowserWindow>();
|
||||
|
||||
/// <summary>
|
||||
/// Creates the window asynchronous.
|
||||
/// </summary>
|
||||
/// <param name="loadUrl">The load URL.</param>
|
||||
/// <returns></returns>
|
||||
public async Task<BrowserWindow> CreateWindowAsync(string loadUrl = "http://localhost")
|
||||
{
|
||||
return await CreateWindowAsync(new BrowserWindowOptions(), loadUrl);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the window asynchronous.
|
||||
/// </summary>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <param name="loadUrl">The load URL.</param>
|
||||
/// <returns></returns>
|
||||
public Task<BrowserWindow> CreateWindowAsync(BrowserWindowOptions options, string loadUrl = "http://localhost")
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<BrowserWindow>();
|
||||
|
||||
BridgeConnector.Socket.On("BrowserWindowCreated", (id) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("BrowserWindowCreated");
|
||||
|
||||
string windowId = id.ToString();
|
||||
BrowserWindow browserWindow = new BrowserWindow(int.Parse(windowId));
|
||||
_browserWindows.Add(browserWindow);
|
||||
|
||||
taskCompletionSource.SetResult(browserWindow);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Off("BrowserWindowClosed");
|
||||
BridgeConnector.Socket.On("BrowserWindowClosed", (ids) =>
|
||||
{
|
||||
var browserWindowIds = ((JArray)ids).ToObject<int[]>();
|
||||
|
||||
for (int index = 0; index < _browserWindows.Count; index++)
|
||||
{
|
||||
if (!browserWindowIds.Contains(_browserWindows[index].Id))
|
||||
{
|
||||
_browserWindows.RemoveAt(index);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (loadUrl.ToUpper() == "HTTP://LOCALHOST")
|
||||
{
|
||||
loadUrl = $"{loadUrl}:{BridgeSettings.WebPort}";
|
||||
}
|
||||
|
||||
BridgeConnector.Socket.Emit("createBrowserWindow", JObject.FromObject(options, _jsonSerializer), loadUrl);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
private JsonSerializer _jsonSerializer = new JsonSerializer()
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
DefaultValueHandling = DefaultValueHandling.Ignore
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.CLI.Commands.Actions;
|
||||
|
||||
namespace ElectronNET.CLI.Commands
|
||||
{
|
||||
public class BuildCommand : ICommand
|
||||
{
|
||||
public const string COMMAND_NAME = "build";
|
||||
public const string COMMAND_DESCRIPTION = "Build your Electron Application.";
|
||||
public static string COMMAND_ARGUMENTS = "Needed: '/target' with params 'win/osx/linux' to build for a typical app or use 'custom' and specify .NET Core build config & electron build config" + Environment.NewLine +
|
||||
" for custom target, check .NET Core RID Catalog and Electron build target/" + Environment.NewLine +
|
||||
" e.g. '/target win' or '/target custom \"win7-x86;win32\"'" + Environment.NewLine +
|
||||
"Optional: '/dotnet-configuration' with the desired .NET Core build config e.g. release or debug. Default = Release" + Environment.NewLine +
|
||||
"Optional: '/electron-arch' to specify the resulting electron processor architecture (e.g. ia86 for x86 builds). Be aware to use the '/target custom' param as well!" + Environment.NewLine +
|
||||
"Optional: '/electron-params' specify any other valid parameter, which will be routed to the electron-packager." + Environment.NewLine +
|
||||
"Full example for a 32bit debug build with electron prune: build /target custom win7-x86;win32 /dotnet-configuration Debug /electron-arch ia32 /electron-params \"--prune=true \"";
|
||||
|
||||
public static IList<CommandOption> CommandOptions { get; set; } = new List<CommandOption>();
|
||||
|
||||
private string[] _args;
|
||||
|
||||
public BuildCommand(string[] args)
|
||||
{
|
||||
_args = args;
|
||||
}
|
||||
|
||||
private string _paramTarget = "target";
|
||||
private string _paramDotNetConfig = "dotnet-configuration";
|
||||
private string _paramElectronArch = "electron-arch";
|
||||
private string _paramElectronParams = "electron-params";
|
||||
|
||||
public Task<bool> ExecuteAsync()
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
Console.WriteLine("Build Electron Application...");
|
||||
|
||||
SimpleCommandLineParser parser = new SimpleCommandLineParser();
|
||||
parser.Parse(_args);
|
||||
|
||||
var desiredPlatform = parser.Arguments[_paramTarget][0];
|
||||
string specifiedFromCustom = string.Empty;
|
||||
if (desiredPlatform == "custom" && parser.Arguments[_paramTarget].Length > 1)
|
||||
{
|
||||
specifiedFromCustom = parser.Arguments["target"][1];
|
||||
}
|
||||
|
||||
string configuration = "Release";
|
||||
if (parser.Arguments.ContainsKey(_paramDotNetConfig))
|
||||
{
|
||||
configuration = parser.Arguments[_paramDotNetConfig][0];
|
||||
}
|
||||
|
||||
var platformInfo = GetTargetPlatformInformation.Do(desiredPlatform, specifiedFromCustom);
|
||||
|
||||
Console.WriteLine($"Build ASP.NET Core App for {platformInfo.NetCorePublishRid}...");
|
||||
|
||||
|
||||
string tempPath = Path.Combine(Directory.GetCurrentDirectory(), "obj", "desktop", desiredPlatform);
|
||||
if (Directory.Exists(tempPath) == false)
|
||||
{
|
||||
Directory.CreateDirectory(tempPath);
|
||||
}
|
||||
|
||||
Console.WriteLine("Executing dotnet publish in this directory: " + tempPath);
|
||||
|
||||
string tempBinPath = Path.Combine(tempPath, "bin");
|
||||
|
||||
Console.WriteLine($"Build ASP.NET Core App for {platformInfo.NetCorePublishRid} under {configuration}-Configuration...");
|
||||
|
||||
var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} -c {configuration} --output \"{tempBinPath}\"", Directory.GetCurrentDirectory());
|
||||
|
||||
if (resultCode != 0)
|
||||
{
|
||||
Console.WriteLine("Error occurred during dotnet publish.");
|
||||
return false;
|
||||
}
|
||||
|
||||
DeployEmbeddedElectronFiles.Do(tempPath);
|
||||
|
||||
var checkForNodeModulesDirPath = Path.Combine(tempPath, "node_modules");
|
||||
|
||||
if (Directory.Exists(checkForNodeModulesDirPath) == false)
|
||||
{
|
||||
Console.WriteLine("node_modules missing in: " + checkForNodeModulesDirPath);
|
||||
|
||||
Console.WriteLine("Start npm install...");
|
||||
ProcessHelper.CmdExecute("npm install", tempPath);
|
||||
|
||||
Console.WriteLine("Start npm install electron-packager...");
|
||||
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
// Works proper on Windows...
|
||||
ProcessHelper.CmdExecute("npm install electron-packager --global", tempPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ToDo: find another solution or document it proper
|
||||
// GH Issue https://github.com/electron-userland/electron-prebuilt/issues/48
|
||||
Console.WriteLine("Electron Packager - make sure you invoke 'sudo npm install electron-packager --global' at " + tempPath + " manually. Sry.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Skip npm install, because node_modules directory exists in: " + checkForNodeModulesDirPath);
|
||||
}
|
||||
|
||||
Console.WriteLine("Build Electron Desktop Application...");
|
||||
string buildPath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "desktop");
|
||||
|
||||
Console.WriteLine("Executing electron magic in this directory: " + buildPath);
|
||||
|
||||
// ToDo: Need a solution for --asar support
|
||||
|
||||
string electronArch = "x64";
|
||||
if (parser.Arguments.ContainsKey(_paramElectronArch))
|
||||
{
|
||||
electronArch = parser.Arguments[_paramElectronArch][0];
|
||||
}
|
||||
|
||||
string electronParams = "";
|
||||
if (parser.Arguments.ContainsKey(_paramElectronParams))
|
||||
{
|
||||
electronParams = parser.Arguments[_paramElectronParams][0];
|
||||
}
|
||||
|
||||
Console.WriteLine($"Package Electron App for Platform {platformInfo.ElectronPackerPlatform}...");
|
||||
ProcessHelper.CmdExecute($"electron-packager . --platform={platformInfo.ElectronPackerPlatform} --arch={electronArch} {electronParams} --out=\"{buildPath}\" --overwrite", tempPath);
|
||||
|
||||
Console.WriteLine("... done");
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.CLI.Commands.Actions;
|
||||
|
||||
namespace ElectronNET.CLI.Commands
|
||||
{
|
||||
public class StartElectronCommand : ICommand
|
||||
{
|
||||
public const string COMMAND_NAME = "start";
|
||||
public const string COMMAND_DESCRIPTION = "Start your ASP.NET Core Application with Electron, without package it as a single exe. Faster for development.";
|
||||
public const string COMMAND_ARGUMENTS = "<Path> from ASP.NET Core Project.";
|
||||
public static IList<CommandOption> CommandOptions { get; set; } = new List<CommandOption>();
|
||||
|
||||
private string[] _args;
|
||||
|
||||
public StartElectronCommand(string[] args)
|
||||
{
|
||||
_args = args;
|
||||
}
|
||||
|
||||
public Task<bool> ExecuteAsync()
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
Console.WriteLine("Start Electron Desktop Application...");
|
||||
|
||||
string aspCoreProjectPath = "";
|
||||
|
||||
if (_args.Length > 0)
|
||||
{
|
||||
if (Directory.Exists(_args[0]))
|
||||
{
|
||||
aspCoreProjectPath = _args[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aspCoreProjectPath = Directory.GetCurrentDirectory();
|
||||
}
|
||||
|
||||
string tempPath = Path.Combine(aspCoreProjectPath, "obj", "Host");
|
||||
if (Directory.Exists(tempPath) == false)
|
||||
{
|
||||
Directory.CreateDirectory(tempPath);
|
||||
}
|
||||
|
||||
var platformInfo = GetTargetPlatformInformation.Do(String.Empty, String.Empty);
|
||||
|
||||
string tempBinPath = Path.Combine(tempPath, "bin");
|
||||
var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\"", aspCoreProjectPath);
|
||||
|
||||
if (resultCode != 0)
|
||||
{
|
||||
Console.WriteLine("Error occurred during dotnet publish.");
|
||||
return false;
|
||||
}
|
||||
|
||||
DeployEmbeddedElectronFiles.Do(tempPath);
|
||||
|
||||
var checkForNodeModulesDirPath = Path.Combine(tempPath, "node_modules");
|
||||
|
||||
if (Directory.Exists(checkForNodeModulesDirPath) == false)
|
||||
{
|
||||
Console.WriteLine("node_modules missing in: " + checkForNodeModulesDirPath);
|
||||
|
||||
Console.WriteLine("Start npm install...");
|
||||
ProcessHelper.CmdExecute("npm install", tempPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Skip npm install, because node_modules directory exists in: " + checkForNodeModulesDirPath);
|
||||
}
|
||||
|
||||
string path = Path.Combine(tempPath, "node_modules", ".bin");
|
||||
|
||||
bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
if (isWindows)
|
||||
{
|
||||
Console.WriteLine("Invoke electron.cmd - in dir: " + path);
|
||||
ProcessHelper.CmdExecute(@"electron.cmd ""..\..\main.js""", path);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Invoke electron - in dir: " + path);
|
||||
ProcessHelper.CmdExecute(@"./electron ""../../main.js""", path);
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<AssemblyName>dotnet-electronize</AssemblyName>
|
||||
|
||||
<PackageType>DotnetCliTool</PackageType>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<PackageOutputPath>..\artifacts</PackageOutputPath>
|
||||
<PackageId>ElectronNET.CLI</PackageId>
|
||||
<Version>1.0.0</Version>
|
||||
<Authors>Gregor Biswanger, Robert Muehsig</Authors>
|
||||
<Product>Electron.NET</Product>
|
||||
<Company />
|
||||
<Description>Building cross platform electron based desktop apps with .NET Core and ASP.NET NET Core.
|
||||
This package contains the dotnet tooling to electronize your application.</Description>
|
||||
<PackageLicenseUrl>https://github.com/ElectronNET/Electron.NET/blob/master/LICENSE</PackageLicenseUrl>
|
||||
<PackageProjectUrl>https://github.com/ElectronNET/Electron.NET/</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/ElectronNET/Electron.NET/</RepositoryUrl>
|
||||
<PackageTags>electron aspnetcore</PackageTags>
|
||||
<PackageReleaseNotes>Changelog: https://github.com/ElectronNET/Electron.NET/blob/master/Changelog.md</PackageReleaseNotes>
|
||||
<PackageIconUrl>https://raw.githubusercontent.com/ElectronNET/Electron.NET/master/assets/images/electron.net-logo-square.png</PackageIconUrl>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="ElectronHost\package-lock.json" />
|
||||
<None Remove="ElectronHost\package.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DocumentationFile></DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DocumentationFile></DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\electron.manifest.json" Link="ElectronHost\electron.manifest.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\package-lock.json" Link="ElectronHost\package-lock.json" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\package.json" Link="ElectronHost\package.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\main.js" Link="ElectronHost\main.js" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\ipc.js" Link="ElectronHost\api\ipc.js" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\app.js" Link="ElectronHost\api\app.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\browserWindows.js" Link="ElectronHost\api\browserWindows.js" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\dialog.js" Link="ElectronHost\api\dialog.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\menu.js" Link="ElectronHost\api\menu.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\notification.js" Link="ElectronHost\api\notification.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\tray.js" Link="ElectronHost\api\tray.js" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\globalShortcut.js" Link="ElectronHost\api\globalShortcut.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\screen.js" Link="ElectronHost\api\screen.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\shell.js" Link="ElectronHost\api\shell.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\webContents.js" Link="ElectronHost\api\webContents.js" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\clipboard.js" Link="ElectronHost\api\clipboard.js" />
|
||||
</ItemGroup>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(OS)' == 'Windows_NT'">
|
||||
<Exec Command="$(ProjectDir)devCleanup.cmd" IgnoreExitCode="true" />
|
||||
</Target>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(OS)' != 'Windows_NT'">
|
||||
<Exec Command="$(ProjectDir)devCleanup.sh" IgnoreExitCode="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,94 +0,0 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace ElectronNET.CLI
|
||||
{
|
||||
public class ProcessHelper
|
||||
{
|
||||
public static int CmdExecute(string command, string workingDirectoryPath, bool output = true, bool waitForExit = true)
|
||||
{
|
||||
using (Process cmd = new Process())
|
||||
{
|
||||
bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
|
||||
if (isWindows)
|
||||
{
|
||||
cmd.StartInfo.FileName = "cmd.exe";
|
||||
}
|
||||
else
|
||||
{
|
||||
// works for OSX and Linux (at least on Ubuntu)
|
||||
cmd.StartInfo.FileName = "bash";
|
||||
}
|
||||
|
||||
cmd.StartInfo.RedirectStandardInput = true;
|
||||
cmd.StartInfo.RedirectStandardOutput = true;
|
||||
cmd.StartInfo.RedirectStandardError = true;
|
||||
cmd.StartInfo.CreateNoWindow = true;
|
||||
cmd.StartInfo.UseShellExecute = false;
|
||||
cmd.StartInfo.WorkingDirectory = workingDirectoryPath;
|
||||
|
||||
int returnCode = 0;
|
||||
|
||||
if (output)
|
||||
{
|
||||
cmd.OutputDataReceived += (s, e) =>
|
||||
{
|
||||
// (sometimes error messages are only visbile here)
|
||||
// poor mans solution, we just seek for the term 'error'
|
||||
|
||||
// we can't just use cmd.ExitCode, because
|
||||
// we delegate it to cmd.exe, which runs fine
|
||||
// but we can catch any error here and return
|
||||
// 1 if something fails
|
||||
if (e != null && string.IsNullOrWhiteSpace(e.Data) == false)
|
||||
{
|
||||
if (e.Data.ToLowerInvariant().Contains("error"))
|
||||
{
|
||||
returnCode = 1;
|
||||
}
|
||||
|
||||
Console.WriteLine(e.Data);
|
||||
}
|
||||
|
||||
};
|
||||
cmd.ErrorDataReceived += (s, e) =>
|
||||
{
|
||||
// poor mans solution, we just seek for the term 'error'
|
||||
|
||||
// we can't just use cmd.ExitCode, because
|
||||
// we delegate it to cmd.exe, which runs fine
|
||||
// but we can catch any error here and return
|
||||
// 1 if something fails
|
||||
if (e != null && string.IsNullOrWhiteSpace(e.Data) == false)
|
||||
{
|
||||
if (e.Data.ToLowerInvariant().Contains("error"))
|
||||
{
|
||||
returnCode = 1;
|
||||
}
|
||||
|
||||
Console.WriteLine(e.Data);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
cmd.Start();
|
||||
cmd.BeginOutputReadLine();
|
||||
cmd.BeginErrorReadLine();
|
||||
|
||||
cmd.StandardInput.WriteLine(command);
|
||||
cmd.StandardInput.Flush();
|
||||
cmd.StandardInput.Close();
|
||||
|
||||
if (waitForExit)
|
||||
{
|
||||
cmd.WaitForExit();
|
||||
}
|
||||
|
||||
return returnCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"profiles": {
|
||||
"ElectronNET.CLI": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "build \"C:\\Users\\Gregor\\Documents\\Visual Studio 2017\\Projects\\ElectronNET\\ElectronNET.WebApp\""
|
||||
}
|
||||
}
|
||||
}
|
||||
16
ElectronNET.Host/.vscode/launch.json
vendored
16
ElectronNET.Host/.vscode/launch.json
vendored
@@ -1,16 +0,0 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Electron App",
|
||||
"program": "${workspaceFolder}\\main.js",
|
||||
"runtimeExecutable": "${workspaceFolder}\\node_modules\\.bin\\electron",
|
||||
"sourceMaps": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,258 +0,0 @@
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var isQuitWindowAllClosed = true;
|
||||
module.exports = function (socket, app) {
|
||||
// Quit when all windows are closed.
|
||||
app.on('window-all-closed', function () {
|
||||
// On macOS it is common for applications and their menu bar
|
||||
// to stay active until the user quits explicitly with Cmd + Q
|
||||
if (process.platform !== 'darwin' &&
|
||||
isQuitWindowAllClosed) {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
socket.on('quit-app-window-all-closed-event', function (quit) {
|
||||
isQuitWindowAllClosed = quit;
|
||||
});
|
||||
socket.on('register-app-window-all-closed-event', function (id) {
|
||||
app.on('window-all-closed', function () {
|
||||
socket.emit('app-window-all-closed' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-before-quit-event', function (id) {
|
||||
app.on('before-quit', function (event) {
|
||||
event.preventDefault();
|
||||
socket.emit('app-before-quit' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-will-quit-event', function (id) {
|
||||
app.on('will-quit', function (event) {
|
||||
event.preventDefault();
|
||||
socket.emit('app-will-quit' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-browser-window-blur-event', function (id) {
|
||||
app.on('browser-window-blur', function () {
|
||||
socket.emit('app-browser-window-blur' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-browser-window-focus-event', function (id) {
|
||||
app.on('browser-window-focus', function () {
|
||||
socket.emit('app-browser-window-focus' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-browser-window-created-event', function (id) {
|
||||
app.on('browser-window-created', function () {
|
||||
socket.emit('app-browser-window-created' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-web-contents-created-event', function (id) {
|
||||
app.on('web-contents-created', function () {
|
||||
socket.emit('app-web-contents-created' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-accessibility-support-changed-event', function (id) {
|
||||
app.on('accessibility-support-changed', function (event, accessibilitySupportEnabled) {
|
||||
socket.emit('app-accessibility-support-changed' + id, accessibilitySupportEnabled);
|
||||
});
|
||||
});
|
||||
socket.on('appQuit', function () {
|
||||
app.quit();
|
||||
});
|
||||
socket.on('appExit', function (exitCode) {
|
||||
if (exitCode === void 0) { exitCode = 0; }
|
||||
app.exit(exitCode);
|
||||
});
|
||||
socket.on('appRelaunch', function (options) {
|
||||
app.relaunch(options);
|
||||
});
|
||||
socket.on('appFocus', function () {
|
||||
app.focus();
|
||||
});
|
||||
socket.on('appHide', function () {
|
||||
app.hide();
|
||||
});
|
||||
socket.on('appShow', function () {
|
||||
app.show();
|
||||
});
|
||||
socket.on('appGetAppPath', function () {
|
||||
var path = app.getAppPath();
|
||||
socket.emit('appGetAppPathCompleted', path);
|
||||
});
|
||||
socket.on('appGetPath', function (name) {
|
||||
var path = app.getPath(name);
|
||||
socket.emit('appGetPathCompleted', path);
|
||||
});
|
||||
// const nativeImages = {};
|
||||
// function addNativeImage(nativeImage: Electron.NativeImage) {
|
||||
// if(Object.keys(nativeImages).length === 0) {
|
||||
// nativeImage['1'] = nativeImage;
|
||||
// } else {
|
||||
// let indexCount = Object.keys(nativeImages).length + 1;
|
||||
// nativeImage[indexCount] = nativeImage;
|
||||
// }
|
||||
// }
|
||||
socket.on('appGetFileIcon', function (path, options) {
|
||||
if (options) {
|
||||
app.getFileIcon(path, options, function (error, nativeImage) {
|
||||
socket.emit('appGetFileIconCompleted', [error, nativeImage]);
|
||||
});
|
||||
}
|
||||
else {
|
||||
app.getFileIcon(path, function (error, nativeImage) {
|
||||
socket.emit('appGetFileIconCompleted', [error, nativeImage]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('appSetPath', function (name, path) {
|
||||
app.setPath(name, path);
|
||||
});
|
||||
socket.on('appGetVersion', function () {
|
||||
var version = app.getVersion();
|
||||
socket.emit('appGetVersionCompleted', version);
|
||||
});
|
||||
socket.on('appGetName', function () {
|
||||
var name = app.getName();
|
||||
socket.emit('appGetNameCompleted', name);
|
||||
});
|
||||
socket.on('appSetName', function (name) {
|
||||
app.setName(name);
|
||||
});
|
||||
socket.on('appGetLocale', function () {
|
||||
var locale = app.getLocale();
|
||||
socket.emit('appGetLocaleCompleted', locale);
|
||||
});
|
||||
socket.on('appAddRecentDocument', function (path) {
|
||||
app.addRecentDocument(path);
|
||||
});
|
||||
socket.on('appClearRecentDocuments', function () {
|
||||
app.clearRecentDocuments();
|
||||
});
|
||||
socket.on('appSetAsDefaultProtocolClient', function (protocol, path, args) {
|
||||
var success = app.setAsDefaultProtocolClient(protocol, path, args);
|
||||
socket.emit('appSetAsDefaultProtocolClientCompleted', success);
|
||||
});
|
||||
socket.on('appRemoveAsDefaultProtocolClient', function (protocol, path, args) {
|
||||
var success = app.removeAsDefaultProtocolClient(protocol, path, args);
|
||||
socket.emit('appRemoveAsDefaultProtocolClientCompleted', success);
|
||||
});
|
||||
socket.on('appIsDefaultProtocolClient', function (protocol, path, args) {
|
||||
var success = app.isDefaultProtocolClient(protocol, path, args);
|
||||
socket.emit('appIsDefaultProtocolClientCompleted', success);
|
||||
});
|
||||
socket.on('appSetUserTasks', function (tasks) {
|
||||
var success = app.setUserTasks(tasks);
|
||||
socket.emit('appSetUserTasksCompleted', success);
|
||||
});
|
||||
socket.on('appGetJumpListSettings', function () {
|
||||
var jumpListSettings = app.getJumpListSettings();
|
||||
socket.emit('appGetJumpListSettingsCompleted', jumpListSettings);
|
||||
});
|
||||
socket.on('appSetJumpList', function (categories) {
|
||||
app.setJumpList(categories);
|
||||
});
|
||||
socket.on('appMakeSingleInstance', function () {
|
||||
var success = app.makeSingleInstance(function (args, workingDirectory) {
|
||||
socket.emit('newInstanceOpened', [args, workingDirectory]);
|
||||
});
|
||||
socket.emit('appMakeSingleInstanceCompleted', success);
|
||||
});
|
||||
socket.on('appReleaseSingleInstance', function () {
|
||||
app.releaseSingleInstance();
|
||||
});
|
||||
socket.on('appSetUserActivity', function (type, userInfo, webpageURL) {
|
||||
app.setUserActivity(type, userInfo, webpageURL);
|
||||
});
|
||||
socket.on('appGetCurrentActivityType', function () {
|
||||
var activityType = app.getCurrentActivityType();
|
||||
socket.emit('appGetCurrentActivityTypeCompleted', activityType);
|
||||
});
|
||||
socket.on('appSetAppUserModelId', function (id) {
|
||||
app.setAppUserModelId(id);
|
||||
});
|
||||
socket.on('appImportCertificate', function (options) {
|
||||
app.importCertificate(options, function (result) {
|
||||
socket.emit('appImportCertificateCompleted', result);
|
||||
});
|
||||
});
|
||||
socket.on('appGetAppMetrics', function () {
|
||||
var processMetrics = app.getAppMetrics();
|
||||
socket.emit('appGetAppMetricsCompleted', processMetrics);
|
||||
});
|
||||
socket.on('appGetGpuFeatureStatus', function () {
|
||||
// TS Workaround - TS say getGpuFeatureStatus - but it is getGPUFeatureStatus
|
||||
var x = app;
|
||||
var gpuFeatureStatus = x.getGPUFeatureStatus();
|
||||
socket.emit('appGetGpuFeatureStatusCompleted', gpuFeatureStatus);
|
||||
});
|
||||
socket.on('appSetBadgeCount', function (count) {
|
||||
var success = app.setBadgeCount(count);
|
||||
socket.emit('appSetBadgeCountCompleted', success);
|
||||
});
|
||||
socket.on('appGetBadgeCount', function () {
|
||||
var count = app.getBadgeCount();
|
||||
socket.emit('appGetBadgeCountCompleted', count);
|
||||
});
|
||||
socket.on('appIsUnityRunning', function () {
|
||||
var isUnityRunning = app.isUnityRunning();
|
||||
socket.emit('appIsUnityRunningCompleted', isUnityRunning);
|
||||
});
|
||||
socket.on('appGetLoginItemSettings', function (options) {
|
||||
var loginItemSettings = app.getLoginItemSettings(options);
|
||||
socket.emit('appGetLoginItemSettingsCompleted', loginItemSettings);
|
||||
});
|
||||
socket.on('appSetLoginItemSettings', function (settings) {
|
||||
app.setLoginItemSettings(settings);
|
||||
});
|
||||
socket.on('appIsAccessibilitySupportEnabled', function () {
|
||||
var isAccessibilitySupportEnabled = app.isAccessibilitySupportEnabled();
|
||||
socket.emit('appIsAccessibilitySupportEnabledCompleted', isAccessibilitySupportEnabled);
|
||||
});
|
||||
socket.on('appSetAboutPanelOptions', function (options) {
|
||||
app.setAboutPanelOptions(options);
|
||||
});
|
||||
socket.on('appCommandLineAppendSwitch', function (theSwitch, value) {
|
||||
app.commandLine.appendSwitch(theSwitch, value);
|
||||
});
|
||||
socket.on('appCommandLineAppendArgument', function (value) {
|
||||
app.commandLine.appendArgument(value);
|
||||
});
|
||||
socket.on('appEnableMixedSandbox', function () {
|
||||
app.enableMixedSandbox();
|
||||
});
|
||||
socket.on('appDockBounce', function (type) {
|
||||
var id = app.dock.bounce(type);
|
||||
socket.emit('appDockBounceCompleted', id);
|
||||
});
|
||||
socket.on('appDockCancelBounce', function (id) {
|
||||
app.dock.cancelBounce(id);
|
||||
});
|
||||
socket.on('appDockDownloadFinished', function (filePath) {
|
||||
app.dock.downloadFinished(filePath);
|
||||
});
|
||||
socket.on('appDockSetBadge', function (text) {
|
||||
app.dock.setBadge(text);
|
||||
});
|
||||
socket.on('appDockGetBadge', function () {
|
||||
var text = app.dock.getBadge();
|
||||
socket.emit('appDockGetBadgeCompleted', text);
|
||||
});
|
||||
socket.on('appDockHide', function () {
|
||||
app.dock.hide();
|
||||
});
|
||||
socket.on('appDockShow', function () {
|
||||
app.dock.show();
|
||||
});
|
||||
socket.on('appDockIsVisible', function () {
|
||||
var isVisible = app.dock.isVisible();
|
||||
socket.emit('appDockIsVisibleCompleted', isVisible);
|
||||
});
|
||||
// TODO: Menü Lösung muss noch implementiert werden
|
||||
socket.on('appDockSetMenu', function (menu) {
|
||||
app.dock.setMenu(menu);
|
||||
});
|
||||
socket.on('appDockSetIcon', function (image) {
|
||||
app.dock.setIcon(image);
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=app.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -1,320 +0,0 @@
|
||||
import { nativeImage as NativeImage } from 'electron';
|
||||
let isQuitWindowAllClosed = true;
|
||||
|
||||
module.exports = (socket: SocketIO.Server, app: Electron.App) => {
|
||||
|
||||
// Quit when all windows are closed.
|
||||
app.on('window-all-closed', () => {
|
||||
// On macOS it is common for applications and their menu bar
|
||||
// to stay active until the user quits explicitly with Cmd + Q
|
||||
if (process.platform !== 'darwin' &&
|
||||
isQuitWindowAllClosed) {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('quit-app-window-all-closed-event', (quit) => {
|
||||
isQuitWindowAllClosed = quit;
|
||||
});
|
||||
|
||||
socket.on('register-app-window-all-closed-event', (id) => {
|
||||
app.on('window-all-closed', () => {
|
||||
socket.emit('app-window-all-closed' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-before-quit-event', (id) => {
|
||||
app.on('before-quit', (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
socket.emit('app-before-quit' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-will-quit-event', (id) => {
|
||||
app.on('will-quit', (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
socket.emit('app-will-quit' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-browser-window-blur-event', (id) => {
|
||||
app.on('browser-window-blur', () => {
|
||||
socket.emit('app-browser-window-blur' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-browser-window-focus-event', (id) => {
|
||||
app.on('browser-window-focus', () => {
|
||||
socket.emit('app-browser-window-focus' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-browser-window-created-event', (id) => {
|
||||
app.on('browser-window-created', () => {
|
||||
socket.emit('app-browser-window-created' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-web-contents-created-event', (id) => {
|
||||
app.on('web-contents-created', () => {
|
||||
socket.emit('app-web-contents-created' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-accessibility-support-changed-event', (id) => {
|
||||
app.on('accessibility-support-changed', (event, accessibilitySupportEnabled) => {
|
||||
socket.emit('app-accessibility-support-changed' + id, accessibilitySupportEnabled);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('appQuit', () => {
|
||||
app.quit();
|
||||
});
|
||||
|
||||
socket.on('appExit', (exitCode = 0) => {
|
||||
app.exit(exitCode);
|
||||
});
|
||||
|
||||
socket.on('appRelaunch', (options) => {
|
||||
app.relaunch(options);
|
||||
});
|
||||
|
||||
socket.on('appFocus', () => {
|
||||
app.focus();
|
||||
});
|
||||
|
||||
socket.on('appHide', () => {
|
||||
app.hide();
|
||||
});
|
||||
|
||||
socket.on('appShow', () => {
|
||||
app.show();
|
||||
});
|
||||
|
||||
socket.on('appGetAppPath', () => {
|
||||
const path = app.getAppPath();
|
||||
socket.emit('appGetAppPathCompleted', path);
|
||||
});
|
||||
|
||||
socket.on('appGetPath', (name) => {
|
||||
const path = app.getPath(name);
|
||||
socket.emit('appGetPathCompleted', path);
|
||||
});
|
||||
|
||||
// const nativeImages = {};
|
||||
|
||||
// function addNativeImage(nativeImage: Electron.NativeImage) {
|
||||
|
||||
// if(Object.keys(nativeImages).length === 0) {
|
||||
// nativeImage['1'] = nativeImage;
|
||||
// } else {
|
||||
// let indexCount = Object.keys(nativeImages).length + 1;
|
||||
// nativeImage[indexCount] = nativeImage;
|
||||
// }
|
||||
// }
|
||||
|
||||
socket.on('appGetFileIcon', (path, options) => {
|
||||
if (options) {
|
||||
app.getFileIcon(path, options, (error, nativeImage) => {
|
||||
socket.emit('appGetFileIconCompleted', [error, nativeImage]);
|
||||
});
|
||||
} else {
|
||||
app.getFileIcon(path, (error, nativeImage) => {
|
||||
socket.emit('appGetFileIconCompleted', [error, nativeImage]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('appSetPath', (name, path) => {
|
||||
app.setPath(name, path);
|
||||
});
|
||||
|
||||
socket.on('appGetVersion', () => {
|
||||
const version = app.getVersion();
|
||||
socket.emit('appGetVersionCompleted', version);
|
||||
});
|
||||
|
||||
socket.on('appGetName', () => {
|
||||
const name = app.getName();
|
||||
socket.emit('appGetNameCompleted', name);
|
||||
});
|
||||
|
||||
socket.on('appSetName', (name) => {
|
||||
app.setName(name);
|
||||
});
|
||||
|
||||
socket.on('appGetLocale', () => {
|
||||
const locale = app.getLocale();
|
||||
socket.emit('appGetLocaleCompleted', locale);
|
||||
});
|
||||
|
||||
socket.on('appAddRecentDocument', (path) => {
|
||||
app.addRecentDocument(path);
|
||||
});
|
||||
|
||||
socket.on('appClearRecentDocuments', () => {
|
||||
app.clearRecentDocuments();
|
||||
});
|
||||
|
||||
socket.on('appSetAsDefaultProtocolClient', (protocol, path, args) => {
|
||||
const success = app.setAsDefaultProtocolClient(protocol, path, args);
|
||||
socket.emit('appSetAsDefaultProtocolClientCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('appRemoveAsDefaultProtocolClient', (protocol, path, args) => {
|
||||
const success = app.removeAsDefaultProtocolClient(protocol, path, args);
|
||||
socket.emit('appRemoveAsDefaultProtocolClientCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('appIsDefaultProtocolClient', (protocol, path, args) => {
|
||||
const success = app.isDefaultProtocolClient(protocol, path, args);
|
||||
socket.emit('appIsDefaultProtocolClientCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('appSetUserTasks', (tasks) => {
|
||||
const success = app.setUserTasks(tasks);
|
||||
socket.emit('appSetUserTasksCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('appGetJumpListSettings', () => {
|
||||
const jumpListSettings = app.getJumpListSettings();
|
||||
socket.emit('appGetJumpListSettingsCompleted', jumpListSettings);
|
||||
});
|
||||
|
||||
socket.on('appSetJumpList', (categories) => {
|
||||
app.setJumpList(categories);
|
||||
});
|
||||
|
||||
socket.on('appMakeSingleInstance', () => {
|
||||
const success = app.makeSingleInstance((args, workingDirectory) => {
|
||||
socket.emit('newInstanceOpened', [args, workingDirectory]);
|
||||
});
|
||||
socket.emit('appMakeSingleInstanceCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('appReleaseSingleInstance', () => {
|
||||
app.releaseSingleInstance();
|
||||
});
|
||||
|
||||
socket.on('appSetUserActivity', (type, userInfo, webpageURL) => {
|
||||
app.setUserActivity(type, userInfo, webpageURL);
|
||||
});
|
||||
|
||||
socket.on('appGetCurrentActivityType', () => {
|
||||
const activityType = app.getCurrentActivityType();
|
||||
socket.emit('appGetCurrentActivityTypeCompleted', activityType);
|
||||
});
|
||||
|
||||
socket.on('appSetAppUserModelId', (id) => {
|
||||
app.setAppUserModelId(id);
|
||||
});
|
||||
|
||||
socket.on('appImportCertificate', (options) => {
|
||||
app.importCertificate(options, (result) => {
|
||||
socket.emit('appImportCertificateCompleted', result);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('appGetAppMetrics', () => {
|
||||
const processMetrics = app.getAppMetrics();
|
||||
socket.emit('appGetAppMetricsCompleted', processMetrics);
|
||||
});
|
||||
|
||||
socket.on('appGetGpuFeatureStatus', () => {
|
||||
// TS Workaround - TS say getGpuFeatureStatus - but it is getGPUFeatureStatus
|
||||
let x = <any>app;
|
||||
const gpuFeatureStatus = x.getGPUFeatureStatus();
|
||||
socket.emit('appGetGpuFeatureStatusCompleted', gpuFeatureStatus);
|
||||
});
|
||||
|
||||
socket.on('appSetBadgeCount', (count) => {
|
||||
const success = app.setBadgeCount(count);
|
||||
socket.emit('appSetBadgeCountCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('appGetBadgeCount', () => {
|
||||
const count = app.getBadgeCount();
|
||||
socket.emit('appGetBadgeCountCompleted', count);
|
||||
});
|
||||
|
||||
socket.on('appIsUnityRunning', () => {
|
||||
const isUnityRunning = app.isUnityRunning();
|
||||
socket.emit('appIsUnityRunningCompleted', isUnityRunning);
|
||||
});
|
||||
|
||||
socket.on('appGetLoginItemSettings', (options) => {
|
||||
const loginItemSettings = app.getLoginItemSettings(options);
|
||||
socket.emit('appGetLoginItemSettingsCompleted', loginItemSettings);
|
||||
});
|
||||
|
||||
socket.on('appSetLoginItemSettings', (settings) => {
|
||||
app.setLoginItemSettings(settings);
|
||||
});
|
||||
|
||||
socket.on('appIsAccessibilitySupportEnabled', () => {
|
||||
const isAccessibilitySupportEnabled = app.isAccessibilitySupportEnabled();
|
||||
socket.emit('appIsAccessibilitySupportEnabledCompleted', isAccessibilitySupportEnabled);
|
||||
});
|
||||
|
||||
socket.on('appSetAboutPanelOptions', (options) => {
|
||||
app.setAboutPanelOptions(options);
|
||||
});
|
||||
|
||||
socket.on('appCommandLineAppendSwitch', (theSwitch, value) => {
|
||||
app.commandLine.appendSwitch(theSwitch, value);
|
||||
});
|
||||
|
||||
socket.on('appCommandLineAppendArgument', (value) => {
|
||||
app.commandLine.appendArgument(value);
|
||||
});
|
||||
|
||||
socket.on('appEnableMixedSandbox', () => {
|
||||
app.enableMixedSandbox();
|
||||
});
|
||||
|
||||
socket.on('appDockBounce', (type) => {
|
||||
const id = app.dock.bounce(type);
|
||||
socket.emit('appDockBounceCompleted', id);
|
||||
});
|
||||
|
||||
socket.on('appDockCancelBounce', (id) => {
|
||||
app.dock.cancelBounce(id);
|
||||
});
|
||||
|
||||
socket.on('appDockDownloadFinished', (filePath) => {
|
||||
app.dock.downloadFinished(filePath);
|
||||
});
|
||||
|
||||
socket.on('appDockSetBadge', (text) => {
|
||||
app.dock.setBadge(text);
|
||||
});
|
||||
|
||||
socket.on('appDockGetBadge', () => {
|
||||
const text = app.dock.getBadge();
|
||||
socket.emit('appDockGetBadgeCompleted', text);
|
||||
});
|
||||
|
||||
socket.on('appDockHide', () => {
|
||||
app.dock.hide();
|
||||
});
|
||||
|
||||
socket.on('appDockShow', () => {
|
||||
app.dock.show();
|
||||
});
|
||||
|
||||
socket.on('appDockIsVisible', () => {
|
||||
const isVisible = app.dock.isVisible();
|
||||
socket.emit('appDockIsVisibleCompleted', isVisible);
|
||||
});
|
||||
|
||||
// TODO: Menü Lösung muss noch implementiert werden
|
||||
socket.on('appDockSetMenu', (menu) => {
|
||||
app.dock.setMenu(menu);
|
||||
});
|
||||
|
||||
socket.on('appDockSetIcon', (image) => {
|
||||
app.dock.setIcon(image);
|
||||
});
|
||||
}
|
||||
@@ -1,530 +0,0 @@
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var electron_1 = require("electron");
|
||||
var path = require('path');
|
||||
var windows = [];
|
||||
module.exports = function (socket) {
|
||||
socket.on('register-browserWindow-ready-to-show', function (id) {
|
||||
getWindowById(id).on('ready-to-show', function () {
|
||||
socket.emit('browserWindow-ready-to-show' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-page-title-updated', function (id) {
|
||||
getWindowById(id).on('page-title-updated', function (event, title) {
|
||||
socket.emit('browserWindow-page-title-updated' + id, title);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-close', function (id) {
|
||||
getWindowById(id).on('close', function () {
|
||||
socket.emit('browserWindow-close' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-closed', function (id) {
|
||||
getWindowById(id).on('closed', function () {
|
||||
socket.emit('browserWindow-closed' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-session-end', function (id) {
|
||||
getWindowById(id).on('session-end', function () {
|
||||
socket.emit('browserWindow-session-end' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-unresponsive', function (id) {
|
||||
getWindowById(id).on('unresponsive', function () {
|
||||
socket.emit('browserWindow-unresponsive' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-responsive', function (id) {
|
||||
getWindowById(id).on('responsive', function () {
|
||||
socket.emit('browserWindow-responsive' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-blur', function (id) {
|
||||
getWindowById(id).on('blur', function () {
|
||||
socket.emit('browserWindow-blur' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-focus', function (id) {
|
||||
getWindowById(id).on('focus', function () {
|
||||
socket.emit('browserWindow-focus' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-show', function (id) {
|
||||
getWindowById(id).on('show', function () {
|
||||
socket.emit('browserWindow-show' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-hide', function (id) {
|
||||
getWindowById(id).on('hide', function () {
|
||||
socket.emit('browserWindow-hide' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-maximize', function (id) {
|
||||
getWindowById(id).on('maximize', function () {
|
||||
socket.emit('browserWindow-maximize' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-unmaximize', function (id) {
|
||||
getWindowById(id).on('unmaximize', function () {
|
||||
socket.emit('browserWindow-unmaximize' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-minimize', function (id) {
|
||||
getWindowById(id).on('minimize', function () {
|
||||
socket.emit('browserWindow-minimize' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-restore', function (id) {
|
||||
getWindowById(id).on('restore', function () {
|
||||
socket.emit('browserWindow-restore' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-resize', function (id) {
|
||||
getWindowById(id).on('resize', function () {
|
||||
socket.emit('browserWindow-resize' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-move', function (id) {
|
||||
getWindowById(id).on('move', function () {
|
||||
socket.emit('browserWindow-move' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-moved', function (id) {
|
||||
getWindowById(id).on('moved', function () {
|
||||
socket.emit('browserWindow-moved' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-enter-full-screen', function (id) {
|
||||
getWindowById(id).on('enter-full-screen', function () {
|
||||
socket.emit('browserWindow-enter-full-screen' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-leave-full-screen', function (id) {
|
||||
getWindowById(id).on('leave-full-screen', function () {
|
||||
socket.emit('browserWindow-leave-full-screen' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-enter-html-full-screen', function (id) {
|
||||
getWindowById(id).on('enter-html-full-screen', function () {
|
||||
socket.emit('browserWindow-enter-html-full-screen' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-leave-html-full-screen', function (id) {
|
||||
getWindowById(id).on('leave-html-full-screen', function () {
|
||||
socket.emit('browserWindow-leave-html-full-screen' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-app-command', function (id) {
|
||||
getWindowById(id).on('app-command', function (event, command) {
|
||||
socket.emit('browserWindow-app-command' + id, command);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-scroll-touch-begin', function (id) {
|
||||
getWindowById(id).on('scroll-touch-begin', function () {
|
||||
socket.emit('browserWindow-scroll-touch-begin' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-scroll-touch-end', function (id) {
|
||||
getWindowById(id).on('scroll-touch-end', function () {
|
||||
socket.emit('browserWindow-scroll-touch-end' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-scroll-touch-edge', function (id) {
|
||||
getWindowById(id).on('scroll-touch-edge', function () {
|
||||
socket.emit('browserWindow-scroll-touch-edge' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-swipe', function (id) {
|
||||
getWindowById(id).on('swipe', function (event, direction) {
|
||||
socket.emit('browserWindow-swipe' + id, direction);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-sheet-begin', function (id) {
|
||||
getWindowById(id).on('sheet-begin', function () {
|
||||
socket.emit('browserWindow-sheet-begin' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-sheet-end', function (id) {
|
||||
getWindowById(id).on('sheet-end', function () {
|
||||
socket.emit('browserWindow-sheet-end' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-new-window-for-tab', function (id) {
|
||||
getWindowById(id).on('new-window-for-tab', function () {
|
||||
socket.emit('browserWindow-new-window-for-tab' + id);
|
||||
});
|
||||
});
|
||||
socket.on('createBrowserWindow', function (options, loadUrl) {
|
||||
var window = new electron_1.BrowserWindow(options);
|
||||
window.on('closed', function (sender) {
|
||||
var _loop_1 = function () {
|
||||
windowItem = windows[index];
|
||||
try {
|
||||
windowItem.id;
|
||||
}
|
||||
catch (error) {
|
||||
if (error.message === 'Object has been destroyed') {
|
||||
windows.splice(index, 1);
|
||||
var ids_1 = [];
|
||||
windows.forEach(function (x) { return ids_1.push(x.id); });
|
||||
socket.emit('BrowserWindowClosed', ids_1);
|
||||
}
|
||||
}
|
||||
};
|
||||
var windowItem;
|
||||
for (var index = 0; index < windows.length; index++) {
|
||||
_loop_1();
|
||||
}
|
||||
});
|
||||
if (loadUrl) {
|
||||
window.loadURL(loadUrl);
|
||||
}
|
||||
windows.push(window);
|
||||
socket.emit('BrowserWindowCreated', window.id);
|
||||
});
|
||||
socket.on('browserWindowDestroy', function (id) {
|
||||
getWindowById(id).destroy();
|
||||
});
|
||||
socket.on('browserWindowClose', function (id) {
|
||||
getWindowById(id).close();
|
||||
});
|
||||
socket.on('browserWindowFocus', function (id) {
|
||||
getWindowById(id).focus();
|
||||
});
|
||||
socket.on('browserWindowBlur', function (id) {
|
||||
getWindowById(id).blur();
|
||||
});
|
||||
socket.on('browserWindowIsFocused', function (id) {
|
||||
var isFocused = getWindowById(id).isFocused();
|
||||
socket.emit('browserWindow-isFocused-completed', isFocused);
|
||||
});
|
||||
socket.on('browserWindowIsDestroyed', function (id) {
|
||||
var isDestroyed = getWindowById(id).isDestroyed();
|
||||
socket.emit('browserWindow-isDestroyed-completed', isDestroyed);
|
||||
});
|
||||
socket.on('browserWindowShow', function (id) {
|
||||
getWindowById(id).show();
|
||||
});
|
||||
socket.on('browserWindowShowInactive', function (id) {
|
||||
getWindowById(id).showInactive();
|
||||
});
|
||||
socket.on('browserWindowHide', function (id) {
|
||||
getWindowById(id).hide();
|
||||
});
|
||||
socket.on('browserWindowIsVisible', function (id) {
|
||||
var isVisible = getWindowById(id).isVisible();
|
||||
socket.emit('browserWindow-isVisible-completed', isVisible);
|
||||
});
|
||||
socket.on('browserWindowIsModal', function (id) {
|
||||
var isModal = getWindowById(id).isModal();
|
||||
socket.emit('browserWindow-isModal-completed', isModal);
|
||||
});
|
||||
socket.on('browserWindowMaximize', function (id) {
|
||||
getWindowById(id).maximize();
|
||||
});
|
||||
socket.on('browserWindowUnmaximize', function (id) {
|
||||
getWindowById(id).unmaximize();
|
||||
});
|
||||
socket.on('browserWindowIsMaximized', function (id) {
|
||||
var isMaximized = getWindowById(id).isMaximized();
|
||||
socket.emit('browserWindow-isMaximized-completed', isMaximized);
|
||||
});
|
||||
socket.on('browserWindowMinimize', function (id) {
|
||||
getWindowById(id).minimize();
|
||||
});
|
||||
socket.on('browserWindowRestore', function (id) {
|
||||
getWindowById(id).restore();
|
||||
});
|
||||
socket.on('browserWindowIsMinimized', function (id) {
|
||||
var isMinimized = getWindowById(id).isMinimized();
|
||||
socket.emit('browserWindow-isMinimized-completed', isMinimized);
|
||||
});
|
||||
socket.on('browserWindowSetFullScreen', function (id, fullscreen) {
|
||||
getWindowById(id).setFullScreen(fullscreen);
|
||||
});
|
||||
socket.on('browserWindowIsFullScreen', function (id) {
|
||||
var isFullScreen = getWindowById(id).isFullScreen();
|
||||
socket.emit('browserWindow-isFullScreen-completed', isFullScreen);
|
||||
});
|
||||
socket.on('browserWindowSetAspectRatio', function (id, aspectRatio, extraSize) {
|
||||
getWindowById(id).setAspectRatio(aspectRatio, extraSize);
|
||||
});
|
||||
socket.on('browserWindowPreviewFile', function (id, path, displayname) {
|
||||
getWindowById(id).previewFile(path, displayname);
|
||||
});
|
||||
socket.on('browserWindowCloseFilePreview', function (id) {
|
||||
getWindowById(id).closeFilePreview();
|
||||
});
|
||||
socket.on('browserWindowSetBounds', function (id, bounds, animate) {
|
||||
getWindowById(id).setBounds(bounds, animate);
|
||||
});
|
||||
socket.on('browserWindowGetBounds', function (id) {
|
||||
var rectangle = getWindowById(id).getBounds();
|
||||
socket.emit('browserWindow-getBounds-completed', rectangle);
|
||||
});
|
||||
socket.on('browserWindowSetContentBounds', function (id, bounds, animate) {
|
||||
getWindowById(id).setContentBounds(bounds, animate);
|
||||
});
|
||||
socket.on('browserWindowGetContentBounds', function (id) {
|
||||
var rectangle = getWindowById(id).getContentBounds();
|
||||
socket.emit('browserWindow-getContentBounds-completed', rectangle);
|
||||
});
|
||||
socket.on('browserWindowSetSize', function (id, width, height, animate) {
|
||||
getWindowById(id).setSize(width, height, animate);
|
||||
});
|
||||
socket.on('browserWindowGetSize', function (id) {
|
||||
var size = getWindowById(id).getSize();
|
||||
socket.emit('browserWindow-getSize-completed', size);
|
||||
});
|
||||
socket.on('browserWindowSetContentSize', function (id, width, height, animate) {
|
||||
getWindowById(id).setContentSize(width, height, animate);
|
||||
});
|
||||
socket.on('browserWindowGetContentSize', function (id) {
|
||||
var size = getWindowById(id).getContentSize();
|
||||
socket.emit('browserWindow-getContentSize-completed', size);
|
||||
});
|
||||
socket.on('browserWindowSetMinimumSize', function (id, width, height) {
|
||||
getWindowById(id).setMinimumSize(width, height);
|
||||
});
|
||||
socket.on('browserWindowGetMinimumSize', function (id) {
|
||||
var size = getWindowById(id).getMinimumSize();
|
||||
socket.emit('browserWindow-getMinimumSize-completed', size);
|
||||
});
|
||||
socket.on('browserWindowSetMaximumSize', function (id, width, height) {
|
||||
getWindowById(id).setMaximumSize(width, height);
|
||||
});
|
||||
socket.on('browserWindowGetMaximumSize', function (id) {
|
||||
var size = getWindowById(id).getMaximumSize();
|
||||
socket.emit('browserWindow-getMaximumSize-completed', size);
|
||||
});
|
||||
socket.on('browserWindowSetResizable', function (id, resizable) {
|
||||
getWindowById(id).setResizable(resizable);
|
||||
});
|
||||
socket.on('browserWindowIsResizable', function (id) {
|
||||
var resizable = getWindowById(id).isResizable();
|
||||
socket.emit('browserWindow-isResizable-completed', resizable);
|
||||
});
|
||||
socket.on('browserWindowSetMovable', function (id, movable) {
|
||||
getWindowById(id).setMovable(movable);
|
||||
});
|
||||
socket.on('browserWindowIsMovable', function (id) {
|
||||
var movable = getWindowById(id).isMovable();
|
||||
socket.emit('browserWindow-isMovable-completed', movable);
|
||||
});
|
||||
socket.on('browserWindowSetMinimizable', function (id, minimizable) {
|
||||
getWindowById(id).setMinimizable(minimizable);
|
||||
});
|
||||
socket.on('browserWindowIsMinimizable', function (id) {
|
||||
var minimizable = getWindowById(id).isMinimizable();
|
||||
socket.emit('browserWindow-isMinimizable-completed', minimizable);
|
||||
});
|
||||
socket.on('browserWindowSetMaximizable', function (id, maximizable) {
|
||||
getWindowById(id).setMaximizable(maximizable);
|
||||
});
|
||||
socket.on('browserWindowIsMaximizable', function (id) {
|
||||
var maximizable = getWindowById(id).isMaximizable();
|
||||
socket.emit('browserWindow-isMaximizable-completed', maximizable);
|
||||
});
|
||||
socket.on('browserWindowSetFullScreenable', function (id, fullscreenable) {
|
||||
getWindowById(id).setFullScreenable(fullscreenable);
|
||||
});
|
||||
socket.on('browserWindowIsFullScreenable', function (id) {
|
||||
var fullscreenable = getWindowById(id).isFullScreenable();
|
||||
socket.emit('browserWindow-isFullScreenable-completed', fullscreenable);
|
||||
});
|
||||
socket.on('browserWindowSetClosable', function (id, closable) {
|
||||
getWindowById(id).setClosable(closable);
|
||||
});
|
||||
socket.on('browserWindowIsClosable', function (id) {
|
||||
var closable = getWindowById(id).isClosable();
|
||||
socket.emit('browserWindow-isClosable-completed', closable);
|
||||
});
|
||||
socket.on('browserWindowSetAlwaysOnTop', function (id, flag, level, relativeLevel) {
|
||||
getWindowById(id).setAlwaysOnTop(flag, level, relativeLevel);
|
||||
});
|
||||
socket.on('browserWindowIsAlwaysOnTop', function (id) {
|
||||
var isAlwaysOnTop = getWindowById(id).isAlwaysOnTop();
|
||||
socket.emit('browserWindow-isAlwaysOnTop-completed', isAlwaysOnTop);
|
||||
});
|
||||
socket.on('browserWindowCenter', function (id) {
|
||||
getWindowById(id).center();
|
||||
});
|
||||
socket.on('browserWindowSetPosition', function (id, x, y, animate) {
|
||||
getWindowById(id).setPosition(x, y, animate);
|
||||
});
|
||||
socket.on('browserWindowGetPosition', function (id) {
|
||||
var position = getWindowById(id).getPosition();
|
||||
socket.emit('browserWindow-getPosition-completed', position);
|
||||
});
|
||||
socket.on('browserWindowSetTitle', function (id, title) {
|
||||
getWindowById(id).setTitle(title);
|
||||
});
|
||||
socket.on('browserWindowGetTitle', function (id) {
|
||||
var title = getWindowById(id).getTitle();
|
||||
socket.emit('browserWindow-getTitle-completed', title);
|
||||
});
|
||||
socket.on('browserWindowSetTitle', function (id, title) {
|
||||
getWindowById(id).setTitle(title);
|
||||
});
|
||||
socket.on('browserWindowSetSheetOffset', function (id, offsetY, offsetX) {
|
||||
if (offsetX) {
|
||||
getWindowById(id).setSheetOffset(offsetY, offsetX);
|
||||
}
|
||||
else {
|
||||
getWindowById(id).setSheetOffset(offsetY);
|
||||
}
|
||||
});
|
||||
socket.on('browserWindowFlashFrame', function (id, flag) {
|
||||
getWindowById(id).flashFrame(flag);
|
||||
});
|
||||
socket.on('browserWindowSetSkipTaskbar', function (id, skip) {
|
||||
getWindowById(id).setSkipTaskbar(skip);
|
||||
});
|
||||
socket.on('browserWindowSetKiosk', function (id, flag) {
|
||||
getWindowById(id).setKiosk(flag);
|
||||
});
|
||||
socket.on('browserWindowIsKiosk', function (id) {
|
||||
var isKiosk = getWindowById(id).isKiosk();
|
||||
socket.emit('browserWindow-isKiosk-completed', isKiosk);
|
||||
});
|
||||
socket.on('browserWindowSetRepresentedFilename', function (id, filename) {
|
||||
getWindowById(id).setRepresentedFilename(filename);
|
||||
});
|
||||
socket.on('browserWindowGetRepresentedFilename', function (id) {
|
||||
var pathname = getWindowById(id).getRepresentedFilename();
|
||||
socket.emit('browserWindow-getRepresentedFilename-completed', pathname);
|
||||
});
|
||||
socket.on('browserWindowSetDocumentEdited', function (id, edited) {
|
||||
getWindowById(id).setDocumentEdited(edited);
|
||||
});
|
||||
socket.on('browserWindowIsDocumentEdited', function (id) {
|
||||
var edited = getWindowById(id).isDocumentEdited();
|
||||
socket.emit('browserWindow-isDocumentEdited-completed', edited);
|
||||
});
|
||||
socket.on('browserWindowFocusOnWebView', function (id) {
|
||||
getWindowById(id).focusOnWebView();
|
||||
});
|
||||
socket.on('browserWindowBlurWebView', function (id) {
|
||||
getWindowById(id).blurWebView();
|
||||
});
|
||||
socket.on('browserWindowLoadURL', function (id, url, options) {
|
||||
getWindowById(id).loadURL(url, options);
|
||||
});
|
||||
socket.on('browserWindowReload', function (id) {
|
||||
getWindowById(id).reload();
|
||||
});
|
||||
socket.on('browserWindowSetMenu', function (id, menuItems) {
|
||||
var menu = null;
|
||||
if (menuItems) {
|
||||
menu = electron_1.Menu.buildFromTemplate(menuItems);
|
||||
addMenuItemClickConnector(menu.items, function (id) {
|
||||
socket.emit("windowMenuItemClicked", id);
|
||||
});
|
||||
}
|
||||
getWindowById(id).setMenu(menu);
|
||||
});
|
||||
function addMenuItemClickConnector(menuItems, callback) {
|
||||
menuItems.forEach(function (item) {
|
||||
if (item.submenu && item.submenu.items.length > 0) {
|
||||
addMenuItemClickConnector(item.submenu.items, callback);
|
||||
}
|
||||
if ("id" in item && item.id) {
|
||||
item.click = function () { callback(item.id); };
|
||||
}
|
||||
});
|
||||
}
|
||||
socket.on('browserWindowSetProgressBar', function (id, progress) {
|
||||
getWindowById(id).setProgressBar(progress);
|
||||
});
|
||||
socket.on('browserWindowSetHasShadow', function (id, hasShadow) {
|
||||
getWindowById(id).setHasShadow(hasShadow);
|
||||
});
|
||||
socket.on('browserWindowHasShadow', function (id) {
|
||||
var hasShadow = getWindowById(id).hasShadow();
|
||||
socket.emit('browserWindow-hasShadow-completed', hasShadow);
|
||||
});
|
||||
socket.on('browserWindowSetThumbarButtons', function (id, thumbarButtons) {
|
||||
thumbarButtons.forEach(function (thumbarButton) {
|
||||
var imagePath = path.join(__dirname.replace('api', ''), 'bin', thumbarButton.icon.toString());
|
||||
thumbarButton.icon = electron_1.nativeImage.createFromPath(imagePath);
|
||||
thumbarButton.click = function () {
|
||||
socket.emit("thumbarButtonClicked", thumbarButton["id"]);
|
||||
};
|
||||
});
|
||||
var success = getWindowById(id).setThumbarButtons(thumbarButtons);
|
||||
socket.emit('browserWindowSetThumbarButtons-completed', success);
|
||||
});
|
||||
socket.on('browserWindowSetThumbnailClip', function (id, rectangle) {
|
||||
getWindowById(id).setThumbnailClip(rectangle);
|
||||
});
|
||||
socket.on('browserWindowSetThumbnailToolTip', function (id, toolTip) {
|
||||
getWindowById(id).setThumbnailToolTip(toolTip);
|
||||
});
|
||||
socket.on('browserWindowSetAppDetails', function (id, options) {
|
||||
getWindowById(id).setAppDetails(options);
|
||||
});
|
||||
socket.on('browserWindowShowDefinitionForSelection', function (id) {
|
||||
getWindowById(id).showDefinitionForSelection();
|
||||
});
|
||||
socket.on('browserWindowSetAutoHideMenuBar', function (id, hide) {
|
||||
getWindowById(id).setAutoHideMenuBar(hide);
|
||||
});
|
||||
socket.on('browserWindowIsMenuBarAutoHide', function (id) {
|
||||
var isMenuBarAutoHide = getWindowById(id).isMenuBarAutoHide();
|
||||
socket.emit('browserWindow-isMenuBarAutoHide-completed', isMenuBarAutoHide);
|
||||
});
|
||||
socket.on('browserWindowSetMenuBarVisibility', function (id, visible) {
|
||||
getWindowById(id).setMenuBarVisibility(visible);
|
||||
});
|
||||
socket.on('browserWindowIsMenuBarVisible', function (id) {
|
||||
var isMenuBarVisible = getWindowById(id).isMenuBarVisible();
|
||||
socket.emit('browserWindow-isMenuBarVisible-completed', isMenuBarVisible);
|
||||
});
|
||||
socket.on('browserWindowSetVisibleOnAllWorkspaces', function (id, visible) {
|
||||
getWindowById(id).setVisibleOnAllWorkspaces(visible);
|
||||
});
|
||||
socket.on('browserWindowIsVisibleOnAllWorkspaces', function (id) {
|
||||
var isVisibleOnAllWorkspaces = getWindowById(id).isVisibleOnAllWorkspaces();
|
||||
socket.emit('browserWindow-isVisibleOnAllWorkspaces-completed', isVisibleOnAllWorkspaces);
|
||||
});
|
||||
socket.on('browserWindowSetIgnoreMouseEvents', function (id, ignore) {
|
||||
getWindowById(id).setIgnoreMouseEvents(ignore);
|
||||
});
|
||||
socket.on('browserWindowSetContentProtection', function (id, enable) {
|
||||
getWindowById(id).setContentProtection(enable);
|
||||
});
|
||||
socket.on('browserWindowSetFocusable', function (id, focusable) {
|
||||
getWindowById(id).setFocusable(focusable);
|
||||
});
|
||||
socket.on('browserWindowSetParentWindow', function (id, parent) {
|
||||
var browserWindow = electron_1.BrowserWindow.fromId(parent.id);
|
||||
getWindowById(id).setParentWindow(browserWindow);
|
||||
});
|
||||
socket.on('browserWindowGetParentWindow', function (id) {
|
||||
var browserWindow = getWindowById(id).getParentWindow();
|
||||
socket.emit('browserWindow-getParentWindow-completed', browserWindow.id);
|
||||
});
|
||||
socket.on('browserWindowGetChildWindows', function (id) {
|
||||
var browserWindows = getWindowById(id).getChildWindows();
|
||||
var ids = [];
|
||||
browserWindows.forEach(function (x) {
|
||||
ids.push(x.id);
|
||||
});
|
||||
socket.emit('browserWindow-getChildWindows-completed', ids);
|
||||
});
|
||||
socket.on('browserWindowSetAutoHideCursor', function (id, autoHide) {
|
||||
getWindowById(id).setAutoHideCursor(autoHide);
|
||||
});
|
||||
socket.on('browserWindowSetVibrancy', function (id, type) {
|
||||
getWindowById(id).setVibrancy(type);
|
||||
});
|
||||
function getWindowById(id) {
|
||||
for (var index = 0; index < windows.length; index++) {
|
||||
var element = windows[index];
|
||||
if (element.id == id) {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=browserWindows.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -1,51 +0,0 @@
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var electron_1 = require("electron");
|
||||
module.exports = function (socket) {
|
||||
socket.on('clipboard-readText', function (type) {
|
||||
var text = electron_1.clipboard.readText(type);
|
||||
socket.emit('clipboard-readText-Completed', text);
|
||||
});
|
||||
socket.on('clipboard-writeText', function (text, type) {
|
||||
electron_1.clipboard.writeText(text, type);
|
||||
});
|
||||
socket.on('clipboard-readHTML', function (type) {
|
||||
var content = electron_1.clipboard.readHTML(type);
|
||||
socket.emit('clipboard-readHTML-Completed', content);
|
||||
});
|
||||
socket.on('clipboard-writeHTML', function (markup, type) {
|
||||
electron_1.clipboard.writeHTML(markup, type);
|
||||
});
|
||||
socket.on('clipboard-readRTF', function (type) {
|
||||
var content = electron_1.clipboard.readRTF(type);
|
||||
socket.emit('clipboard-readRTF-Completed', content);
|
||||
});
|
||||
socket.on('clipboard-writeRTF', function (text, type) {
|
||||
electron_1.clipboard.writeHTML(text, type);
|
||||
});
|
||||
socket.on('clipboard-readBookmark', function () {
|
||||
var bookmark = electron_1.clipboard.readBookmark();
|
||||
socket.emit('clipboard-readBookmark-Completed', bookmark);
|
||||
});
|
||||
socket.on('clipboard-writeBookmark', function (title, url, type) {
|
||||
electron_1.clipboard.writeBookmark(title, url, type);
|
||||
});
|
||||
socket.on('clipboard-readFindText', function () {
|
||||
var content = electron_1.clipboard.readFindText();
|
||||
socket.emit('clipboard-readFindText-Completed', content);
|
||||
});
|
||||
socket.on('clipboard-writeFindText', function (text) {
|
||||
electron_1.clipboard.writeFindText(text);
|
||||
});
|
||||
socket.on('clipboard-clear', function (type) {
|
||||
electron_1.clipboard.clear(type);
|
||||
});
|
||||
socket.on('clipboard-availableFormats', function (type) {
|
||||
var formats = electron_1.clipboard.availableFormats(type);
|
||||
socket.emit('clipboard-availableFormats-Completed', formats);
|
||||
});
|
||||
socket.on('clipboard-write', function (data, type) {
|
||||
electron_1.clipboard.write(data, type);
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=clipboard.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["clipboard.ts"],"names":[],"mappings":";;AAAA,qCAAqC;AAErC,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IAErC,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,UAAC,IAAI;QACjC,IAAM,IAAI,GAAG,oBAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,UAAC,IAAI,EAAE,IAAI;QACxC,oBAAS,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,UAAC,IAAI;QACjC,IAAM,OAAO,GAAG,oBAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,UAAC,MAAM,EAAE,IAAI;QAC1C,oBAAS,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,UAAC,IAAI;QAChC,IAAM,OAAO,GAAG,oBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,UAAC,IAAI,EAAE,IAAI;QACvC,oBAAS,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE;QAChC,IAAM,QAAQ,GAAG,oBAAS,CAAC,YAAY,EAAE,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE,QAAQ,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,UAAC,KAAK,EAAE,GAAG,EAAE,IAAI;QAClD,oBAAS,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE;QAChC,IAAM,OAAO,GAAG,oBAAS,CAAC,YAAY,EAAE,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,UAAC,IAAI;QACtC,oBAAS,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,UAAC,IAAI;QAC9B,oBAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,UAAC,IAAI;QACzC,IAAM,OAAO,GAAG,oBAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACjD,MAAM,CAAC,IAAI,CAAC,sCAAsC,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,UAAC,IAAI,EAAE,IAAI;QACpC,oBAAS,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACP,CAAC,CAAA"}
|
||||
@@ -1,42 +0,0 @@
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var electron_1 = require("electron");
|
||||
module.exports = function (socket) {
|
||||
socket.on('showMessageBox', function (browserWindow, options, guid) {
|
||||
if ("id" in browserWindow) {
|
||||
var window = electron_1.BrowserWindow.fromId(browserWindow.id);
|
||||
electron_1.dialog.showMessageBox(window, options, function (response, checkboxChecked) {
|
||||
socket.emit('showMessageBoxComplete' + guid, [response, checkboxChecked]);
|
||||
});
|
||||
}
|
||||
else {
|
||||
var message = browserWindow;
|
||||
var id_1 = guid || options;
|
||||
electron_1.dialog.showMessageBox(browserWindow, function (response, checkboxChecked) {
|
||||
socket.emit('showMessageBoxComplete' + id_1, [response, checkboxChecked]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('showOpenDialog', function (browserWindow, options, guid) {
|
||||
var window = electron_1.BrowserWindow.fromId(browserWindow.id);
|
||||
electron_1.dialog.showOpenDialog(window, options, function (filePaths) {
|
||||
socket.emit('showOpenDialogComplete' + guid, filePaths || []);
|
||||
});
|
||||
});
|
||||
socket.on('showSaveDialog', function (browserWindow, options, guid) {
|
||||
var window = electron_1.BrowserWindow.fromId(browserWindow.id);
|
||||
electron_1.dialog.showSaveDialog(window, options, function (filename) {
|
||||
socket.emit('showSaveDialogComplete' + guid, filename || '');
|
||||
});
|
||||
});
|
||||
socket.on('showErrorBox', function (title, content) {
|
||||
electron_1.dialog.showErrorBox(title, content);
|
||||
});
|
||||
socket.on('showCertificateTrustDialog', function (browserWindow, options, guid) {
|
||||
var window = electron_1.BrowserWindow.fromId(browserWindow.id);
|
||||
electron_1.dialog.showCertificateTrustDialog(window, options, function () {
|
||||
socket.emit('showCertificateTrustDialogComplete' + guid);
|
||||
});
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=dialog.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["dialog.ts"],"names":[],"mappings":";;AAAA,qCAAiD;AAEjD,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,UAAC,aAAa,EAAE,OAAO,EAAE,IAAI;QACrD,EAAE,CAAC,CAAC,IAAI,IAAI,aAAa,CAAC,CAAC,CAAC;YACxB,IAAI,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YAEpD,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,UAAC,QAAQ,EAAE,eAAe;gBAC7D,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;YAC9E,CAAC,CAAC,CAAC;QACP,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,IAAI,OAAO,GAAG,aAAa,CAAC;YAC5B,IAAI,IAAE,GAAG,IAAI,IAAI,OAAO,CAAC;YACzB,iBAAM,CAAC,cAAc,CAAC,aAAa,EAAE,UAAC,QAAQ,EAAE,eAAe;gBAC3D,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAE,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;YAC5E,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,UAAC,aAAa,EAAE,OAAO,EAAE,IAAI;QACrD,IAAI,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACpD,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,UAAC,SAAS;YAC7C,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,UAAC,aAAa,EAAE,OAAO,EAAE,IAAI;QACrD,IAAI,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACpD,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,UAAC,QAAQ;YAC5C,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,OAAO;QACrC,iBAAM,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,UAAC,aAAa,EAAE,OAAO,EAAE,IAAI;QACjE,IAAI,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACpD,iBAAM,CAAC,0BAA0B,CAAC,MAAM,EAAE,OAAO,EAAE;YAC/C,MAAM,CAAC,IAAI,CAAC,oCAAoC,GAAG,IAAI,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAA"}
|
||||
@@ -1,44 +0,0 @@
|
||||
import { BrowserWindow, dialog } from "electron";
|
||||
|
||||
module.exports = (socket: SocketIO.Server) => {
|
||||
socket.on('showMessageBox', (browserWindow, options, guid) => {
|
||||
if ("id" in browserWindow) {
|
||||
var window = BrowserWindow.fromId(browserWindow.id);
|
||||
|
||||
dialog.showMessageBox(window, options, (response, checkboxChecked) => {
|
||||
socket.emit('showMessageBoxComplete' + guid, [response, checkboxChecked]);
|
||||
});
|
||||
} else {
|
||||
var message = browserWindow;
|
||||
let id = guid || options;
|
||||
dialog.showMessageBox(browserWindow, (response, checkboxChecked) => {
|
||||
socket.emit('showMessageBoxComplete' + id, [response, checkboxChecked]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('showOpenDialog', (browserWindow, options, guid) => {
|
||||
var window = BrowserWindow.fromId(browserWindow.id);
|
||||
dialog.showOpenDialog(window, options, (filePaths) => {
|
||||
socket.emit('showOpenDialogComplete' + guid, filePaths || []);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('showSaveDialog', (browserWindow, options, guid) => {
|
||||
var window = BrowserWindow.fromId(browserWindow.id);
|
||||
dialog.showSaveDialog(window, options, (filename) => {
|
||||
socket.emit('showSaveDialogComplete' + guid, filename || '');
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('showErrorBox', (title, content) => {
|
||||
dialog.showErrorBox(title, content);
|
||||
});
|
||||
|
||||
socket.on('showCertificateTrustDialog', (browserWindow, options, guid) => {
|
||||
var window = BrowserWindow.fromId(browserWindow.id);
|
||||
dialog.showCertificateTrustDialog(window, options, () => {
|
||||
socket.emit('showCertificateTrustDialogComplete' + guid);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var electron_1 = require("electron");
|
||||
module.exports = function (socket) {
|
||||
socket.on('globalShortcut-register', function (accelerator) {
|
||||
electron_1.globalShortcut.register(accelerator, function () {
|
||||
socket.emit('globalShortcut-pressed', accelerator);
|
||||
});
|
||||
});
|
||||
socket.on('globalShortcut-isRegistered', function (accelerator) {
|
||||
var isRegistered = electron_1.globalShortcut.isRegistered(accelerator);
|
||||
socket.emit('globalShortcut-isRegisteredCompleted', isRegistered);
|
||||
});
|
||||
socket.on('globalShortcut-unregister', function (accelerator) {
|
||||
electron_1.globalShortcut.unregister(accelerator);
|
||||
});
|
||||
socket.on('globalShortcut-unregisterAll', function () {
|
||||
try {
|
||||
electron_1.globalShortcut.unregisterAll();
|
||||
}
|
||||
catch (error) { }
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=globalShortcut.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"globalShortcut.js","sourceRoot":"","sources":["globalShortcut.ts"],"names":[],"mappings":";;AAAA,qCAA0C;AAE1C,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,UAAC,WAAW;QAC7C,yBAAc,CAAC,QAAQ,CAAC,WAAW,EAAE;YACjC,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,WAAW,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE,UAAC,WAAW;QACjD,IAAM,YAAY,GAAG,yBAAc,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QAE9D,MAAM,CAAC,IAAI,CAAC,sCAAsC,EAAE,YAAY,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,UAAC,WAAW;QAC/C,yBAAc,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE;QACtC,IAAI,CAAC;YACD,yBAAc,CAAC,aAAa,EAAE,CAAC;QACnC,CAAC;QAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACP,CAAC,CAAA"}
|
||||
@@ -1,40 +0,0 @@
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var electron_1 = require("electron");
|
||||
module.exports = function (socket) {
|
||||
socket.on('registerIpcMainChannel', function (channel) {
|
||||
electron_1.ipcMain.on(channel, function (event, args) {
|
||||
socket.emit(channel, [event.preventDefault(), args]);
|
||||
});
|
||||
});
|
||||
socket.on('registerSyncIpcMainChannel', function (channel) {
|
||||
electron_1.ipcMain.on(channel, function (event, args) {
|
||||
var x = socket;
|
||||
x.removeAllListeners(channel + 'Sync');
|
||||
socket.on(channel + 'Sync', function (result) {
|
||||
event.returnValue = result;
|
||||
});
|
||||
socket.emit(channel, [event.preventDefault(), args]);
|
||||
});
|
||||
});
|
||||
socket.on('registerOnceIpcMainChannel', function (channel) {
|
||||
electron_1.ipcMain.once(channel, function (event, args) {
|
||||
socket.emit(channel, [event.preventDefault(), args]);
|
||||
});
|
||||
});
|
||||
socket.on('removeAllListenersIpcMainChannel', function (channel) {
|
||||
electron_1.ipcMain.removeAllListeners(channel);
|
||||
});
|
||||
socket.on('sendToIpcRenderer', function (browserWindow, channel) {
|
||||
var data = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
data[_i - 2] = arguments[_i];
|
||||
}
|
||||
var window = electron_1.BrowserWindow.fromId(browserWindow.id);
|
||||
if (window) {
|
||||
(_a = window.webContents).send.apply(_a, [channel].concat(data));
|
||||
}
|
||||
var _a;
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=ipc.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"ipc.js","sourceRoot":"","sources":["ipc.ts"],"names":[],"mappings":";;AAAA,qCAAkD;AAElD,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,UAAC,OAAO;QACxC,kBAAO,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,KAAK,EAAE,IAAI;YAC5B,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,UAAC,OAAO;QAC5C,kBAAO,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,KAAK,EAAE,IAAI;YAC5B,IAAI,CAAC,GAAQ,MAAM,CAAC;YACpB,CAAC,CAAC,kBAAkB,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;YACvC,MAAM,CAAC,EAAE,CAAC,OAAO,GAAG,MAAM,EAAE,UAAC,MAAM;gBAC/B,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC;YAC/B,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,UAAC,OAAO;QAC5C,kBAAO,CAAC,IAAI,CAAC,OAAO,EAAE,UAAC,KAAK,EAAE,IAAI;YAC9B,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,kCAAkC,EAAE,UAAC,OAAO;QAClD,kBAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,UAAC,aAAa,EAAE,OAAO;QAAE,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,6BAAO;;QAC3D,IAAM,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QAEtD,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACT,CAAA,KAAA,MAAM,CAAC,WAAW,CAAA,CAAC,IAAI,YAAC,OAAO,SAAK,IAAI,GAAE;QAC9C,CAAC;;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAA"}
|
||||
@@ -1,39 +0,0 @@
|
||||
import { ipcMain, BrowserWindow } from 'electron';
|
||||
|
||||
module.exports = (socket: SocketIO.Server) => {
|
||||
socket.on('registerIpcMainChannel', (channel) => {
|
||||
ipcMain.on(channel, (event, args) => {
|
||||
socket.emit(channel, [event.preventDefault(), args]);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('registerSyncIpcMainChannel', (channel) => {
|
||||
ipcMain.on(channel, (event, args) => {
|
||||
let x = <any>socket;
|
||||
x.removeAllListeners(channel + 'Sync');
|
||||
socket.on(channel + 'Sync', (result) => {
|
||||
event.returnValue = result;
|
||||
});
|
||||
|
||||
socket.emit(channel, [event.preventDefault(), args]);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('registerOnceIpcMainChannel', (channel) => {
|
||||
ipcMain.once(channel, (event, args) => {
|
||||
socket.emit(channel, [event.preventDefault(), args]);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('removeAllListenersIpcMainChannel', (channel) => {
|
||||
ipcMain.removeAllListeners(channel);
|
||||
});
|
||||
|
||||
socket.on('sendToIpcRenderer', (browserWindow, channel, ...data) => {
|
||||
const window = BrowserWindow.fromId(browserWindow.id);
|
||||
|
||||
if (window) {
|
||||
window.webContents.send(channel, ...data);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var electron_1 = require("electron");
|
||||
var contextMenuItems = [];
|
||||
module.exports = function (socket) {
|
||||
socket.on('menu-setContextMenu', function (browserWindowId, menuItems) {
|
||||
var menu = electron_1.Menu.buildFromTemplate(menuItems);
|
||||
addContextMenuItemClickConnector(menu.items, browserWindowId, function (id, browserWindowId) {
|
||||
socket.emit("contextMenuItemClicked", [id, browserWindowId]);
|
||||
});
|
||||
contextMenuItems.push({
|
||||
menu: menu,
|
||||
browserWindowId: browserWindowId
|
||||
});
|
||||
});
|
||||
function addContextMenuItemClickConnector(menuItems, browserWindowId, callback) {
|
||||
menuItems.forEach(function (item) {
|
||||
if (item.submenu && item.submenu.items.length > 0) {
|
||||
addContextMenuItemClickConnector(item.submenu.items, browserWindowId, callback);
|
||||
}
|
||||
if ("id" in item && item.id) {
|
||||
item.click = function () { callback(item.id, browserWindowId); };
|
||||
}
|
||||
});
|
||||
}
|
||||
socket.on('menu-contextMenuPopup', function (browserWindowId) {
|
||||
contextMenuItems.forEach(function (x) {
|
||||
if (x.browserWindowId === browserWindowId) {
|
||||
var browserWindow = electron_1.BrowserWindow.fromId(browserWindowId);
|
||||
x.menu.popup(browserWindow);
|
||||
}
|
||||
});
|
||||
});
|
||||
socket.on('menu-setApplicationMenu', function (menuItems) {
|
||||
var menu = electron_1.Menu.buildFromTemplate(menuItems);
|
||||
addMenuItemClickConnector(menu.items, function (id) {
|
||||
socket.emit("menuItemClicked", id);
|
||||
});
|
||||
electron_1.Menu.setApplicationMenu(menu);
|
||||
});
|
||||
function addMenuItemClickConnector(menuItems, callback) {
|
||||
menuItems.forEach(function (item) {
|
||||
if (item.submenu && item.submenu.items.length > 0) {
|
||||
addMenuItemClickConnector(item.submenu.items, callback);
|
||||
}
|
||||
if ("id" in item && item.id) {
|
||||
item.click = function () { callback(item.id); };
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=menu.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"menu.js","sourceRoot":"","sources":["menu.ts"],"names":[],"mappings":";;AAAA,qCAA+C;AAC/C,IAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,UAAC,eAAe,EAAE,SAAS;QACxD,IAAM,IAAI,GAAG,eAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAE/C,gCAAgC,CAAC,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,UAAC,EAAE,EAAE,eAAe;YAC9E,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,gBAAgB,CAAC,IAAI,CAAC;YAClB,IAAI,EAAE,IAAI;YACV,eAAe,EAAE,eAAe;SACnC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,0CAA0C,SAAS,EAAE,eAAe,EAAE,QAAQ;QAC1E,SAAS,CAAC,OAAO,CAAC,UAAC,IAAI;YACnB,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;gBAChD,gCAAgC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;YACpF,CAAC;YAED,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC1B,IAAI,CAAC,KAAK,GAAG,cAAQ,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/D,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,UAAC,eAAe;QAC/C,gBAAgB,CAAC,OAAO,CAAC,UAAA,CAAC;YACtB,EAAE,CAAA,CAAC,CAAC,CAAC,eAAe,KAAK,eAAe,CAAC,CAAC,CAAC;gBACvC,IAAI,aAAa,GAAG,wBAAa,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;gBAC1D,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAChC,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,UAAC,SAAS;QAC3C,IAAM,IAAI,GAAG,eAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAE/C,yBAAyB,CAAC,IAAI,CAAC,KAAK,EAAE,UAAC,EAAE;YACrC,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QAEH,eAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,mCAAmC,SAAS,EAAE,QAAQ;QAClD,SAAS,CAAC,OAAO,CAAC,UAAC,IAAI;YACnB,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;gBAChD,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YAC5D,CAAC;YAED,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC1B,IAAI,CAAC,KAAK,GAAG,cAAQ,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9C,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAA"}
|
||||
@@ -1,49 +0,0 @@
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var electron_1 = require("electron");
|
||||
var notifications = [];
|
||||
module.exports = function (socket) {
|
||||
socket.on('createNotification', function (options) {
|
||||
var notification = new electron_1.Notification(options);
|
||||
var haveEvent = false;
|
||||
if (options.showID) {
|
||||
haveEvent = true;
|
||||
notification.on('show', function () {
|
||||
socket.emit('NotificationEventShow', options.showID);
|
||||
});
|
||||
}
|
||||
if (options.clickID) {
|
||||
haveEvent = true;
|
||||
notification.on('click', function () {
|
||||
socket.emit('NotificationEventClick', options.clickID);
|
||||
});
|
||||
}
|
||||
if (options.closeID) {
|
||||
haveEvent = true;
|
||||
notification.on('close', function () {
|
||||
socket.emit('NotificationEventClose', options.closeID);
|
||||
});
|
||||
}
|
||||
if (options.replyID) {
|
||||
haveEvent = true;
|
||||
notification.on('reply', function (event, value) {
|
||||
socket.emit('NotificationEventReply', [options.replyID, value]);
|
||||
});
|
||||
}
|
||||
if (options.actionID) {
|
||||
haveEvent = true;
|
||||
notification.on('action', function (event, value) {
|
||||
socket.emit('NotificationEventAction', [options.actionID, value]);
|
||||
});
|
||||
}
|
||||
if (haveEvent) {
|
||||
notifications.push(notification);
|
||||
}
|
||||
notification.show();
|
||||
});
|
||||
socket.on('notificationIsSupported', function (options) {
|
||||
var isSupported = electron_1.Notification.isSupported;
|
||||
socket.emit('notificationIsSupportedComplete', isSupported);
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=notification.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"notification.js","sourceRoot":"","sources":["notification.ts"],"names":[],"mappings":";;AAAA,qCAAwC;AACxC,IAAM,aAAa,GAA4B,EAAE,CAAC;AAElD,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,UAAC,OAAO;QACpC,IAAM,YAAY,GAAG,IAAI,uBAAY,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,SAAS,GAAG,KAAK,CAAC;QAEtB,EAAE,CAAA,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;YAChB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE;gBACpB,MAAM,CAAC,IAAI,CAAC,uBAAuB,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YACzD,CAAC,CAAC,CAAC;QACP,CAAC;QAED,EAAE,CAAA,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;YACjB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE;gBACrB,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YAC3D,CAAC,CAAC,CAAC;QACP,CAAC;QAED,EAAE,CAAA,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;YACjB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE;gBACrB,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YAC3D,CAAC,CAAC,CAAC;QACP,CAAC;QAED,EAAE,CAAA,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;YACjB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,KAAK,EAAE,KAAK;gBAClC,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;YACpE,CAAC,CAAC,CAAC;QACP,CAAC;QAED,EAAE,CAAA,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;YAClB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAC,KAAK,EAAE,KAAK;gBACnC,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;YACtE,CAAC,CAAC,CAAC;QACP,CAAC;QAED,EAAE,CAAA,CAAC,SAAS,CAAC,CAAC,CAAC;YACX,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACrC,CAAC;QAED,YAAY,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,UAAC,OAAO;QACzC,IAAM,WAAW,GAAG,uBAAY,CAAC,WAAW,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,iCAAiC,EAAE,WAAW,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACP,CAAC,CAAA"}
|
||||
@@ -1,55 +0,0 @@
|
||||
import { Notification } from "electron";
|
||||
const notifications: Electron.Notification[] = [];
|
||||
|
||||
module.exports = (socket: SocketIO.Server) => {
|
||||
socket.on('createNotification', (options) => {
|
||||
const notification = new Notification(options);
|
||||
let haveEvent = false;
|
||||
|
||||
if(options.showID) {
|
||||
haveEvent = true;
|
||||
notification.on('show', () => {
|
||||
socket.emit('NotificationEventShow', options.showID);
|
||||
});
|
||||
}
|
||||
|
||||
if(options.clickID) {
|
||||
haveEvent = true;
|
||||
notification.on('click', () => {
|
||||
socket.emit('NotificationEventClick', options.clickID);
|
||||
});
|
||||
}
|
||||
|
||||
if(options.closeID) {
|
||||
haveEvent = true;
|
||||
notification.on('close', () => {
|
||||
socket.emit('NotificationEventClose', options.closeID);
|
||||
});
|
||||
}
|
||||
|
||||
if(options.replyID) {
|
||||
haveEvent = true;
|
||||
notification.on('reply', (event, value) => {
|
||||
socket.emit('NotificationEventReply', [options.replyID, value]);
|
||||
});
|
||||
}
|
||||
|
||||
if(options.actionID) {
|
||||
haveEvent = true;
|
||||
notification.on('action', (event, value) => {
|
||||
socket.emit('NotificationEventAction', [options.actionID, value]);
|
||||
});
|
||||
}
|
||||
|
||||
if(haveEvent) {
|
||||
notifications.push(notification);
|
||||
}
|
||||
|
||||
notification.show();
|
||||
});
|
||||
|
||||
socket.on('notificationIsSupported', (options) => {
|
||||
const isSupported = Notification.isSupported;
|
||||
socket.emit('notificationIsSupportedComplete', isSupported);
|
||||
});
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var electron_1 = require("electron");
|
||||
module.exports = function (socket) {
|
||||
socket.on('register-screen-display-added', function (id) {
|
||||
electron_1.screen.on('display-added', function (event, display) {
|
||||
socket.emit('screen-display-added-event' + id, display);
|
||||
});
|
||||
});
|
||||
socket.on('register-screen-display-removed', function (id) {
|
||||
electron_1.screen.on('display-removed', function (event, display) {
|
||||
socket.emit('screen-display-removed-event' + id, display);
|
||||
});
|
||||
});
|
||||
socket.on('register-screen-display-metrics-changed', function (id) {
|
||||
electron_1.screen.on('display-metrics-changed', function (event, display, changedMetrics) {
|
||||
socket.emit('screen-display-metrics-changed-event' + id, [display, changedMetrics]);
|
||||
});
|
||||
});
|
||||
socket.on('screen-getCursorScreenPoint', function () {
|
||||
var point = electron_1.screen.getCursorScreenPoint();
|
||||
socket.emit('screen-getCursorScreenPointCompleted', point);
|
||||
});
|
||||
socket.on('screen-getMenuBarHeight', function () {
|
||||
var height = electron_1.screen.getMenuBarHeight();
|
||||
socket.emit('screen-getMenuBarHeightCompleted', height);
|
||||
});
|
||||
socket.on('screen-getPrimaryDisplay', function () {
|
||||
var display = electron_1.screen.getPrimaryDisplay();
|
||||
socket.emit('screen-getPrimaryDisplayCompleted', display);
|
||||
});
|
||||
socket.on('screen-getAllDisplays', function () {
|
||||
var display = electron_1.screen.getAllDisplays();
|
||||
socket.emit('screen-getAllDisplaysCompleted', display);
|
||||
});
|
||||
socket.on('screen-getDisplayNearestPoint', function (point) {
|
||||
var display = electron_1.screen.getDisplayNearestPoint(point);
|
||||
socket.emit('screen-getDisplayNearestPointCompleted', display);
|
||||
});
|
||||
socket.on('screen-getDisplayMatching', function (rectangle) {
|
||||
var display = electron_1.screen.getDisplayMatching(rectangle);
|
||||
socket.emit('screen-getDisplayMatchingCompleted', display);
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=screen.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"screen.js","sourceRoot":"","sources":["screen.ts"],"names":[],"mappings":";;AAAA,qCAAkC;AAElC,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,+BAA+B,EAAE,UAAC,EAAE;QAC1C,iBAAM,CAAC,EAAE,CAAC,eAAe,EAAE,UAAC,KAAK,EAAE,OAAO;YACtC,MAAM,CAAC,IAAI,CAAC,4BAA4B,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iCAAiC,EAAE,UAAC,EAAE;QAC5C,iBAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,UAAC,KAAK,EAAE,OAAO;YACxC,MAAM,CAAC,IAAI,CAAC,8BAA8B,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yCAAyC,EAAE,UAAC,EAAE;QACpD,iBAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,UAAC,KAAK,EAAE,OAAO,EAAE,cAAc;YAChE,MAAM,CAAC,IAAI,CAAC,sCAAsC,GAAG,EAAE,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;QACxF,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE;QACrC,IAAI,KAAK,GAAG,iBAAM,CAAC,oBAAoB,EAAE,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE;QACjC,IAAI,MAAM,GAAG,iBAAM,CAAC,gBAAgB,EAAE,CAAC;QACvC,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,0BAA0B,EAAE;QAClC,IAAI,OAAO,GAAG,iBAAM,CAAC,iBAAiB,EAAE,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,mCAAmC,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE;QAC/B,IAAI,OAAO,GAAG,iBAAM,CAAC,cAAc,EAAE,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,+BAA+B,EAAE,UAAC,KAAK;QAC7C,IAAI,OAAO,GAAG,iBAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;QACnD,MAAM,CAAC,IAAI,CAAC,wCAAwC,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,UAAC,SAAS;QAC7C,IAAI,OAAO,GAAG,iBAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACnD,MAAM,CAAC,IAAI,CAAC,oCAAoC,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACP,CAAC,CAAA"}
|
||||
@@ -1,51 +0,0 @@
|
||||
import { screen } from "electron";
|
||||
|
||||
module.exports = (socket: SocketIO.Server) => {
|
||||
socket.on('register-screen-display-added', (id) => {
|
||||
screen.on('display-added', (event, display) => {
|
||||
socket.emit('screen-display-added-event' + id, display);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-screen-display-removed', (id) => {
|
||||
screen.on('display-removed', (event, display) => {
|
||||
socket.emit('screen-display-removed-event' + id, display);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-screen-display-metrics-changed', (id) => {
|
||||
screen.on('display-metrics-changed', (event, display, changedMetrics) => {
|
||||
socket.emit('screen-display-metrics-changed-event' + id, [display, changedMetrics]);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('screen-getCursorScreenPoint', () => {
|
||||
var point = screen.getCursorScreenPoint();
|
||||
socket.emit('screen-getCursorScreenPointCompleted', point);
|
||||
});
|
||||
|
||||
socket.on('screen-getMenuBarHeight', () => {
|
||||
var height = screen.getMenuBarHeight();
|
||||
socket.emit('screen-getMenuBarHeightCompleted', height);
|
||||
});
|
||||
|
||||
socket.on('screen-getPrimaryDisplay', () => {
|
||||
var display = screen.getPrimaryDisplay();
|
||||
socket.emit('screen-getPrimaryDisplayCompleted', display);
|
||||
});
|
||||
|
||||
socket.on('screen-getAllDisplays', () => {
|
||||
var display = screen.getAllDisplays();
|
||||
socket.emit('screen-getAllDisplaysCompleted', display);
|
||||
});
|
||||
|
||||
socket.on('screen-getDisplayNearestPoint', (point) => {
|
||||
var display = screen.getDisplayNearestPoint(point);
|
||||
socket.emit('screen-getDisplayNearestPointCompleted', display);
|
||||
});
|
||||
|
||||
socket.on('screen-getDisplayMatching', (rectangle) => {
|
||||
var display = screen.getDisplayMatching(rectangle);
|
||||
socket.emit('screen-getDisplayMatchingCompleted', display);
|
||||
});
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var electron_1 = require("electron");
|
||||
module.exports = function (socket) {
|
||||
socket.on('shell-showItemInFolder', function (fullPath) {
|
||||
var success = electron_1.shell.showItemInFolder(fullPath);
|
||||
socket.emit('shell-showItemInFolderCompleted', success);
|
||||
});
|
||||
socket.on('shell-openItem', function (fullPath) {
|
||||
var success = electron_1.shell.openItem(fullPath);
|
||||
socket.emit('shell-openItemCompleted', success);
|
||||
});
|
||||
socket.on('shell-openExternal', function (url, options, callback) {
|
||||
var success = false;
|
||||
if (options && callback) {
|
||||
success = electron_1.shell.openExternal(url, options, function (error) {
|
||||
socket.emit('shell-openExternalCallback', [url, error]);
|
||||
});
|
||||
}
|
||||
else if (options) {
|
||||
success = electron_1.shell.openExternal(url, options);
|
||||
}
|
||||
else {
|
||||
success = electron_1.shell.openExternal(url);
|
||||
}
|
||||
socket.emit('shell-openExternalCompleted', success);
|
||||
});
|
||||
socket.on('shell-moveItemToTrash', function (fullPath) {
|
||||
var success = electron_1.shell.moveItemToTrash(fullPath);
|
||||
socket.emit('shell-moveItemToTrashCompleted', success);
|
||||
});
|
||||
socket.on('shell-beep', function () {
|
||||
electron_1.shell.beep();
|
||||
});
|
||||
socket.on('shell-writeShortcutLink', function (shortcutPath, operation, options) {
|
||||
var success = electron_1.shell.writeShortcutLink(shortcutPath, operation, options);
|
||||
socket.emit('shell-writeShortcutLinkCompleted', success);
|
||||
});
|
||||
socket.on('shell-readShortcutLink', function (shortcutPath) {
|
||||
var shortcutDetails = electron_1.shell.readShortcutLink(shortcutPath);
|
||||
socket.emit('shell-readShortcutLinkCompleted', shortcutDetails);
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=shell.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"shell.js","sourceRoot":"","sources":["shell.ts"],"names":[],"mappings":";;AAAA,qCAAiC;AAEjC,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,UAAC,QAAQ;QACzC,IAAM,OAAO,GAAG,gBAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAEjD,MAAM,CAAC,IAAI,CAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,UAAC,QAAQ;QACjC,IAAM,OAAO,GAAG,gBAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAEzC,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,UAAC,GAAG,EAAE,OAAO,EAAE,QAAQ;QACnD,IAAI,OAAO,GAAG,KAAK,CAAC;QAEpB,EAAE,CAAC,CAAC,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC;YACtB,OAAO,GAAG,gBAAK,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,UAAC,KAAK;gBAC7C,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YAC5D,CAAC,CAAC,CAAC;QACP,CAAC;QAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YACjB,OAAO,GAAG,gBAAK,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,OAAO,GAAG,gBAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QACtC,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,UAAC,QAAQ;QACxC,IAAM,OAAO,GAAG,gBAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAEhD,MAAM,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE;QACpB,gBAAK,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,UAAC,YAAY,EAAE,SAAS,EAAE,OAAO;QAClE,IAAM,OAAO,GAAG,gBAAK,CAAC,iBAAiB,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAE1E,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,UAAC,YAAY;QAC7C,IAAM,eAAe,GAAG,gBAAK,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QAE7D,MAAM,CAAC,IAAI,CAAC,iCAAiC,EAAE,eAAe,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACP,CAAC,CAAA"}
|
||||
@@ -1,53 +0,0 @@
|
||||
import { shell } from "electron";
|
||||
|
||||
module.exports = (socket: SocketIO.Server) => {
|
||||
socket.on('shell-showItemInFolder', (fullPath) => {
|
||||
const success = shell.showItemInFolder(fullPath);
|
||||
|
||||
socket.emit('shell-showItemInFolderCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('shell-openItem', (fullPath) => {
|
||||
const success = shell.openItem(fullPath);
|
||||
|
||||
socket.emit('shell-openItemCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('shell-openExternal', (url, options, callback) => {
|
||||
let success = false;
|
||||
|
||||
if (options && callback) {
|
||||
success = shell.openExternal(url, options, (error) => {
|
||||
socket.emit('shell-openExternalCallback', [url, error]);
|
||||
});
|
||||
} else if (options) {
|
||||
success = shell.openExternal(url, options);
|
||||
} else {
|
||||
success = shell.openExternal(url);
|
||||
}
|
||||
|
||||
socket.emit('shell-openExternalCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('shell-moveItemToTrash', (fullPath) => {
|
||||
const success = shell.moveItemToTrash(fullPath);
|
||||
|
||||
socket.emit('shell-moveItemToTrashCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('shell-beep', () => {
|
||||
shell.beep();
|
||||
});
|
||||
|
||||
socket.on('shell-writeShortcutLink', (shortcutPath, operation, options) => {
|
||||
const success = shell.writeShortcutLink(shortcutPath, operation, options);
|
||||
|
||||
socket.emit('shell-writeShortcutLinkCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('shell-readShortcutLink', (shortcutPath) => {
|
||||
const shortcutDetails = shell.readShortcutLink(shortcutPath);
|
||||
|
||||
socket.emit('shell-readShortcutLinkCompleted', shortcutDetails);
|
||||
});
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var electron_1 = require("electron");
|
||||
var path = require('path');
|
||||
var tray;
|
||||
module.exports = function (socket) {
|
||||
socket.on('register-tray-click', function (id) {
|
||||
if (tray) {
|
||||
tray.on('click', function (event, bounds) {
|
||||
socket.emit('tray-click-event' + id, [event.__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-right-click', function (id) {
|
||||
if (tray) {
|
||||
tray.on('right-click', function (event, bounds) {
|
||||
socket.emit('tray-right-click-event' + id, [event.__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-double-click', function (id) {
|
||||
if (tray) {
|
||||
tray.on('double-click', function (event, bounds) {
|
||||
socket.emit('tray-double-click-event' + id, [event.__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-balloon-show', function (id) {
|
||||
if (tray) {
|
||||
tray.on('balloon-show', function () {
|
||||
socket.emit('tray-balloon-show-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-balloon-click', function (id) {
|
||||
if (tray) {
|
||||
tray.on('balloon-click', function () {
|
||||
socket.emit('tray-balloon-click-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-balloon-closed', function (id) {
|
||||
if (tray) {
|
||||
tray.on('balloon-closed', function () {
|
||||
socket.emit('tray-balloon-closed-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('create-tray', function (image, menuItems) {
|
||||
var menu = electron_1.Menu.buildFromTemplate(menuItems);
|
||||
addMenuItemClickConnector(menu.items, function (id) {
|
||||
socket.emit("trayMenuItemClicked", id);
|
||||
});
|
||||
var imagePath = path.join(__dirname.replace('api', ''), 'bin', image);
|
||||
tray = new electron_1.Tray(imagePath);
|
||||
tray.setContextMenu(menu);
|
||||
});
|
||||
socket.on('tray-destroy', function () {
|
||||
if (tray) {
|
||||
tray.destroy();
|
||||
}
|
||||
});
|
||||
socket.on('tray-setImage', function (image) {
|
||||
if (tray) {
|
||||
tray.setImage(image);
|
||||
}
|
||||
});
|
||||
socket.on('tray-setPressedImage', function (image) {
|
||||
if (tray) {
|
||||
var img = electron_1.nativeImage.createFromPath(image);
|
||||
tray.setPressedImage(img);
|
||||
}
|
||||
});
|
||||
socket.on('tray-setToolTip', function (toolTip) {
|
||||
if (tray) {
|
||||
tray.setToolTip(toolTip);
|
||||
}
|
||||
});
|
||||
socket.on('tray-setTitle', function (title) {
|
||||
if (tray) {
|
||||
tray.setTitle(title);
|
||||
}
|
||||
});
|
||||
socket.on('tray-setHighlightMode', function (mode) {
|
||||
if (tray) {
|
||||
tray.setHighlightMode(mode);
|
||||
}
|
||||
});
|
||||
socket.on('tray-displayBalloon', function (options) {
|
||||
if (tray) {
|
||||
tray.displayBalloon(options);
|
||||
}
|
||||
});
|
||||
socket.on('tray-isDestroyed', function () {
|
||||
if (tray) {
|
||||
var isDestroyed = tray.isDestroyed();
|
||||
socket.emit('tray-isDestroyedCompleted', isDestroyed);
|
||||
}
|
||||
});
|
||||
function addMenuItemClickConnector(menuItems, callback) {
|
||||
menuItems.forEach(function (item) {
|
||||
if (item.submenu && item.submenu.items.length > 0) {
|
||||
addMenuItemClickConnector(item.submenu.items, callback);
|
||||
}
|
||||
if ("id" in item && item.id) {
|
||||
item.click = function () { callback(item.id); };
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=tray.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"tray.js","sourceRoot":"","sources":["tray.ts"],"names":[],"mappings":";;AAAA,qCAAmD;AACnD,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAI,IAAmB,CAAC;AAExB,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,UAAC,EAAE;QAChC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,KAAK,EAAE,MAAM;gBAC3B,MAAM,CAAC,IAAI,CAAC,kBAAkB,GAAG,EAAE,EAAE,CAAO,KAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YAC3E,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,UAAC,EAAE;QACtC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,UAAC,KAAK,EAAE,MAAM;gBACjC,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,EAAE,EAAE,CAAO,KAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YACjF,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,UAAC,EAAE;QACvC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,MAAM;gBAClC,MAAM,CAAC,IAAI,CAAC,yBAAyB,GAAG,EAAE,EAAE,CAAO,KAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YAClF,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,UAAC,EAAE;QACvC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE;gBACpB,MAAM,CAAC,IAAI,CAAC,yBAAyB,GAAG,EAAE,CAAC,CAAC;YAChD,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE,UAAC,EAAE;QACxC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,eAAe,EAAE;gBACrB,MAAM,CAAC,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC,CAAC;YACjD,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,UAAC,EAAE;QACzC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,gBAAgB,EAAE;gBACtB,MAAM,CAAC,IAAI,CAAC,2BAA2B,GAAG,EAAE,CAAC,CAAC;YAClD,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,aAAa,EAAE,UAAC,KAAK,EAAE,SAAS;QACtC,IAAM,IAAI,GAAG,eAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAE/C,yBAAyB,CAAC,IAAI,CAAC,KAAK,EAAE,UAAC,EAAE;YACrC,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;QAEH,IAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAExE,IAAI,GAAG,IAAI,eAAI,CAAC,SAAS,CAAC,CAAC;QAC3B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE;QACtB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,eAAe,EAAE,UAAC,KAAK;QAC7B,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,sBAAsB,EAAE,UAAC,KAAK;QACpC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,GAAG,GAAG,sBAAW,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YAC5C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,UAAC,OAAO;QACjC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,eAAe,EAAE,UAAC,KAAK;QAC7B,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,UAAC,IAAI;QACpC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,UAAC,OAAO;QACrC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,kBAAkB,EAAE;QAC1B,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACP,IAAI,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YACrC,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE,WAAW,CAAC,CAAC;QAC1D,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,mCAAmC,SAAS,EAAE,QAAQ;QAClD,SAAS,CAAC,OAAO,CAAC,UAAC,IAAI;YACnB,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;gBAChD,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YAC5D,CAAC;YAED,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC1B,IAAI,CAAC,KAAK,GAAG,cAAQ,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9C,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAA"}
|
||||
@@ -1,128 +0,0 @@
|
||||
import { Menu, Tray, nativeImage } from "electron";
|
||||
const path = require('path');
|
||||
let tray: Electron.Tray;
|
||||
|
||||
module.exports = (socket: SocketIO.Server) => {
|
||||
socket.on('register-tray-click', (id) => {
|
||||
if (tray) {
|
||||
tray.on('click', (event, bounds) => {
|
||||
socket.emit('tray-click-event' + id, [(<any>event).__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-tray-right-click', (id) => {
|
||||
if (tray) {
|
||||
tray.on('right-click', (event, bounds) => {
|
||||
socket.emit('tray-right-click-event' + id, [(<any>event).__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-tray-double-click', (id) => {
|
||||
if (tray) {
|
||||
tray.on('double-click', (event, bounds) => {
|
||||
socket.emit('tray-double-click-event' + id, [(<any>event).__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-tray-balloon-show', (id) => {
|
||||
if (tray) {
|
||||
tray.on('balloon-show', () => {
|
||||
socket.emit('tray-balloon-show-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-tray-balloon-click', (id) => {
|
||||
if (tray) {
|
||||
tray.on('balloon-click', () => {
|
||||
socket.emit('tray-balloon-click-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-tray-balloon-closed', (id) => {
|
||||
if (tray) {
|
||||
tray.on('balloon-closed', () => {
|
||||
socket.emit('tray-balloon-closed-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('create-tray', (image, menuItems) => {
|
||||
const menu = Menu.buildFromTemplate(menuItems);
|
||||
|
||||
addMenuItemClickConnector(menu.items, (id) => {
|
||||
socket.emit("trayMenuItemClicked", id);
|
||||
});
|
||||
|
||||
const imagePath = path.join(__dirname.replace('api', ''), 'bin', image);
|
||||
|
||||
tray = new Tray(imagePath);
|
||||
tray.setContextMenu(menu);
|
||||
});
|
||||
|
||||
socket.on('tray-destroy', () => {
|
||||
if (tray) {
|
||||
tray.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-setImage', (image) => {
|
||||
if (tray) {
|
||||
tray.setImage(image);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-setPressedImage', (image) => {
|
||||
if (tray) {
|
||||
let img = nativeImage.createFromPath(image);
|
||||
tray.setPressedImage(img);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-setToolTip', (toolTip) => {
|
||||
if (tray) {
|
||||
tray.setToolTip(toolTip);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-setTitle', (title) => {
|
||||
if (tray) {
|
||||
tray.setTitle(title);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-setHighlightMode', (mode) => {
|
||||
if (tray) {
|
||||
tray.setHighlightMode(mode);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-displayBalloon', (options) => {
|
||||
if (tray) {
|
||||
tray.displayBalloon(options);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-isDestroyed', () => {
|
||||
if (tray) {
|
||||
let isDestroyed = tray.isDestroyed();
|
||||
socket.emit('tray-isDestroyedCompleted', isDestroyed);
|
||||
}
|
||||
});
|
||||
|
||||
function addMenuItemClickConnector(menuItems, callback) {
|
||||
menuItems.forEach((item) => {
|
||||
if (item.submenu && item.submenu.items.length > 0) {
|
||||
addMenuItemClickConnector(item.submenu.items, callback);
|
||||
}
|
||||
|
||||
if ("id" in item && item.id) {
|
||||
item.click = () => { callback(item.id); };
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var electron_1 = require("electron");
|
||||
var fs = require('fs');
|
||||
module.exports = function (socket) {
|
||||
socket.on('register-webContents-crashed', function (id) {
|
||||
var browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.removeAllListeners('crashed');
|
||||
browserWindow.webContents.on('crashed', function (event, killed) {
|
||||
socket.emit('webContents-crashed' + id, killed);
|
||||
});
|
||||
});
|
||||
socket.on('register-webContents-didFinishLoad', function (id) {
|
||||
var browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.removeAllListeners('did-finish-load');
|
||||
browserWindow.webContents.on('did-finish-load', function () {
|
||||
socket.emit('webContents-didFinishLoad' + id);
|
||||
});
|
||||
});
|
||||
socket.on('webContentsOpenDevTools', function (id, options) {
|
||||
if (options) {
|
||||
getWindowById(id).webContents.openDevTools(options);
|
||||
}
|
||||
else {
|
||||
getWindowById(id).webContents.openDevTools();
|
||||
}
|
||||
});
|
||||
socket.on('webContents-printToPDF', function (id, options, path) {
|
||||
getWindowById(id).webContents.printToPDF(options || {}, function (error, data) {
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
fs.writeFile(path, data, function (error) {
|
||||
if (error) {
|
||||
socket.emit('webContents-printToPDF-completed', false);
|
||||
}
|
||||
else {
|
||||
socket.emit('webContents-printToPDF-completed', true);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
function getWindowById(id) {
|
||||
return electron_1.BrowserWindow.fromId(id);
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=webContents.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"webContents.js","sourceRoot":"","sources":["webContents.ts"],"names":[],"mappings":";;AAAA,qCAAyC;AACzC,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzB,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,UAAC,EAAE;QACzC,IAAI,aAAa,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;QAEtC,aAAa,CAAC,WAAW,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACxD,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,UAAC,KAAK,EAAE,MAAM;YAClD,MAAM,CAAC,IAAI,CAAC,qBAAqB,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oCAAoC,EAAE,UAAC,EAAE;QAC/C,IAAI,aAAa,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;QAEtC,aAAa,CAAC,WAAW,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;QAChE,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC,iBAAiB,EAAE;YAC5C,MAAM,CAAC,IAAI,CAAC,2BAA2B,GAAG,EAAE,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,UAAC,EAAE,EAAE,OAAO;QAC7C,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YACV,aAAa,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACxD,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,aAAa,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC;QACjD,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,UAAC,EAAE,EAAE,OAAO,EAAE,IAAI;QAClD,aAAa,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,IAAI,EAAE,EAAE,UAAC,KAAK,EAAE,IAAI;YAChE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACR,MAAM,KAAK,CAAC;YAChB,CAAC;YAED,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,UAAC,KAAK;gBAC7B,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;oBACV,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;gBACzD,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACN,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE,IAAI,CAAC,CAAC;gBACxD,CAAC;YACH,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,uBAAuB,EAAU;QAC7B,MAAM,CAAC,wBAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;AACL,CAAC,CAAC"}
|
||||
@@ -1,50 +0,0 @@
|
||||
import { BrowserWindow } from 'electron';
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = (socket: SocketIO.Server) => {
|
||||
socket.on('register-webContents-crashed', (id) => {
|
||||
var browserWindow = getWindowById(id);
|
||||
|
||||
browserWindow.webContents.removeAllListeners('crashed');
|
||||
browserWindow.webContents.on('crashed', (event, killed) => {
|
||||
socket.emit('webContents-crashed' + id, killed);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-webContents-didFinishLoad', (id) => {
|
||||
let browserWindow = getWindowById(id);
|
||||
|
||||
browserWindow.webContents.removeAllListeners('did-finish-load');
|
||||
browserWindow.webContents.on('did-finish-load', () => {
|
||||
socket.emit('webContents-didFinishLoad' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('webContentsOpenDevTools', (id, options) => {
|
||||
if (options) {
|
||||
getWindowById(id).webContents.openDevTools(options);
|
||||
} else {
|
||||
getWindowById(id).webContents.openDevTools();
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('webContents-printToPDF', (id, options, path) => {
|
||||
getWindowById(id).webContents.printToPDF(options || {}, (error, data) => {
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
fs.writeFile(path, data, (error) => {
|
||||
if (error) {
|
||||
socket.emit('webContents-printToPDF-completed', false);
|
||||
} else {
|
||||
socket.emit('webContents-printToPDF-completed', true);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function getWindowById(id: number): Electron.BrowserWindow {
|
||||
return BrowserWindow.fromId(id);
|
||||
}
|
||||
};
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"executable": "{{executable}}"
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
const { app } = require('electron');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const process = require('child_process').spawn;
|
||||
const portfinder = require('detect-port');
|
||||
let io, browserWindows, ipc, apiProcess, loadURL;
|
||||
let appApi, menu, dialog, notification, tray, webContents;
|
||||
let globalShortcut, shell, screen, clipboard;
|
||||
|
||||
app.on('ready', () => {
|
||||
portfinder(8000, (error, port) => {
|
||||
startSocketApiBridge(port);
|
||||
});
|
||||
});
|
||||
|
||||
function startSocketApiBridge(port) {
|
||||
io = require('socket.io')(port);
|
||||
startAspCoreBackend(port);
|
||||
|
||||
io.on('connection', (socket) => {
|
||||
console.log('ASP.NET Core Application connected...');
|
||||
|
||||
appApi = require('./api/app')(socket, app);
|
||||
browserWindows = require('./api/browserWindows')(socket);
|
||||
ipc = require('./api/ipc')(socket);
|
||||
menu = require('./api/menu')(socket);
|
||||
dialog = require('./api/dialog')(socket);
|
||||
notification = require('./api/notification')(socket);
|
||||
tray = require('./api/tray')(socket);
|
||||
webContents = require('./api/webContents')(socket);
|
||||
globalShortcut = require('./api/globalShortcut')(socket);
|
||||
shell = require('./api/shell')(socket);
|
||||
screen = require('./api/screen')(socket);
|
||||
clipboard = require('./api/clipboard')(socket);
|
||||
});
|
||||
}
|
||||
|
||||
function startAspCoreBackend(electronPort) {
|
||||
portfinder(8000, (error, electronWebPort) => {
|
||||
loadURL = `http://localhost:${electronWebPort}`
|
||||
const parameters = [`/electronPort=${electronPort}`, `/electronWebPort=${electronWebPort}`];
|
||||
|
||||
const manifestFile = require("./bin/electron.manifest.json");
|
||||
let binaryFile = manifestFile.executable;
|
||||
|
||||
const os = require("os");
|
||||
if(os.platform() === "win32") {
|
||||
binaryFile = binaryFile + '.exe';
|
||||
}
|
||||
|
||||
const binFilePath = path.join(__dirname, 'bin', binaryFile);
|
||||
apiProcess = process(binFilePath, parameters);
|
||||
|
||||
apiProcess.stdout.on('data', (data) => {
|
||||
var text = data.toString();
|
||||
console.log(`stdout: ${data.toString()}`);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//app.on('activate', () => {
|
||||
// On macOS it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
// if (win === null) {
|
||||
// createWindow();
|
||||
// }
|
||||
//});
|
||||
1420
ElectronNET.Host/package-lock.json
generated
1420
ElectronNET.Host/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"name": "ElectronNET.Host",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"detect-port": "^1.2.1",
|
||||
"electron": "^1.7.11",
|
||||
"socket.io": "^2.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/electron": "^1.6.10",
|
||||
"@types/socket.io": "^1.4.31"
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ElectronNET.WebApp.Controllers
|
||||
{
|
||||
public class AboutController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="Controllers\ManageWindowsController.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Remove="Views\Windows\HandleErrorCrashes.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Assets\" />
|
||||
<Folder Include="wwwroot\assets\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ElectronNET.API" Version="1.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="ElectronNET.CLI" Version="*" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="Assets\electron.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\electron_32x32.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Update="electron.manifest.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,68 +0,0 @@
|
||||
using ElectronNET.API;
|
||||
using ElectronNET.API.Entities;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ElectronNET.WebApp
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
public Startup(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddMvc();
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
||||
{
|
||||
loggerFactory.AddConsole();
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
routes.MapRoute(
|
||||
name: "default",
|
||||
template: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
|
||||
|
||||
|
||||
if(HybridSupport.IsElectronActive)
|
||||
{
|
||||
ElectronBootstrap();
|
||||
}
|
||||
}
|
||||
|
||||
public async void ElectronBootstrap()
|
||||
{
|
||||
var browserWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions
|
||||
{
|
||||
Width = 1152,
|
||||
Height = 864,
|
||||
Show = false
|
||||
});
|
||||
|
||||
browserWindow.OnReadyToShow += () => browserWindow.Show();
|
||||
browserWindow.SetTitle(Configuration["DemoTitleInSettings"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
<template class="task-template">
|
||||
<section id="clipboard-section" class="section js-section u-category-system">
|
||||
<header class="section-header">
|
||||
<div class="section-wrapper">
|
||||
<h1>
|
||||
<svg class="section-icon"><use xlink:href="assets/img/icons.svg#icon-system"></use></svg>
|
||||
Clipboard
|
||||
</h1>
|
||||
<h3>The <code>Electron.Clipboard</code> provides methods to perform copy and paste operations.</h3>
|
||||
<p>This module also has methods for copying text as markup (HTML) to the clipboard.</p>
|
||||
|
||||
<p>You find the sample source code in <code>Controllers\ClipboardController.cs</code>.</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="demo">
|
||||
<div class="demo-wrapper">
|
||||
<button id="copy-to-demo-toggle" class="js-container-target demo-toggle-button">
|
||||
Copy
|
||||
<div class="demo-meta u-avoid-clicks">Supports: Win, macOS, Linux <span class="demo-meta-divider">|</span> Process: Both</div>
|
||||
</button>
|
||||
<div class="demo-box">
|
||||
<div class="demo-controls">
|
||||
<button class="demo-button" id="copy-to">Copy</button>
|
||||
<input class="demo-input" id="copy-to-input" aria-label="Click copy" placeholder="Click copy."></input>
|
||||
</div>
|
||||
<p>In this example we copy a phrase to the clipboard. After clicking 'Copy' use the text area to paste (CMD + V or CTRL + V) the phrase from the clipboard.</p>
|
||||
<h5>Main Process (C#)</h5>
|
||||
<pre><code class="csharp">Electron.IpcMain.On("copy-to", (text) =>
|
||||
{
|
||||
Electron.Clipboard.WriteText(text.ToString());
|
||||
});</code></pre>
|
||||
<div class="demo-protip">
|
||||
<h2>ProTip</h2>
|
||||
<strong>Electron.js Support in Electron.NET.</strong>
|
||||
<p>The <code>clipboard</code> module is built into Electron.js (therefore you can use this in the renderer processes).</p>
|
||||
<pre><code class="language-js">const clipboard = require('electron').clipboard;
|
||||
|
||||
const copyBtn = document.getElementById('copy-to');
|
||||
const copyInput = document.getElementById('copy-to-input');
|
||||
|
||||
copyBtn.addEventListener('click', () => {
|
||||
if (copyInput.value !== '') copyInput.value = '';
|
||||
copyInput.placeholder = 'Copied! Paste here to see.';
|
||||
clipboard.writeText('Electron Demo!');
|
||||
})</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="demo">
|
||||
<div class="demo-wrapper">
|
||||
<button id="paste-to-demo-toggle" class="js-container-target demo-toggle-button">
|
||||
Paste
|
||||
<div class="demo-meta u-avoid-clicks">Supports: Win, macOS, Linux <span class="demo-meta-divider">|</span> Process: Both</div>
|
||||
</button>
|
||||
<div class="demo-box">
|
||||
<div class="demo-controls">
|
||||
<button class="demo-button" id="paste-to">Paste</button>
|
||||
<span class="demo-response" id="paste-from"></span>
|
||||
</div>
|
||||
<p>In this example we copy a string to the clipboard and then paste the results into a message above.</p>
|
||||
|
||||
<h5>Main Process (C#)</h5>
|
||||
<pre><code class="csharp">Electron.IpcMain.On("paste-to", async (text) =>
|
||||
{
|
||||
Electron.Clipboard.WriteText(text.ToString());
|
||||
string pasteText = await Electron.Clipboard.ReadTextAsync();
|
||||
|
||||
var mainWindow = Electron.WindowManager.BrowserWindows.First();
|
||||
Electron.IpcMain.Send(mainWindow, "paste-from", pasteText);
|
||||
});</code></pre>
|
||||
|
||||
<div class="demo-protip">
|
||||
<h2>ProTip</h2>
|
||||
<strong>Electron.js Support in Electron.NET.</strong>
|
||||
<p>The <code>clipboard</code> module is built into Electron.js (therefore you can use this in the renderer processes).</p>
|
||||
<pre><code class="language-js">const clipboard = require('electron').clipboard;
|
||||
|
||||
const pasteBtn = document.getElementById('paste-to');
|
||||
|
||||
pasteBtn.addEventListener('click', () => {
|
||||
clipboard.writeText('What a demo!');
|
||||
const message = `Clipboard contents: ${clipboard.readText()}`;
|
||||
document.getElementById('paste-from').innerHTML = message;
|
||||
})</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function(){
|
||||
const { ipcRenderer } = require("electron");
|
||||
|
||||
document.getElementById("copy-to").addEventListener("click", () => {
|
||||
document.getElementById('copy-to-input').placeholder = 'Copied! Paste here to see.';
|
||||
ipcRenderer.send("copy-to", "Electron.NET Demo!");
|
||||
});
|
||||
|
||||
document.getElementById("paste-to").addEventListener("click", () => {
|
||||
ipcRenderer.send("paste-to", "What a demo!");
|
||||
});
|
||||
|
||||
ipcRenderer.on("paste-from", (sender, text) => {
|
||||
const message = `Clipboard contents: ${text}`;
|
||||
document.getElementById("paste-from").innerText = message;
|
||||
});
|
||||
|
||||
}());
|
||||
</script>
|
||||
|
||||
</section>
|
||||
</template>
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"executable": "ElectronNET.WebApp"
|
||||
}
|
||||
@@ -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-2024 Gregor Biswanger, Robert Mühsig
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||
<add key="LocalDev" value="artifacts" />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||
</packageSources>
|
||||
|
||||
</configuration>
|
||||
351
README.md
351
README.md
@@ -1,15 +1,10 @@
|
||||
[](https://github.com/ElectronNET/Electron.NET)
|
||||
[](https://github.com/ElectronNET/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)
|
||||
|
||||
AppVeyor (Win/Linux): [](https://ci.appveyor.com/project/robertmuehsig/electron-net/branch/master)
|
||||
Build cross platform desktop apps with .NET 6 and Blazor, ASP.NET Core (Razor Pages, MVC).
|
||||
|
||||
* Checkout AppVeyor Aritfacts: Contains the WebApp sample built for Windows & Linux!
|
||||
|
||||
Travis-CI (Win/macOS/Linux): [](https://travis-ci.org/ElectronNET/Electron.NET)
|
||||
|
||||
Build cross platform desktop apps with .NET Core 2.0 and ASP.NET NET Core.
|
||||
|
||||
Electron.NET is a __wrapper__ around a "normal" Electron application with an embedded ASP.NET Core application. Via our Electron.NET IPC bridge we can invoke Electron APIs from .NET.
|
||||
Electron.NET is a __wrapper__ around a native Electron application with an embedded ASP.NET Core application. Via our Electron.NET IPC bridge we can invoke Electron APIs from .NET.
|
||||
|
||||
The CLI extensions hosts our toolset to build and start Electron.NET applications.
|
||||
|
||||
@@ -17,163 +12,315 @@ The CLI extensions hosts our toolset to build and start Electron.NET application
|
||||
|
||||
Well... there are lots of different approaches how to get a X-plat desktop app running. We thought it would be nice for .NET devs to use the ASP.NET Core environment and just embed it inside a pretty robust X-plat enviroment called Electron. Porting Electron to .NET is not a goal of this project, at least we don't have any clue how to do it. We just combine ASP.NET Core & Electron.
|
||||
|
||||
# NuGet:
|
||||
## 📦 NuGet
|
||||
|
||||
* API [](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 2.0, so our minimum base OS is the same as [.NET Core 2](https://github.com/dotnet/core/blob/master/release-notes/2.0/2.0-supported-os.md).
|
||||
The current Electron.NET CLI builds Windows/macOS/Linux binaries. Our API uses .NET 6, so our minimum base OS is the same as [.NET 6](https://github.com/dotnet/core/blob/main/release-notes/6.0/supported-os.md).
|
||||
|
||||
# Usage:
|
||||
Also you should have installed:
|
||||
|
||||
* npm [contained in nodejs (at least Version 16.17.1)](https://nodejs.org)
|
||||
|
||||
## 💬 Community
|
||||
|
||||
[](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
|
||||
Besides the chat on Gitter and the issues [discussed here](https://github.com/ElectronNET/Electron.NET/issues) you can also use [StackOverflow](https://stackoverflow.com/questions/tagged/electron.net) with the tag `electron.net`.
|
||||
|
||||
If you want to sponsor the further maintenance and development of this project [see the donate section](#🙏-donate).
|
||||
|
||||
## 👩🏫 Usage
|
||||
|
||||
To activate and communicate with the "native" (sort of native...) Electron API include the [ElectronNET.API NuGet package](https://www.nuget.org/packages/ElectronNET.API/) in your ASP.NET Core app.
|
||||
|
||||
````
|
||||
```ps1
|
||||
PM> Install-Package ElectronNET.API
|
||||
````
|
||||
## Program.cs
|
||||
```
|
||||
|
||||
## Setup Using Minimal-API
|
||||
|
||||
You start Electron.NET up with an `UseElectron` WebHostBuilder-Extension and open the Electron Window:
|
||||
|
||||
### Program.cs
|
||||
|
||||
```csharp
|
||||
using ElectronNET.API;
|
||||
using ElectronNET.API.Entities;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.WebHost.UseElectron(args);
|
||||
|
||||
// Is optional, but you can use the Electron.NET API-Classes directly with DI (relevant if you want more encoupled code)
|
||||
builder.Services.AddElectron();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
...
|
||||
|
||||
await app.StartAsync();
|
||||
|
||||
// Open the Electron-Window here
|
||||
await Electron.WindowManager.CreateWindowAsync();
|
||||
|
||||
app.WaitForShutdown();
|
||||
```
|
||||
|
||||
## Setup using Normal-API
|
||||
|
||||
### Program.cs
|
||||
|
||||
You start Electron.NET up with an `UseElectron` WebHostBuilder-Extension.
|
||||
|
||||
```csharp
|
||||
public static IWebHost BuildWebHost(string[] args)
|
||||
{
|
||||
return WebHost.CreateDefaultBuilder(args)
|
||||
.UseElectron(args)
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
}
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseElectron(args);
|
||||
webBuilder.UseStartup<Startup>();
|
||||
});
|
||||
```
|
||||
|
||||
## Startup.cs
|
||||
### Startup.cs
|
||||
|
||||
Open the Electron Window in the Startup.cs file:
|
||||
Open the Electron Window in the *Startup.cs* file:
|
||||
|
||||
```csharp
|
||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
app.UseBrowserLink();
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
}
|
||||
//...
|
||||
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
routes.MapRoute(
|
||||
name: "default",
|
||||
template: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
|
||||
// Open the Electron-Window here
|
||||
Task.Run(async () => await Electron.WindowManager.CreateWindowAsync());
|
||||
Electron.WindowManager.CreateWindowAsync();
|
||||
}
|
||||
```
|
||||
|
||||
__Please note:__ Currently it is important to use ASP.NET Core with MVC. If you are working with the dotnet CLI, use
|
||||
## 🚀 Starting the Application
|
||||
|
||||
dotnet new mvc
|
||||
|
||||
## Start the Application
|
||||
|
||||
For the tooling you will need your dotnet-electronize package [ElectronNET.CLI NuGet package](https://www.nuget.org/packages/ElectronNET.CLI/). This package __must__ be referenced in the .csproj like this:
|
||||
To start the application make sure you have installed the "[ElectronNET.CLI](https://www.nuget.org/packages/ElectronNET.CLI/)" packages as global tool:
|
||||
|
||||
```sh
|
||||
dotnet tool install ElectronNET.CLI -g
|
||||
```
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="ElectronNET.CLI" Version="0.0.9" />
|
||||
</ItemGroup>
|
||||
```
|
||||
Be aware of the version: The current version of the CLI is 0.0.9.
|
||||
|
||||
After you edited the .csproj-file, you need to restore your NuGet packages within your Project. Run the follwoing command in your ASP.NET Core folder:
|
||||
|
||||
```
|
||||
dotnet restore
|
||||
```
|
||||
|
||||
* Make sure you have __node.js v8.6.0__ and on __macOS/Linux__ the electron-packager installed!
|
||||
|
||||
sudo npm install electron-packager --global
|
||||
|
||||
At the first time, you need an Electron.NET project initialization. Type the following command in your ASP.NET Core folder:
|
||||
|
||||
```
|
||||
dotnet electronize init
|
||||
```sh
|
||||
electronize init
|
||||
```
|
||||
|
||||
* Now a electronnet.manifest.json should appear in your ASP.NET Core project
|
||||
* Now run the following:
|
||||
|
||||
```sh
|
||||
electronize start
|
||||
```
|
||||
dotnet electronize start
|
||||
```
|
||||
### Note
|
||||
> Only the first electronize start is slow. The next will go on faster.
|
||||
|
||||
## Debug
|
||||
### Note
|
||||
|
||||
> Only the first `electronize start` is slow. The next will go on faster.
|
||||
|
||||
## 🔭 Develop Electron.NET apps using a file watcher
|
||||
|
||||
The file watcher is included with version 8.31.1 of Electron.NET. For example, a file change can trigger compilation, test execution, or deployment. The Electron.NET window will automatically refresh and new code changes will be visible more quickly. The following Electron.NET CLI command is required:
|
||||
|
||||
```sh
|
||||
electronize start /watch
|
||||
```
|
||||
|
||||
### Note
|
||||
|
||||
> Only the first `electronize start` is slow. The next will go on faster.
|
||||
|
||||
## 🐞 Debugging the Application
|
||||
|
||||
Start your Electron.NET application with the Electron.NET CLI command. In Visual Studio attach to your running application instance. Go in the __Debug__ Menu and click on __Attach to Process...__. Sort by your projectname on the right and select it on the list.
|
||||
|
||||
## Usage of the Electron-API
|
||||
## 📔 Usage of the Electron API
|
||||
|
||||
A complete documentation will follow. Until then take a look in the source code of the sample application:
|
||||
[Electron.NET API Demos](https://github.com/ElectronNET/electron.net-api-demos)
|
||||
|
||||
In this YouTube video, we show you how you can create a new project, use the Electron.NET API, debug a application and build an executable desktop app for Windows: [Electron.NET - Getting Started](https://www.youtube.com/watch?v=nuM6AojRFHk)
|
||||
|
||||
## Build
|
||||
## ⛏ Building Release Artifacts
|
||||
|
||||
Here you need the Electron.NET CLI too. Type following command in your ASP.NET Core folder:
|
||||
Here you need the Electron.NET CLI as well. Type the following command in your ASP.NET Core folder:
|
||||
|
||||
```
|
||||
dotnet electronize build
|
||||
```sh
|
||||
electronize build /target win
|
||||
```
|
||||
|
||||
In your default setting we just build the application for the OS you are running (Windows builds Windows, macOS builds macOS etc.), but this can be changed with:
|
||||
There are additional platforms available:
|
||||
|
||||
```sh
|
||||
electronize build /target win
|
||||
electronize build /target osx
|
||||
electronize build /target linux
|
||||
```
|
||||
dotnet electronize build win
|
||||
dotnet electronize build osx
|
||||
dotnet electronize build linux
|
||||
|
||||
Those three "default" targets will produce x64 packages for those platforms.
|
||||
|
||||
For certain NuGet packages or certain scenarios you may want to build a pure x86 application. To support those things you can define the desired [.NET Core runtime](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog), the [electron platform](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#platform) and [electron architecture](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#arch) like this:
|
||||
|
||||
```sh
|
||||
electronize build /target custom "win7-x86;win32" /electron-arch ia32
|
||||
```
|
||||
|
||||
The end result should be an electron app under your __/bin/desktop__ folder.
|
||||
|
||||
## Starter kits
|
||||
|
||||
There is a React/Typescript/MobX starter kit at https://github.com/yoDon/Electron.NET-React-Typescript-MobX
|
||||
|
||||
### Note
|
||||
|
||||
> macOS builds can't be created on Windows machines because they require symlinks that aren't supported on Windows (per [this Electron issue](https://github.com/electron-userland/electron-packager/issues/71)). macOS builds can be produced on either Linux or macOS machines.
|
||||
|
||||
## 🔄 Update
|
||||
|
||||
# Working with this Repo
|
||||
After an update to the latest Electron.API package, an update to the latest Electron.CLI is always required. In addition, always update the CLI via NuGet:
|
||||
|
||||
This repository consists of the main parts (API & CLI) and it's own "playground" ASP.NET Core application. Both main parts produce local NuGet packages, that are versioned with 1.0.0. The first thing you will need is to run one of the buildAll scripts (.cmd for Windows, the other for macOS/Linux).
|
||||
```sh
|
||||
dotnet tool update ElectronNET.CLI -g
|
||||
```
|
||||
|
||||
## 👨💻 Authors
|
||||
|
||||
* **[Gregor Biswanger](https://github.com/GregorBiswanger)** - (Microsoft MVP, Intel Black Belt and Intel Software Innovator) is a freelance lecturer, consultant, trainer, author and speaker. He is a consultant for large and medium-sized companies, organizations and agencies for software architecture, web- and cross-platform development. You can find Gregor often on the road attending or speaking at international conferences. - [Cross-Platform-Blog](http://www.cross-platform-blog.com) - Twitter [@BFreakout](https://www.twitter.com/BFreakout)
|
||||
* **[Dr. Florian Rappl](https://github.com/FlorianRappl)** - Software Developer - from Munich, Germany. Microsoft MVP & Web Geek. - [The Art of Micro Frontends](https://microfrontends.art) - [Homepage](https://florian-rappl.de) - Twitter [@florianrappl](https://twitter.com/florianrappl)
|
||||
* **[Robert Muehsig](https://github.com/robertmuehsig)** - Software Developer - from Dresden, Germany, now living & working in Switzerland. Microsoft MVP & Web Geek. - [codeinside Blog](https://blog.codeinside.eu) - Twitter [@robert0muehsig](https://twitter.com/robert0muehsig)
|
||||
|
||||
See also the list of [contributors](https://github.com/ElectronNET/Electron.NET/graphs/contributors) who participated in this project.
|
||||
|
||||
## 🙋♀️🙋♂ Contributing
|
||||
|
||||
Feel free to submit a pull request if you find any bugs (to see a list of active issues, visit the [Issues section](https://github.com/ElectronNET/Electron.NET/issues).
|
||||
Please make sure all commits are properly documented.
|
||||
|
||||
## 🧪 Working with this Repo
|
||||
|
||||
This video provides an introduction to development for Electron.NET: [Electron.NET - Contributing Getting Started](https://youtu.be/Po-saU_Z6Ws)
|
||||
|
||||
This repository consists of the main parts (API & CLI) and it's own "playground" ASP.NET Core application. Both main parts produce local NuGet packages, that are versioned with 99.0.0. The first thing you will need is to run one of the build scripts (.cmd or .ps1 for Windows, the .sh for macOS/Linux).
|
||||
|
||||
If you look for pure __[demo projects](https://github.com/ElectronNET)__ checkout the other repositories.
|
||||
|
||||
The problem working with this repository is, that NuGet has a pretty aggressive cache, see [here for further information](https://github.com/ElectronNET/Electron.NET/wiki).
|
||||
|
||||
# Contributing
|
||||
Feel free to submit a pull request if you find any bugs (to see a list of active issues, visit the [Issues section](https://github.com/ElectronNET/Electron.NET/issues).
|
||||
Please make sure all commits are properly documented.
|
||||
## 🙏 Donate
|
||||
|
||||
# Authors
|
||||
We do this open source work in our free time. If you'd like us to invest more time on it, please [donate](https://donorbox.org/electron-net). Donation can be used to increase some issue priority. Thank you!
|
||||
|
||||
* **Gregor Biswanger** - (Microsoft MVP, Intel Black Belt and Intel Software Innovator) is a freelance lecturer, consultant, trainer, author and speaker. He is a consultant for large and medium-sized companies, organizations and agencies for software architecture, web- and cross-platform development. You can find Gregor often on the road attending or speaking at international conferences. - [Cross-Platform-Blog](http://www.cross-platform-blog.com) - Twitter [@BFreakout](https://www.twitter.com/BFreakout)
|
||||
* **Robert Muehsig** - Software Developer - from Dresden, Germany, now living & working in Switzerland. Microsoft MVP & Web Geek. - [codeinside Blog](https://blog.codeinside.eu) - Twitter [@robert0muehsig](https://twitter.com/robert0muehsig)
|
||||
|
||||
See also the list of [contributors](https://github.com/ElectronNET/Electron.NET/graphs/contributors) who participated in this project.
|
||||
|
||||
# License
|
||||
MIT-licensed
|
||||
[](https://donorbox.org/electron-net)
|
||||
|
||||
Alternatively, consider using a GitHub sponsorship for the core maintainers:
|
||||
|
||||
- [Gregor Biswanger](https://github.com/sponsors/GregorBiswanger)
|
||||
- [Florian Rappl](https://github.com/sponsors/FlorianRappl)
|
||||
|
||||
Any support appreciated! 🍻
|
||||
|
||||
## 🎉 License
|
||||
|
||||
MIT-licensed. See [LICENSE](./LICENSE) for details.
|
||||
|
||||
**Enjoy!**
|
||||
|
||||
## 📝 Important notes
|
||||
|
||||
### ElectronNET.API & ElectronNET.CLI Version 9.31.2
|
||||
|
||||
Make sure you also have the new Electron.NET API & CLI 9.31.2 version.
|
||||
|
||||
```sh
|
||||
dotnet tool update ElectronNET.CLI -g
|
||||
```
|
||||
|
||||
This now uses [electron-builder](https://www.electron.build/configuration/configuration) and the necessary configuration to build is made in the **electron.manifest.json** file (on the build part). In addition, own Electron.NET configurations are stored (on the root).
|
||||
|
||||
Please make sure that your **electron.manifest.json** file has the following new structure:
|
||||
|
||||
```json
|
||||
{
|
||||
"executable": "{{executable}}",
|
||||
"splashscreen": {
|
||||
"imageFile": ""
|
||||
},
|
||||
"name": "{{executable}}",
|
||||
"author": "",
|
||||
"singleInstance": false,
|
||||
"build": {
|
||||
"appId": "com.{{executable}}.app",
|
||||
"productName": "{{executable}}",
|
||||
"copyright": "Copyright © 2020",
|
||||
"buildVersion": "1.0.0",
|
||||
"compression": "maximum",
|
||||
"directories": {
|
||||
"output": "../../../bin/Desktop"
|
||||
},
|
||||
"extraResources": [
|
||||
{
|
||||
"from": "./bin",
|
||||
"to": "bin",
|
||||
"filter": ["**/*"]
|
||||
}
|
||||
],
|
||||
"files": [
|
||||
{
|
||||
"from": "./ElectronHostHook/node_modules",
|
||||
"to": "ElectronHostHook/node_modules",
|
||||
"filter": ["**/*"]
|
||||
},
|
||||
"**/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### ElectronNET.CLI Version 0.0.9
|
||||
|
||||
In the Version 0.0.9 the CLI was not a global tool and needed to be registered like this in the *.csproj*:
|
||||
|
||||
```xml
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="ElectronNET.CLI" Version="0.0.9" />
|
||||
</ItemGroup>
|
||||
```
|
||||
|
||||
After you edited the *.csproj* file, you need to restore your NuGet packages within your Project. Run the following command in your ASP.NET Core folder:
|
||||
|
||||
```sh
|
||||
dotnet restore
|
||||
```
|
||||
|
||||
If you still use this version you will need to invoke it like this:
|
||||
|
||||
```sh
|
||||
electronize ...
|
||||
```
|
||||
|
||||
### Node.js Integration
|
||||
|
||||
Electron.NET requires Node.js integration to be enabled for IPC to function. If you are not using the IPC functionality you can disable Node.js integration like so:
|
||||
|
||||
```csharp
|
||||
WebPreferences wp = new WebPreferences();
|
||||
wp.NodeIntegration = false;
|
||||
BrowserWindowOptions browserWindowOptions = new BrowserWindowOptions
|
||||
{
|
||||
WebPreferences = wp
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
### Dependency Injection
|
||||
|
||||
ElectronNET.API can be added to your DI container within the `Startup` class. All of the modules available in Electron will be added as Singletons.
|
||||
|
||||
```csharp
|
||||
using ElectronNET.API;
|
||||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddElectron();
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
version: 1.0.{build}
|
||||
image: Visual Studio 2017
|
||||
build_script:
|
||||
- cmd: buildAll.cmd
|
||||
pull_requests:
|
||||
do_not_increment_build_number: true
|
||||
artifacts:
|
||||
- path: ElectronNET.WebApp\bin\desktop
|
||||
name: Desktop
|
||||
0
artifacts/.gitkeep
Normal file
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 -- "$@"
|
||||
39
buildAll.cmd
39
buildAll.cmd
@@ -1,39 +0,0 @@
|
||||
echo "Start building Electron.NET dev stack..."
|
||||
echo "Restore & Build API"
|
||||
cd ElectronNet.API
|
||||
dotnet restore
|
||||
dotnet build
|
||||
cd ..
|
||||
echo "Restore & Build CLI"
|
||||
cd ElectronNet.CLI
|
||||
dotnet restore
|
||||
dotnet build
|
||||
cd ..
|
||||
echo "Restore & Build WebApp Demo"
|
||||
cd ElectronNet.WebApp
|
||||
dotnet restore
|
||||
dotnet build
|
||||
|
||||
echo "Invoke electronize build in WebApp Demo"
|
||||
|
||||
|
||||
echo "/target xxx (dev-build)"
|
||||
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target custom win7-x86;win32 /dotnet-configuration Debug /electron-arch ia32 /electron-params "--prune=true "
|
||||
|
||||
|
||||
echo "/target win (dev-build)"
|
||||
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target win
|
||||
|
||||
echo "/target linux (dev-build)"
|
||||
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target linux
|
||||
|
||||
echo "/target custom win7-x86;win32 (dev-build)"
|
||||
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target custom win7-x86;win32
|
||||
|
||||
|
||||
:: Be aware, that for non-electronnet-dev environments the correct
|
||||
:: invoke command would be dotnet electronize ...
|
||||
|
||||
:: Not supported on Windows Systems, because of SymLinks...
|
||||
:: echo "/target osx"
|
||||
:: dotnet electronize build /target osx
|
||||
34
buildAll.sh
34
buildAll.sh
@@ -1,34 +0,0 @@
|
||||
dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
||||
echo "Start building Electron.NET dev stack..."
|
||||
echo "Restore & Build API"
|
||||
cd $dir/ElectronNET.API
|
||||
dotnet restore
|
||||
dotnet build
|
||||
cd ..
|
||||
|
||||
echo "Restore & Build CLI"
|
||||
cd $dir/ElectronNET.CLI
|
||||
dotnet restore
|
||||
dotnet build
|
||||
cd ..
|
||||
|
||||
echo "Restore & Build WebApp Demo"
|
||||
cd $dir/ElectronNET.WebApp
|
||||
dotnet restore
|
||||
dotnet build
|
||||
|
||||
echo "Invoke electronize build in WebApp Demo"
|
||||
echo "/target win (dev-build)"
|
||||
dotnet "$dir/ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target win
|
||||
|
||||
echo "/target linux (dev-build)"
|
||||
dotnet "$dir/ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target linux
|
||||
|
||||
echo "/target osx (dev-build)"
|
||||
dotnet "$dir/ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target osx
|
||||
|
||||
echo "/target custom win7-x86;win32 (dev-build)"
|
||||
dotnet "$dir/ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target custom "win7-x86;win32"
|
||||
|
||||
# Be aware, that for non-electronnet-dev environments the correct
|
||||
# invoke command would be dotnet electronize ...
|
||||
@@ -1,12 +0,0 @@
|
||||
echo "Start building Electron.NET dev stack..."
|
||||
echo "Restore & Build API"
|
||||
cd ElectronNet.API
|
||||
dotnet restore
|
||||
dotnet build --configuration Release --force /property:Version=0.0.9
|
||||
dotnet pack /p:Version=0.0.9 --configuration Release --force --output "%~dp0artifacts"
|
||||
cd ..
|
||||
echo "Restore & Build CLI"
|
||||
cd ElectronNet.CLI
|
||||
dotnet restore
|
||||
dotnet build --configuration Release --force /property:Version=0.0.9
|
||||
dotnet pack /p:Version=0.0.9 --configuration Release --force --output "%~dp0artifacts"
|
||||
11
nuke/.editorconfig
Normal file
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>
|
||||
File diff suppressed because it is too large
Load Diff
621
src/ElectronNET.API/AutoUpdater.cs
Normal file
621
src/ElectronNET.API/AutoUpdater.cs
Normal file
@@ -0,0 +1,621 @@
|
||||
using ElectronNET.API.Entities;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
/// <summary>
|
||||
/// Enable apps to automatically update themselves. Based on electron-updater.
|
||||
/// </summary>
|
||||
public sealed class AutoUpdater
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether to automatically download an update when it is found. (Default is true)
|
||||
/// </summary>
|
||||
public bool AutoDownload
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run<bool>(() =>
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("autoUpdater-autoDownload-get-reply", (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdater-autoDownload-get-reply");
|
||||
taskCompletionSource.SetResult((bool)result);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("autoUpdater-autoDownload-get");
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}).Result;
|
||||
}
|
||||
set
|
||||
{
|
||||
BridgeConnector.Socket.Emit("autoUpdater-autoDownload-set", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether to automatically install a downloaded update on app quit (if `QuitAndInstall` was not called before).
|
||||
///
|
||||
/// Applicable only on Windows and Linux.
|
||||
/// </summary>
|
||||
public bool AutoInstallOnAppQuit
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run<bool>(() =>
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("autoUpdater-autoInstallOnAppQuit-get-reply", (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdater-autoInstallOnAppQuit-get-reply");
|
||||
taskCompletionSource.SetResult((bool)result);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("autoUpdater-autoInstallOnAppQuit-get");
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}).Result;
|
||||
}
|
||||
set
|
||||
{
|
||||
BridgeConnector.Socket.Emit("autoUpdater-autoInstallOnAppQuit-set", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// *GitHub provider only.* Whether to allow update to pre-release versions.
|
||||
/// Defaults to "true" if application version contains prerelease components (e.g. "0.12.1-alpha.1", here "alpha" is a prerelease component), otherwise "false".
|
||||
///
|
||||
/// If "true", downgrade will be allowed("allowDowngrade" will be set to "true").
|
||||
/// </summary>
|
||||
public bool AllowPrerelease
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run<bool>(() =>
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("autoUpdater-allowPrerelease-get-reply", (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdater-allowPrerelease-get-reply");
|
||||
taskCompletionSource.SetResult((bool)result);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("autoUpdater-allowPrerelease-get");
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}).Result;
|
||||
}
|
||||
set
|
||||
{
|
||||
BridgeConnector.Socket.Emit("autoUpdater-allowPrerelease-set", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// *GitHub provider only.*
|
||||
/// Get all release notes (from current version to latest), not just the latest (Default is false).
|
||||
/// </summary>
|
||||
public bool FullChangelog
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run<bool>(() =>
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("autoUpdater-fullChangelog-get-reply", (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdater-fullChangelog-get-reply");
|
||||
taskCompletionSource.SetResult((bool)result);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("autoUpdater-fullChangelog-get");
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}).Result;
|
||||
}
|
||||
set
|
||||
{
|
||||
BridgeConnector.Socket.Emit("autoUpdater-fullChangelog-set", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether to allow version downgrade (when a user from the beta channel wants to go back to the stable channel).
|
||||
/// Taken in account only if channel differs (pre-release version component in terms of semantic versioning).
|
||||
/// Default is false.
|
||||
/// </summary>
|
||||
public bool AllowDowngrade
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run<bool>(() =>
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("autoUpdater-allowDowngrade-get-reply", (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdater-allowDowngrade-get-reply");
|
||||
taskCompletionSource.SetResult((bool)result);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("autoUpdater-allowDowngrade-get");
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}).Result;
|
||||
}
|
||||
set
|
||||
{
|
||||
BridgeConnector.Socket.Emit("autoUpdater-allowDowngrade-set", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For test only.
|
||||
/// </summary>
|
||||
public string UpdateConfigPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run<string>(() =>
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
|
||||
BridgeConnector.Socket.On("autoUpdater-updateConfigPath-get-reply", (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdater-updateConfigPath-get-reply");
|
||||
taskCompletionSource.SetResult(result.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("autoUpdater-updateConfigPath-get");
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}).Result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The current application version
|
||||
/// </summary>
|
||||
public Task<SemVer> CurrentVersionAsync
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run<SemVer>(() =>
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<SemVer>();
|
||||
|
||||
BridgeConnector.Socket.On("autoUpdater-currentVersion-get-reply", (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdater-currentVersion-get-reply");
|
||||
SemVer version = ((JObject)result).ToObject<SemVer>();
|
||||
taskCompletionSource.SetResult(version);
|
||||
});
|
||||
BridgeConnector.Socket.Emit("autoUpdater-currentVersion-get");
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the update channel. Not applicable for GitHub.
|
||||
/// 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
|
||||
{
|
||||
return Task.Run<string>(() =>
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
|
||||
BridgeConnector.Socket.On("autoUpdater-channel-get-reply", (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdater-channel-get-reply");
|
||||
taskCompletionSource.SetResult(result.ToString());
|
||||
});
|
||||
BridgeConnector.Socket.Emit("autoUpdater-channel-get");
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The request headers.
|
||||
/// </summary>
|
||||
public Task<Dictionary<string, string>> RequestHeadersAsync
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<Dictionary<string, string>>();
|
||||
BridgeConnector.Socket.On("autoUpdater-requestHeaders-get-reply", (headers) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdater-requestHeaders-get-reply");
|
||||
Dictionary<string, string> result = ((JObject)headers).ToObject<Dictionary<string, string>>();
|
||||
taskCompletionSource.SetResult(result);
|
||||
});
|
||||
BridgeConnector.Socket.Emit("autoUpdater-requestHeaders-get");
|
||||
return taskCompletionSource.Task;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The request headers.
|
||||
/// </summary>
|
||||
public Dictionary<string, string> RequestHeaders
|
||||
{
|
||||
set
|
||||
{
|
||||
BridgeConnector.Socket.Emit("autoUpdater-requestHeaders-set", JObject.FromObject(value, _jsonSerializer));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when there is an error while updating.
|
||||
/// </summary>
|
||||
public event Action<string> OnError
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_error == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-error" + GetHashCode(), (message) =>
|
||||
{
|
||||
_error(message.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-error-event", GetHashCode());
|
||||
}
|
||||
_error += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_error -= value;
|
||||
|
||||
if (_error == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-error" + GetHashCode());
|
||||
}
|
||||
}
|
||||
|
||||
private event Action<string> _error;
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when checking if an update has started.
|
||||
/// </summary>
|
||||
public event Action OnCheckingForUpdate
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_checkingForUpdate == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-checking-for-update" + GetHashCode(), () =>
|
||||
{
|
||||
_checkingForUpdate();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-checking-for-update-event", GetHashCode());
|
||||
}
|
||||
_checkingForUpdate += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_checkingForUpdate -= value;
|
||||
|
||||
if (_checkingForUpdate == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-checking-for-update" + GetHashCode());
|
||||
}
|
||||
}
|
||||
|
||||
private event Action _checkingForUpdate;
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when there is an available update.
|
||||
/// The update is downloaded automatically if AutoDownload is true.
|
||||
/// </summary>
|
||||
public event Action<UpdateInfo> OnUpdateAvailable
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_updateAvailable == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-update-available" + GetHashCode(), (updateInfo) =>
|
||||
{
|
||||
_updateAvailable(JObject.Parse(updateInfo.ToString()).ToObject<UpdateInfo>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-update-available-event", GetHashCode());
|
||||
}
|
||||
_updateAvailable += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_updateAvailable -= value;
|
||||
|
||||
if (_updateAvailable == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-update-available" + GetHashCode());
|
||||
}
|
||||
}
|
||||
|
||||
private event Action<UpdateInfo> _updateAvailable;
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when there is no available update.
|
||||
/// </summary>
|
||||
public event Action<UpdateInfo> OnUpdateNotAvailable
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_updateNotAvailable == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-update-not-available" + GetHashCode(), (updateInfo) =>
|
||||
{
|
||||
_updateNotAvailable(JObject.Parse(updateInfo.ToString()).ToObject<UpdateInfo>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-update-not-available-event", GetHashCode());
|
||||
}
|
||||
_updateNotAvailable += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_updateNotAvailable -= value;
|
||||
|
||||
if (_updateNotAvailable == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-update-not-available" + GetHashCode());
|
||||
}
|
||||
}
|
||||
|
||||
private event Action<UpdateInfo> _updateNotAvailable;
|
||||
|
||||
/// <summary>
|
||||
/// Emitted on download progress.
|
||||
/// </summary>
|
||||
public event Action<ProgressInfo> OnDownloadProgress
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_downloadProgress == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-download-progress" + GetHashCode(), (progressInfo) =>
|
||||
{
|
||||
_downloadProgress(JObject.Parse(progressInfo.ToString()).ToObject<ProgressInfo>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-download-progress-event", GetHashCode());
|
||||
}
|
||||
_downloadProgress += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_downloadProgress -= value;
|
||||
|
||||
if (_downloadProgress == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-download-progress" + GetHashCode());
|
||||
}
|
||||
}
|
||||
|
||||
private event Action<ProgressInfo> _downloadProgress;
|
||||
|
||||
/// <summary>
|
||||
/// Emitted on download complete.
|
||||
/// </summary>
|
||||
public event Action<UpdateInfo> OnUpdateDownloaded
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_updateDownloaded == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-update-downloaded" + GetHashCode(), (updateInfo) =>
|
||||
{
|
||||
_updateDownloaded(JObject.Parse(updateInfo.ToString()).ToObject<UpdateInfo>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-update-downloaded-event", GetHashCode());
|
||||
}
|
||||
_updateDownloaded += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_updateDownloaded -= value;
|
||||
|
||||
if (_updateDownloaded == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-update-downloaded" + GetHashCode());
|
||||
}
|
||||
}
|
||||
|
||||
private event Action<UpdateInfo> _updateDownloaded;
|
||||
|
||||
private static AutoUpdater _autoUpdater;
|
||||
private static object _syncRoot = new object();
|
||||
|
||||
internal AutoUpdater() { }
|
||||
|
||||
internal static AutoUpdater Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_autoUpdater == null)
|
||||
{
|
||||
lock (_syncRoot)
|
||||
{
|
||||
if (_autoUpdater == null)
|
||||
{
|
||||
_autoUpdater = new AutoUpdater();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _autoUpdater;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asks the server whether there is an update.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<UpdateCheckResult> CheckForUpdatesAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<UpdateCheckResult>();
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
|
||||
BridgeConnector.Socket.On("autoUpdaterCheckForUpdatesComplete" + guid, (updateCheckResult) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesComplete" + guid);
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesError" + guid);
|
||||
taskCompletionSource.SetResult(JObject.Parse(updateCheckResult.ToString()).ToObject<UpdateCheckResult>());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
taskCompletionSource.SetException(ex);
|
||||
}
|
||||
});
|
||||
BridgeConnector.Socket.On("autoUpdaterCheckForUpdatesError" + guid, (error) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesComplete" + guid);
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesError" + guid);
|
||||
string message = "An error occurred in CheckForUpdatesAsync";
|
||||
if (error != null && !string.IsNullOrEmpty(error.ToString()))
|
||||
message = JsonConvert.SerializeObject(error);
|
||||
taskCompletionSource.SetException(new Exception(message));
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("autoUpdaterCheckForUpdates", guid);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asks the server whether there is an update.
|
||||
///
|
||||
/// This will immediately download an update, then install when the app quits.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<UpdateCheckResult> CheckForUpdatesAndNotifyAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<UpdateCheckResult>();
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
|
||||
BridgeConnector.Socket.On("autoUpdaterCheckForUpdatesAndNotifyComplete" + guid, (updateCheckResult) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesAndNotifyComplete" + guid);
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesAndNotifyError" + guid);
|
||||
if (updateCheckResult == null)
|
||||
taskCompletionSource.SetResult(null);
|
||||
else
|
||||
taskCompletionSource.SetResult(JObject.Parse(updateCheckResult.ToString()).ToObject<UpdateCheckResult>());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
taskCompletionSource.SetException(ex);
|
||||
}
|
||||
});
|
||||
BridgeConnector.Socket.On("autoUpdaterCheckForUpdatesAndNotifyError" + guid, (error) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesAndNotifyComplete" + guid);
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesAndNotifyError" + guid);
|
||||
string message = "An error occurred in autoUpdaterCheckForUpdatesAndNotify";
|
||||
if (error != null)
|
||||
message = JsonConvert.SerializeObject(error);
|
||||
taskCompletionSource.SetException(new Exception(message));
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("autoUpdaterCheckForUpdatesAndNotify", guid);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restarts the app and installs the update after it has been downloaded.
|
||||
/// It should only be called after `update-downloaded` has been emitted.
|
||||
///
|
||||
/// Note: QuitAndInstall() will close all application windows first and only emit `before-quit` event on `app` after that.
|
||||
/// This is different from the normal quit event sequence.
|
||||
/// </summary>
|
||||
/// <param name="isSilent">*windows-only* Runs the installer in silent mode. Defaults to `false`.</param>
|
||||
/// <param name="isForceRunAfter">Run the app after finish even on silent install. Not applicable for macOS. Ignored if `isSilent` is set to `false`.</param>
|
||||
public void QuitAndInstall(bool isSilent = false, bool isForceRunAfter = false)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("autoUpdaterQuitAndInstall", isSilent, isForceRunAfter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start downloading update manually. You can use this method if "AutoDownload" option is set to "false".
|
||||
/// </summary>
|
||||
/// <returns>Path to downloaded file.</returns>
|
||||
public Task<string> DownloadUpdateAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
|
||||
BridgeConnector.Socket.On("autoUpdaterDownloadUpdateComplete" + guid, (downloadedPath) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdaterDownloadUpdateComplete" + guid);
|
||||
taskCompletionSource.SetResult(downloadedPath.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("autoUpdaterDownloadUpdate", guid);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Feed URL.
|
||||
/// </summary>
|
||||
/// <returns>Feed URL.</returns>
|
||||
public Task<string> GetFeedURLAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
|
||||
BridgeConnector.Socket.On("autoUpdaterGetFeedURLComplete" + guid, (downloadedPath) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdaterGetFeedURLComplete" + guid);
|
||||
taskCompletionSource.SetResult(downloadedPath.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("autoUpdaterGetFeedURL", guid);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
private readonly JsonSerializer _jsonSerializer = new JsonSerializer()
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver()
|
||||
};
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user