diff --git a/TGCommandLine/DDCommands.cs b/TGCommandLine/DDCommands.cs index ef41ff1ffd..09f6bda7dc 100644 --- a/TGCommandLine/DDCommands.cs +++ b/TGCommandLine/DDCommands.cs @@ -9,7 +9,7 @@ namespace TGCommandLine public DDCommand() { Keyword = "dd"; - Children = new Command[] { new DDStartCommand(), new DDStopCommand(), new DDRestartCommand(), new DDStatusCommand(), new DDAutostartCommand(), new DDPortCommand(), new DDSecurityCommand(), new DDWorldAnnounceCommand() }; + Children = new Command[] { new DDStartCommand(), new DDStopCommand(), new DDRestartCommand(), new DDStatusCommand(), new DDAutostartCommand(), new DDPortCommand(), new DDSecurityCommand(), new DDWorldAnnounceCommand(), new DDWebclientCommand() }; } public override string GetHelpText() { @@ -191,6 +191,45 @@ namespace TGCommandLine return "Change or check autostarting of the game server with the service"; } } + class DDWebclientCommand : Command + { + public DDWebclientCommand() + { + Keyword = "webclient"; + RequiredParameters = 1; + } + + protected override ExitCode Run(IList parameters) + { + var DD = Server.GetComponent(); + switch (parameters[0].ToLower()) + { + case "on": + DD.SetWebclient(true); + break; + case "off": + DD.SetWebclient(false); + break; + case "check": + OutputProc("Webclient is: " + (DD.Webclient() ? "Enabled" : "Disabled")); + break; + default: + OutputProc("Invalid parameter: " + parameters[0]); + return ExitCode.BadCommand; + } + return ExitCode.Normal; + } + + public override string GetArgumentString() + { + return ""; + } + public override string GetHelpText() + { + return "Change or check if the BYOND webclient is enabled for the game server"; + } + } + class DDPortCommand : Command { public DDPortCommand() diff --git a/TGControlPanel/Main.Designer.cs b/TGControlPanel/Main.Designer.cs index 73e37e9903..8a215ebde3 100644 --- a/TGControlPanel/Main.Designer.cs +++ b/TGControlPanel/Main.Designer.cs @@ -71,6 +71,10 @@ this.MajorVersionNumeric = new System.Windows.Forms.NumericUpDown(); this.UpdateProgressBar = new System.Windows.Forms.ProgressBar(); this.ServerPanel = new System.Windows.Forms.TabPage(); + this.AutostartCheckbox = new System.Windows.Forms.CheckBox(); + this.WebclientCheckBox = new System.Windows.Forms.CheckBox(); + this.WorldAnnounceButton = new System.Windows.Forms.Button(); + this.WorldAnnounceField = new System.Windows.Forms.TextBox(); this.VisibilityTitle = new System.Windows.Forms.Label(); this.SecuritySelector = new System.Windows.Forms.ComboBox(); this.SecurityTitle = new System.Windows.Forms.Label(); @@ -79,6 +83,7 @@ this.NudgePortLabel = new System.Windows.Forms.Label(); this.ServerPathLabel = new System.Windows.Forms.Label(); this.ServerPathTextbox = new System.Windows.Forms.TextBox(); + this.CompileCancelButton = new System.Windows.Forms.Button(); this.ProjectPathLabel = new System.Windows.Forms.Label(); this.projectNameText = new System.Windows.Forms.TextBox(); this.PortLabel = new System.Windows.Forms.Label(); @@ -94,7 +99,6 @@ this.ServerRestartButton = new System.Windows.Forms.Button(); this.ServerStopButton = new System.Windows.Forms.Button(); this.ServerStartButton = new System.Windows.Forms.Button(); - this.AutostartCheckbox = new System.Windows.Forms.CheckBox(); this.CompilerStatusLabel = new System.Windows.Forms.Label(); this.CompilerLabel = new System.Windows.Forms.Label(); this.compileButton = new System.Windows.Forms.Button(); @@ -175,9 +179,6 @@ this.WorldStatusTimer = new System.Windows.Forms.Timer(this.components); this.FullUpdateWorker = new System.ComponentModel.BackgroundWorker(); this.ServerStartBGW = new System.ComponentModel.BackgroundWorker(); - this.WorldAnnounceField = new System.Windows.Forms.TextBox(); - this.CompileCancelButton = new System.Windows.Forms.Button(); - this.WorldAnnounceButton = new System.Windows.Forms.Button(); this.Panels.SuspendLayout(); this.RepoPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.TestmergeSelector)).BeginInit(); @@ -723,6 +724,8 @@ // ServerPanel // this.ServerPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(39)))), ((int)(((byte)(40)))), ((int)(((byte)(34))))); + this.ServerPanel.Controls.Add(this.AutostartCheckbox); + this.ServerPanel.Controls.Add(this.WebclientCheckBox); this.ServerPanel.Controls.Add(this.WorldAnnounceButton); this.ServerPanel.Controls.Add(this.WorldAnnounceField); this.ServerPanel.Controls.Add(this.VisibilityTitle); @@ -749,7 +752,6 @@ this.ServerPanel.Controls.Add(this.ServerRestartButton); this.ServerPanel.Controls.Add(this.ServerStopButton); this.ServerPanel.Controls.Add(this.ServerStartButton); - this.ServerPanel.Controls.Add(this.AutostartCheckbox); this.ServerPanel.Controls.Add(this.CompilerStatusLabel); this.ServerPanel.Controls.Add(this.CompilerLabel); this.ServerPanel.Controls.Add(this.compileButton); @@ -764,6 +766,53 @@ this.ServerPanel.TabIndex = 2; this.ServerPanel.Text = "Server"; // + // AutostartCheckbox + // + this.AutostartCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.AutostartCheckbox.AutoSize = true; + this.AutostartCheckbox.Font = new System.Drawing.Font("Verdana", 12F); + this.AutostartCheckbox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(248)))), ((int)(((byte)(248)))), ((int)(((byte)(242))))); + this.AutostartCheckbox.Location = new System.Drawing.Point(758, 0); + this.AutostartCheckbox.Name = "AutostartCheckbox"; + this.AutostartCheckbox.Size = new System.Drawing.Size(104, 22); + this.AutostartCheckbox.TabIndex = 15; + this.AutostartCheckbox.Text = "Autostart"; + this.AutostartCheckbox.UseVisualStyleBackColor = true; + this.AutostartCheckbox.CheckedChanged += new System.EventHandler(this.AutostartCheckbox_CheckedChanged); + // + // WebclientCheckBox + // + this.WebclientCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.WebclientCheckBox.AutoSize = true; + this.WebclientCheckBox.Font = new System.Drawing.Font("Verdana", 12F); + this.WebclientCheckBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(248)))), ((int)(((byte)(248)))), ((int)(((byte)(242))))); + this.WebclientCheckBox.Location = new System.Drawing.Point(758, 28); + this.WebclientCheckBox.Name = "WebclientCheckBox"; + this.WebclientCheckBox.Size = new System.Drawing.Size(108, 22); + this.WebclientCheckBox.TabIndex = 42; + this.WebclientCheckBox.Text = "Webclient"; + this.WebclientCheckBox.UseVisualStyleBackColor = true; + this.WebclientCheckBox.CheckedChanged += new System.EventHandler(this.WebclientCheckBox_CheckedChanged); + // + // WorldAnnounceButton + // + this.WorldAnnounceButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.WorldAnnounceButton.Location = new System.Drawing.Point(785, 136); + this.WorldAnnounceButton.Name = "WorldAnnounceButton"; + this.WorldAnnounceButton.Size = new System.Drawing.Size(77, 20); + this.WorldAnnounceButton.TabIndex = 41; + this.WorldAnnounceButton.Text = "Send"; + this.WorldAnnounceButton.UseVisualStyleBackColor = true; + this.WorldAnnounceButton.Click += new System.EventHandler(this.WorldAnnounceButton_Click); + // + // WorldAnnounceField + // + this.WorldAnnounceField.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.WorldAnnounceField.Location = new System.Drawing.Point(566, 136); + this.WorldAnnounceField.Name = "WorldAnnounceField"; + this.WorldAnnounceField.Size = new System.Drawing.Size(213, 20); + this.WorldAnnounceField.TabIndex = 40; + // // VisibilityTitle // this.VisibilityTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -871,6 +920,18 @@ this.ServerPathTextbox.Size = new System.Drawing.Size(296, 20); this.ServerPathTextbox.TabIndex = 32; // + // CompileCancelButton + // + this.CompileCancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.CompileCancelButton.Enabled = false; + this.CompileCancelButton.Location = new System.Drawing.Point(737, 302); + this.CompileCancelButton.Name = "CompileCancelButton"; + this.CompileCancelButton.Size = new System.Drawing.Size(69, 31); + this.CompileCancelButton.TabIndex = 31; + this.CompileCancelButton.Text = "Cancel"; + this.CompileCancelButton.UseVisualStyleBackColor = true; + this.CompileCancelButton.Click += new System.EventHandler(this.CompileCancelButton_Click); + // // ProjectPathLabel // this.ProjectPathLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -1054,20 +1115,6 @@ this.ServerStartButton.UseVisualStyleBackColor = true; this.ServerStartButton.Click += new System.EventHandler(this.ServerStartButton_Click); // - // AutostartCheckbox - // - this.AutostartCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.AutostartCheckbox.AutoSize = true; - this.AutostartCheckbox.Font = new System.Drawing.Font("Verdana", 12F); - this.AutostartCheckbox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(248)))), ((int)(((byte)(248)))), ((int)(((byte)(242))))); - this.AutostartCheckbox.Location = new System.Drawing.Point(758, 17); - this.AutostartCheckbox.Name = "AutostartCheckbox"; - this.AutostartCheckbox.Size = new System.Drawing.Size(104, 22); - this.AutostartCheckbox.TabIndex = 15; - this.AutostartCheckbox.Text = "Autostart"; - this.AutostartCheckbox.UseVisualStyleBackColor = true; - this.AutostartCheckbox.CheckedChanged += new System.EventHandler(this.AutostartCheckbox_CheckedChanged); - // // CompilerStatusLabel // this.CompilerStatusLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) @@ -1961,37 +2008,6 @@ // this.ServerStartBGW.DoWork += new System.ComponentModel.DoWorkEventHandler(this.ServerStartBGW_DoWork); // - // WorldAnnounceField - // - this.WorldAnnounceField.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.WorldAnnounceField.Location = new System.Drawing.Point(566, 136); - this.WorldAnnounceField.Name = "WorldAnnounceField"; - this.WorldAnnounceField.Size = new System.Drawing.Size(213, 20); - this.WorldAnnounceField.TabIndex = 40; - // - // CompileCancelButton - // - this.CompileCancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.CompileCancelButton.Enabled = false; - this.CompileCancelButton.Location = new System.Drawing.Point(737, 302); - this.CompileCancelButton.Name = "CompileCancelButton"; - this.CompileCancelButton.Size = new System.Drawing.Size(69, 31); - this.CompileCancelButton.TabIndex = 31; - this.CompileCancelButton.Text = "Cancel"; - this.CompileCancelButton.UseVisualStyleBackColor = true; - this.CompileCancelButton.Click += new System.EventHandler(this.CompileCancelButton_Click); - // - // WorldAnnounceButton - // - this.WorldAnnounceButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.WorldAnnounceButton.Location = new System.Drawing.Point(785, 136); - this.WorldAnnounceButton.Name = "WorldAnnounceButton"; - this.WorldAnnounceButton.Size = new System.Drawing.Size(77, 20); - this.WorldAnnounceButton.TabIndex = 41; - this.WorldAnnounceButton.Text = "Send"; - this.WorldAnnounceButton.UseVisualStyleBackColor = true; - this.WorldAnnounceButton.Click += new System.EventHandler(this.WorldAnnounceButton_Click); - // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -2181,5 +2197,6 @@ private System.Windows.Forms.Button WorldAnnounceButton; private System.Windows.Forms.TextBox WorldAnnounceField; private System.Windows.Forms.Button CompileCancelButton; + private System.Windows.Forms.CheckBox WebclientCheckBox; } } diff --git a/TGControlPanel/ServerPage.cs b/TGControlPanel/ServerPage.cs index 44a0c516ee..b5d1e04bd9 100644 --- a/TGControlPanel/ServerPage.cs +++ b/TGControlPanel/ServerPage.cs @@ -104,6 +104,7 @@ namespace TGControlPanel initializeButton.Visible = RepoExists; NudgePortSelector.Visible = RepoExists; AutostartCheckbox.Visible = RepoExists; + WebclientCheckBox.Visible = RepoExists; PortSelector.Visible = RepoExists; projectNameText.Visible = RepoExists; compilerProgressBar.Visible = RepoExists; @@ -157,6 +158,7 @@ namespace TGControlPanel ServerGStopButton.Enabled = !ShuttingDown; AutostartCheckbox.Checked = DD.Autostart(); + WebclientCheckBox.Checked = DD.Webclient(); if (!PortSelector.Focused) PortSelector.Value = DD.Port(); if (!projectNameText.Focused) @@ -485,5 +487,11 @@ namespace TGControlPanel } WorldAnnounceField.Text = ""; } + + private void WebclientCheckBox_CheckedChanged(object sender, EventArgs e) + { + if (!updatingFields) + Server.GetComponent().SetWebclient(WebclientCheckBox.Checked); + } } } diff --git a/TGServerService/App.config b/TGServerService/App.config index 603b9d8c0a..6eb925f561 100644 --- a/TGServerService/App.config +++ b/TGServerService/App.config @@ -61,6 +61,9 @@ + + False + diff --git a/TGServerService/DreamDaemon.cs b/TGServerService/DreamDaemon.cs index 888b1779dd..c53843dbab 100644 --- a/TGServerService/DreamDaemon.cs +++ b/TGServerService/DreamDaemon.cs @@ -380,7 +380,7 @@ namespace TGServerService GenCommsKey(); StartingSecurity = (TGDreamDaemonSecurity)Config.ServerSecurity; - Proc.StartInfo.Arguments = String.Format("{0} -port {1} -close -verbose -params \"server_service={3}&server_service_version={4}\" -{2} -public", DMB, Config.ServerPort, SecurityWord(), serviceCommsKey, Version()); + Proc.StartInfo.Arguments = String.Format("{0} -port {1} {5}-close -verbose -params \"server_service={3}&server_service_version={4}\" -{2} -public", DMB, Config.ServerPort, SecurityWord(), serviceCommsKey, Version(), Config.Webclient ? "-webclient" : ""); InitInterop(); Proc.Start(); @@ -506,5 +506,25 @@ namespace TGServerService return null; return res; } + + /// + public bool Webclient() + { + return Properties.Settings.Default.Webclient; + } + + /// + public void SetWebclient(bool on) + { + var Config = Properties.Settings.Default; + lock (watchdogLock) { + var diff = on != Config.Webclient; + if (diff) + { + Config.Webclient = on; + RequestRestart(); + } + } + } } } diff --git a/TGServerService/Properties/Settings.Designer.cs b/TGServerService/Properties/Settings.Designer.cs index a43d305401..2f61b72c1b 100644 --- a/TGServerService/Properties/Settings.Designer.cs +++ b/TGServerService/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace TGServerService.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -226,5 +226,17 @@ namespace TGServerService.Properties { this["ReattachCommsKey"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool Webclient { + get { + return ((bool)(this["Webclient"])); + } + set { + this["Webclient"] = value; + } + } } } diff --git a/TGServerService/Properties/Settings.settings b/TGServerService/Properties/Settings.settings index 0fa83c24e8..d28e35faa8 100644 --- a/TGServerService/Properties/Settings.settings +++ b/TGServerService/Properties/Settings.settings @@ -53,5 +53,8 @@ + + False + \ No newline at end of file diff --git a/TGServiceInterface/DreamDaemon.cs b/TGServiceInterface/DreamDaemon.cs index a9e8ab6bd7..b370551c42 100644 --- a/TGServiceInterface/DreamDaemon.cs +++ b/TGServiceInterface/DreamDaemon.cs @@ -150,6 +150,20 @@ namespace TGServiceInterface [OperationContract] void SetAutostart(bool on); + /// + /// Check if the byond webclient is currently enabled for the server + /// + /// true if the webclient is enabled, false otherwise + [OperationContract] + bool Webclient(); + + /// + /// Set the webclient config. Calls + /// + /// true to enable the byond webclient for the server, false otherwise + [OperationContract] + void SetWebclient(bool on); + /// /// Checks if a server stop has bee requested ///