From eace72f747170284cc2b7b4e861416f1897baa95 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 1 Nov 2017 17:07:35 -0400 Subject: [PATCH] Documents InstanceConfig --- TGServerService/InstanceConfig.cs | 83 +++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/TGServerService/InstanceConfig.cs b/TGServerService/InstanceConfig.cs index 68020479f4..429ba1b8e6 100644 --- a/TGServerService/InstanceConfig.cs +++ b/TGServerService/InstanceConfig.cs @@ -6,40 +6,115 @@ namespace TGServerService { class InstanceConfig { + /// + /// The name the file is saved as in the + /// //tell javascriptserializer to ignore these fields [ScriptIgnore] const string JSONFilename = "Instance.json"; + /// + /// The current version of the config + /// [ScriptIgnore] protected const ulong CurrentVersion = 0; //Literally any time you add/deprecated a field, this number needs to be bumped + /// + /// The directory this is for + /// [ScriptIgnore] public string Directory { get; private set; } + /// + /// Actual version of the . Migrated up via + /// public ulong Version { get; protected set; } = CurrentVersion; + /// + /// The name of the + /// public string Name { get; set; } = "TG Station Server"; + + /// + /// If the is active + /// public bool Enabled { get; set; } = true; + /// + /// The name of the .dme/.dmb the uses + /// public string ProjectName { get; set; } = "tgstation"; + /// + /// The port the runs on + /// public ushort Port { get; set; } = 1337; + + /// + /// The level for the + /// public DreamDaemonSecurity Security { get; set; } = DreamDaemonSecurity.Trusted; + + /// + /// Whether or not the should immediately start DreamDaemon when activated + /// public bool Autostart { get; set; } = false; + + /// + /// Whether or not DreamDaemon allows connections from webclients + /// public bool Webclient { get; set; } = false; + /// + /// Author and committer name for synchronize commits + /// public string CommitterName { get; set; } = "tgstation-server"; + /// + /// Author and committer e-mail for synchronize commits + /// public string CommitterEmail { get; set; } = "tgstation-server@tgstation13.org"; + /// + /// Encrypted serialized s + /// public string ChatProviderData { get; set; } = ServerInstance.UninitializedString; + + /// + /// Entropy for + /// public string ChatProviderEntropy { get; set; } + /// + /// If the should reattach to a running DreamDaemon + /// public bool ReattachRequired { get; set; } = false; + + /// + /// The of the runnning DreamDaemon + /// public int ReattachProcessID { get; set; } + + /// + /// The port the runnning DreamDaemon was launched on + /// public ushort ReattachPort { get; set; } + + /// + /// The serviceCommsKey the runnning DreamDaemon was launched on + /// public string ReattachCommsKey { get; set; } + + /// + /// The API version of the runnning DreamDaemon + /// public string ReattachAPIVersion { get; set; } + /// + /// The user group allowed to use the + /// public string AuthorizedUserGroupSID { get; set; } = null; + /// + /// The auto update interval for the + /// public ulong AutoUpdateInterval { get; set; } = 0; /// @@ -51,6 +126,9 @@ namespace TGServerService Directory = path; } + /// + /// Saves the to it's + /// public void Save() { var data = new JavaScriptSerializer().Serialize(this); @@ -58,6 +136,11 @@ namespace TGServerService File.WriteAllText(path, data); } + /// + /// Loads and migrates an from a at + /// + /// The path to the directory + /// The migrated public static InstanceConfig Load(string path) { var configtext = File.ReadAllText(Path.Combine(path, JSONFilename));