mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-27 23:17:20 +01:00
Update CommandLine to use the new IServerInterface
This commit is contained in:
@@ -2,11 +2,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using TGS.Interface;
|
||||
using TGS.Interface.Components;
|
||||
|
||||
namespace TGS.CommandLine
|
||||
{
|
||||
class ConfigCommand : InstanceRootCommand
|
||||
class ConfigCommand : RootCommand
|
||||
{
|
||||
public ConfigCommand()
|
||||
{
|
||||
@@ -28,7 +27,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Interface.GetComponent<ITGConfig>().DeleteFile(parameters[0], out bool unauthorized);
|
||||
var res = Instance.Config.DeleteFile(parameters[0], out bool unauthorized);
|
||||
if (res != null)
|
||||
{
|
||||
OutputProc(res);
|
||||
@@ -64,7 +63,7 @@ namespace TGS.CommandLine
|
||||
}
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var list = Interface.GetComponent<ITGConfig>().ListStaticDirectory(parameters.Count > 0 ? parameters[0] : null, out string error, out bool unauthorized);
|
||||
var list = Instance.Config.ListStaticDirectory(parameters.Count > 0 ? parameters[0] : null, out string error, out bool unauthorized);
|
||||
if(list == null)
|
||||
{
|
||||
OutputProc(error);
|
||||
@@ -88,7 +87,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
OutputProc(Interface.GetComponent<ITGInstance>().ServerDirectory());
|
||||
OutputProc(Instance.ServerDirectory());
|
||||
return ExitCode.Normal;
|
||||
}
|
||||
|
||||
@@ -108,7 +107,7 @@ namespace TGS.CommandLine
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var bytes = Interface.GetComponent<ITGConfig>().ReadText(parameters[0], parameters.Count > 2 && parameters[2].ToLower() == "--repo", out string error, out bool unauthorized);
|
||||
var bytes = Instance.Config.ReadText(parameters[0], parameters.Count > 2 && parameters[2].ToLower() == "--repo", out string error, out bool unauthorized);
|
||||
if(bytes == null)
|
||||
{
|
||||
OutputProc("Error: " + error);
|
||||
@@ -148,7 +147,7 @@ namespace TGS.CommandLine
|
||||
{
|
||||
try
|
||||
{
|
||||
var res = Interface.GetComponent<ITGConfig>().WriteText(parameters[0], File.ReadAllText(parameters[1]), out bool unauthorized);
|
||||
var res = Instance.Config.WriteText(parameters[0], File.ReadAllText(parameters[1]), out bool unauthorized);
|
||||
if (res != null)
|
||||
{
|
||||
OutputProc("Error: " + res);
|
||||
|
||||
Reference in New Issue
Block a user