mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-29 16:11:05 +01:00
Heavy instancing work
Added InstanceRootCommand for blocking instance based commands if no instance is chosen CLI now prints the service version Added service level CLI commands Fixed Service.LockLoggingID Added InstanceMetadata DataContract Implemented Service.ListInstances ExitCode is now set to int parent type Fixed ConnectivityLevel flags Optimized channel closing during instance switching
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System.Collections.Generic;
|
||||
using TGServiceInterface;
|
||||
|
||||
namespace TGCommandLine
|
||||
{
|
||||
abstract class InstanceRootCommand : RootCommand
|
||||
{
|
||||
public static Interface currentInterface;
|
||||
public override ExitCode DoRun(IList<string> parameters)
|
||||
{
|
||||
if (currentInterface.InstanceName == null)
|
||||
{
|
||||
OutputProc("Missing instance!");
|
||||
return ExitCode.BadCommand;
|
||||
}
|
||||
else
|
||||
{
|
||||
var res = currentInterface.ConnectToInstance();
|
||||
if (!res.HasFlag(ConnectivityLevel.Connected))
|
||||
{
|
||||
OutputProc("Unable to connect to instance!");
|
||||
return ExitCode.ConnectionError;
|
||||
}
|
||||
else if (!res.HasFlag(ConnectivityLevel.Authenticated))
|
||||
{
|
||||
OutputProc("The current user is not authorized to use this instance!");
|
||||
return ExitCode.ConnectionError;
|
||||
}
|
||||
}
|
||||
return base.DoRun(parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user