Compare commits
545 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b60100171d | ||
![]() |
65e2f342a3 | ||
![]() |
6a695f2abf | ||
![]() |
9289ab8003 | ||
![]() |
f1ea1930f7 | ||
![]() |
fa88faffa2 | ||
![]() |
a7ba540fb1 | ||
![]() |
365fcfd2ef | ||
![]() |
9b9d8b7241 | ||
![]() |
ba7ed276e6 | ||
![]() |
08063c4ce8 | ||
![]() |
0d74a5c1a8 | ||
![]() |
1d852d4bd9 | ||
![]() |
b76af4a8b0 | ||
![]() |
28e26dbf5e | ||
![]() |
46ee2b61a5 | ||
![]() |
bfa3604524 | ||
ab092125b0 | |||
e320d8fbd5 | |||
2d28ce7415 | |||
fd64c77aed | |||
aeaf755d08 | |||
667f52f33b | |||
![]() |
4c5751fccf | ||
![]() |
bd11bc223d | ||
![]() |
ccd04585c4 | ||
![]() |
88ad741f3b | ||
![]() |
29bfcced62 | ||
![]() |
5fac281f37 | ||
![]() |
6698359c08 | ||
![]() |
7bbdb79257 | ||
![]() |
afa40d3532 | ||
![]() |
4afae0fe56 | ||
![]() |
f43e61c7bb | ||
![]() |
646916dc7b | ||
![]() |
563c611e3e | ||
![]() |
579b090c85 | ||
![]() |
f49748da9f | ||
![]() |
534fdd0e49 | ||
![]() |
6070bddd7d | ||
![]() |
d8e2d9fcec | ||
![]() |
615defabb6 | ||
![]() |
0d719ee01f | ||
22c4cfb039 | |||
5f0ffb6f9a | |||
1b2a989441 | |||
![]() |
83dfc7152f | ||
d7e5f53e4f | |||
9b08b39a1f | |||
![]() |
8011f9eed7 | ||
1df791e7a8 | |||
![]() |
bbc2f9046f | ||
117ea7df91 | |||
6ec355f931 | |||
![]() |
343420f1d8 | ||
![]() |
1396c8b1da | ||
![]() |
9900f92133 | ||
![]() |
3be524d169 | ||
ed694ae95b | |||
e9a9e180a8 | |||
a8dfaf6239 | |||
bbdd1c7e01 | |||
e70e1ca4e6 | |||
![]() |
d65c20a05d | ||
f21976cf2d | |||
0c918106bc | |||
6c9ec57d87 | |||
![]() |
b0f491ac88 | ||
![]() |
a426ad9e02 | ||
![]() |
ba75b1583a | ||
![]() |
45068ea932 | ||
![]() |
181e9297a1 | ||
![]() |
e0417d3235 | ||
![]() |
17a244a536 | ||
![]() |
bd27360655 | ||
![]() |
b24eee3ecf | ||
![]() |
9068558a53 | ||
![]() |
9c22948ce9 | ||
![]() |
2b1a5d4c6e | ||
![]() |
2860dda41b | ||
![]() |
5483728a4e | ||
![]() |
32d318be5e | ||
![]() |
f349366b58 | ||
![]() |
73ce979b54 | ||
![]() |
73b95472bc | ||
![]() |
9b832a998d | ||
![]() |
b1087822c9 | ||
![]() |
ef2d35879c | ||
![]() |
83d8eea9ef | ||
![]() |
8cdd992350 | ||
![]() |
b9cb71e11f | ||
![]() |
1a1a7e779a | ||
![]() |
6bcd2ea58e | ||
![]() |
b8a06f7bd7 | ||
![]() |
d44b1a592c | ||
![]() |
d7d556d2f2 | ||
![]() |
850b313269 | ||
![]() |
fe985e1a9c | ||
![]() |
aeea192860 | ||
![]() |
b8be5b2dce | ||
![]() |
ea08d60d58 | ||
![]() |
6493a305f7 | ||
![]() |
bc0a2b89b8 | ||
![]() |
846c2aa42e | ||
![]() |
ac1ec431fd | ||
![]() |
3acaf25376 | ||
![]() |
e8928b6b3b | ||
![]() |
8478ee3752 | ||
![]() |
ead8e3a4fc | ||
![]() |
f73b9df924 | ||
![]() |
d524651da9 | ||
![]() |
2743e5b42d | ||
![]() |
02bd9df059 | ||
![]() |
a5cc132151 | ||
![]() |
92dea1986c | ||
![]() |
c03eb79f81 | ||
![]() |
0ee9c5f97c | ||
![]() |
c283059106 | ||
![]() |
422963517f | ||
![]() |
d2ac0e44be | ||
![]() |
c5acf61f7c | ||
![]() |
197d04a661 | ||
![]() |
99ab7d0eea | ||
![]() |
17f97af52f | ||
![]() |
ed7c897bd2 | ||
![]() |
e4d3c3987f | ||
![]() |
067d8802b6 | ||
![]() |
8f32f64ede | ||
![]() |
90ff3f93f0 | ||
![]() |
ad28b302f9 | ||
![]() |
a0d0976a6a | ||
![]() |
a9c9a0de68 | ||
![]() |
9a967345b9 | ||
![]() |
98a4be655f | ||
![]() |
76de8f3d0b | ||
![]() |
6f886d4f7d | ||
![]() |
a753abb8fd | ||
![]() |
452970d2fd | ||
![]() |
e28c38e04f | ||
![]() |
5d9fe01c69 | ||
![]() |
04227912b0 | ||
![]() |
44dd0805e2 | ||
![]() |
c5c8e527da | ||
![]() |
49f68a8fcc | ||
![]() |
f8a3647308 | ||
![]() |
0a40b1fe0f | ||
![]() |
a1e9434444 | ||
![]() |
d2d96df8be | ||
![]() |
b40f288827 | ||
![]() |
6267cffebe | ||
![]() |
5fe25fb781 | ||
![]() |
d05e979ede | ||
![]() |
1afb126cb5 | ||
![]() |
d52348149a | ||
![]() |
20eac508d3 | ||
![]() |
8ba02a84d3 | ||
![]() |
15be85b4f5 | ||
![]() |
cf5c00ce0e | ||
![]() |
9c185d5577 | ||
![]() |
8b6c401531 | ||
![]() |
92db8994ef | ||
![]() |
aee36661fd | ||
![]() |
feda84fac8 | ||
![]() |
2503cd6372 | ||
![]() |
f321034eeb | ||
![]() |
7573684520 | ||
![]() |
223eaa9fd0 | ||
![]() |
d138a46f25 | ||
![]() |
ce2bbd4a61 | ||
![]() |
85dd4b46b8 | ||
![]() |
166a9d1dbe | ||
![]() |
dfc15354ca | ||
![]() |
57c977deb4 | ||
![]() |
f6cdc2fe79 | ||
![]() |
f42b9c6674 | ||
![]() |
227557f421 | ||
![]() |
0632f68aaf | ||
![]() |
0a9f299527 | ||
![]() |
67f25ab20b | ||
![]() |
ad19a7dc9e | ||
![]() |
dd854a159a | ||
![]() |
879a373e6a | ||
![]() |
ec1b017946 | ||
![]() |
cf75210304 | ||
![]() |
3696f18714 | ||
![]() |
1f7e4e869d | ||
![]() |
ba5b611994 | ||
![]() |
2bcf79efdd | ||
![]() |
d5c101bf19 | ||
![]() |
e9841b4de1 | ||
![]() |
aea0011683 | ||
![]() |
d10528f9fe | ||
![]() |
66ea4d7307 | ||
![]() |
f6ce40a854 | ||
![]() |
bd62d31298 | ||
![]() |
b1cf5fb638 | ||
![]() |
1d6a2a9a60 | ||
![]() |
455be2393e | ||
![]() |
6131a9003b | ||
![]() |
2a17c4bc09 | ||
![]() |
ccc1df9349 | ||
![]() |
d80c7b9fba | ||
![]() |
64c6ce289c | ||
![]() |
67de82a103 | ||
![]() |
357e0446df | ||
![]() |
f2291a57c3 | ||
![]() |
8b862df6ea | ||
![]() |
1c92f69bd4 | ||
![]() |
70833adb44 | ||
![]() |
ab61674b47 | ||
![]() |
c8ddf691ba | ||
![]() |
76afccd9db | ||
![]() |
4882dc673a | ||
![]() |
8546165e59 | ||
![]() |
4cab214635 | ||
![]() |
9a6253d0ef | ||
![]() |
55eac7ecbf | ||
![]() |
057d126658 | ||
![]() |
8efe8ae398 | ||
![]() |
e2cdd803af | ||
![]() |
b6d8cf07f8 | ||
![]() |
1b23cd564e | ||
![]() |
f6ef662344 | ||
![]() |
58b9c926ae | ||
![]() |
81d11a32fe | ||
![]() |
eb9afd5e36 | ||
![]() |
1de0b63907 | ||
![]() |
f89170c37d | ||
![]() |
73ee686a84 | ||
![]() |
e49910e121 | ||
![]() |
83805cba77 | ||
![]() |
32a61d2feb | ||
![]() |
133e20c758 | ||
![]() |
d7c5aa3fa8 | ||
![]() |
f6d59c75c6 | ||
![]() |
fd8c731713 | ||
![]() |
55a552af60 | ||
![]() |
770d18859b | ||
![]() |
22e60edc1f | ||
![]() |
c97fd07f89 | ||
![]() |
7e87cdd5a0 | ||
![]() |
b67eff406f | ||
![]() |
29a5c09ac7 | ||
![]() |
a1668abcd4 | ||
![]() |
2d8ca29935 | ||
![]() |
4f9af817a5 | ||
![]() |
7bd4beb82d | ||
![]() |
1ec57bc4c9 | ||
![]() |
63f14c984d | ||
![]() |
6c227b4a6e | ||
![]() |
b846112c43 | ||
![]() |
23f9b1507d | ||
![]() |
2a0555ea4f | ||
![]() |
0395d0bc7f | ||
![]() |
f2c03cbc34 | ||
![]() |
147c94fd93 | ||
![]() |
0e2ecf16f3 | ||
![]() |
36eb256553 | ||
![]() |
e90ca41c3c | ||
![]() |
5528231cc2 | ||
![]() |
4d01b976f1 | ||
![]() |
ff12b214cd | ||
![]() |
55c9f5296f | ||
![]() |
61e1ed7a59 | ||
![]() |
218cd30152 | ||
![]() |
bf3b819d02 | ||
![]() |
b56c8f711c | ||
![]() |
c5c6ef1cd2 | ||
![]() |
3e01cecdcc | ||
![]() |
966b2f5756 | ||
![]() |
a5743701ea | ||
![]() |
7ea1a523e1 | ||
![]() |
5445459dc7 | ||
![]() |
f2eed13473 | ||
![]() |
af894e7507 | ||
![]() |
94475f7bd1 | ||
![]() |
b5ca0bf392 | ||
![]() |
fdd8479016 | ||
![]() |
c915b385e3 | ||
![]() |
f451c552ec | ||
![]() |
0aa17a26ac | ||
![]() |
41b16a6d75 | ||
![]() |
b5f53dd6c6 | ||
![]() |
5cc2d6652d | ||
![]() |
6fb6226be5 | ||
![]() |
cee5cb3c4d | ||
![]() |
b6fb470b84 | ||
![]() |
6c74ed3869 | ||
![]() |
2c44860a70 | ||
![]() |
169b543f7d | ||
![]() |
efd15fcd62 | ||
![]() |
b372230eae | ||
![]() |
e5cb3e5ae0 | ||
![]() |
8f30b7605b | ||
![]() |
bec29c5bb4 | ||
![]() |
f84a27d705 | ||
![]() |
19f9388a43 | ||
![]() |
f25a412a47 | ||
![]() |
f7a63f17cc | ||
![]() |
aa5963b29b | ||
![]() |
15c4276a81 | ||
![]() |
04b13cbd6c | ||
![]() |
f6971c715b | ||
![]() |
c3e65a5bdd | ||
![]() |
93167f349d | ||
![]() |
b12acddab3 | ||
![]() |
fb9dbf40da | ||
![]() |
1b8bddabc8 | ||
![]() |
a4edbf3bd9 | ||
![]() |
3d13460302 | ||
![]() |
fad656e837 | ||
![]() |
fc986c87a6 | ||
![]() |
80a820ae3d | ||
![]() |
e9e446f8ab | ||
![]() |
b53194184c | ||
![]() |
bcb921cd9d | ||
![]() |
c1632b6b20 | ||
![]() |
88d10d1955 | ||
![]() |
d6fe6234d7 | ||
![]() |
29fcdc0bf8 | ||
![]() |
48ddc6389f | ||
![]() |
a3d722eb16 | ||
![]() |
b386e53ff5 | ||
![]() |
1dd444759b | ||
![]() |
76ea5fdbc1 | ||
![]() |
035325da22 | ||
![]() |
33b2fa7094 | ||
![]() |
b220243b75 | ||
![]() |
f2a077deed | ||
![]() |
d3de1426b2 | ||
![]() |
86b6b94d25 | ||
![]() |
0a19663c33 | ||
![]() |
d236fd9bd9 | ||
![]() |
bc54b79098 | ||
![]() |
5035fa39b7 | ||
![]() |
2395c33995 | ||
![]() |
92ae252210 | ||
![]() |
5d40cf373d | ||
![]() |
9cbcc3ed85 | ||
![]() |
a1f397f9bf | ||
![]() |
540b17448a | ||
![]() |
21fd997554 | ||
![]() |
23b0318591 | ||
![]() |
5727e3b1b8 | ||
![]() |
28164b491b | ||
![]() |
b02d613a28 | ||
![]() |
c18d6d4795 | ||
![]() |
5780cf7c95 | ||
![]() |
cc91fa3653 | ||
![]() |
52ef0b4d6d | ||
![]() |
ef2be78102 | ||
![]() |
9c2dc69e3c | ||
![]() |
8107bf131b | ||
![]() |
0220f46741 | ||
![]() |
e4ad517cb1 | ||
![]() |
792151a8b7 | ||
![]() |
fb67b2f3d1 | ||
![]() |
30c1f07207 | ||
![]() |
562a4554f3 | ||
![]() |
9f22b63227 | ||
![]() |
c96e7a284a | ||
![]() |
dbcd696936 | ||
![]() |
79368aa6dd | ||
![]() |
d661c893d5 | ||
![]() |
ca99404b42 | ||
![]() |
aec03840cc | ||
![]() |
5630eb14c2 | ||
![]() |
6680b0adb2 | ||
![]() |
ff0d881273 | ||
![]() |
ed5d0ea474 | ||
![]() |
997a3ca31c | ||
![]() |
ef444730b7 | ||
![]() |
7bfc6077b9 | ||
![]() |
624bd5a2a4 | ||
![]() |
1e19f9aedf | ||
![]() |
1b4c5ace61 | ||
![]() |
28037e11df | ||
![]() |
036f21de81 | ||
![]() |
43adecaf99 | ||
![]() |
c58e4dccc0 | ||
![]() |
1a1f8b2235 | ||
![]() |
f1616f6532 | ||
![]() |
a42f5ab273 | ||
![]() |
f15139e907 | ||
![]() |
f4399d441d | ||
![]() |
fd4b49e0d5 | ||
![]() |
496a276524 | ||
![]() |
c831df74d0 | ||
![]() |
e77d53fd41 | ||
![]() |
983aff2091 | ||
![]() |
570bc83a6d | ||
![]() |
8dca8bbe65 | ||
![]() |
0e91b47dba | ||
![]() |
3f7e95b502 | ||
![]() |
4f30a47c07 | ||
![]() |
ecbbd6fbf2 | ||
![]() |
13f5648963 | ||
![]() |
dfb7314207 | ||
![]() |
9293801037 | ||
![]() |
d8ac3b2353 | ||
![]() |
056f0e5614 | ||
![]() |
ada5418413 | ||
![]() |
b79e970e66 | ||
![]() |
6fc02edd1e | ||
![]() |
9a8c03106e | ||
![]() |
4a5e41b747 | ||
![]() |
649dcf4019 | ||
![]() |
ae3d1262f5 | ||
![]() |
7b2b0edbdf | ||
![]() |
353746ec04 | ||
![]() |
2fb9b4173a | ||
![]() |
fe7242f36f | ||
![]() |
8015f8486c | ||
![]() |
92d7f8f578 | ||
![]() |
fc9a9f8e09 | ||
![]() |
f94bfc2850 | ||
![]() |
db283fad15 | ||
![]() |
dd7288b787 | ||
![]() |
a6e41b2a90 | ||
![]() |
0e6ac14b74 | ||
![]() |
97f380fb7b | ||
![]() |
3e5b29c84d | ||
![]() |
5d19cc7cf1 | ||
![]() |
19995eba1a | ||
![]() |
990ed0f6bf | ||
![]() |
dc0a085d86 | ||
![]() |
0a852c49e8 | ||
![]() |
59588517d8 | ||
![]() |
3a7cbe48b8 | ||
![]() |
ed298cdfb0 | ||
![]() |
3925c34610 | ||
![]() |
a6fa112050 | ||
![]() |
d97a6a52a4 | ||
![]() |
121846eeae | ||
![]() |
ebef1edc09 | ||
![]() |
bbaf1384ba | ||
![]() |
7036a4da81 | ||
![]() |
91ceb0aa22 | ||
![]() |
de12327ac2 | ||
![]() |
6f65b54883 | ||
![]() |
c0ffd7e641 | ||
![]() |
b0c1ccf9b4 | ||
![]() |
ed3e1aa846 | ||
![]() |
7f720a1753 | ||
![]() |
6cbcbc6f3f | ||
![]() |
53ae9bc42d | ||
![]() |
9813d6946a | ||
![]() |
c7651c9949 | ||
![]() |
34211c4b3f | ||
![]() |
8bc4c247e6 | ||
![]() |
92406a051a | ||
![]() |
56f7578d13 | ||
![]() |
068b074de0 | ||
![]() |
bb0ee3b861 | ||
![]() |
93bb11c135 | ||
![]() |
2fd8c17525 | ||
![]() |
b974487fc4 | ||
![]() |
8198243425 | ||
![]() |
b4addcc125 | ||
![]() |
2d7893b9de | ||
![]() |
60c0ae1049 | ||
![]() |
aaabfa2d01 | ||
![]() |
5c8a1f3677 | ||
![]() |
b37cd74e56 | ||
![]() |
af9a31f4ad | ||
![]() |
7d8838c0ee | ||
![]() |
2c47cfd60e | ||
![]() |
6422f7c576 | ||
![]() |
369a3217f7 | ||
![]() |
f44bf935d3 | ||
![]() |
0e43eee2f3 | ||
![]() |
c6121ab590 | ||
![]() |
72ceeffdad | ||
![]() |
5eb6e9990c | ||
![]() |
3d3769cf5a | ||
![]() |
2a64151f67 | ||
![]() |
34616607a8 | ||
![]() |
796feb05e6 | ||
![]() |
14ae58ca0c | ||
![]() |
b555f46f56 | ||
![]() |
dc5e7e4cb0 | ||
![]() |
deb0b202bf | ||
![]() |
0a5a70f583 | ||
![]() |
f16e825b57 | ||
![]() |
263a8229fa | ||
![]() |
dc7a27a5e3 | ||
![]() |
651865f28a | ||
![]() |
27493d3b23 | ||
![]() |
295bbd62b8 | ||
![]() |
5cf3ae1203 | ||
![]() |
c650e190fb | ||
![]() |
5cd5873ec3 | ||
![]() |
42a66b04c5 | ||
![]() |
a237185e4c | ||
![]() |
df225a3d2f | ||
![]() |
8c59098c28 | ||
![]() |
bbd45df54d | ||
![]() |
8aa0ccd437 | ||
![]() |
74cdd9d055 | ||
![]() |
704f202ce8 | ||
![]() |
fb3082094a | ||
![]() |
7a71cbf756 | ||
![]() |
53c279fa00 | ||
![]() |
8dc542a31c | ||
![]() |
4dee127ce8 | ||
![]() |
3e341e02c8 | ||
![]() |
a673848089 | ||
![]() |
642186678e | ||
![]() |
e37357aea5 | ||
![]() |
967d8ce068 | ||
![]() |
2bb3aa84a7 | ||
![]() |
82ddd3942b | ||
![]() |
ac672092f1 | ||
![]() |
1c6eec61af | ||
![]() |
dda7864c1a | ||
![]() |
ddc13cccec | ||
![]() |
95ac2392e8 | ||
![]() |
0122f9e989 | ||
![]() |
f265f7e773 | ||
![]() |
61307ce584 | ||
![]() |
8f755a5cfc | ||
![]() |
c3addd05f7 | ||
![]() |
bbcfc9fb07 | ||
![]() |
63ac99f97a | ||
![]() |
6d29bce267 | ||
![]() |
6b039288d5 | ||
![]() |
3f803b8107 | ||
![]() |
8c7891809e | ||
![]() |
30729049b3 | ||
![]() |
1a0f80dce7 | ||
![]() |
6973bc8e7d | ||
![]() |
ae3edd67da | ||
![]() |
b66db19c0a | ||
![]() |
36b931f680 | ||
![]() |
9c63054926 | ||
![]() |
4e2e58bb4c | ||
![]() |
ffc6a60ee9 | ||
![]() |
fa1a968b8f | ||
![]() |
471912759a | ||
![]() |
0b76ded5aa | ||
![]() |
76aa95588e | ||
![]() |
6618752b84 | ||
![]() |
af5f39af44 | ||
![]() |
03ef57daeb | ||
![]() |
a059d18195 |
25
.dockerignore
Normal file
25
.dockerignore
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
**/.dockerignore
|
||||||
|
**/.env
|
||||||
|
**/.git
|
||||||
|
**/.gitignore
|
||||||
|
**/.project
|
||||||
|
**/.settings
|
||||||
|
**/.toolstarget
|
||||||
|
**/.vs
|
||||||
|
**/.vscode
|
||||||
|
**/.idea
|
||||||
|
**/*.*proj.user
|
||||||
|
**/*.dbmdl
|
||||||
|
**/*.jfm
|
||||||
|
**/azds.yaml
|
||||||
|
**/bin
|
||||||
|
**/charts
|
||||||
|
**/docker-compose*
|
||||||
|
**/Dockerfile*
|
||||||
|
**/node_modules
|
||||||
|
**/npm-debug.log
|
||||||
|
**/obj
|
||||||
|
**/secrets.dev.yaml
|
||||||
|
**/values.dev.yaml
|
||||||
|
LICENSE
|
||||||
|
README.md
|
101
.github/workflows/release.yaml
vendored
Normal file
101
.github/workflows/release.yaml
vendored
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
env:
|
||||||
|
BUILD_CONFIGURATION: Release
|
||||||
|
DOTNET_NOLOGO: true
|
||||||
|
DOTNET_CLI_TELEMETRY_OPTOUT: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
get-version:
|
||||||
|
name: Get Version
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.version.outputs.version }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
name: Checkout
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Git Version
|
||||||
|
id: version
|
||||||
|
uses: paulhatch/semantic-version@v5.3.0
|
||||||
|
with:
|
||||||
|
tag_prefix: ''
|
||||||
|
major_pattern: 'breaking:'
|
||||||
|
minor_pattern: 'feature:'
|
||||||
|
|
||||||
|
build-nuget:
|
||||||
|
name: Build and Publish Nuget
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [get-version]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
name: Checkout
|
||||||
|
|
||||||
|
- uses: actions/setup-dotnet@v3
|
||||||
|
name: Setup dotnet
|
||||||
|
with:
|
||||||
|
dotnet-version: '8.0.x'
|
||||||
|
|
||||||
|
- name: Restore dependencies
|
||||||
|
run: dotnet restore Torch.Server/Torch.Server.csproj --locked-mode
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: dotnet build Torch.Server/Torch.Server.csproj --no-restore -c ${{ env.BUILD_CONFIGURATION }} -p:Version="${{ needs.get-version.outputs.version }}" -p:AssemblyVersion="${{ needs.get-version.outputs.version }}"
|
||||||
|
|
||||||
|
- run: dotnet pack -c Release ./Torch.API/Torch.API.csproj -o pack -p:Version="${{ needs.get-version.outputs.version }}" -p:AssemblyVersion="${{ needs.get-version.outputs.version }}" --no-build
|
||||||
|
- run: dotnet pack -c Release ./Torch/Torch.csproj -o pack -p:Version="${{ needs.get-version.outputs.version }}" -p:AssemblyVersion="${{ needs.get-version.outputs.version }}" --no-build
|
||||||
|
- run: dotnet pack -c Release ./Torch.Server/Torch.Server.csproj -o pack -p:Version="${{ needs.get-version.outputs.version }}" -p:AssemblyVersion="${{ needs.get-version.outputs.version }}" --no-build
|
||||||
|
|
||||||
|
- name: Install Sleet
|
||||||
|
run: dotnet tool install -g sleet --version 5.1.3
|
||||||
|
- name: Push Nuget Package
|
||||||
|
env:
|
||||||
|
SLEET_FEED_TYPE: s3
|
||||||
|
SLEET_FEED_PATH: https://nuget.storage.yandexcloud.net
|
||||||
|
SLEET_FEED_BUCKETNAME: nuget
|
||||||
|
SLEET_FEED_SERVICEURL: https://storage.yandexcloud.net
|
||||||
|
SLEET_FEED_ACCESSKEYID: ${{ secrets.S3_KEY_ID }}
|
||||||
|
SLEET_FEED_SECRETACCESSKEY: ${{ secrets.S3_KEY }}
|
||||||
|
run: /root/.dotnet/tools/sleet push ./pack
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build and Publish Package
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [get-version]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
name: Checkout
|
||||||
|
|
||||||
|
- uses: actions/setup-dotnet@v3
|
||||||
|
name: Setup dotnet
|
||||||
|
with:
|
||||||
|
dotnet-version: '8.0.x'
|
||||||
|
|
||||||
|
- name: Restore dependencies
|
||||||
|
run: dotnet restore Torch.Server/Torch.Server.csproj --locked-mode -r win-x64
|
||||||
|
|
||||||
|
- name: Publish
|
||||||
|
run: dotnet publish Torch.Server/Torch.Server.csproj --no-restore --sc -r win-x64 -c ${{ env.BUILD_CONFIGURATION }} -o ./publish -p:Version="${{ needs.get-version.outputs.version }}" -p:AssemblyVersion="${{ needs.get-version.outputs.version }}"
|
||||||
|
|
||||||
|
- uses: vimtor/action-zip@v1
|
||||||
|
name: Zip Release
|
||||||
|
with:
|
||||||
|
files: publish/
|
||||||
|
dest: torch-server.zip
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
uses: akkuman/gitea-release-action@v1
|
||||||
|
env:
|
||||||
|
NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18
|
||||||
|
with:
|
||||||
|
tag_name: ${{ needs.get-version.outputs.version }}
|
||||||
|
name: Release v${{ needs.get-version.outputs.version }}
|
||||||
|
body: ${{ steps.github_release.outputs.changelog }}
|
||||||
|
files: |-
|
||||||
|
./torch-server.zip
|
4
.gitignore
vendored
4
.gitignore
vendored
@@ -159,10 +159,6 @@ publish/
|
|||||||
|
|
||||||
# NuGet Packages
|
# NuGet Packages
|
||||||
*.nupkg
|
*.nupkg
|
||||||
# The packages folder can be ignored because of Package Restore
|
|
||||||
**/packages/*
|
|
||||||
# except build/, which is used as an MSBuild target.
|
|
||||||
!**/packages/build/
|
|
||||||
# Uncomment if necessary however generally it will be regenerated when needed
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
#!**/packages/repositories.config
|
#!**/packages/repositories.config
|
||||||
# NuGet v3's project.json files produces more ignoreable files
|
# NuGet v3's project.json files produces more ignoreable files
|
||||||
|
33
CHANGELOG.md
33
CHANGELOG.md
@@ -1,33 +0,0 @@
|
|||||||
# Torch 1.1.229.265
|
|
||||||
* Features
|
|
||||||
- Added more lenient version parsing for plugins (v#.# should work)
|
|
||||||
- Added countdown option to restart command (!restart [seconds])
|
|
||||||
* Fixes
|
|
||||||
- General fixes to work with the latest SE version
|
|
||||||
- Fixed config changes not saving
|
|
||||||
- (hopefully) Fixed issue causing crashes on servers using the Windows Classic theme
|
|
||||||
|
|
||||||
# Torch 1.1.207.7
|
|
||||||
* Notes
|
|
||||||
- This release makes significant changes to TorchConfig.xml. It has been renamed to Torch.cfg and has different options.
|
|
||||||
* Features
|
|
||||||
- Plugins, Torch, and the DS can now all update automatically
|
|
||||||
- Changed command prefix to !
|
|
||||||
- Added manual save command (thanks to Maldark)
|
|
||||||
- Added restart command
|
|
||||||
- Improved instance creation: now creates an entire skeleton instance with blank config
|
|
||||||
- Added instance name to console title
|
|
||||||
* Fixes
|
|
||||||
- Optimized UI so it's snappier and freezes less often
|
|
||||||
- Fixed NetworkManager.RaiseEvent overload that had an off-by-one bug
|
|
||||||
- Fixed chat window so it automatically scrolls down
|
|
||||||
|
|
||||||
# Torch 1.0.182.329
|
|
||||||
* Improved logging, logs now to go the Logs folder and aren't deleted on start
|
|
||||||
* Fixed chat tab not enabling with -autostart
|
|
||||||
* Fixed player list
|
|
||||||
* Watchdog time-out is now configurable in TorchConfig.xml
|
|
||||||
* Fixed infinario log spam
|
|
||||||
* Fixed crash when sending empty message from chat tab
|
|
||||||
* Fixed permissions on Torch commands
|
|
||||||
* Changed plugin StoragePath to the current instance path (per-instance configs)
|
|
8
Directory.Build.props
Normal file
8
Directory.Build.props
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
||||||
|
<EnableWindowsTargeting>true</EnableWindowsTargeting>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
38
Dockerfile
Normal file
38
Dockerfile
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
FROM mcr.microsoft.com/dotnet/runtime:8.0-windowsservercore-ltsc2022 AS base
|
||||||
|
USER $APP_UID
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:8.0-windowsservercore-ltsc2022 AS build
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
WORKDIR /src
|
||||||
|
COPY ["NuGet.config", "."]
|
||||||
|
COPY ["Directory.Build.props", "."]
|
||||||
|
COPY ["Torch.API/Torch.API.csproj", "Torch.API/"]
|
||||||
|
COPY ["Torch/Torch.csproj", "Torch/"]
|
||||||
|
COPY ["Torch.Server/Torch.Server.csproj", "Torch.Server/"]
|
||||||
|
RUN dotnet restore "Torch.Server/Torch.Server.csproj" --locked-mode
|
||||||
|
COPY . .
|
||||||
|
WORKDIR "/src/Torch.Server"
|
||||||
|
RUN dotnet build "Torch.Server.csproj" -c %BUILD_CONFIGURATION% -o /app/build
|
||||||
|
|
||||||
|
FROM build AS publish
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
RUN dotnet publish "Torch.Server.csproj" -c %BUILD_CONFIGURATION% -o /app/publish --no-self-contained /p:UseAppHost=false
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/windows/servercore:ltsc2022
|
||||||
|
|
||||||
|
ADD ["https://aka.ms/dotnet/8.0/windowsdesktop-runtime-win-x64.exe", "installer.exe"]
|
||||||
|
|
||||||
|
RUN installer.exe /install /quiet /norestart && del installer.exe
|
||||||
|
|
||||||
|
ADD ["https://github.com/abbodi1406/vcredist/releases/latest/download/VisualCppRedist_AIO_x86_x64.exe", "vc.exe"]
|
||||||
|
|
||||||
|
USER ContainerAdministrator
|
||||||
|
|
||||||
|
RUN vc.exe /ai39 && del vc.exe
|
||||||
|
|
||||||
|
USER ContainerUser
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=publish /app/publish .
|
||||||
|
ENTRYPOINT ["dotnet", "Torch.Server.dll"]
|
@@ -1,22 +0,0 @@
|
|||||||
pushd
|
|
||||||
|
|
||||||
$steamData = "C:/Steam/Data/"
|
|
||||||
$steamCMDPath = "C:/Steam/steamcmd/"
|
|
||||||
$steamCMDZip = "C:/Steam/steamcmd.zip"
|
|
||||||
|
|
||||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
|
||||||
|
|
||||||
if (!(Test-Path $steamData)) {
|
|
||||||
mkdir "$steamData"
|
|
||||||
}
|
|
||||||
if (!(Test-Path $steamCMDPath)) {
|
|
||||||
if (!(Test-Path $steamCMDZip)) {
|
|
||||||
(New-Object System.Net.WebClient).DownloadFile("https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip", "$steamCMDZip");
|
|
||||||
}
|
|
||||||
[System.IO.Compression.ZipFile]::ExtractToDirectory($steamCMDZip, $steamCMDPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
cd "$steamData"
|
|
||||||
& "$steamCMDPath/steamcmd.exe" "+login anonymous" "+force_install_dir $steamData" "+app_update 298740" "+quit"
|
|
||||||
|
|
||||||
popd
|
|
@@ -1,52 +0,0 @@
|
|||||||
param([string] $ApiBase, [string]$tagName, [string]$authinfo, [string[]] $assetPaths)
|
|
||||||
Add-Type -AssemblyName "System.Web"
|
|
||||||
|
|
||||||
$headers = @{
|
|
||||||
Authorization = "Basic " + [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($authinfo))
|
|
||||||
Accept = "application/vnd.github.v3+json"
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Write-Output("Checking if release with tag " + $tagName + " already exists...")
|
|
||||||
$release = Invoke-RestMethod -Uri ($ApiBase+"releases/tags/$tagName") -Method "GET" -Headers $headers
|
|
||||||
Write-Output(" Using existing release " + $release.id + " at " + $release.html_url)
|
|
||||||
} catch {
|
|
||||||
Write-Output(" Doesn't exist")
|
|
||||||
$rel_arg = @{
|
|
||||||
tag_name=$tagName
|
|
||||||
name="Generated $tagName"
|
|
||||||
body=""
|
|
||||||
draft=$TRUE
|
|
||||||
prerelease=$tagName.Contains("alpha") -or $tagName.Contains("beta")
|
|
||||||
}
|
|
||||||
Write-Output("Creating new release " + $tagName + "...")
|
|
||||||
$release = Invoke-RestMethod -Uri ($ApiBase+"releases") -Method "POST" -Headers $headers -Body (ConvertTo-Json($rel_arg))
|
|
||||||
Write-Output(" Created new release " + $tagName + " at " + $release.html_url)
|
|
||||||
}
|
|
||||||
|
|
||||||
$assetsApiBase = $release.assets_url
|
|
||||||
Write-Output("Checking for existing assets...")
|
|
||||||
$existingAssets = Invoke-RestMethod -Uri ($assetsApiBase) -Method "GET" -Headers $headers
|
|
||||||
$assetLabels = ($assetPaths | ForEach-Object {[System.IO.Path]::GetFileName($_)})
|
|
||||||
foreach ($asset in $existingAssets) {
|
|
||||||
if ($assetLabels -contains $asset.name) {
|
|
||||||
$uri = $asset.url
|
|
||||||
Write-Output(" Deleting old asset " + $asset.name + " (id " + $asset.id + "); URI=" + $uri)
|
|
||||||
$result = Invoke-RestMethod -Uri $uri -Method "DELETE" -Headers $headers
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Write-Output("Uploading assets...")
|
|
||||||
$uploadUrl = $release.upload_url.Substring(0, $release.upload_url.LastIndexOf('{'))
|
|
||||||
foreach ($asset in $assetPaths) {
|
|
||||||
$assetName = [System.IO.Path]::GetFileName($asset)
|
|
||||||
$assetType = [System.Web.MimeMapping]::GetMimeMapping($asset)
|
|
||||||
$assetData = [System.IO.File]::ReadAllBytes($asset)
|
|
||||||
$headerExtra = $headers + @{
|
|
||||||
"Content-Type" = $assetType
|
|
||||||
Name = $assetName
|
|
||||||
}
|
|
||||||
$uri = $uploadUrl + "?name=" + $assetName
|
|
||||||
Write-Output(" Uploading " + $asset + " as " + $assetType + "; URI=" + $uri)
|
|
||||||
$result = Invoke-RestMethod -Uri $uri -Method "POST" -Headers $headerExtra -Body $assetData
|
|
||||||
Write-Output(" ID=" + $result.id + ", found at=" + $result.browser_download_url)
|
|
||||||
}
|
|
73
Jenkinsfile
vendored
73
Jenkinsfile
vendored
@@ -1,73 +0,0 @@
|
|||||||
def packageAndArchive(buildMode, packageName, exclude) {
|
|
||||||
zipFile = "bin\\${packageName}.zip"
|
|
||||||
packageDir = "bin\\${packageName}\\"
|
|
||||||
|
|
||||||
bat "IF EXIST ${zipFile} DEL ${zipFile}"
|
|
||||||
bat "IF EXIST ${packageDir} RMDIR /S /Q ${packageDir}"
|
|
||||||
|
|
||||||
bat "xcopy bin\\x64\\${buildMode} ${packageDir}"
|
|
||||||
if (exclude.length() > 0) {
|
|
||||||
bat "del ${packageDir}${exclude}"
|
|
||||||
}
|
|
||||||
powershell "Add-Type -Assembly System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::CreateFromDirectory(\"\$PWD\\${packageDir}\", \"\$PWD\\${zipFile}\")"
|
|
||||||
archiveArtifacts artifacts: zipFile, caseSensitive: false, onlyIfSuccessful: true
|
|
||||||
}
|
|
||||||
|
|
||||||
node {
|
|
||||||
stage('Checkout') {
|
|
||||||
checkout scm
|
|
||||||
bat 'git pull --tags'
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Acquire SE') {
|
|
||||||
bat 'powershell -File Jenkins/jenkins-grab-se.ps1'
|
|
||||||
bat 'IF EXIST GameBinaries RMDIR GameBinaries'
|
|
||||||
bat 'mklink /J GameBinaries "C:/Steam/Data/DedicatedServer64/"'
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Acquire NuGet Packages') {
|
|
||||||
bat 'nuget restore Torch.sln'
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Build') {
|
|
||||||
currentBuild.description = bat(returnStdout: true, script: '@powershell -File Versioning/version.ps1').trim()
|
|
||||||
if (env.BRANCH_NAME == "master") {
|
|
||||||
buildMode = "Release"
|
|
||||||
} else {
|
|
||||||
buildMode = "Debug"
|
|
||||||
}
|
|
||||||
bat "IF EXIST \"bin\" rmdir /Q /S \"bin\""
|
|
||||||
bat "IF EXIST \"bin-test\" rmdir /Q /S \"bin-test\""
|
|
||||||
bat "\"${tool 'MSBuild'}msbuild\" Torch.sln /p:Configuration=${buildMode} /p:Platform=x64 /t:Clean"
|
|
||||||
bat "\"${tool 'MSBuild'}msbuild\" Torch.sln /p:Configuration=${buildMode} /p:Platform=x64"
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Archive') {
|
|
||||||
archiveArtifacts artifacts: "bin/x64/${buildMode}/Torch*", caseSensitive: false, fingerprint: true, onlyIfSuccessful: true
|
|
||||||
|
|
||||||
packageAndArchive(buildMode, "torch-server", "Torch.Client*")
|
|
||||||
|
|
||||||
/*packageAndArchive(buildMode, "torch-client", "Torch.Server*")*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Disabled because they fail builds more often than they detect actual problems
|
|
||||||
stage('Test') {
|
|
||||||
bat 'IF NOT EXIST reports MKDIR reports'
|
|
||||||
bat "\"packages/xunit.runner.console.2.2.0/tools/xunit.console.exe\" \"bin-test/x64/${buildMode}/Torch.Tests.dll\" \"bin-test/x64/${buildMode}/Torch.Server.Tests.dll\" \"bin-test/x64/${buildMode}/Torch.Client.Tests.dll\" -parallel none -xml \"reports/Torch.Tests.xml\""
|
|
||||||
|
|
||||||
step([
|
|
||||||
$class: 'XUnitBuilder',
|
|
||||||
thresholdMode: 1,
|
|
||||||
thresholds: [[$class: 'FailedThreshold', failureThreshold: '1']],
|
|
||||||
tools: [[
|
|
||||||
$class: 'XUnitDotNetTestType',
|
|
||||||
deleteOutputFiles: true,
|
|
||||||
failIfNotNew: true,
|
|
||||||
pattern: 'reports/*.xml',
|
|
||||||
skipNoTestFiles: false,
|
|
||||||
stopProcessingIfError: true
|
|
||||||
]]
|
|
||||||
])
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
12
NLog.config
12
NLog.config
@@ -4,17 +4,21 @@
|
|||||||
<variable name="logStamp" value="${time} ${pad:padding=-8:inner=[${level:uppercase=true}]}" />
|
<variable name="logStamp" value="${time} ${pad:padding=-8:inner=[${level:uppercase=true}]}" />
|
||||||
<variable name="logContent" value="${message:withException=true}"/>
|
<variable name="logContent" value="${message:withException=true}"/>
|
||||||
|
|
||||||
<targets async="true">
|
<targets>
|
||||||
|
<default-wrapper xsi:type="AsyncWrapper" overflowAction="Block" optimizeBufferReuse="true" />
|
||||||
<target xsi:type="Null" name="null" formatMessage="false" />
|
<target xsi:type="Null" name="null" formatMessage="false" />
|
||||||
<target xsi:type="File" name="keen" layout="${var:logStamp} ${logger}: ${var:logContent}" fileName="Logs\Keen-${shortdate}.log" />
|
<target xsi:type="File" keepFileOpen="true" concurrentWrites="false" name="keen" layout="${var:logStamp} ${logger}: ${var:logContent}"
|
||||||
<target xsi:type="File" name="main" layout="${var:logStamp} ${logger}: ${var:logContent}" fileName="Logs\Torch-${shortdate}.log" />
|
fileName="Logs\Keen-${shortdate}.log" />
|
||||||
|
<target xsi:type="File" keepFileOpen="true" concurrentWrites="false" name="main" layout="${var:logStamp} ${logger}: ${var:logContent}"
|
||||||
|
fileName="Logs\Torch-${shortdate}.log" />
|
||||||
<target xsi:type="File" name="chat" layout="${longdate} ${message}" fileName="Logs\Chat.log" />
|
<target xsi:type="File" name="chat" layout="${longdate} ${message}" fileName="Logs\Chat.log" />
|
||||||
<target xsi:type="ColoredConsole" name="console" layout="${var:logStamp} ${logger:shortName=true}: ${var:logContent}" />
|
<target xsi:type="ColoredConsole" name="console" layout="${var:logStamp} ${logger:shortName=true}: ${var:logContent}" />
|
||||||
<target xsi:type="File" name="patch" layout="${var:logContent}" fileName="Logs\patch.log"/>
|
<target xsi:type="File" name="patch" layout="${var:logContent}" fileName="Logs\patch.log"/>
|
||||||
<target xsi:type="FlowDocument" name="wpf" layout="${var:logStamp} ${logger:shortName=true}: ${var:logContent}" />
|
<target xsi:type="LogViewerTarget" name="wpf" layout="[${level:uppercase=true}] ${logger:shortName=true}: ${var:logContent}" />
|
||||||
</targets>
|
</targets>
|
||||||
|
|
||||||
<rules>
|
<rules>
|
||||||
|
<!-- Do not define custom rules here. Use NLog-user.config -->
|
||||||
<logger name="Keen" minlevel="Warn" writeTo="main"/>
|
<logger name="Keen" minlevel="Warn" writeTo="main"/>
|
||||||
<logger name="Keen" minlevel="Info" writeTo="console, wpf"/>
|
<logger name="Keen" minlevel="Info" writeTo="console, wpf"/>
|
||||||
<logger name="Keen" minlevel="Debug" writeTo="keen" final="true" />
|
<logger name="Keen" minlevel="Debug" writeTo="keen" final="true" />
|
||||||
|
25
README.md
25
README.md
@@ -1,5 +1,3 @@
|
|||||||
[](https://discord.gg/8uHZykr) [](http://build.torchapi.net/job/Torch/job/Torch/job/master/)
|
|
||||||
|
|
||||||
# What is Torch?
|
# What is Torch?
|
||||||
Torch is the successor to SE Server Extender and gives server admins the tools they need to keep their Space Engineers servers running smoothly. It features a user interface with live management tools and a plugin system so you can run your server exactly how you'd like. Torch is still in early development so there may be bugs and incomplete features.
|
Torch is the successor to SE Server Extender and gives server admins the tools they need to keep their Space Engineers servers running smoothly. It features a user interface with live management tools and a plugin system so you can run your server exactly how you'd like. Torch is still in early development so there may be bugs and incomplete features.
|
||||||
|
|
||||||
@@ -12,16 +10,27 @@ Torch is the successor to SE Server Extender and gives server admins the tools t
|
|||||||
* Organized, easy to use configuration editor
|
* Organized, easy to use configuration editor
|
||||||
* Extensible using the Torch plugin system
|
* Extensible using the Torch plugin system
|
||||||
|
|
||||||
|
### Fork Difference
|
||||||
|
* .NET 6.0 runtime
|
||||||
|
* Optimized in-game scripts (also newer compiler & language versions)
|
||||||
|
* Better configuration via cli arguments, environment variables or xml config
|
||||||
|
* Designed to run multiple instance from same install directory without having you to waste disk space
|
||||||
|
* Mostly compatible with original torch's plugins
|
||||||
|
|
||||||
|
### Discord
|
||||||
|
|
||||||
|
If you have any questions or issues please join our [discord](https://discord.gg/UyYFSe3TyQ)
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
* Get the latest Torch release here: https://torchapi.net/download
|
|
||||||
* Unzip the Torch release into its own directory and run the executable. It will automatically download the SE DS and generate the other necessary files.
|
* Unzip the Torch release into its own directory and run the executable. It will automatically download the SE DS and generate the other necessary files.
|
||||||
- If you already have a DS installed you can unzip the Torch files into the folder that contains the DedicatedServer64 folder.
|
- If you already have a DS installed you can:
|
||||||
|
* Unzip the Torch files into the folder that contains the DedicatedServer64 folder.
|
||||||
|
* Pass path to game files using config parameter `gamePath`
|
||||||
|
|
||||||
# Building
|
# Building
|
||||||
To build Torch you must first have a complete SE Dedicated installation somewhere. Before you open the solution, run the Setup batch file and enter the path of that installation's DedicatedServer64 folder. The script will make a symlink to that folder so the Torch solution can find the DLL references it needs.
|
|
||||||
|
|
||||||
In both cases you will need to set the InstancePath in TorchConfig.xml to an existing dedicated server instance as Torch can't fully generate it on its own yet.
|
As a regular dotnet project with cli by running `dotnet build Torch.Server/Torch.Server.csproj`, with VS 2022 or higher, with JB Rider or Fleet.
|
||||||
|
|
||||||
|
If you have a more enjoyable server experience because of Torch, please consider supporting us on Patreon. (https://www.patreon.com/TorchSE)
|
||||||
|
|
||||||
If you have a more enjoyable server experience because of Torch, please consider supporting us on Patreon.
|
|
||||||
[](https://www.patreon.com/bePatron?u=847269)!
|
|
||||||
|
@@ -1,13 +0,0 @@
|
|||||||
:: This script creates a symlink to the game binaries to account for different installation directories on different systems.
|
|
||||||
|
|
||||||
@echo off
|
|
||||||
set /p path="Please enter the folder location of your SpaceEngineersDedicated.exe: "
|
|
||||||
cd %~dp0
|
|
||||||
mklink /J GameBinaries "%path%"
|
|
||||||
if errorlevel 1 goto Error
|
|
||||||
echo Done! You can now open the Torch solution without issue.
|
|
||||||
goto End
|
|
||||||
:Error
|
|
||||||
echo An error occured creating the symlink.
|
|
||||||
:End
|
|
||||||
pause
|
|
30
Torch.API/IApplicationContext.cs
Normal file
30
Torch.API/IApplicationContext.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using System.IO;
|
||||||
|
namespace Torch.API;
|
||||||
|
|
||||||
|
public interface IApplicationContext
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Directory contains torch binaries.
|
||||||
|
/// </summary>
|
||||||
|
public DirectoryInfo TorchDirectory { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Root directory for all game files.
|
||||||
|
/// </summary>
|
||||||
|
public DirectoryInfo GameFilesDirectory { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Directory contains game binaries.
|
||||||
|
/// </summary>
|
||||||
|
public DirectoryInfo GameBinariesDirectory { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Current instance directory.
|
||||||
|
/// </summary>
|
||||||
|
public DirectoryInfo InstanceDirectory { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Current instance name.
|
||||||
|
/// </summary>
|
||||||
|
public string InstanceName { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Application running in service mode.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsService { get; }
|
||||||
|
}
|
@@ -1,11 +1,4 @@
|
|||||||
using System;
|
namespace Torch.API
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using VRage.Game.ModAPI;
|
|
||||||
|
|
||||||
namespace Torch.API
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a player on the server.
|
/// Represents a player on the server.
|
||||||
|
@@ -1,12 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
using Torch.API.Managers;
|
using Torch.API.Managers;
|
||||||
using Torch.API.Session;
|
using Torch.API.Session;
|
||||||
using VRage.Game.ModAPI;
|
using Version = SemanticVersioning.Version;
|
||||||
|
|
||||||
namespace Torch.API
|
namespace Torch.API
|
||||||
{
|
{
|
||||||
@@ -15,30 +14,6 @@ namespace Torch.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ITorchBase
|
public interface ITorchBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Fired when the session begins loading.
|
|
||||||
/// </summary>
|
|
||||||
[Obsolete("Prefer using the TorchSessionManager.SessionStateChanged event")]
|
|
||||||
event Action SessionLoading;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Fired when the session finishes loading.
|
|
||||||
/// </summary>
|
|
||||||
[Obsolete("Prefer using the TorchSessionManager.SessionStateChanged event")]
|
|
||||||
event Action SessionLoaded;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Fires when the session begins unloading.
|
|
||||||
/// </summary>
|
|
||||||
[Obsolete("Prefer using the TorchSessionManager.SessionStateChanged event")]
|
|
||||||
event Action SessionUnloading;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Fired when the session finishes unloading.
|
|
||||||
/// </summary>
|
|
||||||
[Obsolete("Prefer using the TorchSessionManager.SessionStateChanged event")]
|
|
||||||
event Action SessionUnloaded;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the currently running session instance, or null if none exists.
|
/// Gets the currently running session instance, or null if none exists.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -49,6 +24,11 @@ namespace Torch.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
ITorchConfig Config { get; }
|
ITorchConfig Config { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Extended Configuration for the current instance.
|
||||||
|
/// </summary>
|
||||||
|
IConfiguration Configuration { get; }
|
||||||
|
|
||||||
/// <inheritdoc cref="IPluginManager"/>
|
/// <inheritdoc cref="IPluginManager"/>
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
IPluginManager Plugins { get; }
|
IPluginManager Plugins { get; }
|
||||||
@@ -65,7 +45,17 @@ namespace Torch.API
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The binary version of the current instance.
|
/// The binary version of the current instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
InformationalVersion TorchVersion { get; }
|
Version TorchVersion { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Path of the dedicated instance folder.
|
||||||
|
/// </summary>
|
||||||
|
string InstancePath { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Name of the dedicated instance.
|
||||||
|
/// </summary>
|
||||||
|
string InstanceName { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoke an action on the game thread.
|
/// Invoke an action on the game thread.
|
||||||
@@ -104,7 +94,7 @@ namespace Torch.API
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Restart the Torch instance, blocking until the restart has been performed.
|
/// Restart the Torch instance, blocking until the restart has been performed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Restart();
|
void Restart(bool save = true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a save of the game.
|
/// Initializes a save of the game.
|
||||||
@@ -145,15 +135,28 @@ namespace Torch.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
ServerState State { get; }
|
ServerState State { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Path of the dedicated instance folder.
|
|
||||||
/// </summary>
|
|
||||||
string InstancePath { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Raised when the server's Init() method has completed.
|
/// Raised when the server's Init() method has completed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event Action<ITorchServer> Initialized;
|
event Action<ITorchServer> Initialized;
|
||||||
|
|
||||||
|
TimeSpan ElapsedPlayTime { get; set; }
|
||||||
|
|
||||||
|
#region Backwards compat
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Path of the dedicated instance folder.
|
||||||
|
/// </summary>
|
||||||
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
|
new string InstancePath => ((ITorchBase)this).InstancePath;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Name of the dedicated instance.
|
||||||
|
/// </summary>
|
||||||
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
|
new string InstanceName => ((ITorchBase)this).InstanceName;
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Torch.API;
|
||||||
|
|
||||||
namespace Torch
|
namespace Torch
|
||||||
{
|
{
|
||||||
@@ -8,17 +10,45 @@ namespace Torch
|
|||||||
bool ForceUpdate { get; set; }
|
bool ForceUpdate { get; set; }
|
||||||
bool GetPluginUpdates { get; set; }
|
bool GetPluginUpdates { get; set; }
|
||||||
bool GetTorchUpdates { get; set; }
|
bool GetTorchUpdates { get; set; }
|
||||||
|
[Obsolete("Use Torch.InstanceName instead")]
|
||||||
string InstanceName { get; set; }
|
string InstanceName { get; set; }
|
||||||
|
[Obsolete("Use Torch.InstancePath instead")]
|
||||||
string InstancePath { get; set; }
|
string InstancePath { get; set; }
|
||||||
bool NoGui { get; set; }
|
bool NoGui { get; set; }
|
||||||
bool NoUpdate { get; set; }
|
bool NoUpdate { get; set; }
|
||||||
List<string> Plugins { get; set; }
|
List<Guid> Plugins { get; set; }
|
||||||
|
bool LocalPlugins { get; set; }
|
||||||
bool RestartOnCrash { get; set; }
|
bool RestartOnCrash { get; set; }
|
||||||
bool ShouldUpdatePlugins { get; }
|
bool ShouldUpdatePlugins { get; }
|
||||||
bool ShouldUpdateTorch { get; }
|
bool ShouldUpdateTorch { get; }
|
||||||
int TickTimeout { get; set; }
|
int TickTimeout { get; set; }
|
||||||
string WaitForPID { get; set; }
|
string ChatName { get; set; }
|
||||||
|
string ChatColor { get; set; }
|
||||||
|
string TestPlugin { get; set; }
|
||||||
|
bool DisconnectOnRestart { get; set; }
|
||||||
|
int WindowWidth { get; set; }
|
||||||
|
int WindowHeight { get; set; }
|
||||||
|
int FontSize { get; set; }
|
||||||
|
UGCServiceType UgcServiceType { get; set; }
|
||||||
|
bool EntityManagerEnabled { get; set; }
|
||||||
|
string LoginToken { get; set; }
|
||||||
|
UpdateSource UpdateSource { get; set; }
|
||||||
|
List<string> Packages { get; set; }
|
||||||
|
|
||||||
bool Save(string path = null);
|
void Save(string path = null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class UpdateSource
|
||||||
|
{
|
||||||
|
public UpdateSourceType SourceType { get; set; }
|
||||||
|
public string Url { get; set; }
|
||||||
|
public string Repository { get; set; }
|
||||||
|
public string Branch { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum UpdateSourceType
|
||||||
|
{
|
||||||
|
Github,
|
||||||
|
Jenkins
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,52 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Torch.API
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Version in the form v#.#.#.#-info
|
|
||||||
/// </summary>
|
|
||||||
public class InformationalVersion
|
|
||||||
{
|
|
||||||
public Version Version { get; set; }
|
|
||||||
public string[] Information { get; set; }
|
|
||||||
|
|
||||||
public static bool TryParse(string input, out InformationalVersion version)
|
|
||||||
{
|
|
||||||
version = default(InformationalVersion);
|
|
||||||
var trim = input.TrimStart('v');
|
|
||||||
var info = trim.Split('-');
|
|
||||||
if (!Version.TryParse(info[0], out Version result))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
version = new InformationalVersion { Version = result };
|
|
||||||
|
|
||||||
if (info.Length > 1)
|
|
||||||
version.Information = info.Skip(1).ToArray();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
if (Information == null || Information.Length == 0)
|
|
||||||
return $"v{Version}";
|
|
||||||
|
|
||||||
return $"v{Version}-{string.Join("-", Information)}";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static explicit operator InformationalVersion(Version v)
|
|
||||||
{
|
|
||||||
return new InformationalVersion { Version = v };
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator Version(InformationalVersion v)
|
|
||||||
{
|
|
||||||
return v.Version;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,34 +1,51 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Sandbox.Engine.Multiplayer;
|
using Sandbox.Engine.Multiplayer;
|
||||||
using Sandbox.Game.Multiplayer;
|
using Sandbox.Game.Gui;
|
||||||
|
using Torch.Utils;
|
||||||
using VRage.Game;
|
using VRage.Game;
|
||||||
using VRage.Network;
|
using VRageMath;
|
||||||
using VRage.Replication;
|
|
||||||
|
|
||||||
namespace Torch.API.Managers
|
namespace Torch.API.Managers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a scripted or user chat message.
|
/// Represents a scripted or user chat message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public struct TorchChatMessage
|
public readonly struct TorchChatMessage
|
||||||
{
|
{
|
||||||
|
private const string DEFAULT_FONT = MyFontEnum.Blue;
|
||||||
|
|
||||||
|
#region Backwards compatibility
|
||||||
|
|
||||||
|
[Obsolete]
|
||||||
|
public TorchChatMessage(string author, string message, string font = DEFAULT_FONT)
|
||||||
|
: this(author, message, default, font) { }
|
||||||
|
|
||||||
|
[Obsolete]
|
||||||
|
public TorchChatMessage(string author, ulong authorSteamId, string message, ChatChannel channel, long target, string font = DEFAULT_FONT)
|
||||||
|
: this(author, authorSteamId, message, channel, target, default, font) { }
|
||||||
|
|
||||||
|
[Obsolete]
|
||||||
|
public TorchChatMessage(ulong authorSteamId, string message, ChatChannel channel, long target, string font = DEFAULT_FONT)
|
||||||
|
: this(authorSteamId, message, channel, target, default, font) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new torch chat message with the given author and message.
|
/// Creates a new torch chat message with the given author and message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="author">Author's name</param>
|
/// <param name="author">Author's name</param>
|
||||||
/// <param name="message">Message</param>
|
/// <param name="message">Message</param>
|
||||||
/// <param name="font">Font</param>
|
/// <param name="font">Font</param>
|
||||||
public TorchChatMessage(string author, string message, string font = MyFontEnum.Blue)
|
public TorchChatMessage(string author, string message, Color color, string font = DEFAULT_FONT)
|
||||||
{
|
{
|
||||||
Timestamp = DateTime.Now;
|
Timestamp = DateTime.Now;
|
||||||
AuthorSteamId = null;
|
AuthorSteamId = null;
|
||||||
Author = author;
|
Author = author;
|
||||||
Message = message;
|
Message = message;
|
||||||
|
Channel = ChatChannel.Global;
|
||||||
|
Target = 0;
|
||||||
Font = font;
|
Font = font;
|
||||||
|
Color = color == default ? ColorUtils.TranslateColor(font) : color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -38,13 +55,16 @@ namespace Torch.API.Managers
|
|||||||
/// <param name="authorSteamId">Author's steam ID</param>
|
/// <param name="authorSteamId">Author's steam ID</param>
|
||||||
/// <param name="message">Message</param>
|
/// <param name="message">Message</param>
|
||||||
/// <param name="font">Font</param>
|
/// <param name="font">Font</param>
|
||||||
public TorchChatMessage(string author, ulong authorSteamId, string message, string font = MyFontEnum.Blue)
|
public TorchChatMessage(string author, ulong authorSteamId, string message, ChatChannel channel, long target, Color color, string font = DEFAULT_FONT)
|
||||||
{
|
{
|
||||||
Timestamp = DateTime.Now;
|
Timestamp = DateTime.Now;
|
||||||
AuthorSteamId = authorSteamId;
|
AuthorSteamId = authorSteamId;
|
||||||
Author = author;
|
Author = author;
|
||||||
Message = message;
|
Message = message;
|
||||||
|
Channel = channel;
|
||||||
|
Target = target;
|
||||||
Font = font;
|
Font = font;
|
||||||
|
Color = color == default ? ColorUtils.TranslateColor(font) : color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -53,13 +73,16 @@ namespace Torch.API.Managers
|
|||||||
/// <param name="authorSteamId">Author's steam ID</param>
|
/// <param name="authorSteamId">Author's steam ID</param>
|
||||||
/// <param name="message">Message</param>
|
/// <param name="message">Message</param>
|
||||||
/// <param name="font">Font</param>
|
/// <param name="font">Font</param>
|
||||||
public TorchChatMessage(ulong authorSteamId, string message, string font = MyFontEnum.Blue)
|
public TorchChatMessage(ulong authorSteamId, string message, ChatChannel channel, long target, Color color, string font = DEFAULT_FONT)
|
||||||
{
|
{
|
||||||
Timestamp = DateTime.Now;
|
Timestamp = DateTime.Now;
|
||||||
AuthorSteamId = authorSteamId;
|
AuthorSteamId = authorSteamId;
|
||||||
Author = MyMultiplayer.Static?.GetMemberName(authorSteamId) ?? "Player";
|
Author = MyMultiplayer.Static?.GetMemberName(authorSteamId) ?? "Player";
|
||||||
Message = message;
|
Message = message;
|
||||||
|
Channel = channel;
|
||||||
|
Target = target;
|
||||||
Font = font;
|
Font = font;
|
||||||
|
Color = color == default ? ColorUtils.TranslateColor(font) : color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -79,9 +102,21 @@ namespace Torch.API.Managers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly string Message;
|
public readonly string Message;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// The chat channel the message is part of.
|
||||||
|
/// </summary>
|
||||||
|
public readonly ChatChannel Channel;
|
||||||
|
/// <summary>
|
||||||
|
/// The intended recipient of the message.
|
||||||
|
/// </summary>
|
||||||
|
public readonly long Target;
|
||||||
|
/// <summary>
|
||||||
/// The font, or null if default.
|
/// The font, or null if default.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly string Font;
|
public readonly string Font;
|
||||||
|
/// <summary>
|
||||||
|
/// The chat message color.
|
||||||
|
/// </summary>
|
||||||
|
public readonly Color Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@@ -1,9 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using VRage.Collections;
|
||||||
using System.Linq;
|
using VRage.Game;
|
||||||
using System.Text;
|
using VRageMath;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using VRage.Network;
|
|
||||||
|
|
||||||
namespace Torch.API.Managers
|
namespace Torch.API.Managers
|
||||||
{
|
{
|
||||||
@@ -33,13 +31,36 @@ namespace Torch.API.Managers
|
|||||||
void SendMessageAsOther(ulong authorId, string message, ulong targetSteamId = 0);
|
void SendMessageAsOther(ulong authorId, string message, ulong targetSteamId = 0);
|
||||||
|
|
||||||
|
|
||||||
|
[Obsolete("Use the other overload with a Color parameter.")]
|
||||||
|
void SendMessageAsOther(string author, string message, string font, ulong targetSteamId = 0);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a scripted message with the given author and message to the given player, or all players by default.
|
/// Sends a scripted message with the given author and message to the given player, or all players by default.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="author">Author name</param>
|
/// <param name="author">Author name</param>
|
||||||
/// <param name="message">The message to send</param>
|
/// <param name="message">The message to send</param>
|
||||||
|
/// <param name="color">Name color</param>
|
||||||
/// <param name="font">Font to use</param>
|
/// <param name="font">Font to use</param>
|
||||||
/// <param name="targetSteamId">Player to send the message to, or everyone by default</param>
|
/// <param name="targetSteamId">Player to send the message to, or everyone by default</param>
|
||||||
void SendMessageAsOther(string author, string message, string font, ulong targetSteamId = 0);
|
void SendMessageAsOther(string author, string message, Color color = default, ulong targetSteamId = 0, string font = MyFontEnum.White);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Mute user from global chat.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="steamId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool MuteUser(ulong steamId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unmute user from global chat.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="steamId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool UnmuteUser(ulong steamId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Users which are not allowed to chat.
|
||||||
|
/// </summary>
|
||||||
|
HashSetReader<ulong> MutedUsers { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Torch.API.Managers
|
namespace Torch.API.Managers
|
||||||
{
|
{
|
||||||
|
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Torch.API.Managers
|
namespace Torch.API.Managers
|
||||||
{
|
{
|
||||||
|
20
Torch.API/Managers/IInstanceManager.cs
Normal file
20
Torch.API/Managers/IInstanceManager.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using VRage.Game;
|
||||||
|
|
||||||
|
namespace Torch.API.Managers;
|
||||||
|
|
||||||
|
public interface IInstanceManager : IManager
|
||||||
|
{
|
||||||
|
IWorld SelectedWorld { get; }
|
||||||
|
void LoadInstance(string path, bool validate = true);
|
||||||
|
void SelectCreatedWorld(string worldPath);
|
||||||
|
void SelectWorld(string worldPath, bool modsOnly = true);
|
||||||
|
void ImportSelectedWorldConfig();
|
||||||
|
void SaveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IWorld
|
||||||
|
{
|
||||||
|
string WorldPath { get; }
|
||||||
|
MyObjectBuilder_SessionSettings KeenSessionSettings { get; }
|
||||||
|
MyObjectBuilder_Checkpoint KeenCheckpoint { get; }
|
||||||
|
}
|
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace Torch.API.Managers
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Torch.API.Managers
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Base interface for Torch managers.
|
/// Base interface for Torch managers.
|
||||||
|
@@ -1,7 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using VRage.Game;
|
|
||||||
using VRage.Game.ModAPI;
|
using VRage.Game.ModAPI;
|
||||||
|
|
||||||
namespace Torch.API.Managers
|
namespace Torch.API.Managers
|
||||||
|
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace Torch.API.Managers
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Torch.API.Managers
|
|
||||||
{
|
{
|
||||||
public interface IMultiplayerManagerClient : IMultiplayerManagerBase
|
public interface IMultiplayerManagerClient : IMultiplayerManagerBase
|
||||||
{
|
{
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using VRage.Game.ModAPI;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Torch.API.Managers
|
namespace Torch.API.Managers
|
||||||
{
|
{
|
||||||
@@ -21,6 +19,25 @@ namespace Torch.API.Managers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
void BanPlayer(ulong steamId, bool banned = true);
|
void BanPlayer(ulong steamId, bool banned = true);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Promotes user if possible.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="steamId"></param>
|
||||||
|
void PromoteUser(ulong steamId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Demotes user if possible.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="steamId"></param>
|
||||||
|
void DemoteUser(ulong steamId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a user's promote level.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="steamId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
MyPromoteLevel GetUserPromoteLevel(ulong steamId);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of the banned SteamID's
|
/// List of the banned SteamID's
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -42,5 +59,10 @@ namespace Torch.API.Managers
|
|||||||
/// Raised when a player is banned or unbanned. Passes SteamID of player, and true if banned, false if unbanned.
|
/// Raised when a player is banned or unbanned. Passes SteamID of player, and true if banned, false if unbanned.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event Action<ulong, bool> PlayerBanned;
|
event Action<ulong, bool> PlayerBanned;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised when a player is promoted or demoted. Passes SteamID of player, and new promote level.
|
||||||
|
/// </summary>
|
||||||
|
event Action<ulong, MyPromoteLevel> PlayerPromoted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
using VRage;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using VRage;
|
|
||||||
using VRage.Library.Collections;
|
using VRage.Library.Collections;
|
||||||
using VRage.Network;
|
using VRage.Network;
|
||||||
|
|
||||||
|
13
Torch.API/Managers/IPackageManager.cs
Normal file
13
Torch.API/Managers/IPackageManager.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Reflection;
|
||||||
|
using Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
namespace Torch.API.Managers;
|
||||||
|
|
||||||
|
public interface IPackageManager : IManager
|
||||||
|
{
|
||||||
|
IReadOnlySet<Package> Packages { get; }
|
||||||
|
|
||||||
|
bool TryGetPackageAssemblies(Package package, [MaybeNullWhen(false)] out Assembly[] assemblies);
|
||||||
|
}
|
@@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Torch.API.Plugins;
|
using Torch.API.Plugins;
|
||||||
using VRage.Collections;
|
|
||||||
using VRage.Plugins;
|
|
||||||
|
|
||||||
namespace Torch.API.Managers
|
namespace Torch.API.Managers
|
||||||
{
|
{
|
||||||
@@ -14,6 +12,9 @@ namespace Torch.API.Managers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fired when plugins are loaded.
|
/// Fired when plugins are loaded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Fired when plugins are loaded and immediately if subscribed after the plugins are loaded.
|
||||||
|
/// </remarks>
|
||||||
event Action<IReadOnlyCollection<ITorchPlugin>> PluginsLoaded;
|
event Action<IReadOnlyCollection<ITorchPlugin>> PluginsLoaded;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@@ -1,14 +1,4 @@
|
|||||||
using System;
|
namespace Torch.API.ModAPI.Ingame
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Sandbox.Game.Entities.Blocks;
|
|
||||||
using Sandbox.ModAPI.Ingame;
|
|
||||||
using VRage.Game.ModAPI.Ingame;
|
|
||||||
|
|
||||||
namespace Torch.API.ModAPI.Ingame
|
|
||||||
{
|
{
|
||||||
public static class GridExtensions
|
public static class GridExtensions
|
||||||
{
|
{
|
||||||
|
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices.WindowsRuntime;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
//Needed so Torch can set the instance here without exposing anything bad to mods or creating a circular dependency.
|
//Needed so Torch can set the instance here without exposing anything bad to mods or creating a circular dependency.
|
||||||
[assembly: InternalsVisibleTo("Torch")]
|
[assembly: InternalsVisibleTo("Torch")]
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Security.Cryptography.X509Certificates;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Torch.API.Plugins
|
namespace Torch.API.Plugins
|
||||||
{
|
{
|
||||||
@@ -34,5 +29,22 @@ namespace Torch.API.Plugins
|
|||||||
/// This is called on the game thread after each tick.
|
/// This is called on the game thread after each tick.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Plugin's enabled state. Mainly for UI niceness
|
||||||
|
/// </summary>
|
||||||
|
PluginState State { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum PluginState
|
||||||
|
{
|
||||||
|
NotInitialized,
|
||||||
|
DisabledError,
|
||||||
|
DisabledUser,
|
||||||
|
UpdateRequired,
|
||||||
|
UninstallRequested,
|
||||||
|
NotInstalled,
|
||||||
|
MissingDependency,
|
||||||
|
Enabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
using System.Windows.Controls;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
|
|
||||||
namespace Torch.API.Plugins
|
namespace Torch.API.Plugins
|
||||||
{
|
{
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Torch.API.Plugins
|
namespace Torch.API.Plugins
|
||||||
{
|
{
|
||||||
|
@@ -1,17 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
[assembly: AssemblyTitle("Torch API")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("Torch")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © Torch API 2017")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
[assembly: AssemblyConfiguration("Debug")]
|
|
||||||
#else
|
|
||||||
[assembly: AssemblyConfiguration("Release")]
|
|
||||||
#endif
|
|
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace Torch.API
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Torch.API
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to indicate the state of the dedicated server.
|
/// Used to indicate the state of the dedicated server.
|
||||||
|
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace Torch.API.Session
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Torch.API.Session
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The result of a save operation
|
/// The result of a save operation
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
using Sandbox.Game.World;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Sandbox.Game.World;
|
|
||||||
using Torch.API.Managers;
|
using Torch.API.Managers;
|
||||||
|
|
||||||
namespace Torch.API.Session
|
namespace Torch.API.Session
|
||||||
@@ -23,6 +18,11 @@ namespace Torch.API.Session
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
MySession KeenSession { get; }
|
MySession KeenSession { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Currently running world
|
||||||
|
/// </summary>
|
||||||
|
IWorld World { get; }
|
||||||
|
|
||||||
/// <inheritdoc cref="IDependencyManager"/>
|
/// <inheritdoc cref="IDependencyManager"/>
|
||||||
IDependencyManager Managers { get; }
|
IDependencyManager Managers { get; }
|
||||||
|
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.ComponentModel;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Torch.API.Managers;
|
using Torch.API.Managers;
|
||||||
|
using VRage.Game;
|
||||||
|
|
||||||
namespace Torch.API.Session
|
namespace Torch.API.Session
|
||||||
{
|
{
|
||||||
@@ -47,5 +46,29 @@ namespace Torch.API.Session
|
|||||||
/// <returns>true if removed, false if not present</returns>
|
/// <returns>true if removed, false if not present</returns>
|
||||||
/// <exception cref="ArgumentNullException">If the factory is null</exception>
|
/// <exception cref="ArgumentNullException">If the factory is null</exception>
|
||||||
bool RemoveFactory(SessionManagerFactoryDel factory);
|
bool RemoveFactory(SessionManagerFactoryDel factory);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add a mod to be injected into client's world download.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="modId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool AddOverrideMod(ulong modId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes a mod from the injected mod list.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="modId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool RemoveOverrideMod(ulong modId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List over mods that will be injected into client world downloads.
|
||||||
|
/// </summary>
|
||||||
|
IReadOnlyCollection<MyObjectBuilder_Checkpoint.ModItem> OverrideMods { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event raised when injected mod list changes.
|
||||||
|
/// </summary>
|
||||||
|
event Action<CollectionChangeEventArgs> OverrideModsChanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace Torch.API.Session
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Torch.API.Session
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the state of a <see cref="ITorchSession"/>
|
/// Represents the state of a <see cref="ITorchSession"/>
|
||||||
|
@@ -1,201 +1,26 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ProjectGuid>{FBA5D932-6254-4A1E-BAF4-E229FA94E3C2}</ProjectGuid>
|
<AssemblyTitle>Torch API</AssemblyTitle>
|
||||||
<OutputType>Library</OutputType>
|
<Product>Torch</Product>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<Copyright>Copyright © Torch API 2017</Copyright>
|
||||||
<RootNamespace>Torch.API</RootNamespace>
|
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
||||||
<AssemblyName>Torch.API</AssemblyName>
|
<UseWpf>True</UseWpf>
|
||||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<TargetFrameworkProfile />
|
|
||||||
<NuGetPackageImportStamp>
|
|
||||||
</NuGetPackageImportStamp>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<PropertyGroup Condition="$(Configuration) == 'Release'">
|
||||||
<OutputPath>$(SolutionDir)\bin\x64\Debug\</OutputPath>
|
<NoWarn>1591</NoWarn>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
|
||||||
<OutputPath>$(SolutionDir)\bin\x64\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
|
||||||
<DocumentationFile>$(SolutionDir)\bin\x64\Release\Torch.API.xml</DocumentationFile>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="HavokWrapper, Version=1.0.6278.22649, Culture=neutral, processorArchitecture=AMD64">
|
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0" />
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
|
||||||
<HintPath>..\GameBinaries\HavokWrapper.dll</HintPath>
|
<PackageReference Include="NLog" Version="5.3.3" />
|
||||||
<Private>False</Private>
|
<PackageReference Include="NuGet.Commands" Version="6.11.0" />
|
||||||
</Reference>
|
<PackageReference Include="NuGet.DependencyResolver.Core" Version="6.11.0" />
|
||||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
<PackageReference Include="SemanticVersioning" Version="2.0.2" />
|
||||||
<HintPath>..\packages\NLog.4.4.12\lib\net45\NLog.dll</HintPath>
|
<PackageReference Include="SpaceEngineersDedicated.ReferenceAssemblies" Version="1.204.18">
|
||||||
<Private>True</Private>
|
<ExcludeAssets>runtime</ExcludeAssets>
|
||||||
</Reference>
|
</PackageReference>
|
||||||
<Reference Include="PresentationCore" />
|
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
|
||||||
<Reference Include="PresentationFramework" />
|
|
||||||
<Reference Include="Sandbox.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\Sandbox.Common.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Sandbox.Game, Version=0.1.6305.30774, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\Sandbox.Game.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Sandbox.Graphics, Version=0.1.6305.30761, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\Sandbox.Graphics.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="SpaceEngineers.Game, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\SpaceEngineers.Game.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="SpaceEngineers.ObjectBuilders, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\SpaceEngineers.ObjectBuilders.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="SpaceEngineers.ObjectBuilders.XmlSerializers, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\SpaceEngineers.ObjectBuilders.XmlSerializers.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Configuration" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.IO.Compression" />
|
|
||||||
<Reference Include="System.Runtime.Serialization" />
|
|
||||||
<Reference Include="System.ServiceModel" />
|
|
||||||
<Reference Include="System.Transactions" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Net.Http" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
<Reference Include="VRage">
|
|
||||||
<HintPath>..\GameBinaries\VRage.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Audio, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\VRage.Audio.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Dedicated">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Dedicated.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Game, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\VRage.Game.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Game.XmlSerializers, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\VRage.Game.XmlSerializers.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Input, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\VRage.Input.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Library">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Library.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Math, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\VRage.Math.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Native, Version=0.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\VRage.Native.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.OpenVRWrapper, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\VRage.OpenVRWrapper.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Render, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\VRage.Render.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Render11, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\VRage.Render11.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Scripting, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\VRage.Scripting.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="..\Versioning\AssemblyVersion.cs">
|
|
||||||
<Link>Properties\AssemblyVersion.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="ConnectionState.cs" />
|
|
||||||
<Compile Include="InformationalVersion.cs" />
|
|
||||||
<Compile Include="ITorchConfig.cs" />
|
|
||||||
<Compile Include="Managers\DependencyManagerExtensions.cs" />
|
|
||||||
<Compile Include="Managers\DependencyProviderExtensions.cs" />
|
|
||||||
<Compile Include="Event\EventHandlerAttribute.cs" />
|
|
||||||
<Compile Include="Event\IEvent.cs" />
|
|
||||||
<Compile Include="Event\IEventHandler.cs" />
|
|
||||||
<Compile Include="Managers\IChatManagerClient.cs" />
|
|
||||||
<Compile Include="Managers\IChatManagerServer.cs" />
|
|
||||||
<Compile Include="Managers\IDependencyManager.cs" />
|
|
||||||
<Compile Include="Managers\IDependencyProvider.cs" />
|
|
||||||
<Compile Include="Event\IEventManager.cs" />
|
|
||||||
<Compile Include="Managers\IManager.cs" />
|
|
||||||
<Compile Include="Managers\IMultiplayerManagerClient.cs" />
|
|
||||||
<Compile Include="Managers\IMultiplayerManagerBase.cs" />
|
|
||||||
<Compile Include="IPlayer.cs" />
|
|
||||||
<Compile Include="Managers\IMultiplayerManagerServer.cs" />
|
|
||||||
<Compile Include="Managers\INetworkManager.cs" />
|
|
||||||
<Compile Include="Managers\IPluginManager.cs" />
|
|
||||||
<Compile Include="Plugins\ITorchPlugin.cs" />
|
|
||||||
<Compile Include="IServerControls.cs" />
|
|
||||||
<Compile Include="ITorchBase.cs" />
|
|
||||||
<Compile Include="Plugins\IWpfPlugin.cs" />
|
|
||||||
<Compile Include="ModAPI\Ingame\GridExtensions.cs" />
|
|
||||||
<Compile Include="Plugins\PluginAttribute.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="ServerState.cs" />
|
|
||||||
<Compile Include="ModAPI\TorchAPI.cs" />
|
|
||||||
<Compile Include="Session\GameSaveResult.cs" />
|
|
||||||
<Compile Include="Session\ITorchSession.cs" />
|
|
||||||
<Compile Include="Session\ITorchSessionManager.cs" />
|
|
||||||
<Compile Include="Session\TorchSessionState.cs" />
|
|
||||||
<Compile Include="TorchGameState.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="packages.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup />
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<Import Project="$(SolutionDir)\TransformOnBuild.targets" />
|
|
||||||
</Project>
|
</Project>
|
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
using Sandbox;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Sandbox;
|
|
||||||
|
|
||||||
namespace Torch.API
|
namespace Torch.API
|
||||||
{
|
{
|
||||||
|
8
Torch.API/UGCServiceType.cs
Normal file
8
Torch.API/UGCServiceType.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Torch.API
|
||||||
|
{
|
||||||
|
public enum UGCServiceType
|
||||||
|
{
|
||||||
|
Steam,
|
||||||
|
EOS
|
||||||
|
}
|
||||||
|
}
|
40
Torch.API/Utils/ColorUtils.cs
Normal file
40
Torch.API/Utils/ColorUtils.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
using System.Windows.Media;
|
||||||
|
using VRage.Game;
|
||||||
|
using Color = VRageMath.Color;
|
||||||
|
|
||||||
|
namespace Torch.Utils
|
||||||
|
{
|
||||||
|
public static class ColorUtils
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Convert the old "font" or a RGB hex code to a Color.
|
||||||
|
/// </summary>
|
||||||
|
public static Color TranslateColor(string font)
|
||||||
|
{
|
||||||
|
if (StringUtils.IsFontEnum(font))
|
||||||
|
{
|
||||||
|
// RGB values copied from Fonts.sbc
|
||||||
|
switch (font)
|
||||||
|
{
|
||||||
|
case MyFontEnum.Blue:
|
||||||
|
return new Color(220, 244, 252);
|
||||||
|
case MyFontEnum.Red:
|
||||||
|
return new Color(227, 65, 65);
|
||||||
|
case MyFontEnum.Green:
|
||||||
|
return new Color(101, 182, 193);
|
||||||
|
case MyFontEnum.DarkBlue:
|
||||||
|
return new Color(94, 115, 127);
|
||||||
|
default:
|
||||||
|
return Color.White;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// VRage color doesn't have its own hex code parser and I don't want to write one
|
||||||
|
var conv = (System.Windows.Media.Color)(ColorConverter.ConvertFromString(font) ??
|
||||||
|
System.Windows.Media.Color.FromRgb(255, 255, 255));
|
||||||
|
return new Color(conv.R, conv.G, conv.B);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
Torch.API/Utils/SemanticVersionConverter.cs
Normal file
21
Torch.API/Utils/SemanticVersionConverter.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using Version = SemanticVersioning.Version;
|
||||||
|
|
||||||
|
namespace Torch.API.Utils;
|
||||||
|
|
||||||
|
public class SemanticVersionConverter : JsonConverter<Version>
|
||||||
|
{
|
||||||
|
public override Version? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
Version.TryParse(reader.GetString(), out var ver);
|
||||||
|
return ver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Write(Utf8JsonWriter writer, Version value, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
writer.WriteStringValue(value.ToString());
|
||||||
|
}
|
||||||
|
}
|
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Torch.Utils
|
namespace Torch.Utils
|
||||||
{
|
{
|
||||||
@@ -60,5 +60,13 @@ namespace Torch.Utils
|
|||||||
}
|
}
|
||||||
return builder?.ToString() ?? "";
|
return builder?.ToString() ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string[] FontEnumValues => _fontEnumValues ?? (_fontEnumValues = typeof(VRage.Game.MyFontEnum).GetFields(BindingFlags.Public | BindingFlags.Static).Where(x => x.IsLiteral && !x.IsInitOnly).Select(x => (string)x.GetValue(null)).ToArray());
|
||||||
|
|
||||||
|
private static string[] _fontEnumValues;
|
||||||
|
public static bool IsFontEnum(string str)
|
||||||
|
{
|
||||||
|
return FontEnumValues.Contains(str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
12
Torch.API/WebAPI/Plugin/IPluginQuery.cs
Normal file
12
Torch.API/WebAPI/Plugin/IPluginQuery.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugin;
|
||||||
|
|
||||||
|
public interface IPluginQuery
|
||||||
|
{
|
||||||
|
Task<PluginsResponse> QueryAll();
|
||||||
|
Task<PluginItem> QueryOne(Guid guid);
|
||||||
|
Task<bool> DownloadPlugin(Guid guid, string path = null);
|
||||||
|
Task<bool> DownloadPlugin(PluginItem item, string path = null);
|
||||||
|
}
|
81
Torch.API/WebAPI/Plugin/LegacyPluginQuery.cs
Normal file
81
Torch.API/WebAPI/Plugin/LegacyPluginQuery.cs
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Json;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using NLog;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugin;
|
||||||
|
|
||||||
|
public class LegacyPluginQuery : IPluginQuery
|
||||||
|
{
|
||||||
|
private const string BASE_URL = "https://torchapi.com/";
|
||||||
|
private readonly HttpClient _client;
|
||||||
|
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
private LegacyPluginQuery()
|
||||||
|
{
|
||||||
|
_client = new()
|
||||||
|
{
|
||||||
|
BaseAddress = new(BASE_URL)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LegacyPluginQuery Instance { get; } = new();
|
||||||
|
|
||||||
|
public async Task<PluginsResponse> QueryAll()
|
||||||
|
{
|
||||||
|
return await _client.GetFromJsonAsync<PluginsResponse>("/api/plugins/", CancellationToken.None);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<PluginItem> QueryOne(Guid guid)
|
||||||
|
{
|
||||||
|
using var res = await _client.GetAsync($"/api/plugins/search/{guid}");
|
||||||
|
if (!res.IsSuccessStatusCode)
|
||||||
|
return null;
|
||||||
|
return await res.Content.ReadFromJsonAsync<PluginItem>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> DownloadPlugin(Guid guid, string path = null)
|
||||||
|
{
|
||||||
|
var item = await QueryOne(guid);
|
||||||
|
if (item is null) return false;
|
||||||
|
return await DownloadPlugin(item, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> DownloadPlugin(PluginItem item, string path = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
path ??= Path.Combine(AppContext.BaseDirectory, "Plugins", $"{item.Name}.zip");
|
||||||
|
|
||||||
|
if (item.Versions.Length == 0)
|
||||||
|
{
|
||||||
|
Log.Error($"Selected plugin {item.Name} does not have any versions to download!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var version = item.Versions.FirstOrDefault(v => v.Version == item.LatestVersion);
|
||||||
|
if (version is null)
|
||||||
|
{
|
||||||
|
Log.Error($"Could not find latest version for selected plugin {item.Name}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var s = await _client.GetStreamAsync(version.Url);
|
||||||
|
|
||||||
|
if(File.Exists(path))
|
||||||
|
File.Delete(path);
|
||||||
|
|
||||||
|
await using var f = File.Create(path);
|
||||||
|
await s.CopyToAsync(f);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Failed to download plugin!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
11
Torch.API/WebAPI/Plugin/PluginItem.cs
Normal file
11
Torch.API/WebAPI/Plugin/PluginItem.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugin;
|
||||||
|
|
||||||
|
public record PluginItem(Guid Id, string Name, string Author, string Description, string LatestVersion,
|
||||||
|
VersionItem[] Versions)
|
||||||
|
{
|
||||||
|
[JsonIgnore]
|
||||||
|
public bool Installed { get; set; }
|
||||||
|
}
|
3
Torch.API/WebAPI/Plugin/PluginsResponse.cs
Normal file
3
Torch.API/WebAPI/Plugin/PluginsResponse.cs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
namespace Torch.API.WebAPI.Plugin;
|
||||||
|
|
||||||
|
public record PluginsResponse(PluginItem[] Plugins);
|
6
Torch.API/WebAPI/Plugin/VersionItem.cs
Normal file
6
Torch.API/WebAPI/Plugin/VersionItem.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugin;
|
||||||
|
|
||||||
|
public record VersionItem(string Version, string Note, [property: JsonPropertyName("is_beta")] bool IsBeta,
|
||||||
|
string Url);
|
11
Torch.API/WebAPI/Plugins/IPackageItem.cs
Normal file
11
Torch.API/WebAPI/Plugins/IPackageItem.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public interface IPackageItem
|
||||||
|
{
|
||||||
|
Task<Stream> OpenFileAsync();
|
||||||
|
public string FileName { get; }
|
||||||
|
}
|
10
Torch.API/WebAPI/Plugins/IPackageReader.cs
Normal file
10
Torch.API/WebAPI/Plugins/IPackageReader.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public interface IPackageReader
|
||||||
|
{
|
||||||
|
Task<(IEnumerable<IPackageItem> Root, IReadOnlyDictionary<PackageDependency, IEnumerable<IPackageItem>> Dependencies)> GetItemsAsync();
|
||||||
|
}
|
11
Torch.API/WebAPI/Plugins/IPackageResolver.cs
Normal file
11
Torch.API/WebAPI/Plugins/IPackageResolver.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public interface IPackageResolver
|
||||||
|
{
|
||||||
|
Task<IEnumerable<Package>> ResolvePackagesAsync(IReadOnlyDictionary<string, string> packages);
|
||||||
|
Task<IPackageReader> GetPackageAsync(Package package);
|
||||||
|
}
|
87
Torch.API/WebAPI/Plugins/NLogLogger.cs
Normal file
87
Torch.API/WebAPI/Plugins/NLogLogger.cs
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using NuGet.Common;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
internal class NLogLogger : ILogger
|
||||||
|
{
|
||||||
|
private readonly NLog.ILogger _logger;
|
||||||
|
|
||||||
|
public NLogLogger(NLog.ILogger logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogDebug(string data)
|
||||||
|
{
|
||||||
|
_logger.Debug(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogVerbose(string data)
|
||||||
|
{
|
||||||
|
_logger.Trace(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogInformation(string data)
|
||||||
|
{
|
||||||
|
_logger.Info(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogMinimal(string data)
|
||||||
|
{
|
||||||
|
_logger.Debug(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogWarning(string data)
|
||||||
|
{
|
||||||
|
_logger.Warn(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogError(string data)
|
||||||
|
{
|
||||||
|
_logger.Error(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogInformationSummary(string data)
|
||||||
|
{
|
||||||
|
_logger.Info(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Log(LogLevel level, string data)
|
||||||
|
{
|
||||||
|
_logger.Log(ToNLogLevel(level), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static NLog.LogLevel ToNLogLevel(LogLevel level)
|
||||||
|
{
|
||||||
|
return level switch
|
||||||
|
{
|
||||||
|
LogLevel.Debug => NLog.LogLevel.Debug,
|
||||||
|
LogLevel.Verbose => NLog.LogLevel.Trace,
|
||||||
|
LogLevel.Information => NLog.LogLevel.Info,
|
||||||
|
LogLevel.Minimal => NLog.LogLevel.Debug,
|
||||||
|
LogLevel.Warning => NLog.LogLevel.Warn,
|
||||||
|
LogLevel.Error => NLog.LogLevel.Error,
|
||||||
|
_ => throw new ArgumentOutOfRangeException(nameof(level), level, null)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task LogAsync(LogLevel level, string data)
|
||||||
|
{
|
||||||
|
Log(level, data);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Log(ILogMessage message)
|
||||||
|
{
|
||||||
|
_logger.Log(ToNLogLevel(message.Level), message.FormatWithCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task LogAsync(ILogMessage message)
|
||||||
|
{
|
||||||
|
Log(message);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
10
Torch.API/WebAPI/Plugins/Package.cs
Normal file
10
Torch.API/WebAPI/Plugins/Package.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using NuGet.DependencyResolver;
|
||||||
|
using SemanticVersioning;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public record Package(string Name, Version Version, IReadOnlySet<PackageDependency> Dependencies)
|
||||||
|
{
|
||||||
|
internal GraphItem<RemoteResolveResult> Graph { get; init; }
|
||||||
|
}
|
9
Torch.API/WebAPI/Plugins/PackageDependency.cs
Normal file
9
Torch.API/WebAPI/Plugins/PackageDependency.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using NuGet.DependencyResolver;
|
||||||
|
using SemanticVersioning;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public record PackageDependency(string Name, Version Version, PackageDependencyKind Kind)
|
||||||
|
{
|
||||||
|
internal RemoteMatch Match { get; init; }
|
||||||
|
}
|
8
Torch.API/WebAPI/Plugins/PackageDependencyKind.cs
Normal file
8
Torch.API/WebAPI/Plugins/PackageDependencyKind.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public enum PackageDependencyKind
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Transitive,
|
||||||
|
Direct
|
||||||
|
}
|
91
Torch.API/WebAPI/Plugins/PackageReader.cs
Normal file
91
Torch.API/WebAPI/Plugins/PackageReader.cs
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Immutable;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using NuGet.Common;
|
||||||
|
using NuGet.DependencyResolver;
|
||||||
|
using NuGet.Frameworks;
|
||||||
|
using NuGet.Packaging;
|
||||||
|
using NuGet.Protocol.Core.Types;
|
||||||
|
using NuGet.Versioning;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public class PackageReader : IPackageReader
|
||||||
|
{
|
||||||
|
private readonly Package _package;
|
||||||
|
private readonly SourceCacheContext _cacheContext;
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly NuGetFramework _framework;
|
||||||
|
private readonly IFrameworkCompatibilityProvider _compatibilityProvider;
|
||||||
|
private readonly DirectoryInfo _packagesDirectory;
|
||||||
|
|
||||||
|
public PackageReader(Package package, SourceCacheContext cacheContext, ILogger logger, NuGetFramework framework,
|
||||||
|
IFrameworkCompatibilityProvider compatibilityProvider, DirectoryInfo packagesDirectory)
|
||||||
|
{
|
||||||
|
_package = package;
|
||||||
|
_cacheContext = cacheContext;
|
||||||
|
_logger = logger;
|
||||||
|
_framework = framework;
|
||||||
|
_compatibilityProvider = compatibilityProvider;
|
||||||
|
_packagesDirectory = packagesDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<(IEnumerable<IPackageItem> Root, IReadOnlyDictionary<PackageDependency, IEnumerable<IPackageItem>>
|
||||||
|
Dependencies)>
|
||||||
|
GetItemsAsync()
|
||||||
|
{
|
||||||
|
async Task<IEnumerable<IPackageItem>> GetPackageItemsAsync(string id, NuGetVersion version,
|
||||||
|
IRemoteDependencyProvider provider)
|
||||||
|
{
|
||||||
|
var downloader =
|
||||||
|
await provider.GetPackageDownloaderAsync(new(id, version), _cacheContext, _logger,
|
||||||
|
CancellationToken.None);
|
||||||
|
|
||||||
|
await downloader.CopyNupkgFileToAsync(Path.Combine(_packagesDirectory.FullName, $"{id}.{version}.nupkg"),
|
||||||
|
CancellationToken.None);
|
||||||
|
|
||||||
|
var frameworks = await downloader.ContentReader.GetReferenceItemsAsync(CancellationToken.None);
|
||||||
|
var items = frameworks.Where(b => _compatibilityProvider.IsCompatible(_framework, b.TargetFramework))
|
||||||
|
.MaxBy(b => b.TargetFramework.Version)?.Items;
|
||||||
|
|
||||||
|
return items?.Select(b => new PackageItem(b, downloader)) ?? ImmutableArray<PackageItem>.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
var rootIdentity = _package.Graph.Key;
|
||||||
|
return (await GetPackageItemsAsync(rootIdentity.Name, rootIdentity.Version, _package.Graph.Data.Match.Provider),
|
||||||
|
await _package.Dependencies.ToAsyncEnumerable().SelectManyAwait(async b =>
|
||||||
|
(await GetPackageItemsAsync(
|
||||||
|
b.Match.Library.Name,
|
||||||
|
b.Match.Library.Version,
|
||||||
|
b.Match.Provider))
|
||||||
|
.ToAsyncEnumerable()
|
||||||
|
.Select(c => (b, c)))
|
||||||
|
.GroupBy(b => b.b, b => b.c)
|
||||||
|
.ToDictionaryAwaitAsync<IAsyncGrouping<PackageDependency, IPackageItem>, PackageDependency,
|
||||||
|
IEnumerable<IPackageItem>>(b => ValueTask.FromResult(b.Key),
|
||||||
|
async b => await b.ToArrayAsync()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
file class PackageItem : IPackageItem
|
||||||
|
{
|
||||||
|
private readonly string _path;
|
||||||
|
private readonly IPackageDownloader _downloader;
|
||||||
|
|
||||||
|
public string FileName => Path.GetFileName(_path);
|
||||||
|
|
||||||
|
public PackageItem(string path, IPackageDownloader downloader)
|
||||||
|
{
|
||||||
|
_path = path;
|
||||||
|
_downloader = downloader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<Stream> OpenFileAsync()
|
||||||
|
{
|
||||||
|
return _downloader.CoreReader.GetStreamAsync(_path, CancellationToken.None);
|
||||||
|
}
|
||||||
|
}
|
104
Torch.API/WebAPI/Plugins/PackageResolver.cs
Normal file
104
Torch.API/WebAPI/Plugins/PackageResolver.cs
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Immutable;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using NLog;
|
||||||
|
using NuGet.Commands;
|
||||||
|
using NuGet.Configuration;
|
||||||
|
using NuGet.DependencyResolver;
|
||||||
|
using NuGet.Frameworks;
|
||||||
|
using NuGet.LibraryModel;
|
||||||
|
using NuGet.Protocol;
|
||||||
|
using NuGet.Protocol.Core.Types;
|
||||||
|
using NuGet.Versioning;
|
||||||
|
using Version = SemanticVersioning.Version;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public class PackageResolver : IPackageResolver
|
||||||
|
{
|
||||||
|
private static readonly ILogger Log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
private readonly NuGetFramework _framework = NuGetFramework.Parse("net7.0-windows7.0");
|
||||||
|
private readonly NLogLogger _logger = new(Log);
|
||||||
|
private readonly SourceCacheContext _sourceCacheContext = new();
|
||||||
|
private readonly RemoteWalkContext _remoteWalkContext;
|
||||||
|
private readonly DirectoryInfo _packagesDirectory;
|
||||||
|
private readonly IFrameworkCompatibilityProvider _compatibilityProvider = DefaultCompatibilityProvider.Instance;
|
||||||
|
|
||||||
|
public PackageResolver(IEnumerable<PackageSource> sources, DirectoryInfo packagesDirectory)
|
||||||
|
{
|
||||||
|
_packagesDirectory = packagesDirectory;
|
||||||
|
IReadOnlySet<PackageSource> packageSources = sources.Where(b => b.Type is PackageSourceType.NuGet).ToImmutableHashSet();
|
||||||
|
|
||||||
|
var mapping = new PackageSourceMapping(packageSources.ToDictionary(b => b.Name, b => b.Patterns));
|
||||||
|
_remoteWalkContext = new RemoteWalkContext(_sourceCacheContext, mapping, _logger);
|
||||||
|
|
||||||
|
foreach (var (name, url, _, _) in packageSources)
|
||||||
|
{
|
||||||
|
var packageSource = new NuGet.Configuration.PackageSource(url, name);
|
||||||
|
var sourceRepository = new SourceRepository(packageSource, new INuGetResourceProvider[]
|
||||||
|
{
|
||||||
|
new DownloadResourceV3Provider(),
|
||||||
|
new DependencyInfoResourceV3Provider(),
|
||||||
|
new ServiceIndexResourceV3Provider(),
|
||||||
|
new RemoteV3FindPackageByIdResourceProvider(),
|
||||||
|
new V3FeedListResourceProvider(),
|
||||||
|
new HttpSourceResourceProvider(),
|
||||||
|
new RegistrationResourceV3Provider(),
|
||||||
|
new HttpHandlerResourceV3Provider()
|
||||||
|
}.Select(b => new Lazy<INuGetResourceProvider>(b)), FeedType.HttpV3);
|
||||||
|
|
||||||
|
_remoteWalkContext.RemoteLibraryProviders.Add(
|
||||||
|
new SourceRepositoryDependencyProvider(sourceRepository, _logger, _sourceCacheContext, true, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Package>> ResolvePackagesAsync(
|
||||||
|
IReadOnlyDictionary<string, string> packages)
|
||||||
|
{
|
||||||
|
Log.Info("Restoring {0} packages", packages.Count);
|
||||||
|
|
||||||
|
var graphs = await Task.WhenAll(packages.Select(b =>
|
||||||
|
{
|
||||||
|
var (key, versionRange) = b;
|
||||||
|
var libraryRange = new LibraryRange(key, VersionRange.Parse(versionRange), LibraryDependencyTarget.All);
|
||||||
|
return ResolverUtility.FindLibraryEntryAsync(libraryRange, _framework, "win-x64",
|
||||||
|
_remoteWalkContext, CancellationToken.None);
|
||||||
|
}));
|
||||||
|
|
||||||
|
return await graphs.ToAsyncEnumerable().SelectAwait(async graph =>
|
||||||
|
{
|
||||||
|
return new Package(graph.Key.Name, Version.Parse(graph.Key.Version.ToFullString()),
|
||||||
|
await graph.Data.Dependencies
|
||||||
|
.ToAsyncEnumerable()
|
||||||
|
.SelectAwait(async b =>
|
||||||
|
{
|
||||||
|
var match = await ResolverUtility.FindLibraryByVersionAsync(
|
||||||
|
b.LibraryRange, _framework, _remoteWalkContext.RemoteLibraryProviders,
|
||||||
|
_sourceCacheContext, _logger, CancellationToken.None);
|
||||||
|
|
||||||
|
return new PackageDependency(
|
||||||
|
b.Name, Version.Parse(match.Library.Version.ToFullString()),
|
||||||
|
(PackageDependencyKind)b.ReferenceType)
|
||||||
|
{
|
||||||
|
Match = match
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.ToHashSetAsync())
|
||||||
|
{
|
||||||
|
Graph = graph
|
||||||
|
};
|
||||||
|
}).ToArrayAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<IPackageReader> GetPackageAsync(Package package)
|
||||||
|
{
|
||||||
|
var reader = new PackageReader(package, _sourceCacheContext, _logger, _framework, _compatibilityProvider, _packagesDirectory);
|
||||||
|
return Task.FromResult<IPackageReader>(reader);
|
||||||
|
}
|
||||||
|
}
|
8
Torch.API/WebAPI/Plugins/PackageSource.cs
Normal file
8
Torch.API/WebAPI/Plugins/PackageSource.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
public record PackageSource
|
||||||
|
#nullable restore
|
||||||
|
(string Name, string Url, IReadOnlyList<string> Patterns, PackageSourceType Type);
|
8
Torch.API/WebAPI/Plugins/PackageSourceType.cs
Normal file
8
Torch.API/WebAPI/Plugins/PackageSourceType.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#nullable enable
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public enum PackageSourceType
|
||||||
|
{
|
||||||
|
NuGet,
|
||||||
|
LegacyTorch
|
||||||
|
}
|
127
Torch.API/WebAPI/Update/GithubQuery.cs
Normal file
127
Torch.API/WebAPI/Update/GithubQuery.cs
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Json;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Version = SemanticVersioning.Version;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Update;
|
||||||
|
|
||||||
|
public class GithubQuery : IUpdateQuery
|
||||||
|
{
|
||||||
|
private readonly HttpClient _client;
|
||||||
|
|
||||||
|
public GithubQuery(string url)
|
||||||
|
{
|
||||||
|
if (url == null) throw new ArgumentNullException(nameof(url));
|
||||||
|
|
||||||
|
_client = new()
|
||||||
|
{
|
||||||
|
BaseAddress = new(url),
|
||||||
|
DefaultVersionPolicy = HttpVersionPolicy.RequestVersionOrHigher,
|
||||||
|
DefaultRequestHeaders =
|
||||||
|
{
|
||||||
|
{"User-Agent", "TorchAPI"}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_client?.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<UpdateRelease> GetLatestReleaseAsync(string repository, string branch = null)
|
||||||
|
{
|
||||||
|
var response = await _client.GetFromJsonAsync<Release>($"/repos/{repository}/releases/latest", new JsonSerializerOptions(JsonSerializerDefaults.Web)
|
||||||
|
{
|
||||||
|
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response is null)
|
||||||
|
throw new($"Unable to get latest release for {repository}");
|
||||||
|
|
||||||
|
return new(Version.Parse(response.TagName), response.Assets.First(b => b.Name == "torch-server.zip").BrowserDownloadUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
private record Asset(
|
||||||
|
string Url,
|
||||||
|
int Id,
|
||||||
|
string NodeId,
|
||||||
|
string Name,
|
||||||
|
string Label,
|
||||||
|
Uploader Uploader,
|
||||||
|
string ContentType,
|
||||||
|
string State,
|
||||||
|
int Size,
|
||||||
|
int DownloadCount,
|
||||||
|
DateTime CreatedAt,
|
||||||
|
DateTime UpdatedAt,
|
||||||
|
string BrowserDownloadUrl
|
||||||
|
);
|
||||||
|
|
||||||
|
private record Author(
|
||||||
|
string Login,
|
||||||
|
int Id,
|
||||||
|
string NodeId,
|
||||||
|
string AvatarUrl,
|
||||||
|
string GravatarId,
|
||||||
|
string Url,
|
||||||
|
string HtmlUrl,
|
||||||
|
string FollowersUrl,
|
||||||
|
string FollowingUrl,
|
||||||
|
string GistsUrl,
|
||||||
|
string StarredUrl,
|
||||||
|
string SubscriptionsUrl,
|
||||||
|
string OrganizationsUrl,
|
||||||
|
string ReposUrl,
|
||||||
|
string EventsUrl,
|
||||||
|
string ReceivedEventsUrl,
|
||||||
|
string Type,
|
||||||
|
bool SiteAdmin
|
||||||
|
);
|
||||||
|
|
||||||
|
private record Release(
|
||||||
|
string Url,
|
||||||
|
string AssetsUrl,
|
||||||
|
string UploadUrl,
|
||||||
|
string HtmlUrl,
|
||||||
|
int Id,
|
||||||
|
Author Author,
|
||||||
|
string NodeId,
|
||||||
|
string TagName,
|
||||||
|
string TargetCommitish,
|
||||||
|
string Name,
|
||||||
|
bool Draft,
|
||||||
|
bool Prerelease,
|
||||||
|
DateTime CreatedAt,
|
||||||
|
DateTime PublishedAt,
|
||||||
|
IReadOnlyList<Asset> Assets,
|
||||||
|
string TarballUrl,
|
||||||
|
string ZipballUrl,
|
||||||
|
string Body
|
||||||
|
);
|
||||||
|
|
||||||
|
private record Uploader(
|
||||||
|
string Login,
|
||||||
|
int Id,
|
||||||
|
string NodeId,
|
||||||
|
string AvatarUrl,
|
||||||
|
string GravatarId,
|
||||||
|
string Url,
|
||||||
|
string HtmlUrl,
|
||||||
|
string FollowersUrl,
|
||||||
|
string FollowingUrl,
|
||||||
|
string GistsUrl,
|
||||||
|
string StarredUrl,
|
||||||
|
string SubscriptionsUrl,
|
||||||
|
string OrganizationsUrl,
|
||||||
|
string ReposUrl,
|
||||||
|
string EventsUrl,
|
||||||
|
string ReceivedEventsUrl,
|
||||||
|
string Type,
|
||||||
|
bool SiteAdmin
|
||||||
|
);
|
||||||
|
}
|
9
Torch.API/WebAPI/Update/IUpdateQuery.cs
Normal file
9
Torch.API/WebAPI/Update/IUpdateQuery.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Update;
|
||||||
|
|
||||||
|
public interface IUpdateQuery : IDisposable
|
||||||
|
{
|
||||||
|
Task<UpdateRelease> GetLatestReleaseAsync(string repository, string branch = null);
|
||||||
|
}
|
65
Torch.API/WebAPI/Update/JenkinsQuery.cs
Normal file
65
Torch.API/WebAPI/Update/JenkinsQuery.cs
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Torch.API.Utils;
|
||||||
|
using Version = SemanticVersioning.Version;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Update
|
||||||
|
{
|
||||||
|
public class JenkinsQuery : IUpdateQuery
|
||||||
|
{
|
||||||
|
private const string ApiPath = "api/json";
|
||||||
|
private readonly HttpClient _client;
|
||||||
|
|
||||||
|
public JenkinsQuery(string url)
|
||||||
|
{
|
||||||
|
if (url == null) throw new ArgumentNullException(nameof(url));
|
||||||
|
|
||||||
|
_client = new()
|
||||||
|
{
|
||||||
|
BaseAddress = new(url)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<UpdateRelease> GetLatestReleaseAsync(string repository, string branch = null)
|
||||||
|
{
|
||||||
|
branch ??= "master";
|
||||||
|
|
||||||
|
var response = await _client.GetFromJsonAsync<BranchResponse>($"/job/{repository}/job/{branch}/{ApiPath}");
|
||||||
|
|
||||||
|
if (response is null)
|
||||||
|
throw new($"Unable to get latest release for {repository}");
|
||||||
|
|
||||||
|
var job = await _client.GetFromJsonAsync<Job>(
|
||||||
|
$"/job/{repository}/job/{branch}/{response.LastBuild.Number}/{ApiPath}");
|
||||||
|
|
||||||
|
if (job is null)
|
||||||
|
throw new($"Unable to get latest release for job {repository}/{response.LastBuild.Number}");
|
||||||
|
|
||||||
|
return new(job.Version, job.Url + job.Artifacts.First(b => b.FileName == "torch-server.zip").RelativePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_client?.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public record BranchResponse(string Name, string Url, Build LastBuild, Build LastStableBuild);
|
||||||
|
|
||||||
|
public record Build(int Number, string Url);
|
||||||
|
|
||||||
|
public record Job(int Number, bool Building, string Description, string Result, string Url,
|
||||||
|
[property: JsonConverter(typeof(SemanticVersionConverter))] Version Version,
|
||||||
|
IReadOnlyList<Artifact> Artifacts);
|
||||||
|
|
||||||
|
public record Artifact(
|
||||||
|
string DisplayPath,
|
||||||
|
string FileName,
|
||||||
|
string RelativePath
|
||||||
|
);
|
||||||
|
}
|
5
Torch.API/WebAPI/Update/UpdateRelease.cs
Normal file
5
Torch.API/WebAPI/Update/UpdateRelease.cs
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
using SemanticVersioning;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Update;
|
||||||
|
|
||||||
|
public record UpdateRelease(Version Version, string ArtifactUrl);
|
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="Mono.TextTransform" version="1.0.0" targetFramework="net461" />
|
|
||||||
<package id="NLog" version="4.4.12" targetFramework="net461" />
|
|
||||||
</packages>
|
|
226
Torch.API/packages.lock.json
Normal file
226
Torch.API/packages.lock.json
Normal file
@@ -0,0 +1,226 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"dependencies": {
|
||||||
|
"net8.0-windows7.0": {
|
||||||
|
"JetBrains.Annotations": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[2024.2.0, )",
|
||||||
|
"resolved": "2024.2.0",
|
||||||
|
"contentHash": "GNnqCFW/163p1fOehKx0CnAqjmpPrUSqrgfHM6qca+P+RN39C9rhlfZHQpJhxmQG/dkOYe/b3Z0P8b6Kv5m1qw=="
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.Configuration.Binder": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[8.0.2, )",
|
||||||
|
"resolved": "8.0.2",
|
||||||
|
"contentHash": "7IQhGK+wjyGrNsPBjJcZwWAr+Wf6D4+TwOptUt77bWtgNkiV8tDEbhFS+dDamtQFZ2X7kWG9m71iZQRj2x3zgQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NLog": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[5.3.3, )",
|
||||||
|
"resolved": "5.3.3",
|
||||||
|
"contentHash": "cy0+hlrUbYu+6mgUsILqCcqlJ2Csqyt2lm8y9T9kE8nhgwl8SvR+LM21QX4nmzFCPiowbrTFYxNF8+gWpy7/HQ=="
|
||||||
|
},
|
||||||
|
"NuGet.Commands": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[6.11.0, )",
|
||||||
|
"resolved": "6.11.0",
|
||||||
|
"contentHash": "8GjJQZVbNJuttVynsRWsgqhTZiBbjxRr2PgZ3E7zPxDBmKUazkQ1s/FqScm83w8Xq5OdEtegkU0dZhibfRkKeg==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.FileProviders.Abstractions": "6.0.0",
|
||||||
|
"Microsoft.Extensions.FileSystemGlobbing": "6.0.0",
|
||||||
|
"NuGet.Credentials": "6.11.0",
|
||||||
|
"NuGet.ProjectModel": "6.11.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.DependencyResolver.Core": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[6.11.0, )",
|
||||||
|
"resolved": "6.11.0",
|
||||||
|
"contentHash": "SoiPKPooA+IF+iCsX1ykwi3M0e+yBL34QnwIP3ujhQEn1dhlP/N1XsYAnKkJPxV15EZCahuuS4HtnBsZx+CHKA==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Configuration": "6.11.0",
|
||||||
|
"NuGet.LibraryModel": "6.11.0",
|
||||||
|
"NuGet.Protocol": "6.11.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"SemanticVersioning": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[2.0.2, )",
|
||||||
|
"resolved": "2.0.2",
|
||||||
|
"contentHash": "4EQgYdNZ92SyaO7YFk6olVnebF5V+jrHyMUjvPq89tLeMo8NSfgDF+6Zwq/lgh9j/0yfQp9Lkm0ZA0rUATCZFA=="
|
||||||
|
},
|
||||||
|
"SpaceEngineersDedicated.ReferenceAssemblies": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[1.204.18, )",
|
||||||
|
"resolved": "1.204.18",
|
||||||
|
"contentHash": "GT7/9CBMx4jjor41zLOOl87YYM/JdJD8xp9ccXyuhP2oUaz25H3ZmCQuGeAuZNENKru1a/7hZrId4PwlMDGoew==",
|
||||||
|
"dependencies": {
|
||||||
|
"SharpDX": "4.2.0-keen-cringe",
|
||||||
|
"protobuf-net": "1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Linq.Async": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[6.0.1, )",
|
||||||
|
"resolved": "6.0.1",
|
||||||
|
"contentHash": "0YhHcaroWpQ9UCot3Pizah7ryAzQhNvobLMSxeDIGmnXfkQn8u5owvpOH0K6EVB+z9L7u6Cc4W17Br/+jyttEQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Bcl.AsyncInterfaces": "6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Bcl.AsyncInterfaces": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.0.0",
|
||||||
|
"contentHash": "UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg=="
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.Configuration.Abstractions": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "8.0.0",
|
||||||
|
"contentHash": "3lE/iLSutpgX1CC0NOW70FJoGARRHbyKmG7dc0klnUZ9Dd9hS6N/POPWhKhMLCEuNN5nXEY5agmlFtH562vqhQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.Primitives": "8.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.FileProviders.Abstractions": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.0.0",
|
||||||
|
"contentHash": "0pd4/fho0gC12rQswaGQxbU34jOS1TPS8lZPpkFCH68ppQjHNHYle9iRuHeev1LhrJ94YPvzcRd8UmIuFk23Qw==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.Primitives": "6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.FileSystemGlobbing": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.0.0",
|
||||||
|
"contentHash": "ip8jnL1aPiaPeKINCqaTEbvBFDmVx9dXQEBZ2HOBRXPD1eabGNqP/bKlsIcp7U2lGxiXd5xIhoFcmY8nM4Hdiw=="
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.Primitives": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "8.0.0",
|
||||||
|
"contentHash": "bXJEZrW9ny8vjMF1JV253WeLhpEVzFo1lyaZu1vQ4ZxWUlVvknZ/+ftFgVheLubb4eZPSwwxBeqS1JkCOjxd8g=="
|
||||||
|
},
|
||||||
|
"Newtonsoft.Json": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "13.0.3",
|
||||||
|
"contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ=="
|
||||||
|
},
|
||||||
|
"NuGet.Common": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.11.0",
|
||||||
|
"contentHash": "T3bCiKUSx8wdYpcqr6Dbx93zAqFp689ee/oa1tH22XI/xl7EUzQ7No/WlE1FUqvEX1+Mqar3wRNAn2O/yxo94g==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Frameworks": "6.11.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Configuration": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.11.0",
|
||||||
|
"contentHash": "73QprQqmumFrv3Ooi4YWpRYeBj8jZy9gNdOaOCp4pPInpt41SJJAz/aP4je+StwIJvi5HsgPPecLKekDIQEwKg==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Common": "6.11.0",
|
||||||
|
"System.Security.Cryptography.ProtectedData": "4.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Credentials": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.11.0",
|
||||||
|
"contentHash": "TeMvEyoqkIxDnYJjPCpD48vV5XoDATmyX2kGYYB2MIzWBT24ZjWauTda72hYBzg0OLLiuafxfnNJKGG6IHHzOQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Protocol": "6.11.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Frameworks": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.11.0",
|
||||||
|
"contentHash": "Ew/mrfmLF5phsprysHbph2+tdZ10HMHAURavsr/Kx1WhybDG4vmGuoNLbbZMZOqnPRdpyCTc42OKWLoedxpYtA=="
|
||||||
|
},
|
||||||
|
"NuGet.LibraryModel": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.11.0",
|
||||||
|
"contentHash": "KUV2eeMICMb24OPcICn/wgncNzt6+W+lmFVO5eorTdo1qV4WXxYGyG1NTPiCY+Nrv5H/Ilnv9UaUM2ozqSmnjw==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Common": "6.11.0",
|
||||||
|
"NuGet.Versioning": "6.11.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Packaging": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.11.0",
|
||||||
|
"contentHash": "VmUv2LedVuPY1tfNybORO2I9IuqOzeV7I5JBD+PwNvJq2bAqovi4FCw2cYI0g+kjOJXBN2lAJfrfnqtUOlVJdQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"Newtonsoft.Json": "13.0.3",
|
||||||
|
"NuGet.Configuration": "6.11.0",
|
||||||
|
"NuGet.Versioning": "6.11.0",
|
||||||
|
"System.Security.Cryptography.Pkcs": "6.0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.ProjectModel": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.11.0",
|
||||||
|
"contentHash": "g0KtmDH6fas97WsN73yV2h1F5JT9o6+Y0wlPK+ij9YLKaAXaF6+1HkSaQMMJ+xh9/jCJG9G6nau6InOlb1g48g==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.DependencyResolver.Core": "6.11.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Protocol": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.11.0",
|
||||||
|
"contentHash": "p5B8oNLLnGhUfMbcS16aRiegj11pD6k+LELyRBqvNFR/pE3yR1XT+g1XS33ME9wvoU+xbCGnl4Grztt1jHPinw==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Packaging": "6.11.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Versioning": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.11.0",
|
||||||
|
"contentHash": "v/GGlIj2dd7svplFmASWEueu62veKW0MrMtBaZ7QG8aJTSGv2yE+pgUGhXRcQ4nxNOEq/wLBrz1vkth/1SND7A=="
|
||||||
|
},
|
||||||
|
"protobuf-net": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.0.0",
|
||||||
|
"contentHash": "kTGOK0E87473sOImOjgZOnz3kTC2aMLffoRWQLYNuBLJnwNNmjanF9IkevZ9Q7yYLeABQfcF3BpeepuMntMVNw=="
|
||||||
|
},
|
||||||
|
"SharpDX": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "4.2.0-keen-cringe",
|
||||||
|
"contentHash": "LaJN3h1Gi1FWVdef2I5WtOH9gwzKCBniH0CragarbkN2QheYY6Lqm+91PcOfp1w/4wdVb+k8Kjv3sO393Tphtw=="
|
||||||
|
},
|
||||||
|
"System.Formats.Asn1": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.0.0",
|
||||||
|
"contentHash": "T6fD00dQ3NTbPDy31m4eQUwKW84s03z0N2C8HpOklyeaDgaJPa/TexP4/SkORMSOwc7WhKifnA6Ya33AkzmafA=="
|
||||||
|
},
|
||||||
|
"System.Security.Cryptography.Pkcs": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.0.4",
|
||||||
|
"contentHash": "LGbXi1oUJ9QgCNGXRO9ndzBL/GZgANcsURpMhNR8uO+rca47SZmciS3RSQUvlQRwK3QHZSHNOXzoMUASKA+Anw==",
|
||||||
|
"dependencies": {
|
||||||
|
"System.Formats.Asn1": "6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Security.Cryptography.ProtectedData": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "4.4.0",
|
||||||
|
"contentHash": "cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog=="
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"net8.0-windows7.0/win-x64": {
|
||||||
|
"System.Security.Cryptography.Pkcs": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.0.4",
|
||||||
|
"contentHash": "LGbXi1oUJ9QgCNGXRO9ndzBL/GZgANcsURpMhNR8uO+rca47SZmciS3RSQUvlQRwK3QHZSHNOXzoMUASKA+Anw==",
|
||||||
|
"dependencies": {
|
||||||
|
"System.Formats.Asn1": "6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Security.Cryptography.ProtectedData": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "4.4.0",
|
||||||
|
"contentHash": "cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,17 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
[assembly: AssemblyTitle("Torch Client Tests")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("Torch")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © Torch API 2017")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
[assembly: AssemblyConfiguration("Debug")]
|
|
||||||
#else
|
|
||||||
[assembly: AssemblyConfiguration("Release")]
|
|
||||||
#endif
|
|
@@ -1,97 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<ProjectGuid>{632E78C0-0DAC-4B71-B411-2F1B333CC310}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>Torch.Client.Tests</RootNamespace>
|
|
||||||
<AssemblyName>Torch.Client.Tests</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<TargetFrameworkProfile />
|
|
||||||
<NuGetPackageImportStamp>
|
|
||||||
</NuGetPackageImportStamp>
|
|
||||||
<NoWarn>1591,0649</NoWarn>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<OutputPath>$(SolutionDir)\bin-test\x64\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
|
||||||
<OutputPath>$(SolutionDir)\bin-test\x64\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
|
||||||
<DocumentationFile>$(SolutionDir)\bin-test\x64\Release\Torch.Client.Tests.xml</DocumentationFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\NLog.4.4.12\lib\net45\NLog.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Net.Http" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="xunit.assert, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="xunit.core, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="xunit.execution.desktop, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="..\Versioning\AssemblyVersion.cs">
|
|
||||||
<Link>Properties\AssemblyVersion.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="TorchClientReflectionTest.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\Torch.API\Torch.API.csproj">
|
|
||||||
<Project>{fba5d932-6254-4a1e-baf4-e229fa94e3c2}</Project>
|
|
||||||
<Name>Torch.API</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\Torch.Client\Torch.Client.csproj">
|
|
||||||
<Project>{e36df745-260b-4956-a2e8-09f08b2e7161}</Project>
|
|
||||||
<Name>Torch.Client</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\Torch.Tests\Torch.Tests.csproj">
|
|
||||||
<Project>{c3c8b671-6ad1-44aa-a8da-e0c0dc0fedf5}</Project>
|
|
||||||
<Name>Torch.Tests</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\Torch\Torch.csproj">
|
|
||||||
<Project>{7e01635c-3b67-472e-bcd6-c5539564f214}</Project>
|
|
||||||
<Name>Torch</Name>
|
|
||||||
<Private>True</Private>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="packages.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
|
||||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<Import Project="$(SolutionDir)\TransformOnBuild.targets" />
|
|
||||||
</Project>
|
|
@@ -1,94 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Torch.Client;
|
|
||||||
using Torch.Tests;
|
|
||||||
using Torch.Utils;
|
|
||||||
using Xunit;
|
|
||||||
|
|
||||||
namespace Torch.Client.Tests
|
|
||||||
{
|
|
||||||
public class TorchClientReflectionTest
|
|
||||||
{
|
|
||||||
static TorchClientReflectionTest()
|
|
||||||
{
|
|
||||||
TestUtils.Init();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ReflectionTestManager _manager;
|
|
||||||
|
|
||||||
private static ReflectionTestManager Manager()
|
|
||||||
{
|
|
||||||
if (_manager != null)
|
|
||||||
return _manager;
|
|
||||||
|
|
||||||
return _manager = new ReflectionTestManager().Init(typeof(TorchClient).Assembly);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IEnumerable<object[]> Getters => Manager().Getters;
|
|
||||||
|
|
||||||
public static IEnumerable<object[]> Setters => Manager().Setters;
|
|
||||||
|
|
||||||
public static IEnumerable<object[]> Invokers => Manager().Invokers;
|
|
||||||
|
|
||||||
public static IEnumerable<object[]> MemberInfo => Manager().MemberInfo;
|
|
||||||
|
|
||||||
public static IEnumerable<object[]> Events => Manager().Events;
|
|
||||||
|
|
||||||
#region Binding
|
|
||||||
[Theory]
|
|
||||||
[MemberData(nameof(Getters))]
|
|
||||||
public void TestBindingGetter(ReflectionTestManager.FieldRef field)
|
|
||||||
{
|
|
||||||
if (field.Field == null)
|
|
||||||
return;
|
|
||||||
Assert.True(ReflectedManager.Process(field.Field));
|
|
||||||
if (field.Field.IsStatic)
|
|
||||||
Assert.NotNull(field.Field.GetValue(null));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[MemberData(nameof(Setters))]
|
|
||||||
public void TestBindingSetter(ReflectionTestManager.FieldRef field)
|
|
||||||
{
|
|
||||||
if (field.Field == null)
|
|
||||||
return;
|
|
||||||
Assert.True(ReflectedManager.Process(field.Field));
|
|
||||||
if (field.Field.IsStatic)
|
|
||||||
Assert.NotNull(field.Field.GetValue(null));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[MemberData(nameof(Invokers))]
|
|
||||||
public void TestBindingInvoker(ReflectionTestManager.FieldRef field)
|
|
||||||
{
|
|
||||||
if (field.Field == null)
|
|
||||||
return;
|
|
||||||
Assert.True(ReflectedManager.Process(field.Field));
|
|
||||||
if (field.Field.IsStatic)
|
|
||||||
Assert.NotNull(field.Field.GetValue(null));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[MemberData(nameof(MemberInfo))]
|
|
||||||
public void TestBindingMemberInfo(ReflectionTestManager.FieldRef field)
|
|
||||||
{
|
|
||||||
if (field.Field == null)
|
|
||||||
return;
|
|
||||||
Assert.True(ReflectedManager.Process(field.Field));
|
|
||||||
if (field.Field.IsStatic)
|
|
||||||
Assert.NotNull(field.Field.GetValue(null));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[MemberData(nameof(Events))]
|
|
||||||
public void TestBindingEvents(ReflectionTestManager.FieldRef field)
|
|
||||||
{
|
|
||||||
if (field.Field == null)
|
|
||||||
return;
|
|
||||||
Assert.True(ReflectedManager.Process(field.Field));
|
|
||||||
if (field.Field.IsStatic)
|
|
||||||
((Func<ReflectedEventReplacer>)field.Field.GetValue(null)).Invoke();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="Mono.TextTransform" version="1.0.0" targetFramework="net461" />
|
|
||||||
<package id="NLog" version="4.4.12" targetFramework="net461" />
|
|
||||||
<package id="xunit" version="2.2.0" targetFramework="net461" />
|
|
||||||
<package id="xunit.abstractions" version="2.0.1" targetFramework="net461" />
|
|
||||||
<package id="xunit.assert" version="2.2.0" targetFramework="net461" />
|
|
||||||
<package id="xunit.core" version="2.2.0" targetFramework="net461" />
|
|
||||||
<package id="xunit.extensibility.core" version="2.2.0" targetFramework="net461" />
|
|
||||||
<package id="xunit.extensibility.execution" version="2.2.0" targetFramework="net461" />
|
|
||||||
<package id="xunit.runner.console" version="2.2.0" targetFramework="net461" developmentDependency="true" />
|
|
||||||
</packages>
|
|
@@ -1,32 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Sandbox.Engine.Multiplayer;
|
|
||||||
using Torch.API;
|
|
||||||
using Torch.API.Managers;
|
|
||||||
using Torch.Managers;
|
|
||||||
|
|
||||||
namespace Torch.Client.Manager
|
|
||||||
{
|
|
||||||
public class MultiplayerManagerClient : MultiplayerManagerBase, IMultiplayerManagerClient
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public MultiplayerManagerClient(ITorchBase torch) : base(torch) { }
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override void Attach()
|
|
||||||
{
|
|
||||||
base.Attach();
|
|
||||||
MyMultiplayer.Static.ClientJoined += RaiseClientJoined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override void Detach()
|
|
||||||
{
|
|
||||||
MyMultiplayer.Static.ClientJoined -= RaiseClientJoined;
|
|
||||||
base.Detach();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,58 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Sandbox.Engine.Multiplayer;
|
|
||||||
using Torch.API;
|
|
||||||
using Torch.API.Managers;
|
|
||||||
using Torch.Managers;
|
|
||||||
|
|
||||||
namespace Torch.Client.Manager
|
|
||||||
{
|
|
||||||
public class MultiplayerManagerLobby : MultiplayerManagerBase, IMultiplayerManagerServer
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public IReadOnlyList<ulong> BannedPlayers => new List<ulong>();
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public MultiplayerManagerLobby(ITorchBase torch) : base(torch) { }
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public void KickPlayer(ulong steamId) => Torch.Invoke(() => MyMultiplayer.Static.KickClient(steamId));
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public void BanPlayer(ulong steamId, bool banned = true) => Torch.Invoke(() => MyMultiplayer.Static.BanClient(steamId, banned));
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public bool IsBanned(ulong steamId) => false;
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public event Action<ulong> PlayerKicked
|
|
||||||
{
|
|
||||||
add => throw new NotImplementedException();
|
|
||||||
remove => throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public event Action<ulong, bool> PlayerBanned
|
|
||||||
{
|
|
||||||
add => throw new NotImplementedException();
|
|
||||||
remove => throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override void Attach()
|
|
||||||
{
|
|
||||||
base.Attach();
|
|
||||||
MyMultiplayer.Static.ClientJoined += RaiseClientJoined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override void Detach()
|
|
||||||
{
|
|
||||||
MyMultiplayer.Static.ClientJoined -= RaiseClientJoined;
|
|
||||||
base.Detach();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,194 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using NLog;
|
|
||||||
using Torch.Utils;
|
|
||||||
using MessageBox = System.Windows.MessageBox;
|
|
||||||
|
|
||||||
namespace Torch.Client
|
|
||||||
{
|
|
||||||
public static class Program
|
|
||||||
{
|
|
||||||
public const string SpaceEngineersBinaries = "Bin64";
|
|
||||||
private static string _spaceEngInstallAlias = null;
|
|
||||||
|
|
||||||
public static string SpaceEngineersInstallAlias
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
// ReSharper disable once ConvertIfStatementToNullCoalescingExpression
|
|
||||||
if (_spaceEngInstallAlias == null)
|
|
||||||
{
|
|
||||||
// ReSharper disable once AssignNullToNotNullAttribute
|
|
||||||
_spaceEngInstallAlias = Path.Combine(Path.GetDirectoryName(typeof(Program).Assembly.Location),
|
|
||||||
"SpaceEngineersAlias");
|
|
||||||
}
|
|
||||||
return _spaceEngInstallAlias;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private const string _steamSpaceEngineersDirectory = @"steamapps\common\SpaceEngineers\";
|
|
||||||
private const string _spaceEngineersVerifyFile = SpaceEngineersBinaries + @"\SpaceEngineers.exe";
|
|
||||||
|
|
||||||
public const string ConfigName = "Torch.cfg";
|
|
||||||
|
|
||||||
private static Logger _log = LogManager.GetLogger("Torch");
|
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
[DllImport("kernel32.dll")]
|
|
||||||
private static extern void AllocConsole();
|
|
||||||
[DllImport("kernel32.dll")]
|
|
||||||
private static extern void FreeConsole();
|
|
||||||
#endif
|
|
||||||
public static void Main(string[] args)
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
try
|
|
||||||
{
|
|
||||||
AllocConsole();
|
|
||||||
#endif
|
|
||||||
if (!TorchLauncher.IsTorchWrapped())
|
|
||||||
{
|
|
||||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
|
||||||
|
|
||||||
// Early config: Resolve SE install directory.
|
|
||||||
if (!File.Exists(Path.Combine(SpaceEngineersInstallAlias, _spaceEngineersVerifyFile)))
|
|
||||||
SetupSpaceEngInstallAlias();
|
|
||||||
|
|
||||||
TorchLauncher.Launch(Assembly.GetEntryAssembly().FullName, args,
|
|
||||||
Path.Combine(SpaceEngineersInstallAlias, SpaceEngineersBinaries));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RunClient();
|
|
||||||
#if DEBUG
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
FreeConsole();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void SetupSpaceEngInstallAlias()
|
|
||||||
{
|
|
||||||
string spaceEngineersDirectory = null;
|
|
||||||
|
|
||||||
// TODO look at Steam/config/Config.VDF? Has alternate directories.
|
|
||||||
var steamDir =
|
|
||||||
Microsoft.Win32.Registry.GetValue("HKEY_CURRENT_USER\\SOFTWARE\\Valve\\Steam", "SteamPath",
|
|
||||||
null) as string;
|
|
||||||
if (steamDir != null)
|
|
||||||
{
|
|
||||||
spaceEngineersDirectory = Path.Combine(steamDir, _steamSpaceEngineersDirectory);
|
|
||||||
// ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
|
|
||||||
if (File.Exists(Path.Combine(spaceEngineersDirectory, _spaceEngineersVerifyFile)))
|
|
||||||
_log.Debug("Found Space Engineers in {0}", spaceEngineersDirectory);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_log.Debug("Couldn't find Space Engineers in {0}", spaceEngineersDirectory);
|
|
||||||
spaceEngineersDirectory = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (spaceEngineersDirectory == null)
|
|
||||||
{
|
|
||||||
var dialog = new System.Windows.Forms.FolderBrowserDialog
|
|
||||||
{
|
|
||||||
Description = "Please select the SpaceEngineers installation folder"
|
|
||||||
};
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (dialog.ShowDialog() != DialogResult.OK)
|
|
||||||
{
|
|
||||||
var ex = new FileNotFoundException(
|
|
||||||
"Unable to find the Space Engineers install directory, aborting");
|
|
||||||
_log.Fatal(ex);
|
|
||||||
LogManager.Flush();
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
spaceEngineersDirectory = dialog.SelectedPath;
|
|
||||||
if (File.Exists(Path.Combine(spaceEngineersDirectory, _spaceEngineersVerifyFile)))
|
|
||||||
break;
|
|
||||||
if (MessageBox.Show(
|
|
||||||
$"Unable to find {0} in {1}. Are you sure it's the Space Engineers install directory?",
|
|
||||||
"Invalid Space Engineers Directory", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
|
||||||
break;
|
|
||||||
} while (true); // Repeat until they confirm.
|
|
||||||
}
|
|
||||||
if (!JunctionLink(SpaceEngineersInstallAlias, spaceEngineersDirectory))
|
|
||||||
{
|
|
||||||
var ex = new IOException(
|
|
||||||
$"Failed to create junction link {SpaceEngineersInstallAlias} => {spaceEngineersDirectory}. Aborting.");
|
|
||||||
_log.Fatal(ex);
|
|
||||||
LogManager.Flush();
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
string junctionVerify = Path.Combine(SpaceEngineersInstallAlias, _spaceEngineersVerifyFile);
|
|
||||||
if (!File.Exists(junctionVerify))
|
|
||||||
{
|
|
||||||
var ex = new FileNotFoundException(
|
|
||||||
$"Junction link is not working. File {junctionVerify} does not exist");
|
|
||||||
_log.Fatal(ex);
|
|
||||||
LogManager.Flush();
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool JunctionLink(string linkName, string targetDir)
|
|
||||||
{
|
|
||||||
var junctionLinkProc = new ProcessStartInfo("cmd.exe", $"/c mklink /J \"{linkName}\" \"{targetDir}\"")
|
|
||||||
{
|
|
||||||
WorkingDirectory = Directory.GetCurrentDirectory(),
|
|
||||||
UseShellExecute = false,
|
|
||||||
RedirectStandardOutput = true,
|
|
||||||
StandardOutputEncoding = Encoding.ASCII
|
|
||||||
};
|
|
||||||
Process cmd = Process.Start(junctionLinkProc);
|
|
||||||
// ReSharper disable once PossibleNullReferenceException
|
|
||||||
while (!cmd.HasExited)
|
|
||||||
{
|
|
||||||
string line = cmd.StandardOutput.ReadLine();
|
|
||||||
if (!string.IsNullOrWhiteSpace(line))
|
|
||||||
_log.Info(line);
|
|
||||||
Thread.Sleep(100);
|
|
||||||
}
|
|
||||||
if (cmd.ExitCode != 0)
|
|
||||||
_log.Error("Unable to create junction link {0} => {1}", linkName, targetDir);
|
|
||||||
return cmd.ExitCode == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
|
||||||
{
|
|
||||||
var ex = (Exception) e.ExceptionObject;
|
|
||||||
_log.Error(ex);
|
|
||||||
LogManager.Flush();
|
|
||||||
MessageBox.Show(ex.StackTrace, ex.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
||||||
private static void RunClient()
|
|
||||||
{
|
|
||||||
var client = new TorchClient();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
client.Init();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
_log.Fatal("Torch encountered an error trying to initialize the game.");
|
|
||||||
_log.Fatal(e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
client.Start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,17 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
[assembly: AssemblyTitle("Torch Client")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("Torch")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © Torch API 2017")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
[assembly: AssemblyConfiguration("Debug")]
|
|
||||||
#else
|
|
||||||
[assembly: AssemblyConfiguration("Release")]
|
|
||||||
#endif
|
|
63
Torch.Client/Properties/Resources.Designer.cs
generated
63
Torch.Client/Properties/Resources.Designer.cs
generated
@@ -1,63 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
// Runtime Version:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace Torch.Client.Properties {
|
|
||||||
using System;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
|
||||||
/// </summary>
|
|
||||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
|
||||||
// class via a tool like ResGen or Visual Studio.
|
|
||||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
|
||||||
// with the /str option, or rebuild your VS project.
|
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
|
||||||
internal class Resources {
|
|
||||||
|
|
||||||
private static global::System.Resources.ResourceManager resourceMan;
|
|
||||||
|
|
||||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
|
||||||
|
|
||||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
|
||||||
internal Resources() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the cached ResourceManager instance used by this class.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
|
||||||
get {
|
|
||||||
if (object.ReferenceEquals(resourceMan, null)) {
|
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Torch.Client.Properties.Resources", typeof(Resources).Assembly);
|
|
||||||
resourceMan = temp;
|
|
||||||
}
|
|
||||||
return resourceMan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Overrides the current thread's CurrentUICulture property for all
|
|
||||||
/// resource lookups using this strongly typed resource class.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Globalization.CultureInfo Culture {
|
|
||||||
get {
|
|
||||||
return resourceCulture;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
resourceCulture = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,117 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
26
Torch.Client/Properties/Settings.Designer.cs
generated
26
Torch.Client/Properties/Settings.Designer.cs
generated
@@ -1,26 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
// Runtime Version:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace Torch.Client.Properties {
|
|
||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.0.0.0")]
|
|
||||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
|
||||||
|
|
||||||
public static Settings Default {
|
|
||||||
get {
|
|
||||||
return defaultInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
|
||||||
<Profiles>
|
|
||||||
<Profile Name="(Default)" />
|
|
||||||
</Profiles>
|
|
||||||
<Settings />
|
|
||||||
</SettingsFile>
|
|
@@ -1,181 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<ProjectGuid>{E36DF745-260B-4956-A2E8-09F08B2E7161}</ProjectGuid>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>Torch.Client</RootNamespace>
|
|
||||||
<AssemblyName>Torch.Client</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
|
||||||
<TargetFrameworkProfile />
|
|
||||||
<NuGetPackageImportStamp>
|
|
||||||
</NuGetPackageImportStamp>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<OutputPath>$(SolutionDir)\bin\x64\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
|
||||||
<Prefer32Bit>true</Prefer32Bit>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
|
||||||
<OutputPath>$(SolutionDir)\bin\x64\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
|
||||||
<Prefer32Bit>true</Prefer32Bit>
|
|
||||||
<DocumentationFile>$(SolutionDir)\bin\x64\Release\Torch.Client.xml</DocumentationFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<ApplicationIcon>torchicon.ico</ApplicationIcon>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\NLog.4.4.12\lib\net45\NLog.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Sandbox.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\Sandbox.Common.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Sandbox.Game">
|
|
||||||
<HintPath>..\GameBinaries\Sandbox.Game.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Sandbox.Graphics, Version=0.1.6108.20417, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\Sandbox.Graphics.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="SpaceEngineers.Game">
|
|
||||||
<HintPath>..\GameBinaries\SpaceEngineers.Game.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Windows.Forms" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="System.Net.Http" />
|
|
||||||
<Reference Include="System.Xaml">
|
|
||||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage">
|
|
||||||
<HintPath>..\GameBinaries\VRage.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Game">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Game.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Game.XmlSerializers">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Game.XmlSerializers.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Input, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\VRage.Input.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Library">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Library.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Math, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\GameBinaries\VRage.Math.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Render">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Render.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Render11">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Render11.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Steam">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Steam.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="WindowsBase" />
|
|
||||||
<Reference Include="PresentationCore" />
|
|
||||||
<Reference Include="PresentationFramework" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="..\Versioning\AssemblyVersion.cs">
|
|
||||||
<Link>Properties\AssemblyVersion.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Manager\MultiplayerManagerClient.cs" />
|
|
||||||
<Compile Include="Manager\MultiplayerManagerLobby.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="TorchClient.cs" />
|
|
||||||
<Compile Include="TorchClientConfig.cs" />
|
|
||||||
<Compile Include="TorchConsoleScreen.cs" />
|
|
||||||
<Compile Include="TorchSettingsScreen.cs" />
|
|
||||||
<Compile Include="Program.cs" />
|
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Properties\Settings.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Settings.settings</DependentUpon>
|
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="UI\TorchMainMenuScreen.cs" />
|
|
||||||
<Compile Include="UI\TorchNavScreen.cs" />
|
|
||||||
<Compile Include="UI\TorchSettingsScreen.cs" />
|
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<None Include="packages.config" />
|
|
||||||
<None Include="Properties\Settings.settings">
|
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
|
||||||
</None>
|
|
||||||
<AppDesigner Include="Properties\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\Torch.API\Torch.API.csproj">
|
|
||||||
<Project>{fba5d932-6254-4a1e-baf4-e229fa94e3c2}</Project>
|
|
||||||
<Name>Torch.API</Name>
|
|
||||||
<Private>False</Private>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\Torch\Torch.csproj">
|
|
||||||
<Project>{7E01635C-3B67-472E-BCD6-C5539564F214}</Project>
|
|
||||||
<Name>Torch</Name>
|
|
||||||
<Private>False</Private>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Resource Include="torchicon.ico" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup />
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<Import Project="$(SolutionDir)\TransformOnBuild.targets" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<PostBuildEvent>copy "$(SolutionDir)NLog.config" "$(TargetDir)"
|
|
||||||
</PostBuildEvent>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Project>
|
|
@@ -1,92 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Windows;
|
|
||||||
using Sandbox;
|
|
||||||
using Sandbox.Engine.Multiplayer;
|
|
||||||
using Sandbox.Engine.Networking;
|
|
||||||
using Sandbox.Engine.Platform;
|
|
||||||
using Sandbox.Game;
|
|
||||||
using SpaceEngineers.Game;
|
|
||||||
using VRage.Steam;
|
|
||||||
using Torch.API;
|
|
||||||
using Torch.API.Managers;
|
|
||||||
using Torch.API.Session;
|
|
||||||
using Torch.Client.Manager;
|
|
||||||
using Torch.Client.UI;
|
|
||||||
using Torch.Session;
|
|
||||||
using VRage;
|
|
||||||
using VRage.FileSystem;
|
|
||||||
using VRage.GameServices;
|
|
||||||
using VRageRender;
|
|
||||||
using VRageRender.ExternalApp;
|
|
||||||
|
|
||||||
namespace Torch.Client
|
|
||||||
{
|
|
||||||
public class TorchClient : TorchBase, ITorchClient
|
|
||||||
{
|
|
||||||
protected override uint SteamAppId => 244850;
|
|
||||||
protected override string SteamAppName => "SpaceEngineers";
|
|
||||||
|
|
||||||
public TorchClient()
|
|
||||||
{
|
|
||||||
Config = new TorchClientConfig();
|
|
||||||
var sessionManager = Managers.GetManager<ITorchSessionManager>();
|
|
||||||
sessionManager.AddFactory((x) => MyMultiplayer.Static is MyMultiplayerLobby
|
|
||||||
? new MultiplayerManagerLobby(this)
|
|
||||||
: null);
|
|
||||||
sessionManager.AddFactory((x) => MyMultiplayer.Static is MyMultiplayerClientBase
|
|
||||||
? new MultiplayerManagerClient(this)
|
|
||||||
: null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Init()
|
|
||||||
{
|
|
||||||
Directory.SetCurrentDirectory(Program.SpaceEngineersInstallAlias);
|
|
||||||
MyFileSystem.ExePath = Path.Combine(Program.SpaceEngineersInstallAlias, Program.SpaceEngineersBinaries);
|
|
||||||
Log.Info("Initializing Torch Client");
|
|
||||||
Config.InstancePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
|
||||||
SteamAppName);
|
|
||||||
base.Init();
|
|
||||||
OverrideMenus();
|
|
||||||
SetRenderWindowTitle($"Space Engineers v{GameVersion} with Torch v{TorchVersion}");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OverrideMenus()
|
|
||||||
{
|
|
||||||
var credits = new MyCreditsDepartment("Torch Developed By")
|
|
||||||
{
|
|
||||||
Persons = new List<MyCreditsPerson>
|
|
||||||
{
|
|
||||||
new MyCreditsPerson("THE TORCH TEAM"),
|
|
||||||
new MyCreditsPerson("http://github.com/TorchSE"),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
MyPerGameSettings.Credits.Departments.Insert(0, credits);
|
|
||||||
|
|
||||||
MyPerGameSettings.GUI.MainMenu = typeof(TorchMainMenuScreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetRenderWindowTitle(string title)
|
|
||||||
{
|
|
||||||
MyRenderThread renderThread = MySandboxGame.Static?.GameRenderComponent?.RenderThread;
|
|
||||||
if (renderThread == null)
|
|
||||||
return;
|
|
||||||
FieldInfo renderWindowField = typeof(MyRenderThread).GetField("m_renderWindow",
|
|
||||||
BindingFlags.Instance | BindingFlags.NonPublic);
|
|
||||||
if (renderWindowField == null)
|
|
||||||
return;
|
|
||||||
var window =
|
|
||||||
renderWindowField.GetValue(MySandboxGame.Static.GameRenderComponent.RenderThread) as
|
|
||||||
System.Windows.Forms.Form;
|
|
||||||
if (window != null)
|
|
||||||
renderThread.Invoke(() => { window.Text = title; });
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Restart()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,32 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Torch.Client
|
|
||||||
{
|
|
||||||
public class TorchClientConfig : ITorchConfig
|
|
||||||
{
|
|
||||||
// How do we want to handle client side config? It's radically different than the server.
|
|
||||||
public bool GetPluginUpdates { get; set; } = false;
|
|
||||||
public bool GetTorchUpdates { get; set; } = false;
|
|
||||||
public string InstanceName { get; set; } = "TorchClient";
|
|
||||||
public string InstancePath { get; set; }
|
|
||||||
public bool NoUpdate { get; set; } = true;
|
|
||||||
public List<string> Plugins { get; set; }
|
|
||||||
public bool ShouldUpdatePlugins { get; } = false;
|
|
||||||
public bool ShouldUpdateTorch { get; } = false;
|
|
||||||
public int TickTimeout { get; set; }
|
|
||||||
public bool Autostart { get; set; } = false;
|
|
||||||
public bool ForceUpdate { get; set; } = false;
|
|
||||||
public bool NoGui { get; set; } = false;
|
|
||||||
public bool RestartOnCrash { get; set; } = false;
|
|
||||||
public string WaitForPID { get; set; } = null;
|
|
||||||
|
|
||||||
public bool Save(string path = null)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,63 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
using Sandbox.Graphics;
|
|
||||||
using Sandbox.Graphics.GUI;
|
|
||||||
using Sandbox.Gui;
|
|
||||||
using VRage.Utils;
|
|
||||||
using VRageMath;
|
|
||||||
|
|
||||||
namespace Torch.Client
|
|
||||||
{
|
|
||||||
public class TorchConsoleScreen : MyGuiScreenBase
|
|
||||||
{
|
|
||||||
private MyGuiControlTextbox _textBox;
|
|
||||||
|
|
||||||
public override string GetFriendlyName()
|
|
||||||
{
|
|
||||||
return "Torch Console";
|
|
||||||
}
|
|
||||||
|
|
||||||
public TorchConsoleScreen() : base(isTopMostScreen: true)
|
|
||||||
{
|
|
||||||
BackgroundColor = new Vector4(0, 0, 0, 0.5f);
|
|
||||||
Size = new Vector2(0.5f);
|
|
||||||
RecreateControls(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed override void RecreateControls(bool constructor)
|
|
||||||
{
|
|
||||||
Elements.Clear();
|
|
||||||
Elements.Add(new MyGuiControlLabel
|
|
||||||
{
|
|
||||||
Text = "Torch Console",
|
|
||||||
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
|
|
||||||
Position = MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP)
|
|
||||||
});
|
|
||||||
|
|
||||||
Controls.Clear();
|
|
||||||
_textBox = new MyGuiControlTextbox
|
|
||||||
{
|
|
||||||
BorderEnabled = false,
|
|
||||||
Enabled = true,
|
|
||||||
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
|
|
||||||
Position = new Vector2(-0.5f)
|
|
||||||
};
|
|
||||||
Controls.Add(_textBox);
|
|
||||||
|
|
||||||
var pistonBtn = new MyGuiControlImageButton
|
|
||||||
{
|
|
||||||
Name = "TorchButton",
|
|
||||||
Text = "Torch",
|
|
||||||
HighlightType = MyGuiControlHighlightType.WHEN_CURSOR_OVER,
|
|
||||||
Visible = true,
|
|
||||||
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP
|
|
||||||
};
|
|
||||||
|
|
||||||
Controls.Add(pistonBtn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,38 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Sandbox.Graphics;
|
|
||||||
using Sandbox.Graphics.GUI;
|
|
||||||
using VRage.Utils;
|
|
||||||
using VRageMath;
|
|
||||||
|
|
||||||
namespace Torch.Client
|
|
||||||
{
|
|
||||||
public class TorchSettingsScreen : MyGuiScreenBase
|
|
||||||
{
|
|
||||||
public override string GetFriendlyName() => "Torch Settings";
|
|
||||||
|
|
||||||
public TorchSettingsScreen() : base(new Vector2(0.5f), null, Vector2.One, true)
|
|
||||||
{
|
|
||||||
RecreateControls(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed override void RecreateControls(bool constructor)
|
|
||||||
{
|
|
||||||
base.RecreateControls(constructor);
|
|
||||||
AddCaption(MyStringId.GetOrCompute("Torch Settings"), null, new Vector2(0, 0), 1.2f);
|
|
||||||
var pluginList = new MyGuiControlListbox
|
|
||||||
{
|
|
||||||
VisibleRowsCount = 10,
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (var plugin in TorchBase.Instance.Plugins)
|
|
||||||
{
|
|
||||||
pluginList.Items.Add(new MyGuiControlListbox.Item(new StringBuilder(plugin.Name)));
|
|
||||||
}
|
|
||||||
Controls.Add(pluginList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,56 +0,0 @@
|
|||||||
#pragma warning disable 618
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Sandbox.Engine.Networking;
|
|
||||||
using Sandbox.Engine.Utils;
|
|
||||||
using Sandbox.Game;
|
|
||||||
using Sandbox.Game.Gui;
|
|
||||||
using Sandbox.Graphics;
|
|
||||||
using Sandbox.Graphics.GUI;
|
|
||||||
using Sandbox.Gui;
|
|
||||||
using SpaceEngineers.Game.GUI;
|
|
||||||
using Torch.Utils;
|
|
||||||
using VRage.Game;
|
|
||||||
using VRage.Utils;
|
|
||||||
using VRageMath;
|
|
||||||
|
|
||||||
namespace Torch.Client.UI
|
|
||||||
{
|
|
||||||
public class TorchMainMenuScreen : MyGuiScreenMainMenu
|
|
||||||
{
|
|
||||||
#pragma warning disable 169
|
|
||||||
[ReflectedGetter(Name = "m_elementGroup")]
|
|
||||||
private static Func<MyGuiScreenMainMenu, MyGuiControlElementGroup> _elementsGroup;
|
|
||||||
#pragma warning restore 169
|
|
||||||
|
|
||||||
public TorchMainMenuScreen() : this(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public TorchMainMenuScreen(bool pauseGame)
|
|
||||||
: base(pauseGame)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override void RecreateControls(bool constructor)
|
|
||||||
{
|
|
||||||
base.RecreateControls(constructor);
|
|
||||||
|
|
||||||
Vector2 minSizeGui = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui;
|
|
||||||
Vector2 value = MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM, 54, 54) + new Vector2(minSizeGui.X / 2f, 0f) + new Vector2(15f, 0f) / MyGuiConstants.GUI_OPTIMAL_SIZE;
|
|
||||||
|
|
||||||
MyGuiControlButton myGuiControlButton = MakeButton(value - 9 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
|
|
||||||
MyStringId.GetOrCompute("Torch"), TorchButtonClicked, MyCommonTexts.ToolTipExitToWindows);
|
|
||||||
Controls.Add(myGuiControlButton);
|
|
||||||
_elementsGroup.Invoke(this).Add(myGuiControlButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TorchButtonClicked(MyGuiControlButton obj)
|
|
||||||
{
|
|
||||||
MyGuiSandbox.AddScreen(MyGuiSandbox.CreateScreen<TorchNavScreen>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,49 +0,0 @@
|
|||||||
using Sandbox;
|
|
||||||
using Sandbox.Game.Gui;
|
|
||||||
using Sandbox.Graphics.GUI;
|
|
||||||
using VRage;
|
|
||||||
using VRage.Game;
|
|
||||||
using VRage.Utils;
|
|
||||||
using VRageMath;
|
|
||||||
|
|
||||||
namespace Torch.Client.UI
|
|
||||||
{
|
|
||||||
public class TorchNavScreen : MyGuiScreenBase
|
|
||||||
{
|
|
||||||
private MyGuiControlElementGroup _elementGroup;
|
|
||||||
|
|
||||||
public TorchNavScreen() : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.35875f, 0.558333337f))
|
|
||||||
{
|
|
||||||
EnabledBackgroundFade = true;
|
|
||||||
RecreateControls(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void RecreateControls(bool constructor)
|
|
||||||
{
|
|
||||||
base.RecreateControls(constructor);
|
|
||||||
_elementGroup = new MyGuiControlElementGroup();
|
|
||||||
_elementGroup.HighlightChanged += ElementGroupHighlightChanged;
|
|
||||||
AddCaption(MyCommonTexts.ScreenCaptionOptions, null, null);
|
|
||||||
var value = new Vector2(0f, -m_size.Value.Y / 2f + 0.146f);
|
|
||||||
var num = 0;
|
|
||||||
var myGuiControlButton = new MyGuiControlButton(value + num++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenOptionsButtonGame), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_ACTIVE, delegate(MyGuiControlButton sender)
|
|
||||||
{
|
|
||||||
MyGuiSandbox.AddScreen(MyGuiSandbox.CreateScreen<TorchSettingsScreen>());
|
|
||||||
}, GuiSounds.MouseClick, 1f, null);
|
|
||||||
Controls.Add(myGuiControlButton);
|
|
||||||
_elementGroup.Add(myGuiControlButton);
|
|
||||||
CloseButtonEnabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ElementGroupHighlightChanged(MyGuiControlElementGroup obj)
|
|
||||||
{
|
|
||||||
foreach (MyGuiControlBase current in _elementGroup)
|
|
||||||
if (current.HasFocus && obj.SelectedElement != current)
|
|
||||||
FocusedControl = obj.SelectedElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string GetFriendlyName() => "Torch";
|
|
||||||
|
|
||||||
public void OnBackClick(MyGuiControlButton sender) => CloseScreen();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,25 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Sandbox.Graphics.GUI;
|
|
||||||
using VRageMath;
|
|
||||||
|
|
||||||
namespace Torch.Client.UI
|
|
||||||
{
|
|
||||||
public class TorchSettingsScreen : MyGuiScreenBase
|
|
||||||
{
|
|
||||||
public TorchSettingsScreen() : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR,
|
|
||||||
new Vector2(0.35875f, 0.558333337f))
|
|
||||||
{
|
|
||||||
EnabledBackgroundFade = true;
|
|
||||||
RecreateControls(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override string GetFriendlyName() => "Torch Settings";
|
|
||||||
|
|
||||||
public void OnBackClick(MyGuiControlButton sender) => CloseScreen();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="Mono.TextTransform" version="1.0.0" targetFramework="net461" />
|
|
||||||
<package id="NLog" version="4.4.12" targetFramework="net461" />
|
|
||||||
</packages>
|
|
Binary file not shown.
Before Width: | Height: | Size: 17 KiB |
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ProtoBuf;
|
using ProtoBuf;
|
||||||
using Sandbox.ModAPI;
|
using Sandbox.ModAPI;
|
||||||
|
|
||||||
|
@@ -1,26 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Torch.Mod.Messages
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// shim to store incoming message data
|
|
||||||
/// </summary>
|
|
||||||
internal class IncomingMessage : MessageBase
|
|
||||||
{
|
|
||||||
public IncomingMessage()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void ProcessClient()
|
|
||||||
{
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void ProcessServer()
|
|
||||||
{
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
49
Torch.Mod/Messages/JoinServerMessage.cs
Normal file
49
Torch.Mod/Messages/JoinServerMessage.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
using ProtoBuf;
|
||||||
|
using Sandbox.ModAPI;
|
||||||
|
|
||||||
|
namespace Torch.Mod.Messages
|
||||||
|
{
|
||||||
|
[ProtoContract]
|
||||||
|
public class JoinServerMessage : MessageBase
|
||||||
|
{
|
||||||
|
[ProtoMember(201)]
|
||||||
|
public int Delay;
|
||||||
|
[ProtoMember(202)]
|
||||||
|
public string Address;
|
||||||
|
|
||||||
|
private JoinServerMessage()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public JoinServerMessage(string address)
|
||||||
|
{
|
||||||
|
Address = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JoinServerMessage(string address, int delay)
|
||||||
|
{
|
||||||
|
Address = address;
|
||||||
|
Delay = delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ProcessClient()
|
||||||
|
{
|
||||||
|
if (Delay <= 0)
|
||||||
|
{
|
||||||
|
MyAPIGateway.Multiplayer.JoinServer(Address);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MyAPIGateway.Parallel.StartBackground(() =>
|
||||||
|
{
|
||||||
|
MyAPIGateway.Parallel.Sleep(Delay);
|
||||||
|
MyAPIGateway.Multiplayer.JoinServer(Address);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ProcessServer()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
using ProtoBuf;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ProtoBuf;
|
|
||||||
|
|
||||||
namespace Torch.Mod.Messages
|
namespace Torch.Mod.Messages
|
||||||
{
|
{
|
||||||
@@ -11,41 +6,15 @@ namespace Torch.Mod.Messages
|
|||||||
[ProtoInclude(1, typeof(DialogMessage))]
|
[ProtoInclude(1, typeof(DialogMessage))]
|
||||||
[ProtoInclude(2, typeof(NotificationMessage))]
|
[ProtoInclude(2, typeof(NotificationMessage))]
|
||||||
[ProtoInclude(3, typeof(VoxelResetMessage))]
|
[ProtoInclude(3, typeof(VoxelResetMessage))]
|
||||||
|
[ProtoInclude(4, typeof(JoinServerMessage))]
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
[ProtoContract]
|
[ProtoContract]
|
||||||
public abstract class MessageBase
|
public abstract class MessageBase
|
||||||
{
|
{
|
||||||
[ProtoMember(101)]
|
|
||||||
public ulong SenderId;
|
public ulong SenderId;
|
||||||
|
|
||||||
public abstract void ProcessClient();
|
public abstract void ProcessClient();
|
||||||
public abstract void ProcessServer();
|
public abstract void ProcessServer();
|
||||||
|
|
||||||
//members below not serialized, they're just metadata about the intended target(s) of this message
|
|
||||||
internal MessageTarget TargetType;
|
|
||||||
internal ulong Target;
|
|
||||||
internal ulong[] Ignore;
|
|
||||||
internal byte[] CompressedData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum MessageTarget
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Send to Target
|
|
||||||
/// </summary>
|
|
||||||
Single,
|
|
||||||
/// <summary>
|
|
||||||
/// Send to Server
|
|
||||||
/// </summary>
|
|
||||||
Server,
|
|
||||||
/// <summary>
|
|
||||||
/// Send to all Clients (only valid from server)
|
|
||||||
/// </summary>
|
|
||||||
AllClients,
|
|
||||||
/// <summary>
|
|
||||||
/// Send to all except those steam ID listed in Ignore
|
|
||||||
/// </summary>
|
|
||||||
AllExcept,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using ProtoBuf;
|
using ProtoBuf;
|
||||||
using Sandbox.ModAPI;
|
using Sandbox.ModAPI;
|
||||||
|
|
||||||
|
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using ProtoBuf;
|
using ProtoBuf;
|
||||||
using Sandbox.ModAPI;
|
using Sandbox.ModAPI;
|
||||||
using VRage.ModAPI;
|
using VRage.ModAPI;
|
||||||
|
@@ -1,142 +1,50 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Sandbox.ModAPI;
|
using Sandbox.ModAPI;
|
||||||
using Torch.Mod.Messages;
|
using Torch.Mod.Messages;
|
||||||
using VRage;
|
using VRage.Game.Components;
|
||||||
using VRage.Collections;
|
|
||||||
using VRage.Game.ModAPI;
|
using VRage.Game.ModAPI;
|
||||||
using VRage.Utils;
|
#if TORCH
|
||||||
using Task = ParallelTasks.Task;
|
using Torch.Utils;
|
||||||
|
using VRage.Library.Collections;
|
||||||
|
using System.Reflection;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Torch.Mod
|
namespace Torch.Mod
|
||||||
{
|
{
|
||||||
public static class ModCommunication
|
[MySessionComponentDescriptor(MyUpdateOrder.AfterSimulation)]
|
||||||
|
public class ModCommunication : MySessionComponentBase
|
||||||
{
|
{
|
||||||
public const ushort NET_ID = 4352;
|
public const ulong MOD_ID = 2915950488;
|
||||||
private static bool _closing = false;
|
private const ushort CHANNEL = 7654;
|
||||||
private static BlockingCollection<MessageBase> _processing;
|
|
||||||
private static MyConcurrentPool<IncomingMessage> _messagePool;
|
|
||||||
private static List<IMyPlayer> _playerCache;
|
|
||||||
|
|
||||||
public static void Register()
|
public override void BeforeStart()
|
||||||
{
|
{
|
||||||
MyLog.Default.WriteLineAndConsole("TORCH MOD: Registering mod communication.");
|
base.BeforeStart();
|
||||||
_processing = new BlockingCollection<MessageBase>(new ConcurrentQueue<MessageBase>());
|
MyAPIGateway.Multiplayer.RegisterSecureMessageHandler(CHANNEL, MessageHandler);
|
||||||
_playerCache = new List<IMyPlayer>();
|
|
||||||
_messagePool = new MyConcurrentPool<IncomingMessage>(8);
|
|
||||||
|
|
||||||
MyAPIGateway.Multiplayer.RegisterMessageHandler(NET_ID, MessageHandler);
|
|
||||||
//background thread to handle de/compression and processing
|
|
||||||
_closing = false;
|
|
||||||
MyAPIGateway.Parallel.StartBackground(DoProcessing);
|
|
||||||
MyLog.Default.WriteLineAndConsole("TORCH MOD: Mod communication registered successfully.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Unregister()
|
private void MessageHandler(ushort channel, byte[] data, ulong sender, bool fromServer)
|
||||||
{
|
{
|
||||||
MyLog.Default.WriteLineAndConsole("TORCH MOD: Unregistering mod communication.");
|
if (!fromServer)
|
||||||
MyAPIGateway.Multiplayer?.UnregisterMessageHandler(NET_ID, MessageHandler);
|
return;
|
||||||
_processing?.CompleteAdding();
|
|
||||||
_closing = true;
|
var message = MyAPIGateway.Utilities.SerializeFromBinary<MessageBase>(data);
|
||||||
//_task.Wait();
|
message.SenderId = sender;
|
||||||
|
|
||||||
|
if (MyAPIGateway.Multiplayer.IsServer) message.ProcessServer();
|
||||||
|
else message.ProcessClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void MessageHandler(byte[] bytes)
|
#if TORCH
|
||||||
|
[ReflectedMethodInfo(typeof(MyAPIUtilities), "VRage.Game.ModAPI.IMyUtilities.SerializeToBinary")]
|
||||||
|
private static MethodInfo _serializeMethod = null!;
|
||||||
|
|
||||||
|
private static readonly CacheList<IMyPlayer> Players = new();
|
||||||
|
|
||||||
|
private static byte[] Serialize(MessageBase message)
|
||||||
{
|
{
|
||||||
var m = _messagePool.Get();
|
return (byte[])_serializeMethod.MakeGenericMethod(message.GetType())
|
||||||
m.CompressedData = bytes;
|
.Invoke(MyAPIGateway.Utilities, new object[] { message });
|
||||||
_processing.Add(m);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void DoProcessing()
|
|
||||||
{
|
|
||||||
while (!_closing)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var m = _processing.Take();
|
|
||||||
MyLog.Default.WriteLineAndConsole($"Processing message: {m.GetType().Name}");
|
|
||||||
|
|
||||||
if (m is IncomingMessage)
|
|
||||||
{
|
|
||||||
MessageBase i;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var o = MyCompression.Decompress(m.CompressedData);
|
|
||||||
m.CompressedData = null;
|
|
||||||
_messagePool.Return((IncomingMessage)m);
|
|
||||||
i = MyAPIGateway.Utilities.SerializeFromBinary<MessageBase>(o);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MyLog.Default.WriteLineAndConsole($"TORCH MOD: Failed to deserialize message! {ex}");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (MyAPIGateway.Multiplayer.IsServer)
|
|
||||||
i.ProcessServer();
|
|
||||||
else
|
|
||||||
i.ProcessClient();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var b = MyAPIGateway.Utilities.SerializeToBinary(m);
|
|
||||||
m.CompressedData = MyCompression.Compress(b);
|
|
||||||
|
|
||||||
MyAPIGateway.Utilities.InvokeOnGameThread(() =>
|
|
||||||
{
|
|
||||||
|
|
||||||
switch (m.TargetType)
|
|
||||||
{
|
|
||||||
case MessageTarget.Single:
|
|
||||||
MyAPIGateway.Multiplayer.SendMessageTo(NET_ID, m.CompressedData, m.Target);
|
|
||||||
break;
|
|
||||||
case MessageTarget.Server:
|
|
||||||
MyAPIGateway.Multiplayer.SendMessageToServer(NET_ID, m.CompressedData);
|
|
||||||
break;
|
|
||||||
case MessageTarget.AllClients:
|
|
||||||
MyAPIGateway.Players.GetPlayers(_playerCache);
|
|
||||||
foreach (var p in _playerCache)
|
|
||||||
{
|
|
||||||
if (p.SteamUserId == MyAPIGateway.Multiplayer.MyId)
|
|
||||||
continue;
|
|
||||||
MyAPIGateway.Multiplayer.SendMessageTo(NET_ID, m.CompressedData, p.SteamUserId);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MessageTarget.AllExcept:
|
|
||||||
MyAPIGateway.Players.GetPlayers(_playerCache);
|
|
||||||
foreach (var p in _playerCache)
|
|
||||||
{
|
|
||||||
if (p.SteamUserId == MyAPIGateway.Multiplayer.MyId || m.Ignore.Contains(p.SteamUserId))
|
|
||||||
continue;
|
|
||||||
MyAPIGateway.Multiplayer.SendMessageTo(NET_ID, m.CompressedData, p.SteamUserId);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
_playerCache.Clear();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MyLog.Default.WriteLineAndConsole($"TORCH MOD: Exception occurred in communication thread! {ex}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MyLog.Default.WriteLineAndConsole("TORCH MOD: COMMUNICATION THREAD: EXIT SIGNAL RECEIVED!");
|
|
||||||
//exit signal received. Clean everything and GTFO
|
|
||||||
_processing?.Dispose();
|
|
||||||
_processing = null;
|
|
||||||
_messagePool?.Clean();
|
|
||||||
_messagePool = null;
|
|
||||||
_playerCache = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SendMessageTo(MessageBase message, ulong target)
|
public static void SendMessageTo(MessageBase message, ulong target)
|
||||||
@@ -144,12 +52,7 @@ namespace Torch.Mod
|
|||||||
if (!MyAPIGateway.Multiplayer.IsServer)
|
if (!MyAPIGateway.Multiplayer.IsServer)
|
||||||
throw new Exception("Only server can send targeted messages");
|
throw new Exception("Only server can send targeted messages");
|
||||||
|
|
||||||
if (_closing)
|
MyAPIGateway.Multiplayer.SendMessageTo(CHANNEL, Serialize(message), target);
|
||||||
return;
|
|
||||||
|
|
||||||
message.Target = target;
|
|
||||||
message.TargetType = MessageTarget.Single;
|
|
||||||
_processing.Add(message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SendMessageToClients(MessageBase message)
|
public static void SendMessageToClients(MessageBase message)
|
||||||
@@ -157,11 +60,7 @@ namespace Torch.Mod
|
|||||||
if (!MyAPIGateway.Multiplayer.IsServer)
|
if (!MyAPIGateway.Multiplayer.IsServer)
|
||||||
throw new Exception("Only server can send targeted messages");
|
throw new Exception("Only server can send targeted messages");
|
||||||
|
|
||||||
if (_closing)
|
MyAPIGateway.Multiplayer.SendMessageToOthers(CHANNEL, Serialize(message));
|
||||||
return;
|
|
||||||
|
|
||||||
message.TargetType = MessageTarget.AllClients;
|
|
||||||
_processing.Add(message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SendMessageExcept(MessageBase message, params ulong[] ignoredUsers)
|
public static void SendMessageExcept(MessageBase message, params ulong[] ignoredUsers)
|
||||||
@@ -169,21 +68,20 @@ namespace Torch.Mod
|
|||||||
if (!MyAPIGateway.Multiplayer.IsServer)
|
if (!MyAPIGateway.Multiplayer.IsServer)
|
||||||
throw new Exception("Only server can send targeted messages");
|
throw new Exception("Only server can send targeted messages");
|
||||||
|
|
||||||
if (_closing)
|
using var players = Players;
|
||||||
return;
|
MyAPIGateway.Multiplayer.Players.GetPlayers(players, player => !ignoredUsers.Contains(player.SteamUserId));
|
||||||
|
|
||||||
message.TargetType = MessageTarget.AllExcept;
|
var data = Serialize(message);
|
||||||
message.Ignore = ignoredUsers;
|
foreach (var player in players)
|
||||||
_processing.Add(message);
|
{
|
||||||
|
MyAPIGateway.Multiplayer.SendMessageTo(CHANNEL, data, player.SteamUserId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SendMessageToServer(MessageBase message)
|
public static void SendMessageToServer(MessageBase message)
|
||||||
{
|
{
|
||||||
if (_closing)
|
throw new NotSupportedException();
|
||||||
return;
|
|
||||||
|
|
||||||
message.TargetType = MessageTarget.Server;
|
|
||||||
_processing.Add(message);
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,12 +9,11 @@
|
|||||||
<Import_RootNamespace>Torch.Mod</Import_RootNamespace>
|
<Import_RootNamespace>Torch.Mod</Import_RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Messages\IncomingMessage.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Messages\JoinServerMessage.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Messages\NotificationMessage.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Messages\NotificationMessage.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Messages\DialogMessage.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Messages\DialogMessage.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Messages\MessageBase.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Messages\MessageBase.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Messages\VoxelResetMessage.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Messages\VoxelResetMessage.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ModCommunication.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ModCommunication.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)TorchModCore.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@@ -7,7 +7,6 @@
|
|||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
|
||||||
<PropertyGroup />
|
|
||||||
<Import Project="Torch.Mod.projitems" Label="Shared" />
|
<Import Project="Torch.Mod.projitems" Label="Shared" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
|
@@ -1,37 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using VRage.Game.Components;
|
|
||||||
|
|
||||||
namespace Torch.Mod
|
|
||||||
{
|
|
||||||
[MySessionComponentDescriptor(MyUpdateOrder.AfterSimulation)]
|
|
||||||
public class TorchModCore : MySessionComponentBase
|
|
||||||
{
|
|
||||||
public const ulong MOD_ID = 1406994352;
|
|
||||||
private static bool _init;
|
|
||||||
|
|
||||||
public override void UpdateAfterSimulation()
|
|
||||||
{
|
|
||||||
if (_init)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_init = true;
|
|
||||||
ModCommunication.Register();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void UnloadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ModCommunication.Unregister();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
//session unloading, don't care
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user