Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
67bb3fd00c | ||
90546a78c2 | |||
![]() |
d301955609 | ||
![]() |
264daf7515 |
@@ -11,7 +11,7 @@ Torch is the successor to SE Server Extender and gives server admins the tools t
|
||||
* Extensible using the Torch plugin system
|
||||
|
||||
### Fork Difference
|
||||
* .NET 6.0 runtime
|
||||
* .NET 8.0 runtime
|
||||
* Optimized in-game scripts (also newer compiler & language versions)
|
||||
* Better configuration via cli arguments, environment variables or xml config
|
||||
* Designed to run multiple instance from same install directory without having you to waste disk space
|
||||
@@ -19,7 +19,9 @@ Torch is the successor to SE Server Extender and gives server admins the tools t
|
||||
|
||||
### 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
|
||||
|
||||
@@ -30,7 +32,7 @@ If you have any questions or issues please join our [discord](https://discord.gg
|
||||
|
||||
# Building
|
||||
|
||||
As a regular dotnet project with cli by running `dotnet build Torch.Server/Torch.Server.csproj`, with VS 2022 or higher, with JB Rider or Fleet.
|
||||
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)
|
||||
|
||||
|
@@ -94,27 +94,11 @@ namespace Torch.Server
|
||||
|
||||
_server.Init();
|
||||
|
||||
var uiThread = new Thread(() =>
|
||||
{
|
||||
var ui = new TorchUI(_server);
|
||||
if (!Config.Autostart && !Config.TempAutostart) return;
|
||||
|
||||
SynchronizationContext.SetSynchronizationContext(
|
||||
new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));
|
||||
|
||||
ui.ShowDialog();
|
||||
});
|
||||
|
||||
uiThread.SetApartmentState(ApartmentState.STA);
|
||||
uiThread.Start();
|
||||
|
||||
if (Config.Autostart || Config.TempAutostart)
|
||||
{
|
||||
Config.TempAutostart = false;
|
||||
_server.Start();
|
||||
}
|
||||
|
||||
uiThread.Join();
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task RunSteamCmdAsync(IConfiguration configuration)
|
||||
|
37
Torch.Server/Managers/UiManager.cs
Normal file
37
Torch.Server/Managers/UiManager.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.Threading;
|
||||
using System.Windows.Threading;
|
||||
using JetBrains.Annotations;
|
||||
using Torch.Managers;
|
||||
|
||||
namespace Torch.Server.Managers;
|
||||
|
||||
public class UiManager(TorchServer torchInstance) : Manager(torchInstance)
|
||||
{
|
||||
[CanBeNull] private Thread _uiThread;
|
||||
[CanBeNull] private Dispatcher _dispatcher;
|
||||
|
||||
public override void Attach()
|
||||
{
|
||||
_uiThread = new Thread(() =>
|
||||
{
|
||||
var ui = new TorchUI(torchInstance);
|
||||
|
||||
_dispatcher = Dispatcher.CurrentDispatcher;
|
||||
|
||||
SynchronizationContext.SetSynchronizationContext(
|
||||
new DispatcherSynchronizationContext(_dispatcher));
|
||||
|
||||
ui.ShowDialog();
|
||||
});
|
||||
|
||||
_uiThread.SetApartmentState(ApartmentState.STA);
|
||||
_uiThread.Start();
|
||||
}
|
||||
|
||||
public override void Detach()
|
||||
{
|
||||
_dispatcher?.InvokeShutdown();
|
||||
if (Thread.CurrentThread != _uiThread)
|
||||
_uiThread?.Join();
|
||||
}
|
||||
}
|
@@ -114,8 +114,8 @@ public class TorchConfig : ViewModel, ITorchConfig
|
||||
|
||||
public UpdateSource UpdateSource { get; set; } = new()
|
||||
{
|
||||
Repository = "PveTeam/Torch",
|
||||
Url = "https://api.github.com",
|
||||
Repository = "PvE/Torch",
|
||||
Url = "https://git.zznty.ru/api/v1",
|
||||
SourceType = UpdateSourceType.Github
|
||||
};
|
||||
|
||||
|
@@ -56,6 +56,8 @@ namespace Torch.Server
|
||||
if (config.EntityManagerEnabled)
|
||||
AddManager(new EntityControlManager(this));
|
||||
AddManager(new RemoteAPIManager(this));
|
||||
if (!ApplicationContext.Current.IsService && !config.NoGui)
|
||||
AddManager(new UiManager(this));
|
||||
|
||||
var sessionManager = Managers.GetManager<ITorchSessionManager>();
|
||||
sessionManager.AddFactory(_ => new MultiplayerManagerDedicated(this));
|
||||
@@ -185,7 +187,7 @@ namespace Torch.Server
|
||||
|
||||
if (IsRunning || HasRun)
|
||||
{
|
||||
Restart();
|
||||
Restart(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -65,7 +65,8 @@ internal static class AssemblyRewriter
|
||||
{
|
||||
using var assembly = AssemblyDefinition.ReadAssembly(inputStream, new()
|
||||
{
|
||||
AssemblyResolver = resolver
|
||||
AssemblyResolver = resolver,
|
||||
ReadSymbols = true
|
||||
});
|
||||
foreach (var fieldDefinition in FindAllToRewrite(assembly.MainModule))
|
||||
{
|
||||
|
@@ -293,15 +293,20 @@ namespace Torch
|
||||
{
|
||||
}
|
||||
|
||||
private bool _disposed = false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual void Destroy()
|
||||
{
|
||||
if (_disposed) return;
|
||||
Game.SignalDestroy();
|
||||
if (!Game.WaitFor(VRageGame.GameState.Destroyed))
|
||||
Log.Warn("Failed to wait for the game to be destroyed");
|
||||
Game = null;
|
||||
|
||||
Managers.Detach();
|
||||
|
||||
_disposed = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
Reference in New Issue
Block a user