Compare commits
176 Commits
v1.0.42-ma
...
master
Author | SHA1 | Date | |
---|---|---|---|
![]() |
cae3d9ad8c | ||
![]() |
aa7426dfa2 | ||
![]() |
7ea0a4f8b9 | ||
![]() |
d15985e918 | ||
![]() |
58340e0f5d | ||
![]() |
67bb3fd00c | ||
90546a78c2 | |||
![]() |
d301955609 | ||
![]() |
264daf7515 | ||
![]() |
f75ef55405 | ||
![]() |
5804165d2b | ||
![]() |
1960d2a0de | ||
![]() |
0c53b2f1d3 | ||
![]() |
b6e88b359f | ||
![]() |
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 |
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
|
86
.github/workflows/release.yaml
vendored
Normal file
86
.github/workflows/release.yaml
vendored
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
env:
|
||||||
|
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]
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
project: [ Torch.API, Torch, Torch.Server ]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
name: Checkout
|
||||||
|
|
||||||
|
- uses: actions/setup-dotnet@v4
|
||||||
|
name: Setup dotnet
|
||||||
|
|
||||||
|
- name: Restore dependencies
|
||||||
|
run: dotnet restore ${{ matrix.project }}/${{ matrix.project }}.csproj --locked-mode
|
||||||
|
|
||||||
|
- name: Pack
|
||||||
|
run: dotnet pack ${{ matrix.project }}/${{ matrix.project }}.csproj -o pack --no-restore -p:Version="${{ needs.get-version.outputs.version }}" -p:AssemblyVersion="${{ needs.get-version.outputs.version }}"
|
||||||
|
|
||||||
|
- name: Push
|
||||||
|
run: dotnet nuget push -s https://ng.zznty.ru/v3/index.json -k ${{ secrets.NUGET_API_KEY }} ./pack/${{ matrix.project }}.${{ needs.get-version.outputs.version }}.nupkg
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build and Publish Package
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [get-version]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
name: Checkout
|
||||||
|
|
||||||
|
- uses: actions/setup-dotnet@v4
|
||||||
|
name: Setup dotnet
|
||||||
|
|
||||||
|
- 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 -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>net9.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"]
|
20
README.md
20
README.md
@@ -1,5 +1,3 @@
|
|||||||
[](https://ci.appveyor.com/project/zznty/torch/branch/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.
|
||||||
|
|
||||||
@@ -13,20 +11,28 @@ Torch is the successor to SE Server Extender and gives server admins the tools t
|
|||||||
* Extensible using the Torch plugin system
|
* Extensible using the Torch plugin system
|
||||||
|
|
||||||
### Fork Difference
|
### Fork Difference
|
||||||
* .NET 6.0 runtime
|
* .NET 8.0 runtime
|
||||||
* Additional options & features
|
* 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
|
### Discord
|
||||||
|
|
||||||
If you have any questions or issues please join our [discord](https://discord.gg/UyYFSe3TyQ)
|
If you have any questions or issues please join our discord
|
||||||
|
|
||||||
|
[](https://discord.gg/VAb2zgXHAN)
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
* 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.
|
|
||||||
|
As a regular dotnet project with cli by running `dotnet build Torch.Server/Torch.Server.csproj`, with VS 2022 or higher or JB Rider.
|
||||||
|
|
||||||
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/TorchSE)
|
||||||
|
|
||||||
|
@@ -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,10 @@
|
|||||||
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;
|
using Version = SemanticVersioning.Version;
|
||||||
|
|
||||||
namespace Torch.API
|
namespace Torch.API
|
||||||
@@ -16,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>
|
||||||
@@ -50,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; }
|
||||||
@@ -68,6 +47,16 @@ namespace Torch.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Version 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.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -146,22 +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>
|
|
||||||
/// Name of the dedicated instance.
|
|
||||||
/// </summary>
|
|
||||||
string InstanceName { 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; }
|
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>
|
||||||
|
@@ -22,7 +22,6 @@ namespace Torch
|
|||||||
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 ChatName { get; set; }
|
||||||
string ChatColor { get; set; }
|
string ChatColor { get; set; }
|
||||||
string TestPlugin { get; set; }
|
string TestPlugin { get; set; }
|
||||||
@@ -32,6 +31,25 @@ namespace Torch
|
|||||||
int FontSize { get; set; }
|
int FontSize { get; set; }
|
||||||
UGCServiceType UgcServiceType { get; set; }
|
UGCServiceType UgcServiceType { get; set; }
|
||||||
bool EntityManagerEnabled { get; set; }
|
bool EntityManagerEnabled { get; set; }
|
||||||
|
string LoginToken { get; set; }
|
||||||
|
UpdateSource UpdateSource { get; set; }
|
||||||
|
List<string> Packages { get; set; }
|
||||||
|
int RestartSaveTimeout { get; set; }
|
||||||
|
|
||||||
void 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,17 +1,9 @@
|
|||||||
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.Gui;
|
using Sandbox.Game.Gui;
|
||||||
using Sandbox.Game.Multiplayer;
|
|
||||||
using Torch.Utils;
|
using Torch.Utils;
|
||||||
using VRage.Game;
|
using VRage.Game;
|
||||||
using VRage.Network;
|
|
||||||
using VRage.Replication;
|
|
||||||
using VRageMath;
|
using VRageMath;
|
||||||
using VRageRender;
|
|
||||||
|
|
||||||
namespace Torch.API.Managers
|
namespace Torch.API.Managers
|
||||||
{
|
{
|
||||||
|
@@ -1,11 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using VRage.Collections;
|
using VRage.Collections;
|
||||||
using VRage.Game;
|
using VRage.Game;
|
||||||
using VRage.Network;
|
|
||||||
using VRageMath;
|
using VRageMath;
|
||||||
|
|
||||||
namespace Torch.API.Managers
|
namespace Torch.API.Managers
|
||||||
|
@@ -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
|
||||||
{
|
{
|
||||||
|
@@ -14,7 +14,6 @@ public interface IInstanceManager : IManager
|
|||||||
|
|
||||||
public interface IWorld
|
public interface IWorld
|
||||||
{
|
{
|
||||||
string FolderName { get; }
|
|
||||||
string WorldPath { get; }
|
string WorldPath { get; }
|
||||||
MyObjectBuilder_SessionSettings KeenSessionSettings { get; }
|
MyObjectBuilder_SessionSettings KeenSessionSettings { get; }
|
||||||
MyObjectBuilder_Checkpoint KeenCheckpoint { 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,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using VRage.Game.ModAPI;
|
using VRage.Game.ModAPI;
|
||||||
|
|
||||||
namespace Torch.API.Managers
|
namespace Torch.API.Managers
|
||||||
|
@@ -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,9 +1,4 @@
|
|||||||
using System;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
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
|
||||||
{
|
{
|
||||||
|
@@ -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
|
||||||
@@ -39,6 +33,11 @@ namespace Torch.API.Session
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The save operation timed out
|
/// The save operation timed out
|
||||||
/// </summary>
|
/// </summary>
|
||||||
TimedOut = -5
|
TimedOut = -5,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Another save operation is in progress
|
||||||
|
/// </summary>
|
||||||
|
ConcurrentSaveInProgress = -6
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -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
|
||||||
|
@@ -1,9 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Torch.API.Managers;
|
using Torch.API.Managers;
|
||||||
using VRage.Game;
|
using VRage.Game;
|
||||||
|
|
||||||
|
@@ -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,105 +1,26 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6-windows</TargetFramework>
|
|
||||||
<AssemblyTitle>Torch API</AssemblyTitle>
|
<AssemblyTitle>Torch API</AssemblyTitle>
|
||||||
<Product>Torch</Product>
|
<Product>Torch</Product>
|
||||||
<Copyright>Copyright © Torch API 2017</Copyright>
|
<Copyright>Copyright © Torch API 2017</Copyright>
|
||||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
||||||
<OutputPath>..\bin\$(Platform)\$(Configuration)\</OutputPath>
|
|
||||||
<UseWpf>True</UseWpf>
|
<UseWpf>True</UseWpf>
|
||||||
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<Configurations>Debug;Release</Configurations>
|
|
||||||
<Platforms>AnyCPU</Platforms>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="$(Configuration) == 'Release'">
|
<PropertyGroup Condition="$(Configuration) == 'Release'">
|
||||||
<NoWarn>1591</NoWarn>
|
<NoWarn>1591</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<!-- <Import Project="$(SolutionDir)\TransformOnBuild.targets" /> -->
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="NLog" Version="5.0.0-rc2" />
|
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />
|
||||||
<PackageReference Include="SemanticVersioning" Version="2.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="NLog" Version="5.3.4" />
|
||||||
<ItemGroup>
|
<PackageReference Include="NuGet.Commands" Version="6.12.1" />
|
||||||
<Reference Include="HavokWrapper, Version=1.0.6278.22649, Culture=neutral, processorArchitecture=AMD64">
|
<PackageReference Include="NuGet.DependencyResolver.Core" Version="6.12.1" />
|
||||||
<HintPath>..\GameBinaries\HavokWrapper.dll</HintPath>
|
<PackageReference Include="SemanticVersioning" Version="3.0.0" />
|
||||||
<Private>False</Private>
|
<PackageReference Include="SpaceEngineersDedicated.ReferenceAssemblies" Version="1.*">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<ExcludeAssets>runtime</ExcludeAssets>
|
||||||
</Reference>
|
</PackageReference>
|
||||||
<Reference Include="Sandbox.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
|
||||||
<HintPath>..\GameBinaries\Sandbox.Common.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Sandbox.Game, Version=0.1.6305.30774, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<HintPath>..\GameBinaries\Sandbox.Game.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Sandbox.Graphics, Version=0.1.6305.30761, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<HintPath>..\GameBinaries\Sandbox.Graphics.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="SpaceEngineers.Game, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<HintPath>..\GameBinaries\SpaceEngineers.Game.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="SpaceEngineers.ObjectBuilders, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<HintPath>..\GameBinaries\SpaceEngineers.ObjectBuilders.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</Reference>
|
|
||||||
<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">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Audio.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</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">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Game.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Input, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Input.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</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">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Math.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Render, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Render.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Render11, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Render11.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="VRage.Scripting, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Scripting.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="..\Versioning\AssemblyVersion.cs" Link="Properties/AssemblyVersion.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</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
|
||||||
{
|
{
|
||||||
|
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Torch.Utils
|
namespace Torch.Utils
|
||||||
{
|
{
|
||||||
|
@@ -1,84 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Net.Http.Json;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using NLog;
|
|
||||||
using Torch.API.Utils;
|
|
||||||
using Version = SemanticVersioning.Version;
|
|
||||||
|
|
||||||
namespace Torch.API.WebAPI
|
|
||||||
{
|
|
||||||
public class JenkinsQuery
|
|
||||||
{
|
|
||||||
private const string BRANCH_QUERY = "http://136.243.80.164:2690/job/Torch/job/{0}/" + API_PATH;
|
|
||||||
private const string ARTIFACT_PATH = "artifact/bin/torch-server.zip";
|
|
||||||
private const string API_PATH = "api/json";
|
|
||||||
|
|
||||||
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
|
|
||||||
|
|
||||||
private static JenkinsQuery _instance;
|
|
||||||
public static JenkinsQuery Instance => _instance ??= new JenkinsQuery();
|
|
||||||
private HttpClient _client;
|
|
||||||
|
|
||||||
private JenkinsQuery()
|
|
||||||
{
|
|
||||||
_client = new HttpClient();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Job> GetLatestVersion(string branch)
|
|
||||||
{
|
|
||||||
var h = await _client.GetAsync(string.Format(BRANCH_QUERY, branch));
|
|
||||||
if (!h.IsSuccessStatusCode)
|
|
||||||
{
|
|
||||||
Log.Error($"'{branch}' Branch query failed with code {h.StatusCode}");
|
|
||||||
if(h.StatusCode == HttpStatusCode.NotFound)
|
|
||||||
Log.Error("This likely means you're trying to update a branch that is not public on Jenkins. Sorry :(");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var branchResponse = await h.Content.ReadFromJsonAsync<BranchResponse>();
|
|
||||||
|
|
||||||
if (branchResponse is null)
|
|
||||||
{
|
|
||||||
Log.Error("Error reading branch response");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
h = await _client.GetAsync($"{branchResponse.LastStableBuild.Url}{API_PATH}");
|
|
||||||
if (h.IsSuccessStatusCode)
|
|
||||||
return await h.Content.ReadFromJsonAsync<Job>();
|
|
||||||
|
|
||||||
Log.Error($"Job query failed with code {h.StatusCode}");
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<bool> DownloadRelease(Job job, string path)
|
|
||||||
{
|
|
||||||
var h = await _client.GetAsync(job.Url + ARTIFACT_PATH);
|
|
||||||
if (!h.IsSuccessStatusCode)
|
|
||||||
{
|
|
||||||
Log.Error($"Job download failed with code {h.StatusCode}");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var s = await h.Content.ReadAsStreamAsync();
|
|
||||||
await using var fs = new FileStream(path, FileMode.Create);
|
|
||||||
await s.CopyToAsync(fs);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
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);
|
@@ -1,104 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Net.Http.Json;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using NLog;
|
|
||||||
|
|
||||||
namespace Torch.API.WebAPI
|
|
||||||
{
|
|
||||||
public class PluginQuery
|
|
||||||
{
|
|
||||||
private const string ALL_QUERY = "https://torchapi.com/api/plugins/";
|
|
||||||
private const string PLUGIN_QUERY = "https://torchapi.com/api/plugins/?guid={0}";
|
|
||||||
private readonly HttpClient _client;
|
|
||||||
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
|
|
||||||
|
|
||||||
private static PluginQuery _instance;
|
|
||||||
public static PluginQuery Instance => _instance ??= new();
|
|
||||||
|
|
||||||
private PluginQuery()
|
|
||||||
{
|
|
||||||
_client = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<PluginsResponse> QueryAll()
|
|
||||||
{
|
|
||||||
return (PluginsResponse) await _client.GetFromJsonAsync(ALL_QUERY, typeof(PluginsResponse), CancellationToken.None);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<PluginItem> QueryOne(Guid guid)
|
|
||||||
{
|
|
||||||
return QueryOne(guid.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<PluginItem> QueryOne(string guid)
|
|
||||||
{
|
|
||||||
using var res = await _client.GetAsync(string.Format(PLUGIN_QUERY, guid));
|
|
||||||
if (!res.IsSuccessStatusCode)
|
|
||||||
return null;
|
|
||||||
return await res.Content.ReadFromJsonAsync<PluginItem>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<bool> DownloadPlugin(Guid guid, string path = null)
|
|
||||||
{
|
|
||||||
return DownloadPlugin(guid.ToString(), path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<bool> DownloadPlugin(string 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(Directory.GetCurrentDirectory(), "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 true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public record PluginsResponse(PluginItem[] Plugins);
|
|
||||||
|
|
||||||
public record PluginItem(Guid Id, string Name, string Author, string Description, string LatestVersion,
|
|
||||||
VersionItem[] Versions)
|
|
||||||
{
|
|
||||||
[JsonIgnore]
|
|
||||||
public bool Installed { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
227
Torch.API/packages.lock.json
Normal file
227
Torch.API/packages.lock.json
Normal file
@@ -0,0 +1,227 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"dependencies": {
|
||||||
|
"net9.0-windows7.0": {
|
||||||
|
"JetBrains.Annotations": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[2024.3.0, )",
|
||||||
|
"resolved": "2024.3.0",
|
||||||
|
"contentHash": "ox5pkeLQXjvJdyAB4b2sBYAlqZGLh3PjSnP1bQNVx72ONuTJ9+34/+Rq91Fc0dG29XG9RgZur9+NcP4riihTug=="
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.Configuration.Binder": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[9.0.0, )",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "RiScL99DcyngY9zJA2ROrri7Br8tn5N4hP4YNvGdTN/bvg1A3dwvDOxHnNZ3Im7x2SJ5i4LkX1uPiR/MfSFBLQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.Configuration.Abstractions": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NLog": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[5.3.4, )",
|
||||||
|
"resolved": "5.3.4",
|
||||||
|
"contentHash": "gLy7+O1hEYJXIlcTr1/VWjGXrZTQFZzYNO18IWasD64pNwz0BreV+nHLxWKXWZzERRzoKnsk2XYtwLkTVk7J1A=="
|
||||||
|
},
|
||||||
|
"NuGet.Commands": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[6.12.1, )",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "wP1gRYoW+yeY0mmPRBGhI7DFZ8JoGKzWfbiSsceHzVTp00WfnqiEAqSQtB6QJkc5jukoajtP3U1+lx0mErfFsA==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.FileProviders.Abstractions": "6.0.0",
|
||||||
|
"Microsoft.Extensions.FileSystemGlobbing": "6.0.0",
|
||||||
|
"NuGet.Credentials": "6.12.1",
|
||||||
|
"NuGet.ProjectModel": "6.12.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.DependencyResolver.Core": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[6.12.1, )",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "Nn4+pXW1qxGcq0OEQBJBh/FjKvWhzD49+kRzuOC9SkRZOrHsTaA12EsQ1mEE4rMUfqviaosmPEtvodJ4eKCmIw==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Configuration": "6.12.1",
|
||||||
|
"NuGet.LibraryModel": "6.12.1",
|
||||||
|
"NuGet.Protocol": "6.12.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"SemanticVersioning": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[3.0.0, )",
|
||||||
|
"resolved": "3.0.0",
|
||||||
|
"contentHash": "RR+8GbPQ/gjDqov/1QN1OPoUlbUruNwcL3WjWCeLw+MY7+od/ENhnkYxCfAC6rQLIu3QifaJt3kPYyP3RumqMQ=="
|
||||||
|
},
|
||||||
|
"SpaceEngineersDedicated.ReferenceAssemblies": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[1.*, )",
|
||||||
|
"resolved": "1.205.26",
|
||||||
|
"contentHash": "kQSFCLgi0nFUhLvXlp9D2w4cTnXtEIctWtNlK+Vw4FAofws60rwR6Kil9YBNlaDyoo19dcyNt3bs4G9VculcIA==",
|
||||||
|
"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": "9.0.0",
|
||||||
|
"contentHash": "lqvd7W3FGKUO1+ZoUEMaZ5XDJeWvjpy2/M/ptCGz3tXLD4HWVaSzjufsAsjemasBEg+2SxXVtYVvGt5r2nKDlg==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.Primitives": "9.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": "9.0.0",
|
||||||
|
"contentHash": "N3qEBzmLMYiASUlKxxFIISP4AiwuPTHF5uCh+2CWSwwzAJiIYx0kBJsS30cp1nvhSySFAVi30jecD307jV+8Kg=="
|
||||||
|
},
|
||||||
|
"Newtonsoft.Json": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "13.0.3",
|
||||||
|
"contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ=="
|
||||||
|
},
|
||||||
|
"NuGet.Common": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "nk8nTdhQl4x2VaAQUvefI7DDYAuBDlE+OZZRffm50Qx5dUAEq8wkc5JIqrN2lTEohObHPI/SXyG2UFdMQkrdyg==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Frameworks": "6.12.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Configuration": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "IRwlY1379ZgJ0oEJvjD+lDuOhJ5S1fsU5n/bEC5/i0+N9bo2WIMDAdaQ/qIdyK/gMJ/YWS+++GSX6rN7luqEvg==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Common": "6.12.1",
|
||||||
|
"System.Security.Cryptography.ProtectedData": "4.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Credentials": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "VdqUIupqm16kiedkv/iyBX5yaVwCI9piV7IvHf0FLgFciCnx22jI8luHXTqeJgWsHOLJl+nTjeV3RY/AcccK7Q==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Protocol": "6.12.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Frameworks": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "kPaRD5RJC0ByUg+yGX6bDz5XHMI7OYmQwP8kbtef+vZ+csj/VDb5Bwas4ChxwhoAbI8lEvwP5/3aViQPpgNBow=="
|
||||||
|
},
|
||||||
|
"NuGet.LibraryModel": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "IqX7Ze7qSbhx22lsdnMbLJpcqrmwGyQbyNk9JSsZ/u5p6PIaZyeWsvHHy+oXU8fuRmmKfHBnZEsceaCAw6Xy5A==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Common": "6.12.1",
|
||||||
|
"NuGet.Versioning": "6.12.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Packaging": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "6s5NO3VNX6fIx6GwuWZtIsal9W1xkelYd3Vg2KUAg1zGqnKC3wB5IZlombvVGVGcwyl/A+iDvpUwSvgeDoB3wA==",
|
||||||
|
"dependencies": {
|
||||||
|
"Newtonsoft.Json": "13.0.3",
|
||||||
|
"NuGet.Configuration": "6.12.1",
|
||||||
|
"NuGet.Versioning": "6.12.1",
|
||||||
|
"System.Formats.Asn1": "8.0.1",
|
||||||
|
"System.Security.Cryptography.Pkcs": "6.0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.ProjectModel": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "nzpVqooG0qumADw5t8YMg9e+ezVqUhhoGvoihVmu5O9gJDqzkRYswQzyIVsE24dirBQabW0X0Sv53f6ZLJCv+g==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.DependencyResolver.Core": "6.12.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Protocol": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "VBN7OtG/Y9Rnj1WT3G8X88ZHu5Pq+yzca5Z6OI/FWXcENVAQkUl0ml6Cv8ghOqYyiuvnObGDV9oWLD/bIuVtDw==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Packaging": "6.12.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Versioning": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "fJ6rFYANDnohFsdpaY79FvrJxI6murmoOxXz6nZlf819F48+IBKMnAIg3oIBRtZq5y498ObMtKnro5IitvizUg=="
|
||||||
|
},
|
||||||
|
"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": "8.0.1",
|
||||||
|
"contentHash": "XqKba7Mm/koKSjKMfW82olQdmfbI5yqeoLV/tidRp7fbh5rmHAQ5raDI/7SU0swTzv+jgqtUGkzmFxuUg0it1A=="
|
||||||
|
},
|
||||||
|
"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=="
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"net9.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,51 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net461</TargetFramework>
|
|
||||||
<NoWarn>1591,0649</NoWarn>
|
|
||||||
<AssemblyTitle>Torch Client Tests</AssemblyTitle>
|
|
||||||
<Product>Torch</Product>
|
|
||||||
<Copyright>Copyright © Torch API 2017</Copyright>
|
|
||||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
|
||||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
|
||||||
<OutputPath>$(SolutionDir)\bin-test\$(Platform)\$(Configuration)\</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<DocumentationFile>$(SolutionDir)\bin-test\$(Platform)\$(Configuration)\Torch.Client.Tests.xml</DocumentationFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(SolutionDir)\TransformOnBuild.targets" />
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Mono.TextTransform" Version="1.0.0" />
|
|
||||||
<PackageReference Include="NLog" Version="4.4.12" />
|
|
||||||
<PackageReference Include="xunit" Version="2.2.0" />
|
|
||||||
<PackageReference Include="xunit.abstractions" Version="2.0.1" />
|
|
||||||
<PackageReference Include="xunit.assert" Version="2.2.0" />
|
|
||||||
<PackageReference Include="xunit.core" Version="2.2.0" />
|
|
||||||
<PackageReference Include="xunit.extensibility.core" Version="2.2.0" />
|
|
||||||
<PackageReference Include="xunit.extensibility.execution" Version="2.2.0" />
|
|
||||||
<PackageReference Include="xunit.runner.console" Version="2.2.0">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Net.Http" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="..\Versioning\AssemblyVersion.cs" Link="Properties\AssemblyVersion.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\Torch.API\Torch.API.csproj" />
|
|
||||||
<ProjectReference Include="..\Torch.Client\Torch.Client.csproj" />
|
|
||||||
<ProjectReference Include="..\Torch.Tests\Torch.Tests.csproj" />
|
|
||||||
<ProjectReference Include="..\Torch\Torch.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Remove="obj\x64\Debug\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs" />
|
|
||||||
<Compile Remove="obj\x64\Release\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
</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,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<configuration>
|
|
||||||
<runtime>
|
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="protobuf-net" publicKeyToken="257b51d87d2e4d67" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-2.4.0.0" newVersion="2.4.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
</assemblyBinding>
|
|
||||||
</runtime>
|
|
||||||
</configuration>
|
|
@@ -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,95 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Sandbox.Engine.Multiplayer;
|
|
||||||
using Sandbox.Game.World;
|
|
||||||
using Torch.API;
|
|
||||||
using Torch.API.Managers;
|
|
||||||
using Torch.Managers;
|
|
||||||
using VRage.Game.ModAPI;
|
|
||||||
|
|
||||||
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 void PromoteUser(ulong steamId)
|
|
||||||
{
|
|
||||||
Torch.Invoke(() =>
|
|
||||||
{
|
|
||||||
var p = MySession.Static.GetUserPromoteLevel(steamId);
|
|
||||||
if (p < MyPromoteLevel.Admin) //cannot promote to owner by design
|
|
||||||
MySession.Static.SetUserPromoteLevel(steamId, p + 1);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public void DemoteUser(ulong steamId)
|
|
||||||
{
|
|
||||||
Torch.Invoke(() =>
|
|
||||||
{
|
|
||||||
var p = MySession.Static.GetUserPromoteLevel(steamId);
|
|
||||||
if (p > MyPromoteLevel.None && p < MyPromoteLevel.Owner) //owner cannot be demoted by design
|
|
||||||
MySession.Static.SetUserPromoteLevel(steamId, p - 1);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public MyPromoteLevel GetUserPromoteLevel(ulong steamId)
|
|
||||||
{
|
|
||||||
return MySession.Static.GetUserPromoteLevel(steamId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <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 event Action<ulong, MyPromoteLevel> PlayerPromoted
|
|
||||||
{
|
|
||||||
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,122 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<TargetFramework>net461</TargetFramework>
|
|
||||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
|
||||||
<AssemblyTitle>Torch Client</AssemblyTitle>
|
|
||||||
<Product>Torch</Product>
|
|
||||||
<Copyright>Copyright © Torch API 2017</Copyright>
|
|
||||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
|
||||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
|
||||||
<OutputPath>$(SolutionDir)\bin\$(Platform)\$(Configuration)\</OutputPath>
|
|
||||||
<Prefer32Bit>true</Prefer32Bit>
|
|
||||||
<UseWPF>true</UseWPF>
|
|
||||||
<PostBuildEvent>copy "$(SolutionDir)NLog.config" "$(TargetDir)"
|
|
||||||
</PostBuildEvent>
|
|
||||||
<PostBuildEvent>copy "$(SolutionDir)NLog.config" "$(TargetDir)"
|
|
||||||
</PostBuildEvent>
|
|
||||||
<PostBuildEvent>copy "$(SolutionDir)NLog.config" "$(TargetDir)"
|
|
||||||
</PostBuildEvent>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<DocumentationFile>$(SolutionDir)\bin\$(Platform)\$(Configuration)\Torch.Client.xml</DocumentationFile>
|
|
||||||
<NoWarn>1591</NoWarn>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<ApplicationIcon>torchicon.ico</ApplicationIcon>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<PostBuildEvent>copy "$(SolutionDir)NLog.config" "$(TargetDir)"
|
|
||||||
</PostBuildEvent>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(SolutionDir)\TransformOnBuild.targets" />
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Mono.TextTransform" Version="1.0.0" />
|
|
||||||
<PackageReference Include="NLog" Version="4.4.12" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Sandbox.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\GameBinaries\Sandbox.Common.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</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">
|
|
||||||
<HintPath>..\GameBinaries\Sandbox.Graphics.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="SpaceEngineers.Game">
|
|
||||||
<HintPath>..\GameBinaries\SpaceEngineers.Game.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Windows.Forms" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="System.Net.Http" />
|
|
||||||
<Reference Include="System.Xaml" />
|
|
||||||
<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">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Input.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</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">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Math.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</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" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\Torch.API\Torch.API.csproj" />
|
|
||||||
<ProjectReference Include="..\Torch\Torch.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Resource Include="torchicon.ico" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Remove="obj\x64\Debug\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs" />
|
|
||||||
<Compile Remove="obj\x64\Release\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
</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,34 +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 string ChatName { get; set; }
|
|
||||||
public string ChatColor { get; set; }
|
|
||||||
|
|
||||||
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,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<configuration>
|
|
||||||
<runtime>
|
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="protobuf-net" publicKeyToken="257b51d87d2e4d67" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-2.4.0.0" newVersion="2.4.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
</assemblyBinding>
|
|
||||||
</runtime>
|
|
||||||
</configuration>
|
|
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +1,4 @@
|
|||||||
using System;
|
using ProtoBuf;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using ProtoBuf;
|
|
||||||
using Sandbox.ModAPI;
|
using Sandbox.ModAPI;
|
||||||
|
|
||||||
namespace Torch.Mod.Messages
|
namespace Torch.Mod.Messages
|
||||||
@@ -32,11 +29,6 @@ namespace Torch.Mod.Messages
|
|||||||
|
|
||||||
public override void ProcessClient()
|
public override void ProcessClient()
|
||||||
{
|
{
|
||||||
if (TorchModCore.Debug)
|
|
||||||
{
|
|
||||||
MyAPIGateway.Utilities.ShowMessage("Torch", $"Joining server {Address} with delay {Delay}");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Delay <= 0)
|
if (Delay <= 0)
|
||||||
{
|
{
|
||||||
MyAPIGateway.Multiplayer.JoinServer(Address);
|
MyAPIGateway.Multiplayer.JoinServer(Address);
|
||||||
|
@@ -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
|
||||||
{
|
{
|
||||||
@@ -17,36 +12,9 @@ namespace Torch.Mod.Messages
|
|||||||
[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,161 +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.Network;
|
#if TORCH
|
||||||
using VRage.Utils;
|
using Torch.Utils;
|
||||||
using Task = ParallelTasks.Task;
|
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)
|
|
||||||
{
|
|
||||||
var m = _messagePool.Get();
|
|
||||||
m.CompressedData = bytes;
|
|
||||||
#if TORCH
|
#if TORCH
|
||||||
m.SenderId = MyEventContext.Current.Sender.Value;
|
[ReflectedMethodInfo(typeof(MyAPIUtilities), "VRage.Game.ModAPI.IMyUtilities.SerializeToBinary")]
|
||||||
#endif
|
private static MethodInfo _serializeMethod = null!;
|
||||||
|
|
||||||
_processing.Add(m);
|
private static readonly CacheList<IMyPlayer> Players = new();
|
||||||
}
|
|
||||||
|
|
||||||
public static void DoProcessing()
|
private static byte[] Serialize(MessageBase message)
|
||||||
{
|
{
|
||||||
while (!_closing)
|
return (byte[])_serializeMethod.MakeGenericMethod(message.GetType())
|
||||||
{
|
.Invoke(MyAPIGateway.Utilities, new object[] { message });
|
||||||
try
|
|
||||||
{
|
|
||||||
MessageBase m;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
m = _processing.Take();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
MyLog.Default.WriteLineAndConsole($"Processing message: {m.GetType().Name}");
|
|
||||||
|
|
||||||
if (m is IncomingMessage) //process incoming messages
|
|
||||||
{
|
|
||||||
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 (TorchModCore.Debug)
|
|
||||||
MyAPIGateway.Utilities.ShowMessage("Torch", $"Received message of type {i.GetType().Name}");
|
|
||||||
|
|
||||||
if (MyAPIGateway.Multiplayer.IsServer)
|
|
||||||
i.ProcessServer();
|
|
||||||
else
|
|
||||||
i.ProcessClient();
|
|
||||||
}
|
|
||||||
else //process outgoing messages
|
|
||||||
{
|
|
||||||
if (TorchModCore.Debug)
|
|
||||||
MyAPIGateway.Utilities.ShowMessage("Torch", $"Sending message of type {m.GetType().Name}");
|
|
||||||
|
|
||||||
var b = MyAPIGateway.Utilities.SerializeToBinary(m);
|
|
||||||
m.CompressedData = MyCompression.Compress(b);
|
|
||||||
|
|
||||||
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: INFO: Communication thread shut down successfully! THIS IS NOT AN ERROR");
|
|
||||||
//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)
|
||||||
@@ -163,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)
|
||||||
@@ -176,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)
|
||||||
@@ -188,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,13 +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\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>
|
@@ -1,51 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Sandbox.ModAPI;
|
|
||||||
using VRage.Game.Components;
|
|
||||||
|
|
||||||
namespace Torch.Mod
|
|
||||||
{
|
|
||||||
[MySessionComponentDescriptor(MyUpdateOrder.AfterSimulation)]
|
|
||||||
public class TorchModCore : MySessionComponentBase
|
|
||||||
{
|
|
||||||
public const ulong MOD_ID = 2722000298;
|
|
||||||
private static bool _init;
|
|
||||||
public static bool Debug;
|
|
||||||
|
|
||||||
public override void UpdateAfterSimulation()
|
|
||||||
{
|
|
||||||
if (_init)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_init = true;
|
|
||||||
ModCommunication.Register();
|
|
||||||
MyAPIGateway.Utilities.MessageEntered += Utilities_MessageEntered;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Utilities_MessageEntered(string messageText, ref bool sendToOthers)
|
|
||||||
{
|
|
||||||
if (messageText == "@!debug")
|
|
||||||
{
|
|
||||||
Debug = !Debug;
|
|
||||||
MyAPIGateway.Utilities.ShowMessage("Torch", $"Debug: {Debug}");
|
|
||||||
sendToOthers = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void UnloadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
MyAPIGateway.Utilities.MessageEntered -= Utilities_MessageEntered;
|
|
||||||
ModCommunication.Unregister();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
//session unloading, don't care
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,17 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
[assembly: AssemblyTitle("Torch Server 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,6 +1,5 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6-windows</TargetFramework>
|
|
||||||
<NoWarn>1591,0649</NoWarn>
|
<NoWarn>1591,0649</NoWarn>
|
||||||
<AssemblyTitle>Torch Server Tests</AssemblyTitle>
|
<AssemblyTitle>Torch Server Tests</AssemblyTitle>
|
||||||
<Product>Torch</Product>
|
<Product>Torch</Product>
|
||||||
@@ -8,27 +7,15 @@
|
|||||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
||||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
<OutputPath>$(SolutionDir)\bin-test\$(Platform)\$(Configuration)\</OutputPath>
|
<OutputPath>$(SolutionDir)\bin-test\$(Platform)\$(Configuration)\</OutputPath>
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<Configurations>Debug;Release</Configurations>
|
|
||||||
<Platforms>AnyCPU</Platforms>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="$(Configuration) == 'Release'">
|
<PropertyGroup Condition="$(Configuration) == 'Release'">
|
||||||
<DocumentationFile>$(SolutionDir)\bin-test\$(Platform)\$(Configuration)\Torch.Server.Tests.xml</DocumentationFile>
|
<DocumentationFile>$(SolutionDir)\bin-test\$(Platform)\$(Configuration)\Torch.Server.Tests.xml</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<!-- <Import Project="$(SolutionDir)\TransformOnBuild.targets" /> -->
|
<!-- <Import Project="$(SolutionDir)\TransformOnBuild.targets" /> -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||||
<PackageReference Include="NLog" Version="5.0.0-rc2" />
|
<PackageReference Include="NLog" Version="5.3.4" />
|
||||||
<PackageReference Include="xunit" Version="2.4.1" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="VRage.Game, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\GameBinaries\VRage.Game.dll</HintPath>
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="..\Versioning\AssemblyVersion.cs" Link="Properties\AssemblyVersion.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Torch.API\Torch.API.csproj" />
|
<ProjectReference Include="..\Torch.API\Torch.API.csproj" />
|
||||||
|
@@ -2,8 +2,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Torch.Server.ViewModels;
|
using Torch.Server.ViewModels;
|
||||||
using VRage.Game;
|
using VRage.Game;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<configuration>
|
|
||||||
<runtime>
|
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="protobuf-net" publicKeyToken="257b51d87d2e4d67" culture="neutral"/>
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-2.4.0.0" newVersion="2.4.0.0"/>
|
|
||||||
</dependentAssembly>
|
|
||||||
</assemblyBinding>
|
|
||||||
</runtime>
|
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
|
681
Torch.Server.Tests/packages.lock.json
Normal file
681
Torch.Server.Tests/packages.lock.json
Normal file
@@ -0,0 +1,681 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"dependencies": {
|
||||||
|
"net9.0-windows7.0": {
|
||||||
|
"Microsoft.NET.Test.Sdk": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[17.12.0, )",
|
||||||
|
"resolved": "17.12.0",
|
||||||
|
"contentHash": "kt/PKBZ91rFCWxVIJZSgVLk+YR+4KxTuHf799ho8WNiK5ZQpJNAEZCAWX86vcKrs+DiYjiibpYKdGZP6+/N17w==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.CodeCoverage": "17.12.0",
|
||||||
|
"Microsoft.TestPlatform.TestHost": "17.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NLog": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[5.3.4, )",
|
||||||
|
"resolved": "5.3.4",
|
||||||
|
"contentHash": "gLy7+O1hEYJXIlcTr1/VWjGXrZTQFZzYNO18IWasD64pNwz0BreV+nHLxWKXWZzERRzoKnsk2XYtwLkTVk7J1A=="
|
||||||
|
},
|
||||||
|
"xunit": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[2.9.3, )",
|
||||||
|
"resolved": "2.9.3",
|
||||||
|
"contentHash": "TlXQBinK35LpOPKHAqbLY4xlEen9TBafjs0V5KnA4wZsoQLQJiirCR4CbIXvOH8NzkW4YeJKP5P/Bnrodm0h9Q==",
|
||||||
|
"dependencies": {
|
||||||
|
"xunit.analyzers": "1.18.0",
|
||||||
|
"xunit.assert": "2.9.3",
|
||||||
|
"xunit.core": "[2.9.3]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AutoCompleteTextBox": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.7.2",
|
||||||
|
"contentHash": "rslnIhQRK++Ty7epprYj861F8bo2N11TCUOgRs1r9mJ6w9HrhnQnE4zvUVm7xUsq8u5DCxR7cQtbAZ1txS2/Aw=="
|
||||||
|
},
|
||||||
|
"AvalonEdit": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.3.0.90",
|
||||||
|
"contentHash": "WVTb5MxwGqKdeasd3nG5udlV4t6OpvkFanziwI133K0/QJ5FvZmfzRQgpAjGTJhQfIA8GP7AzKQ3sTY9JOFk8Q=="
|
||||||
|
},
|
||||||
|
"Ben.Demystifier": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "0.4.1",
|
||||||
|
"contentHash": "axFeEMfmEORy3ipAzOXG/lE+KcNptRbei3F0C4kQCdeiQtW+qJW90K5iIovITGrdLt8AjhNCwk5qLSX9/rFpoA==",
|
||||||
|
"dependencies": {
|
||||||
|
"System.Reflection.Metadata": "5.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ControlzEx": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "5.0.2",
|
||||||
|
"contentHash": "f724LoDJ36LxaLR62G4ek9ZAJI8BiiYRJJ04furC/qjXSeIwU0qmHFIe19xB1/FwxyZjevdFguEr9ZUjf3dZgw==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Xaml.Behaviors.Wpf": "1.1.31",
|
||||||
|
"System.Text.Json": "5.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"JetBrains.Annotations": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "2024.3.0",
|
||||||
|
"contentHash": "ox5pkeLQXjvJdyAB4b2sBYAlqZGLh3PjSnP1bQNVx72ONuTJ9+34/+Rq91Fc0dG29XG9RgZur9+NcP4riihTug=="
|
||||||
|
},
|
||||||
|
"Lib.Harmony.Thin": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "2.3.4-torch",
|
||||||
|
"contentHash": "UnLUnLLiXfHZdKa1zhi6w8cl8tJTrpVixLtvjFEVtlDA6Rkf06OcZ2gSidcbcgKjTcR+fk5Qsdos3mU5oohzfg==",
|
||||||
|
"dependencies": {
|
||||||
|
"MonoMod.Core": "1.2.2",
|
||||||
|
"System.Text.Json": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"MahApps.Metro": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "2.4.10",
|
||||||
|
"contentHash": "45exHKJCVYaD1/rNr3ekZPECEBM4uHOt6aYp6yNaJbliFMUo+d3z8Gi1xG+qEkbiHKITX+dlz+BW1FOsjAbl/w==",
|
||||||
|
"dependencies": {
|
||||||
|
"ControlzEx": "[4.4.0, 6.0.0)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"MdXaml": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.27.0",
|
||||||
|
"contentHash": "VWhqhCeKVkJe8vkPmXuGZlRX01WDrTugOLeUvJn18jH/8DrGGVBvtgIlJoELHD2f1DiEWqF3lxxjV55vnzE7Tg==",
|
||||||
|
"dependencies": {
|
||||||
|
"AvalonEdit": "6.3.0.90",
|
||||||
|
"MdXaml.Plugins": "1.27.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"MdXaml.Plugins": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.27.0",
|
||||||
|
"contentHash": "We7LtBdoukRg9mqTfa1f5n8z/GQPMKBRj3URk9DiMuqzIHkW1lTgK5njVPSScxsRt4YzW22423tSnLWNm2MJKg=="
|
||||||
|
},
|
||||||
|
"Microsoft.Bcl.AsyncInterfaces": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "owmu2Cr3IQ8yQiBleBHlGk8dSQ12oaF2e7TpzwJKEl4m84kkZJjEY1n33L67Y3zM5jPOjmmbdHjbfiL0RqcMRQ=="
|
||||||
|
},
|
||||||
|
"Microsoft.CodeAnalysis.Analyzers": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "3.3.4",
|
||||||
|
"contentHash": "AxkxcPR+rheX0SmvpLVIGLhOUXAKG56a64kV9VQZ4y9gR9ZmPXnqZvHJnmwLSwzrEP6junUF11vuc+aqo5r68g=="
|
||||||
|
},
|
||||||
|
"Microsoft.CodeAnalysis.Common": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "4.12.0",
|
||||||
|
"contentHash": "c1kNYihL2gdcuU1dqm8R8YeA4YkB43TpU3pa2r66Uooh6AAhRtENzj9A4Kj0a+H8JDDyuTjNZql9XlVUzV+UjA==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.CodeAnalysis.Analyzers": "3.3.4",
|
||||||
|
"System.Collections.Immutable": "8.0.0",
|
||||||
|
"System.Reflection.Metadata": "8.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.CodeAnalysis.CSharp": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "4.12.0",
|
||||||
|
"contentHash": "30vVQ1MizeC22iEdEvI2w0eTIYG43/L20yBzuQH01xKzJgHAoWehzI2F8u07o4mXh4DGMOjQF7aEm0zzvsG3Mg==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.CodeAnalysis.Analyzers": "3.3.4",
|
||||||
|
"Microsoft.CodeAnalysis.Common": "[4.12.0]",
|
||||||
|
"System.Collections.Immutable": "8.0.0",
|
||||||
|
"System.Reflection.Metadata": "8.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.CodeCoverage": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "17.12.0",
|
||||||
|
"contentHash": "4svMznBd5JM21JIG2xZKGNanAHNXplxf/kQDFfLHXQ3OnpJkayRK/TjacFjA+EYmoyuNXHo/sOETEfcYtAzIrA=="
|
||||||
|
},
|
||||||
|
"Microsoft.Diagnostics.NETCore.Client": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "0.2.410101",
|
||||||
|
"contentHash": "I4hMjlbPcM5R+M4ThD2Zt1z58M8uZnWkDbFLXHntOOAajajEucrw4XYNSaoi5rgoqksgxQ3g388Vof4QzUNwdQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Bcl.AsyncInterfaces": "1.1.0",
|
||||||
|
"Microsoft.Extensions.Logging": "2.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Diagnostics.Runtime": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "3.1.512801",
|
||||||
|
"contentHash": "0lMUDr2oxNZa28D6NH5BuSQEe5T9tZziIkvkD44YkkCGQXPJqvFjLq5ZQq1hYLl3RjQJrY+hR0jFgap+EWPDTw==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Diagnostics.NETCore.Client": "0.2.410101"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.Configuration": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "YIMO9T3JL8MeEXgVozKt2v79hquo/EFtnY0vgxmLnUvk1Rei/halI7kOWZL2RBeV9FMGzgM9LZA8CVaNwFMaNA==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.Configuration.Abstractions": "9.0.0",
|
||||||
|
"Microsoft.Extensions.Primitives": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.Configuration.Abstractions": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "lqvd7W3FGKUO1+ZoUEMaZ5XDJeWvjpy2/M/ptCGz3tXLD4HWVaSzjufsAsjemasBEg+2SxXVtYVvGt5r2nKDlg==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.Primitives": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.Configuration.Binder": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "RiScL99DcyngY9zJA2ROrri7Br8tn5N4hP4YNvGdTN/bvg1A3dwvDOxHnNZ3Im7x2SJ5i4LkX1uPiR/MfSFBLQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.Configuration.Abstractions": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.Configuration.CommandLine": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "qD+hdkBtR9Ps7AxfhTJCnoVakkadHgHlD1WRN0QHGHod+SDuca1ao1kF4G2rmpAz2AEKrE2N2vE8CCCZ+ILnNw==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.Configuration": "9.0.0",
|
||||||
|
"Microsoft.Extensions.Configuration.Abstractions": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.Configuration.EnvironmentVariables": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "v5R638eNMxksfXb7MFnkPwLPp+Ym4W/SIGNuoe8qFVVyvygQD5DdLusybmYSJEr9zc1UzWzim/ATKeIOVvOFDg==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.Configuration": "9.0.0",
|
||||||
|
"Microsoft.Extensions.Configuration.Abstractions": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.Configuration.FileExtensions": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "4EK93Jcd2lQG4GY6PAw8jGss0ZzFP0vPc1J85mES5fKNuDTqgFXHba9onBw2s18fs3I4vdo2AWyfD1mPAxWSQQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.Configuration": "9.0.0",
|
||||||
|
"Microsoft.Extensions.Configuration.Abstractions": "9.0.0",
|
||||||
|
"Microsoft.Extensions.FileProviders.Abstractions": "9.0.0",
|
||||||
|
"Microsoft.Extensions.FileProviders.Physical": "9.0.0",
|
||||||
|
"Microsoft.Extensions.Primitives": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.Configuration.Xml": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "emIBXgb6KyFpog3mKXdRq6Wt1JpWLQJi2SoNDI6Q93O1DX9YtsH/Hy03OrryQEEwJrwta6r5iqBP1lY9PMXGUQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.Configuration": "9.0.0",
|
||||||
|
"Microsoft.Extensions.Configuration.Abstractions": "9.0.0",
|
||||||
|
"Microsoft.Extensions.Configuration.FileExtensions": "9.0.0",
|
||||||
|
"Microsoft.Extensions.FileProviders.Abstractions": "9.0.0",
|
||||||
|
"System.Security.Cryptography.Xml": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.DependencyInjection": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "MCPrg7v3QgNMr0vX4vzRXvkNGgLg8vKWX0nKCWUxu2uPyMsaRgiRc1tHBnbTcfJMhMKj2slE/j2M9oGkd25DNw==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.DependencyInjection.Abstractions": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "+6f2qv2a3dLwd5w6JanPIPs47CxRbnk+ZocMJUhv9NxP88VlOcJYZs9jY+MYSjxvady08bUZn6qgiNh7DadGgg=="
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.FileProviders.Abstractions": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "uK439QzYR0q2emLVtYzwyK3x+T5bTY4yWsd/k/ZUS9LR6Sflp8MIdhGXW8kQCd86dQD4tLqvcbLkku8qHY263Q==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.Primitives": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.FileProviders.Physical": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "3+ZUSpOSmie+o8NnLIRqCxSh65XL/ExU7JYnFOg58awDRlY3lVpZ9A369jkoZL1rpsq7LDhEfkn2ghhGaY1y5Q==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.FileProviders.Abstractions": "9.0.0",
|
||||||
|
"Microsoft.Extensions.FileSystemGlobbing": "9.0.0",
|
||||||
|
"Microsoft.Extensions.Primitives": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.FileSystemGlobbing": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "jGFKZiXs2HNseK3NK/rfwHNNovER71jSj4BD1a/649ml9+h6oEtYd0GSALZDNW8jZ2Rh+oAeadOa6sagYW1F2A=="
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.Logging": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "crjWyORoug0kK7RSNJBTeSE6VX8IQgLf3nUpTB9m62bPXp/tzbnOsnbe8TXEG0AASNaKZddnpHKw7fET8E++Pg==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.DependencyInjection": "9.0.0",
|
||||||
|
"Microsoft.Extensions.Logging.Abstractions": "9.0.0",
|
||||||
|
"Microsoft.Extensions.Options": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.Logging.Abstractions": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "g0UfujELzlLbHoVG8kPKVBaW470Ewi+jnptGS9KUi6jcb+k2StujtK3m26DFSGGwQ/+bVgZfsWqNzlP6YOejvw==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.Options": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "y2146b3jrPI3Q0lokKXdKLpmXqakYbDIPDV6r3M8SqvSf45WwOTzkyfDpxnZXJsJQEpAsAqjUq5Pu8RCJMjubg==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.0",
|
||||||
|
"Microsoft.Extensions.Primitives": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.Primitives": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "N3qEBzmLMYiASUlKxxFIISP4AiwuPTHF5uCh+2CWSwwzAJiIYx0kBJsS30cp1nvhSySFAVi30jecD307jV+8Kg=="
|
||||||
|
},
|
||||||
|
"Microsoft.TestPlatform.ObjectModel": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "17.12.0",
|
||||||
|
"contentHash": "TDqkTKLfQuAaPcEb3pDDWnh7b3SyZF+/W9OZvWFp6eJCIiiYFdSB6taE2I6tWrFw5ywhzOb6sreoGJTI6m3rSQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"System.Reflection.Metadata": "1.6.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.TestPlatform.TestHost": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "17.12.0",
|
||||||
|
"contentHash": "MiPEJQNyADfwZ4pJNpQex+t9/jOClBGMiCiVVFuELCMSX2nmNfvUor3uFVxNNCg30uxDP8JDYfPnMXQzsfzYyg==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.TestPlatform.ObjectModel": "17.12.0",
|
||||||
|
"Newtonsoft.Json": "13.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Xaml.Behaviors.Wpf": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.1.31",
|
||||||
|
"contentHash": "LZpuf82ACZWldmfMuv3CTUMDh3o0xo0uHUaybR5HgqVLDBJJ9RZLykplQ/bTJd0/VDt3EhD4iDgUgbdIUAM+Kg=="
|
||||||
|
},
|
||||||
|
"Mono.Cecil": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "0.11.5",
|
||||||
|
"contentHash": "fxfX+0JGTZ8YQeu1MYjbBiK2CYTSzDyEeIixt+yqKKTn7FW8rv7JMY70qevup4ZJfD7Kk/VG/jDzQQTpfch87g=="
|
||||||
|
},
|
||||||
|
"MonoMod.Backports": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.1.2",
|
||||||
|
"contentHash": "baYlNy8n8kmaNhNvqmZ/dIPOeO1r9//dG1i2WbunMWtWZ2EKtIgmXaS+ZzphzTsikkGnoD4Jwr5g0TVdpDjgpw==",
|
||||||
|
"dependencies": {
|
||||||
|
"MonoMod.ILHelpers": "1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"MonoMod.Core": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.2.2",
|
||||||
|
"contentHash": "3R9mQ7TxeQQBFLtGTR2VIDSBGx/I7d8RYpxvW1Mot0/PB6+UOnHr+lkw7dj8cus8YSnLdCFT+CG4JW89daEvjg==",
|
||||||
|
"dependencies": {
|
||||||
|
"Mono.Cecil": "0.11.5",
|
||||||
|
"MonoMod.Backports": "1.1.2",
|
||||||
|
"MonoMod.ILHelpers": "1.1.0",
|
||||||
|
"MonoMod.Utils": "25.0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"MonoMod.ILHelpers": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.1.0",
|
||||||
|
"contentHash": "L2FWjhTrv7tcIxshfZ+M3OcaNr4cNw0IwiVZEgwqRnZ5QAN3+RrNJ8ZwCzwXUWyPDqooJxMcjjg8PsSYUiNBjQ=="
|
||||||
|
},
|
||||||
|
"MonoMod.Utils": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "25.0.8",
|
||||||
|
"contentHash": "8wfyawgvGqUvfchAj7/gPazAjXO8CWNyXH+C0az+hgJH/80zVL5LxDhQMz0NQTyoCEJWU6gNBGc7CL+G7vCbaQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"Mono.Cecil": "0.11.5",
|
||||||
|
"MonoMod.Backports": "1.1.2",
|
||||||
|
"MonoMod.ILHelpers": "1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Newtonsoft.Json": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "13.0.3",
|
||||||
|
"contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ=="
|
||||||
|
},
|
||||||
|
"NuGet.Commands": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "wP1gRYoW+yeY0mmPRBGhI7DFZ8JoGKzWfbiSsceHzVTp00WfnqiEAqSQtB6QJkc5jukoajtP3U1+lx0mErfFsA==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.FileProviders.Abstractions": "6.0.0",
|
||||||
|
"Microsoft.Extensions.FileSystemGlobbing": "6.0.0",
|
||||||
|
"NuGet.Credentials": "6.12.1",
|
||||||
|
"NuGet.ProjectModel": "6.12.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Common": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "nk8nTdhQl4x2VaAQUvefI7DDYAuBDlE+OZZRffm50Qx5dUAEq8wkc5JIqrN2lTEohObHPI/SXyG2UFdMQkrdyg==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Frameworks": "6.12.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Configuration": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "IRwlY1379ZgJ0oEJvjD+lDuOhJ5S1fsU5n/bEC5/i0+N9bo2WIMDAdaQ/qIdyK/gMJ/YWS+++GSX6rN7luqEvg==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Common": "6.12.1",
|
||||||
|
"System.Security.Cryptography.ProtectedData": "4.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Credentials": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "VdqUIupqm16kiedkv/iyBX5yaVwCI9piV7IvHf0FLgFciCnx22jI8luHXTqeJgWsHOLJl+nTjeV3RY/AcccK7Q==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Protocol": "6.12.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.DependencyResolver.Core": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "Nn4+pXW1qxGcq0OEQBJBh/FjKvWhzD49+kRzuOC9SkRZOrHsTaA12EsQ1mEE4rMUfqviaosmPEtvodJ4eKCmIw==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Configuration": "6.12.1",
|
||||||
|
"NuGet.LibraryModel": "6.12.1",
|
||||||
|
"NuGet.Protocol": "6.12.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Frameworks": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "kPaRD5RJC0ByUg+yGX6bDz5XHMI7OYmQwP8kbtef+vZ+csj/VDb5Bwas4ChxwhoAbI8lEvwP5/3aViQPpgNBow=="
|
||||||
|
},
|
||||||
|
"NuGet.LibraryModel": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "IqX7Ze7qSbhx22lsdnMbLJpcqrmwGyQbyNk9JSsZ/u5p6PIaZyeWsvHHy+oXU8fuRmmKfHBnZEsceaCAw6Xy5A==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Common": "6.12.1",
|
||||||
|
"NuGet.Versioning": "6.12.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Packaging": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "6s5NO3VNX6fIx6GwuWZtIsal9W1xkelYd3Vg2KUAg1zGqnKC3wB5IZlombvVGVGcwyl/A+iDvpUwSvgeDoB3wA==",
|
||||||
|
"dependencies": {
|
||||||
|
"Newtonsoft.Json": "13.0.3",
|
||||||
|
"NuGet.Configuration": "6.12.1",
|
||||||
|
"NuGet.Versioning": "6.12.1",
|
||||||
|
"System.Formats.Asn1": "8.0.1",
|
||||||
|
"System.Security.Cryptography.Pkcs": "6.0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.ProjectModel": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "nzpVqooG0qumADw5t8YMg9e+ezVqUhhoGvoihVmu5O9gJDqzkRYswQzyIVsE24dirBQabW0X0Sv53f6ZLJCv+g==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.DependencyResolver.Core": "6.12.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Protocol": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "VBN7OtG/Y9Rnj1WT3G8X88ZHu5Pq+yzca5Z6OI/FWXcENVAQkUl0ml6Cv8ghOqYyiuvnObGDV9oWLD/bIuVtDw==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Packaging": "6.12.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Versioning": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.12.1",
|
||||||
|
"contentHash": "fJ6rFYANDnohFsdpaY79FvrJxI6murmoOxXz6nZlf819F48+IBKMnAIg3oIBRtZq5y498ObMtKnro5IitvizUg=="
|
||||||
|
},
|
||||||
|
"nulastudio.NetBeauty": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "2.1.4.6",
|
||||||
|
"contentHash": "jB9L3V4raas4cIczo3zU+Kb6LwsZ215iVDsxo+jm/QXYQxy+HSizpV3StN3BC35nv3YMaSdthXoxD3aBSPJscw=="
|
||||||
|
},
|
||||||
|
"protobuf-net": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.0.0",
|
||||||
|
"contentHash": "kTGOK0E87473sOImOjgZOnz3kTC2aMLffoRWQLYNuBLJnwNNmjanF9IkevZ9Q7yYLeABQfcF3BpeepuMntMVNw=="
|
||||||
|
},
|
||||||
|
"SemanticVersioning": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "3.0.0",
|
||||||
|
"contentHash": "RR+8GbPQ/gjDqov/1QN1OPoUlbUruNwcL3WjWCeLw+MY7+od/ENhnkYxCfAC6rQLIu3QifaJt3kPYyP3RumqMQ=="
|
||||||
|
},
|
||||||
|
"SharpDX": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "4.2.0-keen-cringe",
|
||||||
|
"contentHash": "LaJN3h1Gi1FWVdef2I5WtOH9gwzKCBniH0CragarbkN2QheYY6Lqm+91PcOfp1w/4wdVb+k8Kjv3sO393Tphtw=="
|
||||||
|
},
|
||||||
|
"SixLabors.Core": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.0.0-beta0007",
|
||||||
|
"contentHash": "s9aPl6yxwcvoKRD0u0zjkCISZCCifbUi9/XVFjdvlx5Pt7vRYmGV0anq1EEftUjIEHbEu5aNBipbUSBIV2CE7w==",
|
||||||
|
"dependencies": {
|
||||||
|
"System.Runtime.CompilerServices.Unsafe": "4.5.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"SpaceEngineersDedicated.ReferenceAssemblies": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.205.26",
|
||||||
|
"contentHash": "kQSFCLgi0nFUhLvXlp9D2w4cTnXtEIctWtNlK+Vw4FAofws60rwR6Kil9YBNlaDyoo19dcyNt3bs4G9VculcIA==",
|
||||||
|
"dependencies": {
|
||||||
|
"SharpDX": "4.2.0-keen-cringe",
|
||||||
|
"protobuf-net": "1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.CodeDom": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "oTE5IfuMoET8yaZP/vdvy9xO47guAv/rOhe4DODuFBN3ySprcQOlXqO3j+e/H/YpKKR5sglrxRaZ2HYOhNJrqA=="
|
||||||
|
},
|
||||||
|
"System.Collections.Immutable": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "8.0.0",
|
||||||
|
"contentHash": "AurL6Y5BA1WotzlEvVaIDpqzpIPvYnnldxru8oXJU2yFxFUy3+pNXjXd1ymO+RA0rq0+590Q8gaz2l3Sr7fmqg=="
|
||||||
|
},
|
||||||
|
"System.ComponentModel.Annotations": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "5.0.0",
|
||||||
|
"contentHash": "dMkqfy2el8A8/I76n2Hi1oBFEbG1SfxD2l5nhwXV3XjlnOmwxJlQbYpJH4W51odnU9sARCSAgv7S3CyAFMkpYg=="
|
||||||
|
},
|
||||||
|
"System.Formats.Asn1": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "8.0.1",
|
||||||
|
"contentHash": "XqKba7Mm/koKSjKMfW82olQdmfbI5yqeoLV/tidRp7fbh5rmHAQ5raDI/7SU0swTzv+jgqtUGkzmFxuUg0it1A=="
|
||||||
|
},
|
||||||
|
"System.Linq.Async": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.0.1",
|
||||||
|
"contentHash": "0YhHcaroWpQ9UCot3Pizah7ryAzQhNvobLMSxeDIGmnXfkQn8u5owvpOH0K6EVB+z9L7u6Cc4W17Br/+jyttEQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Bcl.AsyncInterfaces": "6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Management": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "bVh4xAMI5grY5GZoklKcMBLirhC8Lqzp63Ft3zXJacwGAlLyFdF4k0qz4pnKIlO6HyL2Z4zqmHm9UkzEo6FFsA==",
|
||||||
|
"dependencies": {
|
||||||
|
"System.CodeDom": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Reflection.Metadata": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "8.0.0",
|
||||||
|
"contentHash": "ptvgrFh7PvWI8bcVqG5rsA/weWM09EnthFHR5SCnS6IN+P4mj6rE1lBDC4U8HL9/57htKAqy4KQ3bBj84cfYyQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"System.Collections.Immutable": "8.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Runtime.CompilerServices.Unsafe": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "4.5.1",
|
||||||
|
"contentHash": "Zh8t8oqolRaFa9vmOZfdQm/qKejdqz0J9kr7o2Fu0vPeoH3BL1EOXipKWwkWtLT1JPzjByrF19fGuFlNbmPpiw=="
|
||||||
|
},
|
||||||
|
"System.Security.Cryptography.Pkcs": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "8tluJF8w9si+2yoHeL8rgVJS6lKvWomTDC8px65Z8MCzzdME5eaPtEQf4OfVGrAxB5fW93ncucy1+221O9EQaw=="
|
||||||
|
},
|
||||||
|
"System.Security.Cryptography.ProtectedData": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "4.4.0",
|
||||||
|
"contentHash": "cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog=="
|
||||||
|
},
|
||||||
|
"System.Security.Cryptography.Xml": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "GQZn5wFd+pyOfwWaCbqxG7trQ5ox01oR8kYgWflgtux4HiUNihGEgG2TktRWyH+9bw7NoEju1D41H/upwQeFQw==",
|
||||||
|
"dependencies": {
|
||||||
|
"System.Security.Cryptography.Pkcs": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Text.Json": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "js7+qAu/9mQvnhA4EfGMZNEzXtJCDxgkgj8ohuxq/Qxv+R56G+ljefhiJHOxTNiw54q8vmABCWUwkMulNdlZ4A=="
|
||||||
|
},
|
||||||
|
"Torch.SixLabors.ImageSharp": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.0.0-beta6",
|
||||||
|
"contentHash": "WJ7ocT79HgmuKi0+ltpvXTiMI80UcI3DeS8XSfYwJtTB1tcQws6zLPGuUwra6qe6qRrFfpABeDP3xvHV1rJgfg==",
|
||||||
|
"dependencies": {
|
||||||
|
"SixLabors.Core": "1.0.0-beta0007",
|
||||||
|
"System.Runtime.CompilerServices.Unsafe": "4.5.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xunit.abstractions": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "2.0.3",
|
||||||
|
"contentHash": "pot1I4YOxlWjIb5jmwvvQNbTrZ3lJQ+jUGkGjWE3hEFM0l5gOnBWS+H3qsex68s5cO52g+44vpGzhAt+42vwKg=="
|
||||||
|
},
|
||||||
|
"xunit.analyzers": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.18.0",
|
||||||
|
"contentHash": "OtFMHN8yqIcYP9wcVIgJrq01AfTxijjAqVDy/WeQVSyrDC1RzBWeQPztL49DN2syXRah8TYnfvk035s7L95EZQ=="
|
||||||
|
},
|
||||||
|
"xunit.assert": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "2.9.3",
|
||||||
|
"contentHash": "/Kq28fCE7MjOV42YLVRAJzRF0WmEqsmflm0cfpMjGtzQ2lR5mYVj1/i0Y8uDAOLczkL3/jArrwehfMD0YogMAA=="
|
||||||
|
},
|
||||||
|
"xunit.core": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "2.9.3",
|
||||||
|
"contentHash": "BiAEvqGvyme19wE0wTKdADH+NloYqikiU0mcnmiNyXaF9HyHmE6sr/3DC5vnBkgsWaE6yPyWszKSPSApWdRVeQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"xunit.extensibility.core": "[2.9.3]",
|
||||||
|
"xunit.extensibility.execution": "[2.9.3]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xunit.extensibility.core": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "2.9.3",
|
||||||
|
"contentHash": "kf3si0YTn2a8J8eZNb+zFpwfoyvIrQ7ivNk5ZYA5yuYk1bEtMe4DxJ2CF/qsRgmEnDr7MnW1mxylBaHTZ4qErA==",
|
||||||
|
"dependencies": {
|
||||||
|
"xunit.abstractions": "2.0.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xunit.extensibility.execution": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "2.9.3",
|
||||||
|
"contentHash": "yMb6vMESlSrE3Wfj7V6cjQ3S4TXdXpRqYeNEI3zsX31uTsGMJjEw6oD5F5u1cHnMptjhEECnmZSsPxB6ChZHDQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"xunit.extensibility.core": "[2.9.3]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"torch": {
|
||||||
|
"type": "Project",
|
||||||
|
"dependencies": {
|
||||||
|
"ControlzEx": "[5.0.2, )",
|
||||||
|
"Lib.Harmony.Thin": "[2.3.4-torch, )",
|
||||||
|
"MahApps.Metro": "[2.4.10, )",
|
||||||
|
"Microsoft.CodeAnalysis.CSharp": "[4.12.0, )",
|
||||||
|
"Microsoft.CodeAnalysis.Common": "[4.12.0, )",
|
||||||
|
"NLog": "[5.3.4, )",
|
||||||
|
"System.ComponentModel.Annotations": "[5.0.0, )",
|
||||||
|
"Torch.API": "[1.0.0, )",
|
||||||
|
"Torch.SixLabors.ImageSharp": "[1.0.0-beta6, )"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"torch.api": {
|
||||||
|
"type": "Project",
|
||||||
|
"dependencies": {
|
||||||
|
"JetBrains.Annotations": "[2024.3.0, )",
|
||||||
|
"Microsoft.Extensions.Configuration.Binder": "[9.0.0, )",
|
||||||
|
"NLog": "[5.3.4, )",
|
||||||
|
"NuGet.Commands": "[6.12.1, )",
|
||||||
|
"NuGet.DependencyResolver.Core": "[6.12.1, )",
|
||||||
|
"SemanticVersioning": "[3.0.0, )",
|
||||||
|
"SpaceEngineersDedicated.ReferenceAssemblies": "[1.*, )",
|
||||||
|
"System.Linq.Async": "[6.0.1, )"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"torch.server": {
|
||||||
|
"type": "Project",
|
||||||
|
"dependencies": {
|
||||||
|
"AutoCompleteTextBox": "[1.7.2, )",
|
||||||
|
"Ben.Demystifier": "[0.4.1, )",
|
||||||
|
"ControlzEx": "[5.0.2, )",
|
||||||
|
"MahApps.Metro": "[2.4.10, )",
|
||||||
|
"MdXaml": "[1.27.0, )",
|
||||||
|
"Microsoft.Bcl.AsyncInterfaces": "[9.0.0, )",
|
||||||
|
"Microsoft.Diagnostics.Runtime": "[3.1.512801, )",
|
||||||
|
"Microsoft.Extensions.Configuration.CommandLine": "[9.0.0, )",
|
||||||
|
"Microsoft.Extensions.Configuration.EnvironmentVariables": "[9.0.0, )",
|
||||||
|
"Microsoft.Extensions.Configuration.Xml": "[9.0.0, )",
|
||||||
|
"Microsoft.Extensions.Logging": "[9.0.0, )",
|
||||||
|
"NLog": "[5.3.4, )",
|
||||||
|
"System.ComponentModel.Annotations": "[5.0.0, )",
|
||||||
|
"System.Management": "[9.0.0, )",
|
||||||
|
"Torch": "[1.0.0, )",
|
||||||
|
"Torch.API": "[1.0.0, )",
|
||||||
|
"nulastudio.NetBeauty": "[2.1.4.6, )"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"torch.tests": {
|
||||||
|
"type": "Project",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.NET.Test.Sdk": "[17.12.0, )",
|
||||||
|
"NLog": "[5.3.4, )",
|
||||||
|
"Torch": "[1.0.0, )",
|
||||||
|
"Torch.API": "[1.0.0, )",
|
||||||
|
"xunit": "[2.9.3, )"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"net9.0-windows7.0/win-x64": {
|
||||||
|
"System.Management": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "bVh4xAMI5grY5GZoklKcMBLirhC8Lqzp63Ft3zXJacwGAlLyFdF4k0qz4pnKIlO6HyL2Z4zqmHm9UkzEo6FFsA==",
|
||||||
|
"dependencies": {
|
||||||
|
"System.CodeDom": "9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Security.Cryptography.Pkcs": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.0",
|
||||||
|
"contentHash": "8tluJF8w9si+2yoHeL8rgVJS6lKvWomTDC8px65Z8MCzzdME5eaPtEQf4OfVGrAxB5fW93ncucy1+221O9EQaw=="
|
||||||
|
},
|
||||||
|
"System.Security.Cryptography.ProtectedData": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "4.4.0",
|
||||||
|
"contentHash": "cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
39
Torch.Server/ApplicationRestartHelper.cs
Normal file
39
Torch.Server/ApplicationRestartHelper.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Torch.Server;
|
||||||
|
|
||||||
|
internal static class ApplicationRestartHelper
|
||||||
|
{
|
||||||
|
public static void RestartApplication()
|
||||||
|
{
|
||||||
|
var exe = Path.Combine(AppContext.BaseDirectory, "Torch.Server.exe");
|
||||||
|
|
||||||
|
var args = Environment.GetCommandLineArgs().ToList();
|
||||||
|
|
||||||
|
args.RemoveAt(0); // dll entry path
|
||||||
|
|
||||||
|
args.RemoveConfigItem("--tempAutostart");
|
||||||
|
args.RemoveConfigItem("--waitForPid");
|
||||||
|
|
||||||
|
args.AddRange([
|
||||||
|
"--waitForPid", Environment.ProcessId.ToString(),
|
||||||
|
"--tempAutostart", "true"
|
||||||
|
]);
|
||||||
|
|
||||||
|
Process.Start(new ProcessStartInfo(exe, args));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void RemoveConfigItem(this List<string> list, string item)
|
||||||
|
{
|
||||||
|
var index = list.BinarySearch(item, StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
if (index < 0) return;
|
||||||
|
|
||||||
|
list.RemoveAt(index);
|
||||||
|
list.RemoveAt(index);
|
||||||
|
}
|
||||||
|
}
|
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
using Torch.Commands;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Torch.Commands;
|
|
||||||
|
|
||||||
namespace Torch.Server.Commands
|
namespace Torch.Server.Commands
|
||||||
{
|
{
|
||||||
|
@@ -1,22 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NLog.Targets;
|
|
||||||
using Sandbox.Engine.Utils;
|
|
||||||
using Torch.Utils;
|
|
||||||
using VRage.FileSystem;
|
|
||||||
|
|
||||||
namespace Torch.Server
|
namespace Torch.Server
|
||||||
{
|
{
|
||||||
@@ -26,28 +17,23 @@ namespace Torch.Server
|
|||||||
|
|
||||||
private static readonly Logger Log = LogManager.GetLogger(nameof(Initializer));
|
private static readonly Logger Log = LogManager.GetLogger(nameof(Initializer));
|
||||||
private bool _init;
|
private bool _init;
|
||||||
private const string STEAMCMD_DIR = "steamcmd";
|
private const string TOOL_DIR = "tool";
|
||||||
private const string STEAMCMD_ZIP = "temp.zip";
|
private const string TOOL_ZIP = "temp.zip";
|
||||||
private static readonly string STEAMCMD_EXE = "steamcmd.exe";
|
private static readonly string TOOL_EXE = "steamcmd.exe";
|
||||||
private static readonly string RUNSCRIPT_FILE = "runscript.txt";
|
private const string TOOL_ARGS = "+force_install_dir \"{0}\" +login anonymous +app_update 298740 +quit";
|
||||||
|
|
||||||
private const string RUNSCRIPT = @"force_install_dir ../
|
|
||||||
login anonymous
|
|
||||||
app_update 298740
|
|
||||||
quit";
|
|
||||||
private TorchServer _server;
|
private TorchServer _server;
|
||||||
|
|
||||||
internal Persistent<TorchConfig> ConfigPersistent { get; }
|
internal Persistent<TorchConfig> ConfigPersistent { get; }
|
||||||
public TorchConfig Config => ConfigPersistent?.Data;
|
public TorchConfig Config => ConfigPersistent?.Data;
|
||||||
public TorchServer Server => _server;
|
public TorchServer Server => _server;
|
||||||
|
|
||||||
public Initializer(string basePath, Persistent<TorchConfig> torchConfig)
|
public Initializer(Persistent<TorchConfig> torchConfig)
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
ConfigPersistent = torchConfig;
|
ConfigPersistent = torchConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Initialize(string[] args)
|
public bool Initialize(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
if (_init)
|
if (_init)
|
||||||
return false;
|
return false;
|
||||||
@@ -60,18 +46,17 @@ quit";
|
|||||||
Log.Debug("Debug logging enabled.");
|
Log.Debug("Debug logging enabled.");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This is what happens when Keen is bad and puts extensions into the System namespace.
|
if (configuration.GetValue("getGameUpdates", true) && !configuration.GetValue("noupdate", false))
|
||||||
if (!Enumerable.Contains(args, "-noupdate"))
|
RunSteamCmdAsync(configuration).Wait();
|
||||||
RunSteamCmd();
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Config.WaitForPID))
|
var processPid = configuration.GetValue<int>("waitForPid");
|
||||||
|
if (processPid != 0)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var pid = int.Parse(Config.WaitForPID);
|
var waitProc = Process.GetProcessById(processPid);
|
||||||
var waitProc = Process.GetProcessById(pid);
|
|
||||||
Log.Info("Continuing in 5 seconds.");
|
Log.Info("Continuing in 5 seconds.");
|
||||||
Log.Warn($"Waiting for process {pid} to close");
|
Log.Warn($"Waiting for process {processPid} to close");
|
||||||
while (!waitProc.HasExited)
|
while (!waitProc.HasExited)
|
||||||
{
|
{
|
||||||
Console.Write(".");
|
Console.Write(".");
|
||||||
@@ -88,11 +73,11 @@ quit";
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run(bool isService, string instanceName, string instancePath)
|
public void Run(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_server = new TorchServer(Config, instancePath, instanceName);
|
_server = new TorchServer(Config, ApplicationContext.Current.InstanceDirectory.FullName, ApplicationContext.Current.InstanceName, configuration);
|
||||||
|
|
||||||
if (isService || Config.NoGui)
|
if (ApplicationContext.Current.IsService || Config.NoGui)
|
||||||
{
|
{
|
||||||
_server.Init();
|
_server.Init();
|
||||||
_server.Start();
|
_server.Start();
|
||||||
@@ -107,55 +92,40 @@ quit";
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
var gameThread = new Thread(() =>
|
_server.Init();
|
||||||
{
|
|
||||||
_server.Init();
|
|
||||||
|
|
||||||
if (Config.Autostart || Config.TempAutostart)
|
if (!Config.Autostart && !Config.TempAutostart) return;
|
||||||
{
|
|
||||||
Config.TempAutostart = false;
|
|
||||||
_server.Start();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
gameThread.Start();
|
Config.TempAutostart = false;
|
||||||
|
_server.Start();
|
||||||
var ui = new TorchUI(_server);
|
|
||||||
|
|
||||||
SynchronizationContext.SetSynchronizationContext(
|
|
||||||
new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));
|
|
||||||
|
|
||||||
ui.ShowDialog();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RunSteamCmd()
|
public static async Task RunSteamCmdAsync(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
var log = LogManager.GetLogger("SteamCMD");
|
var log = LogManager.GetLogger("SteamCMD");
|
||||||
|
|
||||||
var path = Environment.GetEnvironmentVariable("TORCH_STEAMCMD") ?? Path.GetFullPath(STEAMCMD_DIR);
|
var path = configuration.GetValue<string>("steamToolPath") ?? ApplicationContext.Current.TorchDirectory
|
||||||
|
.CreateSubdirectory(TOOL_DIR).FullName;
|
||||||
|
|
||||||
if (!Directory.Exists(path))
|
if (!Directory.Exists(path))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(path);
|
Directory.CreateDirectory(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
var runScriptPath = Path.Combine(path, RUNSCRIPT_FILE);
|
var toolExe = Path.Combine(path, TOOL_EXE);
|
||||||
if (!File.Exists(runScriptPath))
|
if (!File.Exists(toolExe))
|
||||||
File.WriteAllText(runScriptPath, RUNSCRIPT);
|
|
||||||
|
|
||||||
var steamCmdExePath = Path.Combine(path, STEAMCMD_EXE);
|
|
||||||
if (!File.Exists(steamCmdExePath))
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
log.Info("Downloading SteamCMD.");
|
log.Info("Downloading SteamCMD.");
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
using (var file = File.Create(STEAMCMD_ZIP))
|
await using (var file = File.Create(TOOL_ZIP))
|
||||||
client.GetStreamAsync("https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip").Result.CopyTo(file);
|
await using (var stream = await client.GetStreamAsync("https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip"))
|
||||||
|
await stream.CopyToAsync(file);
|
||||||
|
|
||||||
ZipFile.ExtractToDirectory(STEAMCMD_ZIP, path);
|
ZipFile.ExtractToDirectory(TOOL_ZIP, path);
|
||||||
File.Delete(STEAMCMD_ZIP);
|
File.Delete(TOOL_ZIP);
|
||||||
log.Info("SteamCMD downloaded successfully!");
|
log.Info("SteamCMD downloaded successfully!");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -166,20 +136,18 @@ quit";
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Checking for DS updates.");
|
log.Info("Checking for DS updates.");
|
||||||
var steamCmdProc = new ProcessStartInfo(steamCmdExePath, "+runscript runscript.txt")
|
var steamCmdProc = new ProcessStartInfo(toolExe)
|
||||||
{
|
{
|
||||||
|
Arguments = string.Format(TOOL_ARGS, configuration.GetValue("gamePath", "../")),
|
||||||
WorkingDirectory = path,
|
WorkingDirectory = path,
|
||||||
UseShellExecute = false,
|
RedirectStandardOutput = true
|
||||||
RedirectStandardOutput = true,
|
|
||||||
StandardOutputEncoding = Encoding.ASCII
|
|
||||||
};
|
};
|
||||||
var cmd = Process.Start(steamCmdProc);
|
var cmd = Process.Start(steamCmdProc)!;
|
||||||
|
|
||||||
// ReSharper disable once PossibleNullReferenceException
|
|
||||||
while (!cmd.HasExited)
|
while (!cmd.HasExited)
|
||||||
{
|
{
|
||||||
log.Info(cmd.StandardOutput.ReadLine());
|
if (await cmd.StandardOutput.ReadLineAsync() is { } line)
|
||||||
Thread.Sleep(100);
|
log.Info(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user