Update CommandLine to use the new IServerInterface

This commit is contained in:
Cyberboss
2017-12-08 13:08:48 -05:00
parent 50a78b3193
commit e58f09eef4
16 changed files with 111 additions and 151 deletions
+6 -7
View File
@@ -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);