diff --git a/TGS.Interface/TGS.Interface.csproj b/TGS.Interface/TGS.Interface.csproj
index 80043925e2..fd1a344ca5 100644
--- a/TGS.Interface/TGS.Interface.csproj
+++ b/TGS.Interface/TGS.Interface.csproj
@@ -79,6 +79,7 @@
+
diff --git a/TGS.Interface/Wrappers/IInstance.cs b/TGS.Interface/Wrappers/IInstance.cs
index cf1f759785..a6895998d9 100644
--- a/TGS.Interface/Wrappers/IInstance.cs
+++ b/TGS.Interface/Wrappers/IInstance.cs
@@ -7,6 +7,11 @@ namespace TGS.Interface.Wrappers
///
public interface IInstance : ITGInstance
{
+ ///
+ /// Get the for the
+ ///
+ InstanceMetadata Metadata { get; }
+
///
/// The component
///
diff --git a/TGS.Interface/Wrappers/Instance.cs b/TGS.Interface/Wrappers/Instance.cs
index 355c0d831d..77e304af38 100644
--- a/TGS.Interface/Wrappers/Instance.cs
+++ b/TGS.Interface/Wrappers/Instance.cs
@@ -1,4 +1,5 @@
-using TGS.Interface.Components;
+using System.Linq;
+using TGS.Interface.Components;
namespace TGS.Interface.Wrappers
{
@@ -12,53 +13,65 @@ namespace TGS.Interface.Wrappers
///
/// The name of the
///
- readonly string instanceName;
+ InstanceMetadata metadata;
///
/// Construct an
///
/// The to use
- /// The name to use
- public Instance(ServerInterface _serverInterface, string _instanceName)
+ /// The for the
+ public Instance(ServerInterface _serverInterface, InstanceMetadata _metadata)
{
serverInterface = _serverInterface;
- instanceName = _instanceName;
+ metadata = _metadata;
}
///
- public ITGAdministration Administration => serverInterface.GetComponent(instanceName);
+ public InstanceMetadata Metadata
+ {
+ get
+ {
+ if (!metadata.Enabled)
+ //metadata needs populating
+ metadata = serverInterface.GetComponent(null).ListInstances().Where(x => x.Name == metadata.Name).First();
+ return metadata;
+ }
+ }
///
- public ITGByond Byond => serverInterface.GetComponent(instanceName);
+ public ITGAdministration Administration => serverInterface.GetComponent(metadata.Name);
///
- public ITGChat Chat => serverInterface.GetComponent(instanceName);
+ public ITGByond Byond => serverInterface.GetComponent(metadata.Name);
///
- public ITGCompiler Compiler => serverInterface.GetComponent(instanceName);
+ public ITGChat Chat => serverInterface.GetComponent(metadata.Name);
///
- public ITGConfig Config => serverInterface.GetComponent(instanceName);
+ public ITGCompiler Compiler => serverInterface.GetComponent(metadata.Name);
///
- public ITGDreamDaemon DreamDaemon => serverInterface.GetComponent(instanceName);
+ public ITGConfig Config => serverInterface.GetComponent(metadata.Name);
///
- public ITGInterop Interop => serverInterface.GetComponent(instanceName);
+ public ITGDreamDaemon DreamDaemon => serverInterface.GetComponent(metadata.Name);
///
- public ITGRepository Repository => serverInterface.GetComponent(instanceName);
+ public ITGInterop Interop => serverInterface.GetComponent(metadata.Name);
+
+ ///
+ public ITGRepository Repository => serverInterface.GetComponent(metadata.Name);
///
public string ServerDirectory()
{
- return serverInterface.GetComponent(instanceName).ServerDirectory();
+ return serverInterface.GetComponent(metadata.Name).ServerDirectory();
}
///
public string Version()
{
- return serverInterface.GetComponent(instanceName).Version();
+ return serverInterface.GetComponent(metadata.Name).Version();
}
}
}
diff --git a/TGS.Interface/Wrappers/Server.cs b/TGS.Interface/Wrappers/Server.cs
new file mode 100644
index 0000000000..c45b1f820c
--- /dev/null
+++ b/TGS.Interface/Wrappers/Server.cs
@@ -0,0 +1,88 @@
+using System;
+using System.Collections.Generic;
+using TGS.Interface.Components;
+
+namespace TGS.Interface.Wrappers
+{
+ ///
+ sealed class Server : IServer
+ {
+ ///
+ public Version Version => serverInterface.ServerVersion;
+
+ ///
+ public IEnumerable Instances { get
+ {
+ lock (this)
+ if(knownInstances == null)
+ knownInstances = serverInterface.GetComponent().ListInstances();
+ foreach(var I in knownInstances)
+ yield return new Instance(serverInterface, I);
+ }
+ }
+
+ ///
+ public ITGInstanceManager InstanceManager => serverInterface.GetComponent();
+
+ ///
+ /// The backing
+ ///
+ readonly ServerInterface serverInterface;
+
+ ///
+ /// Result of a call to
+ ///
+ IList knownInstances;
+
+ ///
+ /// Construct an
+ ///
+ /// The to use
+ public Server(ServerInterface _serverInterface)
+ {
+ serverInterface = _serverInterface;
+ }
+
+ ///
+ public IInstance GetInstance(string name)
+ {
+ return new Instance(serverInterface, new InstanceMetadata { Name = name, Enabled = false });
+ }
+
+ ///
+ public void PrepareForUpdate()
+ {
+ serverInterface.GetComponent().PrepareForUpdate();
+ }
+
+ ///
+ public string PythonPath()
+ {
+ return serverInterface.GetComponent().PythonPath();
+ }
+
+ ///
+ public ushort RemoteAccessPort()
+ {
+ return serverInterface.GetComponent().RemoteAccessPort();
+ }
+
+ ///
+ public bool SetPythonPath(string path)
+ {
+ return serverInterface.GetComponent().SetPythonPath(path);
+ }
+
+ ///
+ public string SetRemoteAccessPort(ushort port)
+ {
+ return serverInterface.GetComponent().SetRemoteAccessPort(port);
+ }
+
+ ///
+ string ITGSService.Version()
+ {
+ return serverInterface.GetComponent().Version();
+ }
+ }
+}