Warning guard around some unsafe stuff
This commit is contained in:
@@ -42,11 +42,17 @@ namespace Torch.Server
|
||||
public class TorchServer : TorchBase, ITorchServer
|
||||
{
|
||||
//public MyConfigDedicated<MyObjectBuilder_SessionSettings> DedicatedConfig { get; set; }
|
||||
/// <inheritdoc />
|
||||
public float SimulationRatio { get => _simRatio; set { _simRatio = value; OnPropertyChanged(); } }
|
||||
/// <inheritdoc />
|
||||
public TimeSpan ElapsedPlayTime { get => _elapsedPlayTime; set { _elapsedPlayTime = value; OnPropertyChanged(); } }
|
||||
/// <inheritdoc />
|
||||
public Thread GameThread { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public ServerState State { get => _state; private set { _state = value; OnPropertyChanged(); } }
|
||||
/// <inheritdoc />
|
||||
public bool IsRunning { get => _isRunning; set { _isRunning = value; OnPropertyChanged(); } }
|
||||
/// <inheritdoc />
|
||||
public InstanceManager DedicatedInstance { get; }
|
||||
/// <inheritdoc />
|
||||
public string InstanceName => Config?.InstanceName;
|
||||
@@ -61,6 +67,7 @@ namespace Torch.Server
|
||||
private Timer _watchdog;
|
||||
private Stopwatch _uptime;
|
||||
|
||||
/// <inheritdoc />
|
||||
public TorchServer(TorchConfig config = null)
|
||||
{
|
||||
DedicatedInstance = new InstanceManager(this);
|
||||
|
@@ -30,22 +30,24 @@ namespace Torch.Utils
|
||||
foreach (string other in binaryPaths)
|
||||
allPaths.Add(other.ToLower().Replace('/', '\\'));
|
||||
var pathPrefix = StringUtils.CommonPrefix(allPaths);
|
||||
#pragma warning disable 618
|
||||
AppDomain.CurrentDomain.AppendPrivatePath(String.Join(Path.PathSeparator.ToString(), allPaths));
|
||||
#pragma warning restore 618
|
||||
AppDomain.CurrentDomain.SetData(TorchKey, true);
|
||||
AppDomain.CurrentDomain.ExecuteAssemblyByName(entryPoint, args);
|
||||
return;
|
||||
// this would be way better but HAVOK IS UNMANAGED :clang:
|
||||
// exclude application base from probing
|
||||
var setup = new AppDomainSetup
|
||||
{
|
||||
ApplicationBase = pathPrefix.ToString(),
|
||||
PrivateBinPathProbe = "",
|
||||
PrivateBinPath = string.Join(";", allPaths)
|
||||
};
|
||||
AppDomain domain = AppDomain.CreateDomain($"TorchDomain-{Assembly.GetEntryAssembly().GetName().Name}-{new Random().Next():X}", null, setup);
|
||||
domain.SetData(TorchKey, true);
|
||||
domain.ExecuteAssemblyByName(entryPoint, args);
|
||||
AppDomain.Unload(domain);
|
||||
// var setup = new AppDomainSetup
|
||||
// {
|
||||
// ApplicationBase = pathPrefix.ToString(),
|
||||
// PrivateBinPathProbe = "",
|
||||
// PrivateBinPath = string.Join(";", allPaths)
|
||||
// };
|
||||
// AppDomain domain = AppDomain.CreateDomain($"TorchDomain-{Assembly.GetEntryAssembly().GetName().Name}-{new Random().Next():X}", null, setup);
|
||||
// domain.SetData(TorchKey, true);
|
||||
// domain.ExecuteAssemblyByName(entryPoint, args);
|
||||
// AppDomain.Unload(domain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user