From 52d517241ff992aececab8bb5a5763c32d74dbe7 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Fri, 14 Jul 2017 11:23:37 -0400 Subject: [PATCH 01/42] Removes ITGServerUpdater --- TGCommandLine/RootCommands.cs | 53 ++++++++++++++++++++++----- TGControlPanel/ServerPage.cs | 63 +++++++++++++++++++++++++++----- TGServerService/InterfaceBase.cs | 51 +------------------------- TGServerService/Repository.cs | 25 ++++++++++++- TGServiceInterface/Repository.cs | 6 +++ TGServiceInterface/Server.cs | 43 +--------------------- 6 files changed, 130 insertions(+), 111 deletions(-) diff --git a/TGCommandLine/RootCommands.cs b/TGCommandLine/RootCommands.cs index 4a4c6d1e0a..b14547c794 100644 --- a/TGCommandLine/RootCommands.cs +++ b/TGCommandLine/RootCommands.cs @@ -27,22 +27,44 @@ namespace TGCommandLine protected override ExitCode Run(IList parameters) { var gen_cl = parameters.Count > 1 && parameters[1].ToLower() == "--cl"; - TGRepoUpdateMethod method; + var Repo = Server.GetComponent(); switch (parameters[0].ToLower()) { case "hard": - method = TGRepoUpdateMethod.Hard; + var res = Repo.Update(true); + if (res != null) + { + OutputProc(res); + return ExitCode.ServerError; + } break; case "merge": - method = TGRepoUpdateMethod.Merge; + res = Repo.Update(false); + if (res != null) + { + OutputProc(res); + return ExitCode.ServerError; + } break; default: OutputProc("Please specify hard or merge"); return ExitCode.BadCommand; } - var result = Server.GetComponent().UpdateServer(method, gen_cl); - OutputProc(result ?? "Compilation started!"); - return result == null ? ExitCode.Normal : ExitCode.ServerError; + if (gen_cl) + { + var res = Repo.GenerateChangelog(out string error2); + if(res != null) + { + OutputProc(res); + return ExitCode.ServerError; + } + res = Repo.PushChangelog(); + if (res != null) + OutputProc(res); + } + var resu = Server.GetComponent().Compile(true); + OutputProc(resu ? "Compilation started!" : "Compilation could not be started!"); + return resu ? ExitCode.Normal : ExitCode.ServerError; } public override string GetArgumentString() @@ -77,9 +99,22 @@ namespace TGCommandLine OutputProc("Invalid tesmerge #: " + parameters[0]); return ExitCode.BadCommand; } - var result = Server.GetComponent().UpdateServer(TGRepoUpdateMethod.None, false, tm); - OutputProc(result ?? "Compilation started!"); - return result == null ? ExitCode.Normal : ExitCode.ServerError; + var Repo = Server.GetComponent(); + var res = Repo.MergePullRequest(tm); + if (res != null) + { + OutputProc(res); + return ExitCode.ServerError; + } + res = Repo.GenerateChangelog(out string error2); + if (res != null) + { + OutputProc(res); + return ExitCode.ServerError; + } + var resu = Server.GetComponent().Compile(true); + OutputProc(resu ? "Compilation started!" : "Compilation could not be started!"); + return resu ? ExitCode.Normal : ExitCode.ServerError; } public override string GetArgumentString() { diff --git a/TGControlPanel/ServerPage.cs b/TGControlPanel/ServerPage.cs index 97cf19924a..37ad89821d 100644 --- a/TGControlPanel/ServerPage.cs +++ b/TGControlPanel/ServerPage.cs @@ -17,7 +17,7 @@ namespace TGControlPanel } FullUpdateAction fuAction; - int testmergePR; + ushort testmergePR; string updateError; bool updatingFields = false; @@ -246,7 +246,7 @@ namespace TGControlPanel Server.GetComponent().SetPort((ushort)PortSelector.Value); } - private void RunServerUpdate(FullUpdateAction fua, int tm = 0) + private void RunServerUpdate(FullUpdateAction fua, ushort tm = 0) { if (FullUpdateWorker.IsBusy) return; @@ -373,25 +373,68 @@ namespace TGControlPanel return; Server.GetComponent().RequestRestart(); } + + private void FullUpdateWorker_DoWork(object sender, DoWorkEventArgs e) { - var Updater = Server.GetComponent(); + var Repo = Server.GetComponent(); + var DM = Server.GetComponent(); switch (fuAction) { case FullUpdateAction.Testmerge: - updateError = Updater.UpdateServer(TGRepoUpdateMethod.None, false, (ushort)testmergePR); + updateError = Repo.MergePullRequest(testmergePR); + updateError = Repo.GenerateChangelog(out string error2); + if (updateError == null) + updateError = DM.Compile(true) ? null : "Compilation failed!"; break; case FullUpdateAction.UpdateHard: - updateError = Updater.UpdateServer(TGRepoUpdateMethod.Hard, true); + updateError = Repo.Update(true); + updateError = Repo.GenerateChangelog(out error2); + if (updateError == null) + { + updateError = Repo.PushChangelog(); + error2 = DM.Compile(true) ? null : "Compilation failed!"; + if(error2 != null) + updateError = error2; + } break; case FullUpdateAction.UpdateHardTestmerge: - updateError = Updater.UpdateServer(TGRepoUpdateMethod.Hard, true, (ushort)testmergePR); + updateError = Repo.Update(true); + updateError = Repo.GenerateChangelog(out error2); + if (updateError == null) + { + updateError = Repo.PushChangelog(); + error2 = Repo.MergePullRequest(testmergePR); + if (error2 == null) + { + error2 = Repo.GenerateChangelog(out error2); + if (error2 == null) + error2 = DM.Compile(true) ? null : "Compilation failed!"; + } + updateError = error2 ?? updateError; + } break; case FullUpdateAction.UpdateMerge: - updateError = Updater.UpdateServer(TGRepoUpdateMethod.Merge, true, (ushort)testmergePR); + updateError = Repo.Update(false); + updateError = Repo.GenerateChangelog(out error2); + if (updateError == null) + { + updateError = Repo.PushChangelog(); + error2 = DM.Compile(true) ? null : "Compilation failed!"; + if (error2 != null) + updateError = error2; + } break; case FullUpdateAction.Reset: - updateError = Updater.UpdateServer(TGRepoUpdateMethod.Reset, false, 0); + updateError = Repo.Reset(true); + updateError = Repo.GenerateChangelog(out error2); + if (updateError == null) + { + updateError = Repo.PushChangelog(); + error2 = DM.Compile(true) ? null : "Compilation failed!"; + if (error2 != null) + updateError = error2; + } break; } } @@ -407,7 +450,7 @@ namespace TGControlPanel private void UpdateTestmergeButton_Click(object sender, System.EventArgs e) { - RunServerUpdate(FullUpdateAction.UpdateHardTestmerge, (int)ServerTestmergeInput.Value); + RunServerUpdate(FullUpdateAction.UpdateHardTestmerge, (ushort)ServerTestmergeInput.Value); } private void UpdateMergeButton_Click(object sender, System.EventArgs e) @@ -416,7 +459,7 @@ namespace TGControlPanel } private void TestmergeButton_Click(object sender, System.EventArgs e) { - RunServerUpdate(FullUpdateAction.Testmerge, (int)ServerTestmergeInput.Value); + RunServerUpdate(FullUpdateAction.Testmerge, (ushort)ServerTestmergeInput.Value); } private void NudgePortSelector_ValueChanged(object sender, EventArgs e) diff --git a/TGServerService/InterfaceBase.cs b/TGServerService/InterfaceBase.cs index e8ecc903ff..91d23b953c 100644 --- a/TGServerService/InterfaceBase.cs +++ b/TGServerService/InterfaceBase.cs @@ -9,7 +9,7 @@ namespace TGServerService //this line basically says make one instance of the service, use it multithreaded for requests, and never delete it [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.Single)] - partial class TGStationServer : IDisposable, ITGSService, ITGServerUpdater + partial class TGStationServer : IDisposable, ITGSService { //call partial constructors/destructors from here @@ -32,59 +32,12 @@ namespace TGServerService DisposeChat(); } + //public api public string Version() { return TGServerService.Version; } - //one stop update - public string UpdateServer(TGRepoUpdateMethod updateType, bool push_changelog_if_enabled, ushort testmerge_pr) - { - try - { - string res; - switch (updateType) - { - case TGRepoUpdateMethod.Hard: - case TGRepoUpdateMethod.Merge: - res = Update(updateType == TGRepoUpdateMethod.Hard); - if (res != null && res != RepoErrorUpToDate) - return res; - break; - case TGRepoUpdateMethod.Reset: - res = Reset(true); - if (res != null) - return res; - break; - case TGRepoUpdateMethod.None: - break; - } - - if (testmerge_pr != 0) - { - res = MergePullRequestImpl(testmerge_pr, true); - if (res != null && res != RepoErrorUpToDate) - return res; - } - - GenerateChangelog(out res); - if (res == null && push_changelog_if_enabled && SSHAuth()) - { - res = Commit(); - if (res == null) - res = Push(); - } - - if (!Compile(true)) - return "Compilation could not be started!"; - return res; - } - catch (Exception e) - { - return e.ToString(); - } - } - //public api public void VerifyConnection() { } diff --git a/TGServerService/Repository.cs b/TGServerService/Repository.cs index c5f98a172a..1ad74c8522 100644 --- a/TGServerService/Repository.cs +++ b/TGServerService/Repository.cs @@ -671,7 +671,30 @@ namespace TGServerService } } - //public api + public string PushChangelog() + { + return LocalIsRemote() ? Commit() ?? Push() : "Can't push changelog: HEAD does not match tracked remote branch"; + } + + bool LocalIsRemote() + { + lock (RepoLock) + { + if (LoadRepo() != null) + return false; + var R = Repo.Network.Remotes["origin"]; + try + { + Commands.Fetch(Repo, R.Name, R.FetchRefSpecs.Select(X => X.Specification), null, null); + return Repo.Head.IsTracking && Repo.Head.TrackedBranch.Tip.Sha == Repo.Head.Tip.Sha; + } + catch + { + return false; + } + } + } + string Commit() { lock (RepoLock) diff --git a/TGServiceInterface/Repository.cs b/TGServiceInterface/Repository.cs index f853ef1004..ac69f3bd85 100644 --- a/TGServiceInterface/Repository.cs +++ b/TGServiceInterface/Repository.cs @@ -187,6 +187,12 @@ namespace TGServiceInterface [OperationContract] string GenerateChangelog(out string error); + /// + /// Pushes the changelog to the currently git, this operation will only run if the changelog is the only difference to be pushed (i.e. no PRs merged) + /// + /// null on success, error on failure + string PushChangelog(); + /// /// Sets the path to the python 2.7 installation /// diff --git a/TGServiceInterface/Server.cs b/TGServiceInterface/Server.cs index 0a88927638..3270b8dfc5 100644 --- a/TGServiceInterface/Server.cs +++ b/TGServiceInterface/Server.cs @@ -8,7 +8,7 @@ namespace TGServiceInterface /// /// List of types that can be used with GetComponen /// - public static readonly IList ValidInterfaces = new List { typeof(ITGByond), typeof(ITGChat), typeof(ITGCompiler), typeof(ITGConfig), typeof(ITGDreamDaemon), typeof(ITGRepository), typeof(ITGServerUpdater), typeof(ITGSService) }; + public static readonly IList ValidInterfaces = new List { typeof(ITGByond), typeof(ITGChat), typeof(ITGCompiler), typeof(ITGConfig), typeof(ITGDreamDaemon), typeof(ITGRepository), typeof(ITGSService) }; /// /// Base name of the communication pipe @@ -79,45 +79,4 @@ namespace TGServiceInterface [OperationContract] string Version(); } - - /// - /// How to modify the repo during the UpdateServer operation - /// - public enum TGRepoUpdateMethod - { - /// - /// Do not update the repo - /// - None, - /// - /// Update the repo by merging the origin branch - /// - Merge, - /// - /// Update the repo by hard resetting to the remote branch - /// - Hard, - /// - /// Clean the repo by hard resetting to the origin branch - /// - Reset, - } - - /// - /// One stop shop for server updates - /// - [ServiceContract] - public interface ITGServerUpdater - { - /// - /// Updates the server fully with various options as a blocking operation - /// - /// How to handle the repository during the update - /// true if the changelog should be pushed to git - /// If not zero, will testmerge the designated pull request - /// null on success, error message on failure - [OperationContract] - string UpdateServer(TGRepoUpdateMethod updateType, bool push_changelog_if_enabled, ushort testmerge_pr = 0); - } - } From ac80fd8dc46a16295d22b3a367e352d8b9d2280e Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 18 Jul 2017 10:41:23 -0400 Subject: [PATCH 02/42] Changelog fails don't stop --- TGCommandLine/RootCommands.cs | 12 ++++++------ TGControlPanel/ServerPage.cs | 23 +++++++++++------------ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/TGCommandLine/RootCommands.cs b/TGCommandLine/RootCommands.cs index b14547c794..9569273d98 100644 --- a/TGCommandLine/RootCommands.cs +++ b/TGCommandLine/RootCommands.cs @@ -53,14 +53,14 @@ namespace TGCommandLine if (gen_cl) { var res = Repo.GenerateChangelog(out string error2); - if(res != null) - { - OutputProc(res); - return ExitCode.ServerError; - } - res = Repo.PushChangelog(); if (res != null) OutputProc(res); + else + { + res = Repo.PushChangelog(); + if (res != null) + OutputProc(res); + } } var resu = Server.GetComponent().Compile(true); OutputProc(resu ? "Compilation started!" : "Compilation could not be started!"); diff --git a/TGControlPanel/ServerPage.cs b/TGControlPanel/ServerPage.cs index 37ad89821d..4dd2efce03 100644 --- a/TGControlPanel/ServerPage.cs +++ b/TGControlPanel/ServerPage.cs @@ -383,16 +383,17 @@ namespace TGControlPanel { case FullUpdateAction.Testmerge: updateError = Repo.MergePullRequest(testmergePR); - updateError = Repo.GenerateChangelog(out string error2); if (updateError == null) - updateError = DM.Compile(true) ? null : "Compilation failed!"; + { + updateError = Repo.GenerateChangelog(out string error2); + updateError = DM.Compile(true) ? updateError : "Compilation failed!"; + } break; case FullUpdateAction.UpdateHard: updateError = Repo.Update(true); - updateError = Repo.GenerateChangelog(out error2); if (updateError == null) { - updateError = Repo.PushChangelog(); + updateError = Repo.GenerateChangelog(out string error2) ?? Repo.PushChangelog(); error2 = DM.Compile(true) ? null : "Compilation failed!"; if(error2 != null) updateError = error2; @@ -400,26 +401,25 @@ namespace TGControlPanel break; case FullUpdateAction.UpdateHardTestmerge: updateError = Repo.Update(true); - updateError = Repo.GenerateChangelog(out error2); if (updateError == null) { - updateError = Repo.PushChangelog(); + updateError = Repo.GenerateChangelog(out string error2) ?? Repo.PushChangelog(); error2 = Repo.MergePullRequest(testmergePR); if (error2 == null) { error2 = Repo.GenerateChangelog(out error2); - if (error2 == null) - error2 = DM.Compile(true) ? null : "Compilation failed!"; + error2 = DM.Compile(true) ? error2 : "Compilation failed!"; } updateError = error2 ?? updateError; } break; case FullUpdateAction.UpdateMerge: updateError = Repo.Update(false); - updateError = Repo.GenerateChangelog(out error2); if (updateError == null) { - updateError = Repo.PushChangelog(); + updateError = Repo.GenerateChangelog(out string error2); + if(updateError == null) + Repo.PushChangelog(); //not an error 99% of the time if this fails, just a dirty tree error2 = DM.Compile(true) ? null : "Compilation failed!"; if (error2 != null) updateError = error2; @@ -427,10 +427,9 @@ namespace TGControlPanel break; case FullUpdateAction.Reset: updateError = Repo.Reset(true); - updateError = Repo.GenerateChangelog(out error2); if (updateError == null) { - updateError = Repo.PushChangelog(); + updateError = Repo.GenerateChangelog(out string error2); error2 = DM.Compile(true) ? null : "Compilation failed!"; if (error2 != null) updateError = error2; From 1674273e2c921683ab08a893c282dd28ff2954cf Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 31 Jul 2017 15:53:32 -0400 Subject: [PATCH 03/42] Removes visibility configuration. Adds a world announce filed and command. --- TGCommandLine/DDCommands.cs | 72 +++++++++++----------------- TGControlPanel/Main.Designer.cs | 79 +++++++++++++++++-------------- TGControlPanel/ServerPage.cs | 20 +++++--- TGServerService/DreamDaemon.cs | 64 ++++++------------------- TGServerService/Interop.cs | 5 -- TGServiceInterface/DreamDaemon.cs | 45 ++++-------------- 6 files changed, 107 insertions(+), 178 deletions(-) diff --git a/TGCommandLine/DDCommands.cs b/TGCommandLine/DDCommands.cs index 63170b1e3d..ef41ff1ffd 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 DDVisibilityCommand(), new DDSecurityCommand() }; + Children = new Command[] { new DDStartCommand(), new DDStopCommand(), new DDRestartCommand(), new DDStatusCommand(), new DDAutostartCommand(), new DDPortCommand(), new DDSecurityCommand(), new DDWorldAnnounceCommand() }; } public override string GetHelpText() { @@ -17,6 +17,32 @@ namespace TGCommandLine } } + class DDWorldAnnounceCommand : Command + { + public DDWorldAnnounceCommand() + { + Keyword = "announce"; + RequiredParameters = 1; + } + + public override string GetHelpText() + { + return "Sends a message all players on the server"; + } + + public override string GetArgumentString() + { + return ""; + } + + protected override ExitCode Run(IList parameters) + { + var res = Server.GetComponent().WorldAnnounce(String.Join(" ", parameters)); + OutputProc(res ?? "Success!"); + return res == null ? ExitCode.Normal : ExitCode.ServerError; + } + } + class DDStartCommand : Command { public DDStartCommand() @@ -201,50 +227,6 @@ namespace TGCommandLine } } - class DDVisibilityCommand : Command - { - public DDVisibilityCommand() - { - Keyword = "set-visibility"; - RequiredParameters = 1; - } - - protected override ExitCode Run(IList parameters) - { - TGDreamDaemonVisibility vis; - switch (parameters[0].ToLower()) - { - case "invisible": - case "invis": - vis = TGDreamDaemonVisibility.Invisible; - break; - case "private": - case "priv": - vis = TGDreamDaemonVisibility.Private; - break; - case "public": - case "pub": - vis = TGDreamDaemonVisibility.Public; - break; - default: - OutputProc("Invalid visiblity word!"); - return ExitCode.BadCommand; - } - Server.GetComponent().SetVisibility(vis); - return ExitCode.Normal; - } - - public override string GetHelpText() - { - return "Sets the visibility option for the DreamDaemon world. Requires a server restart to apply and queues a graceful one up"; - } - - public override string GetArgumentString() - { - return ""; - } - } - class DDSecurityCommand : Command { public DDSecurityCommand() diff --git a/TGControlPanel/Main.Designer.cs b/TGControlPanel/Main.Designer.cs index 20c4e75974..f998e2984d 100644 --- a/TGControlPanel/Main.Designer.cs +++ b/TGControlPanel/Main.Designer.cs @@ -71,7 +71,6 @@ this.MajorVersionNumeric = new System.Windows.Forms.NumericUpDown(); this.UpdateProgressBar = new System.Windows.Forms.ProgressBar(); this.ServerPanel = new System.Windows.Forms.TabPage(); - this.VisibilitySelector = new System.Windows.Forms.ComboBox(); this.VisibilityTitle = new System.Windows.Forms.Label(); this.SecuritySelector = new System.Windows.Forms.ComboBox(); this.SecurityTitle = new System.Windows.Forms.Label(); @@ -80,7 +79,6 @@ 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(); @@ -177,6 +175,9 @@ 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(); @@ -722,7 +723,8 @@ // ServerPanel // this.ServerPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(39)))), ((int)(((byte)(40)))), ((int)(((byte)(34))))); - this.ServerPanel.Controls.Add(this.VisibilitySelector); + this.ServerPanel.Controls.Add(this.WorldAnnounceButton); + this.ServerPanel.Controls.Add(this.WorldAnnounceField); this.ServerPanel.Controls.Add(this.VisibilityTitle); this.ServerPanel.Controls.Add(this.SecuritySelector); this.ServerPanel.Controls.Add(this.SecurityTitle); @@ -762,32 +764,17 @@ this.ServerPanel.TabIndex = 2; this.ServerPanel.Text = "Server"; // - // VisibilitySelector - // - this.VisibilitySelector.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.VisibilitySelector.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.VisibilitySelector.FormattingEnabled = true; - this.VisibilitySelector.Items.AddRange(new object[] { - "Public", - "Private", - "Invisible"}); - this.VisibilitySelector.Location = new System.Drawing.Point(566, 136); - this.VisibilitySelector.Name = "VisibilitySelector"; - this.VisibilitySelector.Size = new System.Drawing.Size(121, 21); - this.VisibilitySelector.TabIndex = 40; - this.VisibilitySelector.SelectedIndexChanged += new System.EventHandler(this.VisibilitySelector_SelectedIndexChanged); - // // VisibilityTitle // this.VisibilityTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.VisibilityTitle.AutoSize = true; this.VisibilityTitle.Font = new System.Drawing.Font("Verdana", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.VisibilityTitle.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(248)))), ((int)(((byte)(248)))), ((int)(((byte)(242))))); - this.VisibilityTitle.Location = new System.Drawing.Point(474, 139); + this.VisibilityTitle.Location = new System.Drawing.Point(466, 139); this.VisibilityTitle.Name = "VisibilityTitle"; - this.VisibilityTitle.Size = new System.Drawing.Size(86, 18); + this.VisibilityTitle.Size = new System.Drawing.Size(94, 18); this.VisibilityTitle.TabIndex = 39; - this.VisibilityTitle.Text = "Visibility:"; + this.VisibilityTitle.Text = "Announce:"; this.VisibilityTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // SecuritySelector @@ -884,18 +871,6 @@ 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))); @@ -1608,7 +1583,6 @@ this.AdminModeSpecial.TabStop = true; this.AdminModeSpecial.Text = "Channel Mode"; this.AdminModeSpecial.UseVisualStyleBackColor = true; - this.AdminModeNormal.CheckedChanged += new System.EventHandler(this.AdminModeSpecial_CheckedChanged); // // AdminModeNormal // @@ -1987,6 +1961,38 @@ // 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.Enabled = false; + 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); @@ -2082,7 +2088,6 @@ private System.Windows.Forms.NumericUpDown PortSelector; private System.Windows.Forms.Label ProjectPathLabel; private System.Windows.Forms.TextBox projectNameText; - private System.Windows.Forms.Button CompileCancelButton; private System.Windows.Forms.Label ServerPathLabel; private System.Windows.Forms.TextBox ServerPathTextbox; private System.Windows.Forms.Label LatestVersionLabel; @@ -2159,7 +2164,6 @@ private System.Windows.Forms.ComboBox SecuritySelector; private System.Windows.Forms.Label SecurityTitle; private System.Windows.Forms.Label VisibilityTitle; - private System.Windows.Forms.ComboBox VisibilitySelector; private System.ComponentModel.BackgroundWorker ServerStartBGW; private System.Windows.Forms.Button RepoRefreshButton; private System.Windows.Forms.ComboBox IRCModesComboBox; @@ -2175,5 +2179,8 @@ private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button WorldAnnounceButton; + private System.Windows.Forms.TextBox WorldAnnounceField; + private System.Windows.Forms.Button CompileCancelButton; } } diff --git a/TGControlPanel/ServerPage.cs b/TGControlPanel/ServerPage.cs index 97cf19924a..afa83ac31a 100644 --- a/TGControlPanel/ServerPage.cs +++ b/TGControlPanel/ServerPage.cs @@ -125,6 +125,8 @@ namespace TGControlPanel UpdateMergeButton.Visible = RepoExists; UpdateTestmergeButton.Visible = RepoExists; ResetTestmerge.Visible = RepoExists; + WorldAnnounceField.Visible = RepoExists; + WorldAnnounceButton.Visible = RepoExists; var DM = Server.GetComponent(); var DD = Server.GetComponent(); @@ -137,8 +139,7 @@ namespace TGControlPanel if (!ServerPathTextbox.Focused) ServerPathTextbox.Text = Config.ServerDirectory(); - - VisibilitySelector.SelectedIndex = (int)DD.VisibilityLevel(); + SecuritySelector.SelectedIndex = (int)DD.SecurityLevel(); if (!RepoExists) @@ -432,11 +433,18 @@ namespace TGControlPanel MessageBox.Show("Security change will be applied after next server reboot."); } - private void VisibilitySelector_SelectedIndexChanged(object sender, EventArgs e) + private void WorldAnnounceButton_Click(object sender, EventArgs e) { - if (!updatingFields) - if (!Server.GetComponent().SetVisibility((TGDreamDaemonVisibility)VisibilitySelector.SelectedIndex)) - MessageBox.Show("Visibility change will be applied after next server reboot."); + var msg = WorldAnnounceField.Text; + if (!String.IsNullOrWhiteSpace(msg)) { + var res = Server.GetComponent().WorldAnnounce(msg); + if(res != null) + { + MessageBox.Show(res); + return; + } + } + WorldAnnounceField.Text = ""; } } } diff --git a/TGServerService/DreamDaemon.cs b/TGServerService/DreamDaemon.cs index d523a3548b..9cdca9f1eb 100644 --- a/TGServerService/DreamDaemon.cs +++ b/TGServerService/DreamDaemon.cs @@ -31,7 +31,6 @@ namespace TGServerService bool RestartInProgress = false; TGDreamDaemonSecurity StartingSecurity; - TGDreamDaemonVisibility StartingVisiblity; ShutdownRequestPhase AwaitingShutdown; @@ -364,23 +363,6 @@ namespace TGServerService } } - //same thing with visibility - string VisibilityWord(bool starting = false) - { - var level = starting ? StartingVisiblity : (TGDreamDaemonVisibility)Properties.Settings.Default.ServerVisiblity; - switch (level) - { - case TGDreamDaemonVisibility.Invisible: - return "invisible"; - case TGDreamDaemonVisibility.Private: - return "private"; - case TGDreamDaemonVisibility.Public: - return "public"; - default: - throw new Exception(String.Format("Bad DreamDaemon visibility level: {0}", level)); - } - } - //used by Start and Watchdog to start a DD instance string StartImpl(bool watchdog) { @@ -394,11 +376,9 @@ namespace TGServerService var Config = Properties.Settings.Default; var DMB = GameDirLive + "/" + Config.ProjectName + ".dmb"; - - GenCommsKey(); - StartingVisiblity = (TGDreamDaemonVisibility)Config.ServerVisiblity; + StartingSecurity = (TGDreamDaemonSecurity)Config.ServerSecurity; - Proc.StartInfo.Arguments = String.Format("{0} -port {1} -close -verbose -params server_service={4} -{2} -{3}", DMB, Config.ServerPort, SecurityWord(), VisibilityWord(), serviceCommsKey); + Proc.StartInfo.Arguments = String.Format("{0} -port {1} -close -verbose -params server_service={3} -{2} -public", DMB, Config.ServerPort, SecurityWord(), serviceCommsKey); InitInterop(); Proc.Start(); @@ -429,31 +409,6 @@ namespace TGServerService } } - //public api - public TGDreamDaemonVisibility VisibilityLevel() - { - lock (watchdogLock) - { - return (TGDreamDaemonVisibility)Properties.Settings.Default.ServerVisiblity; - } - } - - //public api - public bool SetVisibility(TGDreamDaemonVisibility NewVis) - { - var Config = Properties.Settings.Default; - var visInt = (int)NewVis; - bool needReboot; - lock (watchdogLock) - { - needReboot = Config.ServerVisiblity != visInt; - Config.ServerVisiblity = visInt; - } - if (needReboot) - RequestRestart(); - return DaemonStatus() != TGDreamDaemonStatus.Online; - } - //public api public TGDreamDaemonSecurity SecurityLevel() { @@ -494,7 +449,7 @@ namespace TGServerService //public api public string StatusString(bool includeMetaInfo) { - const string visSecStr = " (Vis: {0}, Sec: {1})"; + const string visSecStr = " (Sec: {1})"; string res; var ds = DaemonStatus(); switch (ds) @@ -512,7 +467,7 @@ namespace TGServerService string secandvis; lock (watchdogLock) { - secandvis = String.Format(visSecStr, VisibilityWord(true), SecurityWord(true)); + secandvis = String.Format(visSecStr, SecurityWord(true)); } res += secandvis; } @@ -522,7 +477,7 @@ namespace TGServerService break; } if (includeMetaInfo && ds != TGDreamDaemonStatus.Online) - res += String.Format(visSecStr, VisibilityWord(), SecurityWord()); + res += String.Format(visSecStr, SecurityWord()); return res; } @@ -540,5 +495,14 @@ namespace TGServerService return AwaitingShutdown != ShutdownRequestPhase.None; } } + + /// + public string WorldAnnounce(string message) + { + var res = SendCommand(SCWorldAnnounce + ";message=" + message); + if (res == "SUCCESS") + return null; + return res; + } } } diff --git a/TGServerService/Interop.cs b/TGServerService/Interop.cs index e9a2b943ba..6d0652b7ec 100644 --- a/TGServerService/Interop.cs +++ b/TGServerService/Interop.cs @@ -77,11 +77,6 @@ namespace TGServerService } } - bool WorldAnnounce(string message) - { - return SendCommand(SCWorldAnnounce + ";message=" + message) == "SUCCESS" ; - } - public string SendPM(string targetCkey, string sender, string message) { return SendCommand(String.Format("{3};target={0};sender={1};message={2}", targetCkey, sender, message, SCAdminPM)); diff --git a/TGServiceInterface/DreamDaemon.cs b/TGServiceInterface/DreamDaemon.cs index 1d52ca5b41..a9e8ab6bd7 100644 --- a/TGServiceInterface/DreamDaemon.cs +++ b/TGServiceInterface/DreamDaemon.cs @@ -39,26 +39,7 @@ namespace TGServiceInterface /// Ultrasafe } - - /// - /// DreamDaemon's hub visibility - /// - public enum TGDreamDaemonVisibility - { - /// - /// Server will be visible on the hub - /// - Public, - /// - /// Server will not be visible on the hub to anyone but the host's friends. Since the service does not have a BYOND account, this is effectively the same as Invisible - /// - Private, - /// - /// Server will not be visible on the hub - /// - Invisible = 2, //default config - } - + /// /// Interface for managing the actual BYOND game server /// @@ -140,22 +121,6 @@ namespace TGServiceInterface [OperationContract] bool SetSecurityLevel(TGDreamDaemonSecurity level); - /// - /// Get the configured (not running) visibility level - /// - /// The configured (not running) visibility level - [OperationContract] - TGDreamDaemonVisibility VisibilityLevel(); - - /// - /// Sets the visiblity level of the server. Requires reboot to apply - /// Implies a call to RequestRestart() - /// - /// The new visibility level - /// True if the change was immediately applied, false if a graceful restart was queued - [OperationContract] - bool SetVisibility(TGDreamDaemonVisibility vis); - /// /// Get the configured port. Not necessarily the running port if it has since changed /// @@ -191,5 +156,13 @@ namespace TGServiceInterface /// true if RequestStop has been called since the last server start, false otherwise [OperationContract] bool ShutdownInProgress(); + + /// + /// Sends a message to everyone on the server + /// + /// The message to send + /// null on success, error message on failure + [OperationContract] + string WorldAnnounce(string msg); } } From 83ca8ad9eb01649148f467ca982c9026eb17a43f Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 31 Jul 2017 15:56:12 -0400 Subject: [PATCH 04/42] Actually remove the setting --- TGServerService/App.config | 3 --- TGServerService/Properties/Settings.Designer.cs | 12 ------------ TGServerService/Properties/Settings.settings | 3 --- 3 files changed, 18 deletions(-) diff --git a/TGServerService/App.config b/TGServerService/App.config index 8e565d7e93..603b9d8c0a 100644 --- a/TGServerService/App.config +++ b/TGServerService/App.config @@ -31,9 +31,6 @@ 0 - - 2 - False diff --git a/TGServerService/Properties/Settings.Designer.cs b/TGServerService/Properties/Settings.Designer.cs index e0397af473..a43d305401 100644 --- a/TGServerService/Properties/Settings.Designer.cs +++ b/TGServerService/Properties/Settings.Designer.cs @@ -107,18 +107,6 @@ namespace TGServerService.Properties { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("2")] - public int ServerVisiblity { - get { - return ((int)(this["ServerVisiblity"])); - } - set { - this["ServerVisiblity"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] diff --git a/TGServerService/Properties/Settings.settings b/TGServerService/Properties/Settings.settings index 803cc28afe..0fa83c24e8 100644 --- a/TGServerService/Properties/Settings.settings +++ b/TGServerService/Properties/Settings.settings @@ -23,9 +23,6 @@ 0 - - 2 - False From f6ed40c8bbbd73db45460edaff2a7a356ceda4b7 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Wed, 16 Aug 2017 14:15:43 -0400 Subject: [PATCH 05/42] Version bump to 3.0.90.0 [TGSDeploy] --- Version.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Version.cs b/Version.cs index 036fc15399..4408fca292 100644 --- a/Version.cs +++ b/Version.cs @@ -12,6 +12,6 @@ using System.Reflection; // [assembly: AssemblyVersion("1.0.*")] //It's impossible to make these a define, don't say I didn't warn you -[assembly: AssemblyVersion("3.0.89.0")] -[assembly: AssemblyFileVersion("3.0.89.0")] -[assembly: AssemblyInformationalVersion("3.0.89.0")] +[assembly: AssemblyVersion("3.0.90.0")] +[assembly: AssemblyFileVersion("3.0.90.0")] +[assembly: AssemblyInformationalVersion("3.0.90.0")] From 6420cf70776c94ad3c993e2e8c209d94181242d9 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 16 Aug 2017 14:45:07 -0400 Subject: [PATCH 06/42] Fixes output of generate changelog being sent to user --- TGCommandLine/RootCommands.cs | 4 ++-- TGControlPanel/ServerPage.cs | 39 ++++++++++++++++------------------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/TGCommandLine/RootCommands.cs b/TGCommandLine/RootCommands.cs index 9569273d98..88ebf4973b 100644 --- a/TGCommandLine/RootCommands.cs +++ b/TGCommandLine/RootCommands.cs @@ -52,7 +52,7 @@ namespace TGCommandLine } if (gen_cl) { - var res = Repo.GenerateChangelog(out string error2); + Repo.GenerateChangelog(out string res); if (res != null) OutputProc(res); else @@ -106,7 +106,7 @@ namespace TGCommandLine OutputProc(res); return ExitCode.ServerError; } - res = Repo.GenerateChangelog(out string error2); + Repo.GenerateChangelog(out res); if (res != null) { OutputProc(res); diff --git a/TGControlPanel/ServerPage.cs b/TGControlPanel/ServerPage.cs index 53bdaa87a6..44a0c516ee 100644 --- a/TGControlPanel/ServerPage.cs +++ b/TGControlPanel/ServerPage.cs @@ -386,7 +386,7 @@ namespace TGControlPanel updateError = Repo.MergePullRequest(testmergePR); if (updateError == null) { - updateError = Repo.GenerateChangelog(out string error2); + Repo.GenerateChangelog(out updateError); updateError = DM.Compile(true) ? updateError : "Compilation failed!"; } break; @@ -394,46 +394,43 @@ namespace TGControlPanel updateError = Repo.Update(true); if (updateError == null) { - updateError = Repo.GenerateChangelog(out string error2) ?? Repo.PushChangelog(); - error2 = DM.Compile(true) ? null : "Compilation failed!"; - if(error2 != null) - updateError = error2; + Repo.GenerateChangelog(out updateError); + if(updateError == null) + updateError = Repo.PushChangelog(); + updateError = DM.Compile(true) ? updateError : "Compilation failed!"; } break; case FullUpdateAction.UpdateHardTestmerge: updateError = Repo.Update(true); if (updateError == null) { - updateError = Repo.GenerateChangelog(out string error2) ?? Repo.PushChangelog(); - error2 = Repo.MergePullRequest(testmergePR); - if (error2 == null) + Repo.GenerateChangelog(out updateError); + if (updateError == null) + updateError = Repo.PushChangelog(); + updateError = Repo.MergePullRequest(testmergePR); + if (updateError == null) { - error2 = Repo.GenerateChangelog(out error2); - error2 = DM.Compile(true) ? error2 : "Compilation failed!"; + Repo.GenerateChangelog(out updateError); + updateError = DM.Compile(true) ? updateError : "Compilation failed!"; } - updateError = error2 ?? updateError; } break; case FullUpdateAction.UpdateMerge: updateError = Repo.Update(false); if (updateError == null) { - updateError = Repo.GenerateChangelog(out string error2); - if(updateError == null) - Repo.PushChangelog(); //not an error 99% of the time if this fails, just a dirty tree - error2 = DM.Compile(true) ? null : "Compilation failed!"; - if (error2 != null) - updateError = error2; + Repo.GenerateChangelog(out updateError); + if (updateError == null) + Repo.PushChangelog(); //not an error 99% of the time if this fails, just a dirty tree + updateError = DM.Compile(true) ? updateError : "Compilation failed!"; } break; case FullUpdateAction.Reset: updateError = Repo.Reset(true); if (updateError == null) { - updateError = Repo.GenerateChangelog(out string error2); - error2 = DM.Compile(true) ? null : "Compilation failed!"; - if (error2 != null) - updateError = error2; + Repo.GenerateChangelog(out updateError); + updateError = DM.Compile(true) ? updateError : "Compilation failed!"; } break; } From b7e1f7568d548526b3b5fa46100526c243e67dd5 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 16 Aug 2017 14:50:18 -0400 Subject: [PATCH 07/42] Fixed world announce buton being disabled --- TGControlPanel/Main.Designer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/TGControlPanel/Main.Designer.cs b/TGControlPanel/Main.Designer.cs index f998e2984d..73e37e9903 100644 --- a/TGControlPanel/Main.Designer.cs +++ b/TGControlPanel/Main.Designer.cs @@ -1984,7 +1984,6 @@ // WorldAnnounceButton // this.WorldAnnounceButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.WorldAnnounceButton.Enabled = false; this.WorldAnnounceButton.Location = new System.Drawing.Point(785, 136); this.WorldAnnounceButton.Name = "WorldAnnounceButton"; this.WorldAnnounceButton.Size = new System.Drawing.Size(77, 20); From c1b712dd4910912695c2cc1f04c0d8cda513a653 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 16 Aug 2017 14:55:42 -0400 Subject: [PATCH 08/42] Fixes StatusString() --- TGServerService/DreamDaemon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TGServerService/DreamDaemon.cs b/TGServerService/DreamDaemon.cs index 9cdca9f1eb..1b09867fdd 100644 --- a/TGServerService/DreamDaemon.cs +++ b/TGServerService/DreamDaemon.cs @@ -449,7 +449,7 @@ namespace TGServerService //public api public string StatusString(bool includeMetaInfo) { - const string visSecStr = " (Sec: {1})"; + const string visSecStr = " (Sec: {0})"; string res; var ds = DaemonStatus(); switch (ds) From c0e9a01d1faf81f09e3beebe56c322271305832a Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 16 Aug 2017 15:05:39 -0400 Subject: [PATCH 09/42] Readds the missing call to GenCommsKey() --- TGServerService/DreamDaemon.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TGServerService/DreamDaemon.cs b/TGServerService/DreamDaemon.cs index 1b09867fdd..e70e33953f 100644 --- a/TGServerService/DreamDaemon.cs +++ b/TGServerService/DreamDaemon.cs @@ -376,7 +376,8 @@ namespace TGServerService var Config = Properties.Settings.Default; var DMB = GameDirLive + "/" + Config.ProjectName + ".dmb"; - + + GenCommsKey(); StartingSecurity = (TGDreamDaemonSecurity)Config.ServerSecurity; Proc.StartInfo.Arguments = String.Format("{0} -port {1} -close -verbose -params server_service={3} -{2} -public", DMB, Config.ServerPort, SecurityWord(), serviceCommsKey); InitInterop(); From abc0881ea2a0576f2841ecb8240ab8a2a8356cdb Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 16 Aug 2017 15:06:12 -0400 Subject: [PATCH 10/42] Version bump to 3.0.90.1 [TGSDeploy] --- Version.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Version.cs b/Version.cs index 4408fca292..4a77ac0d5a 100644 --- a/Version.cs +++ b/Version.cs @@ -12,6 +12,6 @@ using System.Reflection; // [assembly: AssemblyVersion("1.0.*")] //It's impossible to make these a define, don't say I didn't warn you -[assembly: AssemblyVersion("3.0.90.0")] -[assembly: AssemblyFileVersion("3.0.90.0")] -[assembly: AssemblyInformationalVersion("3.0.90.0")] +[assembly: AssemblyVersion("3.0.90.1")] +[assembly: AssemblyFileVersion("3.0.90.1")] +[assembly: AssemblyInformationalVersion("3.0.90.1")] From 010f172cdf2533b9a20d1f5f4d881f22c1b9eecb Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Sat, 26 Aug 2017 13:13:29 -0400 Subject: [PATCH 11/42] Fix error message if no ssh keys are present --- TGServerService/Repository.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TGServerService/Repository.cs b/TGServerService/Repository.cs index 1ad74c8522..e30759d1d3 100644 --- a/TGServerService/Repository.cs +++ b/TGServerService/Repository.cs @@ -673,6 +673,8 @@ namespace TGServerService public string PushChangelog() { + if (!SSHAuth()) + return null; return LocalIsRemote() ? Commit() ?? Push() : "Can't push changelog: HEAD does not match tracked remote branch"; } From ad6befbe088a0ae6ecd3da7213d53a7fb19b28db Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Sat, 26 Aug 2017 13:17:07 -0400 Subject: [PATCH 12/42] Fixes PushChangelog() crashing --- TGServiceInterface/Repository.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/TGServiceInterface/Repository.cs b/TGServiceInterface/Repository.cs index ac69f3bd85..2e37dfc627 100644 --- a/TGServiceInterface/Repository.cs +++ b/TGServiceInterface/Repository.cs @@ -187,11 +187,12 @@ namespace TGServiceInterface [OperationContract] string GenerateChangelog(out string error); - /// - /// Pushes the changelog to the currently git, this operation will only run if the changelog is the only difference to be pushed (i.e. no PRs merged) - /// - /// null on success, error on failure - string PushChangelog(); + /// + /// Pushes the changelog to the currently git, this operation will only run if the changelog is the only difference to be pushed (i.e. no PRs merged) + /// + /// null on success, error on failure + [OperationContract] + string PushChangelog(); /// /// Sets the path to the python 2.7 installation From f920c65eed1c849f61069b82ba8938a4e8f5746d Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Sat, 26 Aug 2017 13:21:30 -0400 Subject: [PATCH 13/42] Version bump to 3.0.90.2 [TGSDeploy] --- Version.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Version.cs b/Version.cs index 4a77ac0d5a..2fdd65b7fb 100644 --- a/Version.cs +++ b/Version.cs @@ -12,6 +12,6 @@ using System.Reflection; // [assembly: AssemblyVersion("1.0.*")] //It's impossible to make these a define, don't say I didn't warn you -[assembly: AssemblyVersion("3.0.90.1")] -[assembly: AssemblyFileVersion("3.0.90.1")] -[assembly: AssemblyInformationalVersion("3.0.90.1")] +[assembly: AssemblyVersion("3.0.90.2")] +[assembly: AssemblyFileVersion("3.0.90.2")] +[assembly: AssemblyInformationalVersion("3.0.90.2")] From b0a1045f74f5205fd99f4ba47749b64d4bafa6e1 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sat, 26 Aug 2017 13:39:53 -0400 Subject: [PATCH 14/42] Prompts to kill running interfaces are now shown at the beginning of installation --- TGInstallerWrapper/Main.cs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/TGInstallerWrapper/Main.cs b/TGInstallerWrapper/Main.cs index 09f1b8243b..0372aa7204 100644 --- a/TGInstallerWrapper/Main.cs +++ b/TGInstallerWrapper/Main.cs @@ -68,6 +68,21 @@ namespace TGInstallerWrapper string logfile = null; try { + while (true) + { + var res = PromptKillProcess("TGCommandLine"); + if (res == PKillType.Aborted) + return; + else if (res == PKillType.Killed) + continue; + res = PromptKillProcess("TGControlPanel"); + if (res == PKillType.Aborted) + return; + else if (res == PKillType.Killed) + continue; + break; + } + var args = new List(); if (!pathIsDefault) args.Add(String.Format("INSTALLFOLDER=\"{0}\"", PathTextBox.Text)); @@ -114,21 +129,6 @@ namespace TGInstallerWrapper } } - while (true) - { - var res = PromptKillProcess("TGCommandLine"); - if (res == PKillType.Aborted) - return; - else if (res == PKillType.Killed) - continue; - res = PromptKillProcess("TGControlPanel"); - if (res == PKillType.Aborted) - return; - else if (res == PKillType.Killed) - continue; - break; - } - InstallCancelButton.Enabled = true; if (ShowLogCheckbox.Checked) From dc13315cc17a33dedf30046b06ccfbc4026470e1 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 28 Aug 2017 09:21:13 -0400 Subject: [PATCH 15/42] PR test json is copied to live folder at the time of compile --- TGServerService/Compiler.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/TGServerService/Compiler.cs b/TGServerService/Compiler.cs index 631a7e12a4..80b67a7f2c 100644 --- a/TGServerService/Compiler.cs +++ b/TGServerService/Compiler.cs @@ -345,6 +345,11 @@ namespace TGServerService //just the tip const string GitLogsDir = "/.git/logs"; Program.CopyDirectory(RepoPath + GitLogsDir, resurrectee + GitLogsDir); + try + { + File.Copy(PRJobFile, resurrectee + Path.DirectorySeparatorChar + PRJobFile); + } + catch { } } finally { From 7dc5012ea6c4022364ede5b9091c5c068a917883 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 28 Aug 2017 11:48:21 -0400 Subject: [PATCH 16/42] Service version is now passed to DD --- TGServerService/DreamDaemon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TGServerService/DreamDaemon.cs b/TGServerService/DreamDaemon.cs index e70e33953f..f576fdfc77 100644 --- a/TGServerService/DreamDaemon.cs +++ b/TGServerService/DreamDaemon.cs @@ -379,7 +379,7 @@ namespace TGServerService GenCommsKey(); StartingSecurity = (TGDreamDaemonSecurity)Config.ServerSecurity; - Proc.StartInfo.Arguments = String.Format("{0} -port {1} -close -verbose -params server_service={3} -{2} -public", DMB, Config.ServerPort, SecurityWord(), serviceCommsKey); + 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()); InitInterop(); Proc.Start(); From 80ff0f885f99602a2adb36a656589071fb21f5e7 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 28 Aug 2017 11:54:39 -0400 Subject: [PATCH 17/42] Service now requests DD to restart when upgraded --- TGServerService/DreamDaemon.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/TGServerService/DreamDaemon.cs b/TGServerService/DreamDaemon.cs index e70e33953f..7fe807d91a 100644 --- a/TGServerService/DreamDaemon.cs +++ b/TGServerService/DreamDaemon.cs @@ -56,6 +56,7 @@ namespace TGServerService currentStatus = TGDreamDaemonStatus.Online; DDWatchdog = new Thread(new ThreadStart(Watchdog)); DDWatchdog.Start(); + RequestRestart(); //TODO: Remove this when DD -> Service communication is more } catch (Exception e) { From de974efdb560e6dc287833c8b783873f5bc93e30 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Thu, 31 Aug 2017 14:41:30 -0400 Subject: [PATCH 18/42] Removes relay restart --- TGServerService/ChatCommands.cs | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/TGServerService/ChatCommands.cs b/TGServerService/ChatCommands.cs index 9ca1d13831..d60581d1e5 100644 --- a/TGServerService/ChatCommands.cs +++ b/TGServerService/ChatCommands.cs @@ -41,7 +41,7 @@ namespace TGServerService public RootChatCommand() { PrintHelpList = true; - Children = new Command[] { new CheckCommand(), new StatusCommand(), new PRsCommand(), new VersionCommand(), new AHelpCommand(), new NameCheckCommand(), new RevisionCommand(), new AdminWhoCommand(), new ByondCommand(), new KekCommand(), new RelayRestartCommand() }; + Children = new Command[] { new CheckCommand(), new StatusCommand(), new PRsCommand(), new VersionCommand(), new AHelpCommand(), new NameCheckCommand(), new RevisionCommand(), new AdminWhoCommand(), new ByondCommand(), new KekCommand() }; } } class RevisionCommand : ChatCommand @@ -262,22 +262,4 @@ namespace TGServerService return " |list>>"; } } - class RelayRestartCommand : ChatCommand - { - public RelayRestartCommand() - { - Keyword = "relayrestart"; - RequiresAdmin = true; - } - protected override ExitCode Run(IList parameters) - { - Instance.InitInterop(); - return ExitCode.Normal; - } - - public override string GetHelpText() - { - return "Restart the relay listener. This is a massive hack but it'll do for now"; - } - } } From 54ea32f8a6791c8353ac22f208d9894fbf24b15e Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Fri, 1 Sep 2017 14:43:52 -0400 Subject: [PATCH 19/42] Updates the error message and calls RequestRestart() to handle it --- TGServerService/Interop.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TGServerService/Interop.cs b/TGServerService/Interop.cs index 6d0652b7ec..8dec4f1df1 100644 --- a/TGServerService/Interop.cs +++ b/TGServerService/Interop.cs @@ -243,7 +243,8 @@ namespace TGServerService catch (Exception e) { TGServerService.WriteError("Nudge handler thread crashed: " + e.ToString(), TGServerService.EventID.NudgeCrash); - SendMessage("SERVICE: The relay handler crashed, use relayrestart to restore it! Error: " + e.Message, ChatMessageType.AdminInfo); + SendMessage("SERVICE: The relay handler crashed, I will attempt to restore it when the server reboots! Error: " + e.Message, ChatMessageType.AdminInfo); + RequestRestart(); } } } From 71178d0851b6ee929ec4e9403a693b7f7d9fbd1e Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Fri, 1 Sep 2017 19:39:17 -0400 Subject: [PATCH 20/42] Implement server chat commands --- TGServerService/Chat.cs | 4 +- TGServerService/ChatCommands.cs | 145 ++++++++------------------------ TGServerService/DreamDaemon.cs | 2 +- TGServerService/Interop.cs | 37 ++++---- 4 files changed, 58 insertions(+), 130 deletions(-) diff --git a/TGServerService/Chat.cs b/TGServerService/Chat.cs index 7d3ab39b8b..cafc390697 100644 --- a/TGServerService/Chat.cs +++ b/TGServerService/Chat.cs @@ -147,7 +147,9 @@ namespace TGServerService Server = this, }; TGServerService.WriteInfo(String.Format("Chat Command from {0} ({2}): {1}", speaker, String.Join(" ", asList), channel), TGServerService.EventID.ChatCommand); - new RootChatCommand().DoRun(asList); + if (ServerChatCommands == null) + LoadServerChatCommands(); + new RootChatCommand(ServerChatCommands).DoRun(asList); } //cleanup and save diff --git a/TGServerService/ChatCommands.cs b/TGServerService/ChatCommands.cs index d60581d1e5..3ea26883d3 100644 --- a/TGServerService/ChatCommands.cs +++ b/TGServerService/ChatCommands.cs @@ -1,7 +1,7 @@ using TGServiceInterface; -using System.Threading; -using System.Collections.Generic; using System; +using System.Collections.Generic; +using System.Threading; namespace TGServerService { @@ -36,12 +36,40 @@ namespace TGServerService return base.DoRun(parameters); } } + + class ServerChatCommand : ChatCommand + { + readonly string HelpText; + public ServerChatCommand(string name, string helpText, bool adminOnly) + { + Keyword = name; + RequiresAdmin = adminOnly; + HelpText = helpText; + } + + public override string GetHelpText() + { + return HelpText; + } + + protected override ExitCode Run(IList parameters) + { + var res = Instance.SendCommand(String.Format("{0} {1}", Keyword, String.Join(" ", parameters))); + if (res != "SUCESS" && !String.IsNullOrWhiteSpace(res)) + OutputProc(res); + return ExitCode.Normal; + } + } + class RootChatCommand : RootCommand { - public RootChatCommand() + public RootChatCommand(List serverCommands) { + if (serverCommands == null) + serverCommands = new List(); PrintHelpList = true; - Children = new Command[] { new CheckCommand(), new StatusCommand(), new PRsCommand(), new VersionCommand(), new AHelpCommand(), new NameCheckCommand(), new RevisionCommand(), new AdminWhoCommand(), new ByondCommand(), new KekCommand() }; + serverCommands.AddRange(new Command[] { new PRsCommand(), new VersionCommand(), new RevisionCommand(), new ByondCommand(), new KekCommand() }); + Children = serverCommands.ToArray(); } } class RevisionCommand : ChatCommand @@ -61,51 +89,6 @@ namespace TGServerService return "Returns mob info of the specified target"; } } - class NameCheckCommand : ChatCommand - { - public NameCheckCommand() - { - Keyword = "namecheck"; - RequiredParameters = 1; - RequiresAdmin = true; - } - protected override ExitCode Run(IList parameters) - { - OutputProc(Instance.NameCheck(parameters[0], CommandInfo.Value.Speaker)); - return ExitCode.Normal; - } - - public override string GetHelpText() - { - return "Returns mob info of the specified target"; - } - public override string GetArgumentString() - { - return ""; - } - } - class AdminWhoCommand : ChatCommand - { - public AdminWhoCommand() - { - Keyword = "adminwho"; - RequiresAdmin = true; - } - protected override ExitCode Run(IList parameters) - { - OutputProc(Instance.SendCommand(TGStationServer.SCAdminWho)); - return ExitCode.Normal; - } - - public override string GetHelpText() - { - return "Returns mob info of the specified target"; - } - public override string GetArgumentString() - { - return ""; - } - } class ByondCommand : ChatCommand { @@ -134,42 +117,6 @@ namespace TGServerService return "[--staged|--latest]"; } } - class CheckCommand : ChatCommand - { - public CheckCommand() - { - Keyword = "check"; - } - protected override ExitCode Run(IList parameters) - { - OutputProc(Instance.StatusString(CommandInfo.Value.IsAdmin && CommandInfo.Value.IsAdminChannel)); - return ExitCode.Normal; - } - - public override string GetHelpText() - { - return "Gets the playercount, gamemode, and address of the server"; - } - } - - class StatusCommand : ChatCommand - { - public StatusCommand() - { - Keyword = "status"; - RequiresAdmin = true; - } - protected override ExitCode Run(IList parameters) - { - OutputProc(Instance.SendCommand(TGStationServer.SCIRCStatus)); - return ExitCode.Normal; - } - - public override string GetHelpText() - { - return "Gets the admincount, playercount, gamemode, and true game mode of the server"; - } - } class VersionCommand : ChatCommand { public VersionCommand() @@ -235,31 +182,5 @@ namespace TGServerService return "Gets the currently merged pull requests in the repository"; } } - - class AHelpCommand : ChatCommand - { - public AHelpCommand() - { - Keyword = "ahelp"; - RequiresAdmin = true; - RequiredParameters = 2; - } - protected override ExitCode Run(IList parameters) - { - var ckey = parameters[0]; - parameters.RemoveAt(0); - OutputProc(Instance.SendPM(ckey, CommandInfo.Value.Speaker, String.Join(" ", parameters))); - return ExitCode.Normal; - } - - public override string GetHelpText() - { - return "Respond to a relayed admin help request"; - } - - public override string GetArgumentString() - { - return " |list>>"; - } - } + } diff --git a/TGServerService/DreamDaemon.cs b/TGServerService/DreamDaemon.cs index 4d05e5a9a9..696125a7d3 100644 --- a/TGServerService/DreamDaemon.cs +++ b/TGServerService/DreamDaemon.cs @@ -463,7 +463,7 @@ namespace TGServerService res = "REBOOTING"; break; case TGDreamDaemonStatus.Online: - res = SendCommand(SCIRCCheck); + res = "ONLINE"; if (includeMetaInfo) { string secandvis; diff --git a/TGServerService/Interop.cs b/TGServerService/Interop.cs index 8dec4f1df1..072d6aebda 100644 --- a/TGServerService/Interop.cs +++ b/TGServerService/Interop.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Net; using System.Net.Sockets; using System.Text; using System.Threading; +using System.Web.Script.Serialization; using System.Web.Security; using TGServiceInterface; @@ -24,17 +24,32 @@ namespace TGServerService const string SCHardReboot = "hard_reboot"; //requests that dreamdaemon restarts when the round ends const string SCGracefulShutdown = "graceful_shutdown"; //requests that dreamdaemon stops when the round ends const string SCWorldAnnounce = "world_announce"; //sends param 'message' to the world - public const string SCIRCCheck = "irc_check"; //returns game stats - public const string SCIRCStatus = "irc_status"; //returns admin stats - public const string SCNameCheck = "namecheck"; //returns keywords lookup - const string SCAdminPM = "adminmsg"; //pms a target ckey - public const string SCAdminWho = "adminwho"; //lists admins + const string SCListCustomCommands = "list_custom_commands"; //Get a list of commands supported by the server const string SRKillProcess = "killme"; const string SRIRCBroadcast = "irc"; const string SRIRCAdminChannelMessage = "send2irc"; const string SRWorldReboot = "worldreboot"; + List ServerChatCommands; + + void LoadServerChatCommands() + { + if (DaemonStatus() != TGDreamDaemonStatus.Online) + return; + var json = SendCommand(SCListCustomCommands); + if (String.IsNullOrWhiteSpace(json)) + return; + List tmp = new List(); + try + { + foreach(var I in new JavaScriptSerializer().Deserialize>>(json)) + tmp.Add(new ServerChatCommand(I.Key, (string)I.Value["help_text"], (bool)I.Value["adminOnly"])); + ServerChatCommands = tmp; + } + catch { } + } + //raw command string sent here via world.ExportService void HandleCommand(string cmd) { @@ -77,16 +92,6 @@ namespace TGServerService } } - public string SendPM(string targetCkey, string sender, string message) - { - return SendCommand(String.Format("{3};target={0};sender={1};message={2}", targetCkey, sender, message, SCAdminPM)); - } - - public string NameCheck(string targetCkey, string sender) - { - return SendCommand(String.Format("{2};target={0};sender={1}", targetCkey, sender, SCNameCheck)); - } - //Fuckery to diddle byond with the right packet to accept our girth string SendTopic(string topicdata, ushort port) { From f8a0f73e4428e68b0a17ed9b4e952c1511c5ca18 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Fri, 1 Sep 2017 19:46:15 -0400 Subject: [PATCH 21/42] Required parameters --- TGServerService/ChatCommands.cs | 3 ++- TGServerService/Interop.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/TGServerService/ChatCommands.cs b/TGServerService/ChatCommands.cs index 3ea26883d3..f0a8d42ec6 100644 --- a/TGServerService/ChatCommands.cs +++ b/TGServerService/ChatCommands.cs @@ -40,11 +40,12 @@ namespace TGServerService class ServerChatCommand : ChatCommand { readonly string HelpText; - public ServerChatCommand(string name, string helpText, bool adminOnly) + public ServerChatCommand(string name, string helpText, bool adminOnly, int requiredParameters) { Keyword = name; RequiresAdmin = adminOnly; HelpText = helpText; + RequiredParameters = requiredParameters; } public override string GetHelpText() diff --git a/TGServerService/Interop.cs b/TGServerService/Interop.cs index 072d6aebda..48b2d7953a 100644 --- a/TGServerService/Interop.cs +++ b/TGServerService/Interop.cs @@ -44,7 +44,7 @@ namespace TGServerService try { foreach(var I in new JavaScriptSerializer().Deserialize>>(json)) - tmp.Add(new ServerChatCommand(I.Key, (string)I.Value["help_text"], (bool)I.Value["adminOnly"])); + tmp.Add(new ServerChatCommand(I.Key, (string)I.Value["help_text"], (bool)I.Value["adminOnly"], (int)I.Value["required_parameters"])); ServerChatCommands = tmp; } catch { } From 67f5275a39074c2f54bdc79a87ad739e6a6e3f2e Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Fri, 1 Sep 2017 20:19:57 -0400 Subject: [PATCH 22/42] FUCKING FIX THIS FUCKING SHIT SO GOD DAMN FUCKING FAST --- TGServerService/DreamDaemon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TGServerService/DreamDaemon.cs b/TGServerService/DreamDaemon.cs index 4d05e5a9a9..2e7139a2fc 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} -close -verbose -params server_service={3}&server_service_version={4} -{2} -public", DMB, Config.ServerPort, SecurityWord(), serviceCommsKey, Version()); InitInterop(); Proc.Start(); From cbca4483e30e714a214d830fac5c4f9d5f9ce791 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Fri, 1 Sep 2017 20:25:41 -0400 Subject: [PATCH 23/42] YOU DIDN'T FUCKING FIX IT RIGHT THE FUCKING FIRST TIME YOU IGNORANT SLUT --- TGServerService/DreamDaemon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TGServerService/DreamDaemon.cs b/TGServerService/DreamDaemon.cs index 2e7139a2fc..ce6b749d1c 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} -close -verbose -params \"server_service={3}&server_service_version={4}\" -{2} -public", DMB, Config.ServerPort, SecurityWord(), serviceCommsKey, Version()); InitInterop(); Proc.Start(); From 6ed3ffabe237d73ed276d404c217025bfd765603 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Fri, 1 Sep 2017 20:36:25 -0400 Subject: [PATCH 24/42] Null out chat commands on restart --- TGServerService/Interop.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/TGServerService/Interop.cs b/TGServerService/Interop.cs index 48b2d7953a..c8f4b06fdc 100644 --- a/TGServerService/Interop.cs +++ b/TGServerService/Interop.cs @@ -70,6 +70,7 @@ namespace TGServerService break; case SRWorldReboot: TGServerService.WriteInfo("World Rebooted", TGServerService.EventID.WorldReboot); + ServerChatCommands = null; lock (CompilerLock) { if (UpdateStaged) From 32ee79121d245a45d6012eda593caf18f6a259c1 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Sat, 2 Sep 2017 21:56:42 -0400 Subject: [PATCH 25/42] Buff the topic recieve size --- TGServerService/Interop.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TGServerService/Interop.cs b/TGServerService/Interop.cs index c8f4b06fdc..e71b35a6a3 100644 --- a/TGServerService/Interop.cs +++ b/TGServerService/Interop.cs @@ -124,7 +124,7 @@ namespace TGServerService string returnedString = "NULL"; try { - var returnedData = new byte[512]; + var returnedData = new byte[UInt16.MaxValue]; topicSender.Receive(returnedData); var raw_string = Encoding.ASCII.GetString(returnedData).TrimEnd(new char[] { (char)0 }).Trim(); if (raw_string.Length > 6) From a17fd979223eb762b7636b23c4ed1b51dd94fde7 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Sat, 2 Sep 2017 22:17:39 -0400 Subject: [PATCH 26/42] The more defines the more better --- TGServerService/Interop.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/TGServerService/Interop.cs b/TGServerService/Interop.cs index e71b35a6a3..04d39d5052 100644 --- a/TGServerService/Interop.cs +++ b/TGServerService/Interop.cs @@ -29,7 +29,11 @@ namespace TGServerService const string SRKillProcess = "killme"; const string SRIRCBroadcast = "irc"; const string SRIRCAdminChannelMessage = "send2irc"; - const string SRWorldReboot = "worldreboot"; + const string SRWorldReboot = "worldreboot"; + + const string CCPHelpText = "help_text"; + const string CCPAdminOnly = "admin_only"; + const string CCPRequiredParameters = "required_parameters"; List ServerChatCommands; @@ -44,7 +48,7 @@ namespace TGServerService try { foreach(var I in new JavaScriptSerializer().Deserialize>>(json)) - tmp.Add(new ServerChatCommand(I.Key, (string)I.Value["help_text"], (bool)I.Value["adminOnly"], (int)I.Value["required_parameters"])); + tmp.Add(new ServerChatCommand(I.Key, (string)I.Value[CCPHelpText], (bool)I.Value[CCPAdminOnly], (int)I.Value[CCPRequiredParameters])); ServerChatCommands = tmp; } catch { } From 6f87fa6c18eb004e8b20aff0db579bddd0de4729 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Sat, 2 Sep 2017 22:38:12 -0400 Subject: [PATCH 27/42] Fix conversion --- TGServerService/Interop.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TGServerService/Interop.cs b/TGServerService/Interop.cs index 04d39d5052..9008416f31 100644 --- a/TGServerService/Interop.cs +++ b/TGServerService/Interop.cs @@ -48,7 +48,7 @@ namespace TGServerService try { foreach(var I in new JavaScriptSerializer().Deserialize>>(json)) - tmp.Add(new ServerChatCommand(I.Key, (string)I.Value[CCPHelpText], (bool)I.Value[CCPAdminOnly], (int)I.Value[CCPRequiredParameters])); + tmp.Add(new ServerChatCommand(I.Key, (string)I.Value[CCPHelpText], ((int)I.Value[CCPAdminOnly]) == 1, (int)I.Value[CCPRequiredParameters])); ServerChatCommands = tmp; } catch { } From 19c75976c61ffd2c0c56cfd8fb9e6a384ea24803 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Sat, 2 Sep 2017 22:40:13 -0400 Subject: [PATCH 28/42] Fix command format --- TGServerService/ChatCommands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TGServerService/ChatCommands.cs b/TGServerService/ChatCommands.cs index f0a8d42ec6..55b92365f5 100644 --- a/TGServerService/ChatCommands.cs +++ b/TGServerService/ChatCommands.cs @@ -55,7 +55,7 @@ namespace TGServerService protected override ExitCode Run(IList parameters) { - var res = Instance.SendCommand(String.Format("{0} {1}", Keyword, String.Join(" ", parameters))); + var res = Instance.SendCommand(String.Format("{0};sender={1};custom=\"{2}\"", Keyword, CommandInfo.Value.Speaker, String.Join(" ", parameters))); if (res != "SUCESS" && !String.IsNullOrWhiteSpace(res)) OutputProc(res); return ExitCode.Normal; From 5bffe2e304a169a606b83c731909e5a71c2e758b Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Sat, 2 Sep 2017 22:44:16 -0400 Subject: [PATCH 29/42] Fix infinite listing --- TGServerService/ChatCommands.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/TGServerService/ChatCommands.cs b/TGServerService/ChatCommands.cs index 55b92365f5..1025066cc2 100644 --- a/TGServerService/ChatCommands.cs +++ b/TGServerService/ChatCommands.cs @@ -65,12 +65,12 @@ namespace TGServerService class RootChatCommand : RootCommand { public RootChatCommand(List serverCommands) - { - if (serverCommands == null) - serverCommands = new List(); + { + Children = new Command[] { new PRsCommand(), new VersionCommand(), new RevisionCommand(), new ByondCommand(), new KekCommand() }; + if (serverCommands != null) + serverCommands.CopyTo(Children); + serverCommands = new List(); PrintHelpList = true; - serverCommands.AddRange(new Command[] { new PRsCommand(), new VersionCommand(), new RevisionCommand(), new ByondCommand(), new KekCommand() }); - Children = serverCommands.ToArray(); } } class RevisionCommand : ChatCommand From 1be5f93d105af8ca0b016dd2a91b8578aba1cadc Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Sat, 2 Sep 2017 22:46:33 -0400 Subject: [PATCH 30/42] Actually fix it --- TGServerService/ChatCommands.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/TGServerService/ChatCommands.cs b/TGServerService/ChatCommands.cs index 1025066cc2..f0659c9c87 100644 --- a/TGServerService/ChatCommands.cs +++ b/TGServerService/ChatCommands.cs @@ -65,11 +65,12 @@ namespace TGServerService class RootChatCommand : RootCommand { public RootChatCommand(List serverCommands) - { - Children = new Command[] { new PRsCommand(), new VersionCommand(), new RevisionCommand(), new ByondCommand(), new KekCommand() }; - if (serverCommands != null) - serverCommands.CopyTo(Children); - serverCommands = new List(); + { + var tmp = new List { new PRsCommand(), new VersionCommand(), new RevisionCommand(), new ByondCommand(), new KekCommand() }; + if (serverCommands != null) + tmp.AddRange(serverCommands); + Children = tmp.ToArray(); + serverCommands = new List(); PrintHelpList = true; } } From c81cb5b8158e2842c22b222798adbc285213e58e Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Sat, 2 Sep 2017 22:51:40 -0400 Subject: [PATCH 31/42] Tabs --- TGServerService/Interop.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TGServerService/Interop.cs b/TGServerService/Interop.cs index 9008416f31..e30144b16b 100644 --- a/TGServerService/Interop.cs +++ b/TGServerService/Interop.cs @@ -29,11 +29,11 @@ namespace TGServerService const string SRKillProcess = "killme"; const string SRIRCBroadcast = "irc"; const string SRIRCAdminChannelMessage = "send2irc"; - const string SRWorldReboot = "worldreboot"; + const string SRWorldReboot = "worldreboot"; - const string CCPHelpText = "help_text"; - const string CCPAdminOnly = "admin_only"; - const string CCPRequiredParameters = "required_parameters"; + const string CCPHelpText = "help_text"; + const string CCPAdminOnly = "admin_only"; + const string CCPRequiredParameters = "required_parameters"; List ServerChatCommands; From a4ef3e1bf5cab49c755d2831631c6b7e4135421b Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 6 Sep 2017 13:53:16 -0400 Subject: [PATCH 32/42] Adds submodule update handling --- TGServerService/Repository.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/TGServerService/Repository.cs b/TGServerService/Repository.cs index e30759d1d3..a6bb1d7ddc 100644 --- a/TGServerService/Repository.cs +++ b/TGServerService/Repository.cs @@ -364,11 +364,12 @@ namespace TGServerService }; fos.OnTransferProgress += HandleTransferProgress; Commands.Fetch(Repo, R.Name, refSpecs, fos, logMessage); - + var originBranch = Repo.Head.TrackedBranch; if (reset) { var error = ResetNoLock(Repo.Head.TrackedBranch); + UpdateSubmodules(); if (error != null) throw new Exception(error); DeletePRList(); @@ -376,6 +377,7 @@ namespace TGServerService return error; } var res = MergeBranch(originBranch.FriendlyName); + UpdateSubmodules(); if (res != null) throw new Exception(res); TGServerService.WriteInfo("Repo merge updated to " + originBranch.Tip.Sha, TGServerService.EventID.RepoMergeUpdate); @@ -390,6 +392,16 @@ namespace TGServerService } } + private void UpdateSubmodules() + { + var suo = new SubmoduleUpdateOptions + { + Init = true + }; + foreach (var I in Repo.Submodules) + Repo.Submodules.Update(I.Name, suo); + } + string CreateBackup() { try From 51884104aa1da7d670b0a367bf2a55e83ece9ae1 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 6 Sep 2017 14:01:59 -0400 Subject: [PATCH 33/42] Also while testmerging --- TGServerService/Repository.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/TGServerService/Repository.cs b/TGServerService/Repository.cs index a6bb1d7ddc..ad8eaafdef 100644 --- a/TGServerService/Repository.cs +++ b/TGServerService/Repository.cs @@ -377,9 +377,9 @@ namespace TGServerService return error; } var res = MergeBranch(originBranch.FriendlyName); - UpdateSubmodules(); if (res != null) throw new Exception(res); + UpdateSubmodules(); TGServerService.WriteInfo("Repo merge updated to " + originBranch.Tip.Sha, TGServerService.EventID.RepoMergeUpdate); return null; } @@ -569,6 +569,16 @@ namespace TGServerService //so we'll know if this fails var Result = MergeBranch(LocalBranchName); + if (Result == null) + try + { + UpdateSubmodules(); + } + catch (Exception e) + { + Result = e.ToString(); + } + if (Result == null) { TGServerService.WriteInfo(String.Format("Merged pull request #{0}", PRNumber), TGServerService.EventID.RepoPRMerge); From 8809b8f25edcfa65c34f4eb6647295bd1e33cd4d Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 6 Sep 2017 14:14:31 -0400 Subject: [PATCH 34/42] Also on checkout --- TGServerService/Repository.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/TGServerService/Repository.cs b/TGServerService/Repository.cs index ad8eaafdef..387a72b442 100644 --- a/TGServerService/Repository.cs +++ b/TGServerService/Repository.cs @@ -307,6 +307,7 @@ namespace TGServerService }; Commands.Checkout(Repo, sha, Opts); var res = ResetNoLock(null); + UpdateSubmodules(); SendMessage("REPO: Checkout complete!", ChatMessageType.DeveloperInfo); TGServerService.WriteInfo("Repo checked out " + sha, TGServerService.EventID.RepoCheckout); return res; From 7e57e293f1228ff187686d181c3679887301d785 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 6 Sep 2017 14:42:57 -0400 Subject: [PATCH 35/42] Add the ability to checkout branches from remote --- TGServerService/Repository.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/TGServerService/Repository.cs b/TGServerService/Repository.cs index e30759d1d3..598d148a2b 100644 --- a/TGServerService/Repository.cs +++ b/TGServerService/Repository.cs @@ -300,6 +300,17 @@ namespace TGServerService SendMessage("REPO: Checking out object: " + sha, ChatMessageType.DeveloperInfo); try { + if(Repo.Branches[sha] == null) + { + //see if origin has the branch + var trackedBranch = Repo.Branches[String.Format("origin/{0}", sha)]; + if(trackedBranch != null) + { + var newBranch = Repo.CreateBranch(sha, trackedBranch.Tip); + //track it + Repo.Branches.Update(newBranch, b => b.TrackedBranch = trackedBranch.CanonicalName); + } + } var Opts = new CheckoutOptions() { CheckoutModifiers = CheckoutModifiers.Force, From 43faed13409c36820e48edf3a194718e2120cf56 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 6 Sep 2017 15:36:09 -0400 Subject: [PATCH 36/42] What a beautiful hack this is! --- TGServerService/Repository.cs | 21 ++++++++++++++++++++- TGServerService/ServerService.cs | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/TGServerService/Repository.cs b/TGServerService/Repository.cs index 387a72b442..461ea798e5 100644 --- a/TGServerService/Repository.cs +++ b/TGServerService/Repository.cs @@ -400,7 +400,26 @@ namespace TGServerService Init = true }; foreach (var I in Repo.Submodules) - Repo.Submodules.Update(I.Name, suo); + try + { + Repo.Submodules.Update(I.Name, suo); + } + catch(Exception e) + { + //workaround for https://github.com/libgit2/libgit2/issues/3820 + //kill off the modules/ folder in .git and try again + try + { + Program.DeleteDirectory(String.Format("{0}/.git/modules/{1}", RepoPath, I.Path)); + } + catch { + throw e; + } + Repo.Submodules.Update(I.Name, suo); + var msg = String.Format("I had to reclone submodule {0}. If this is happening a lot find a better hack or fix https://github.com/libgit2/libgit2/issues/3820!", I.Name); + SendMessage(String.Format("REPO: {0}", msg), ChatMessageType.DeveloperInfo); + TGServerService.WriteWarning(msg, TGServerService.EventID.SubmoduleReclone); + } } string CreateBackup() diff --git a/TGServerService/ServerService.cs b/TGServerService/ServerService.cs index 7cbc5fb224..1f3a5d76ea 100644 --- a/TGServerService/ServerService.cs +++ b/TGServerService/ServerService.cs @@ -75,6 +75,7 @@ namespace TGServerService ServerUpdateApplied = 6300, ChatBroadcastFail = 6400, IRCLogModes = 6500, + SubmoduleReclone = 6600, } static TGServerService ActiveService; //So everyone else can write to our eventlog From 31ecd57a34c7612ad3289e267a0476c34b25779b Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 6 Sep 2017 15:46:20 -0400 Subject: [PATCH 37/42] Adds compatibility for zbot to chat commands --- TGServerService/ChatCommands.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TGServerService/ChatCommands.cs b/TGServerService/ChatCommands.cs index f0659c9c87..9349288488 100644 --- a/TGServerService/ChatCommands.cs +++ b/TGServerService/ChatCommands.cs @@ -82,7 +82,7 @@ namespace TGServerService } protected override ExitCode Run(IList parameters) { - OutputProc(Instance.GetHead(out string error) ?? error); + OutputProc(String.Format("^{0}", Instance.GetHead(out string error)) ?? error); return error == null ? ExitCode.Normal : ExitCode.ServerError; } @@ -173,7 +173,7 @@ namespace TGServerService { res = ""; foreach (var I in PRs) - res += I.Number + " "; + res += "#" + I.Number + " "; OutputProc(res); } return ExitCode.Normal; From 3925f437be646c70e4fc3e97641c75a446e6f229 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 6 Sep 2017 15:56:34 -0400 Subject: [PATCH 38/42] Fixes revision command help text --- TGServerService/ChatCommands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TGServerService/ChatCommands.cs b/TGServerService/ChatCommands.cs index f0659c9c87..7f51a84215 100644 --- a/TGServerService/ChatCommands.cs +++ b/TGServerService/ChatCommands.cs @@ -88,7 +88,7 @@ namespace TGServerService public override string GetHelpText() { - return "Returns mob info of the specified target"; + return "Prints the current code revision of the repository (not the server)"; } } From 86fa34ab7705157986aa099f6dbcc92faa2cb2e4 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 6 Sep 2017 16:02:02 -0400 Subject: [PATCH 39/42] Added webclient configuration setting. Currently unchangeable --- TGServerService/App.config | 3 +++ TGServerService/DreamDaemon.cs | 2 +- TGServerService/Properties/Settings.Designer.cs | 14 +++++++++++++- TGServerService/Properties/Settings.settings | 3 +++ 4 files changed, 20 insertions(+), 2 deletions(-) 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..4b10718376 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(); 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 From 6f8f9a6a86bc52c4ec052198d2052203ee7b1946 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 6 Sep 2017 16:08:03 -0400 Subject: [PATCH 40/42] Implements the API to change the webclient setting --- TGServerService/DreamDaemon.cs | 20 ++++++++++++++++++++ TGServiceInterface/DreamDaemon.cs | 14 ++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/TGServerService/DreamDaemon.cs b/TGServerService/DreamDaemon.cs index 4b10718376..c53843dbab 100644 --- a/TGServerService/DreamDaemon.cs +++ b/TGServerService/DreamDaemon.cs @@ -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/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 /// From ca4cd31feaffced2b4a62e672bb5b5f78f381534 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 6 Sep 2017 16:10:11 -0400 Subject: [PATCH 41/42] Adds the webclient command to the command line --- TGCommandLine/DDCommands.cs | 41 ++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) 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() From 39eed6d9e28da0fd7e2c47503ac51792c5f74dc8 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 6 Sep 2017 16:14:14 -0400 Subject: [PATCH 42/42] Adds the webclient checkbox to server tools --- TGControlPanel/Main.Designer.cs | 117 ++++++++++++++++++-------------- TGControlPanel/ServerPage.cs | 8 +++ 2 files changed, 75 insertions(+), 50 deletions(-) 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); + } } }