diff --git a/TGServerService/ChatCommands.cs b/TGServerService/ChatCommands.cs
deleted file mode 100644
index 51a4014329..0000000000
--- a/TGServerService/ChatCommands.cs
+++ /dev/null
@@ -1,290 +0,0 @@
-using TGServiceInterface;
-using System;
-using System.Collections.Generic;
-using System.Threading;
-
-namespace TGServerService.ChatCommands
-{
- ///
- /// Metadata about the currently running
- ///
- sealed class CommandInfo
- {
- ///
- /// If the was invoked by an admin
- ///
- public bool IsAdmin { get; set; }
- ///
- /// If the was invoked from an admin chat channel
- ///
- public bool IsAdminChannel { get; set; }
- ///
- /// The name of the invoker
- ///
- public string Speaker { get; set; }
- ///
- /// A reference to the that runs the that heard the
- ///
- public ServerInstance Server { get; set; }
- }
- ///
- /// A command heard by a
- ///
- abstract class ChatCommand : Command
- {
- ///
- /// for the
- ///
- public static ThreadLocal CommandInfo { get; private set; } = new ThreadLocal();
- ///
- /// If set to , the cannot be invoked by a non-admin or outside an admin chat channel
- ///
- public bool RequiresAdmin { get; protected set; }
- ///
- /// Shorthand for accessing
- ///
- protected ServerInstance Instance { get { return CommandInfo.Value.Server; } }
-
- ///
- public override ExitCode DoRun(IList parameters)
- {
- if (RequiresAdmin)
- {
- var Info = CommandInfo.Value;
- if (!Info.IsAdmin)
- {
- OutputProc("You are not authorized to use that command!");
- return ExitCode.BadCommand;
- }
- if (!Info.IsAdminChannel)
- {
- OutputProc("Use this command in an admin channel!");
- return ExitCode.BadCommand;
- }
- }
- return base.DoRun(parameters);
- }
- }
-
- ///
- /// s generated by DreamDaemon via the API
- ///
- sealed class ServerChatCommand : ChatCommand
- {
- ///
- /// The help text for the
- ///
- readonly string HelpText;
-
- ///
- /// Construct a
- ///
- /// The invocation of the
- /// The help text of the
- /// If set to , the cannot be invoked by a non-admin or outside an admin chat channel
- /// The number of parameters the requires
- public ServerChatCommand(string name, string helpText, bool adminOnly, int requiredParameters)
- {
- Keyword = name;
- RequiresAdmin = adminOnly;
- HelpText = helpText;
- RequiredParameters = requiredParameters;
- }
-
- ///
- public override string GetHelpText()
- {
- return HelpText;
- }
-
- ///
- protected override ExitCode Run(IList parameters)
- {
- var res = Instance.SendCommand(String.Format("{0};sender={1};custom={2}", Keyword, CommandInfo.Value.Speaker, Program.SanitizeTopicString(String.Join(" ", parameters))));
- if (res != "SUCCESS" && !String.IsNullOrWhiteSpace(res))
- OutputProc(res);
- return ExitCode.Normal;
- }
- }
-
- ///
- /// The main root chat command
- ///
- sealed class RootChatCommand : RootCommand
- {
- ///
- /// Construct a
- ///
- /// List of s supplied by DreamDaemon
- public RootChatCommand(List serverCommands)
- {
- 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;
- }
- }
- ///
- /// Retrieves the git SHA of the live DreamDaemon code
- ///
- sealed class RevisionCommand : ChatCommand
- {
- ///
- /// Construct a
- ///
- public RevisionCommand()
- {
- Keyword = "revision";
- }
- ///
- protected override ExitCode Run(IList parameters)
- {
- var res = Instance.LiveSha();
- if (res == "UNKNOWN") {
- OutputProc(res);
- return ExitCode.ServerError;
- }
- OutputProc(String.Format("^{0}", res));
- return ExitCode.Normal;
- }
-
- ///
- public override string GetHelpText()
- {
- return "Prints the current code revision of the repository (not the server)";
- }
- }
- ///
- /// Retrieve the installed, staged, or latest availab
- ///
- sealed class ByondCommand : ChatCommand
- {
- ///
- /// Construct a
- ///
- public ByondCommand()
- {
- Keyword = "byond";
- }
-
- ///
- protected override ExitCode Run(IList parameters)
- {
- var type = ByondVersion.Installed;
- if (parameters.Count > 0)
- if (parameters[0].ToLower() == "--staged")
- type = ByondVersion.Staged;
- else if (parameters[0].ToLower() == "--latest")
- type = ByondVersion.Latest;
- OutputProc(Instance.GetVersion(type) ?? "None");
- return ExitCode.Normal;
- }
-
- ///
- public override string GetHelpText()
- {
- return "Gets the specified BYOND version";
- }
-
- ///
- public override string GetArgumentString()
- {
- return "[--staged|--latest]";
- }
- }
- ///
- /// Retrieve the current service version
- ///
- sealed class VersionCommand : ChatCommand
- {
- ///
- /// Construct a
- ///
- public VersionCommand()
- {
- Keyword = "version";
- }
-
- ///
- protected override ExitCode Run(IList parameters)
- {
- OutputProc(Instance.Version());
- return ExitCode.Normal;
- }
-
- ///
- public override string GetHelpText()
- {
- return "Gets the running service version";
- }
- }
- ///
- /// kek
- ///
- sealed class KekCommand : ChatCommand
- {
- ///
- /// Construct a
- ///
- public KekCommand()
- {
- Keyword = "kek";
- }
-
- ///
- protected override ExitCode Run(IList parameters)
- {
- OutputProc("kek");
- return ExitCode.Normal;
- }
-
- ///
- public override string GetHelpText()
- {
- return "kek";
- }
- }
- ///
- /// Retrieve the list of test-merged github pull requests
- ///
- sealed class PRsCommand : ChatCommand
- {
- ///
- /// Construct a
- ///
- public PRsCommand()
- {
- Keyword = "prs";
- }
-
- ///
- protected override ExitCode Run(IList parameters)
- {
- var PRs = Instance.MergedPullRequests(out string res);
- if (PRs == null)
- {
- OutputProc(res);
- return ExitCode.ServerError;
- }
- if (PRs.Count == 0)
- OutputProc("None!");
- else
- {
- res = "";
- foreach (var I in PRs)
- res += "#" + I.Number + " ";
- OutputProc(res);
- }
- return ExitCode.Normal;
- }
-
- ///
- public override string GetHelpText()
- {
- return "Gets the currently merged pull requests in the repository";
- }
- }
-
-}
diff --git a/TGServerService/ChatCommands/ByondCommand.cs b/TGServerService/ChatCommands/ByondCommand.cs
new file mode 100644
index 0000000000..27cd19dadf
--- /dev/null
+++ b/TGServerService/ChatCommands/ByondCommand.cs
@@ -0,0 +1,44 @@
+using System.Collections.Generic;
+using TGServiceInterface;
+
+namespace TGServerService.ChatCommands
+{
+ ///
+ /// Retrieve the installed, staged, or latest availab
+ ///
+ sealed class ByondCommand : ChatCommand
+ {
+ ///
+ /// Construct a
+ ///
+ public ByondCommand()
+ {
+ Keyword = "byond";
+ }
+
+ ///
+ protected override ExitCode Run(IList parameters)
+ {
+ var type = ByondVersion.Installed;
+ if (parameters.Count > 0)
+ if (parameters[0].ToLower() == "--staged")
+ type = ByondVersion.Staged;
+ else if (parameters[0].ToLower() == "--latest")
+ type = ByondVersion.Latest;
+ OutputProc(Instance.GetVersion(type) ?? "None");
+ return ExitCode.Normal;
+ }
+
+ ///
+ public override string GetHelpText()
+ {
+ return "Gets the specified BYOND version";
+ }
+
+ ///
+ public override string GetArgumentString()
+ {
+ return "[--staged|--latest]";
+ }
+ }
+}
diff --git a/TGServerService/ChatCommands/ChatCommand.cs b/TGServerService/ChatCommands/ChatCommand.cs
new file mode 100644
index 0000000000..17794613fa
--- /dev/null
+++ b/TGServerService/ChatCommands/ChatCommand.cs
@@ -0,0 +1,45 @@
+using System.Collections.Generic;
+using System.Threading;
+using TGServiceInterface;
+
+namespace TGServerService.ChatCommands
+{
+ ///
+ /// A command heard by a
+ ///
+ abstract class ChatCommand : Command
+ {
+ ///
+ /// for the
+ ///
+ public static ThreadLocal CommandInfo { get; private set; } = new ThreadLocal();
+ ///
+ /// If set to , the cannot be invoked by a non-admin or outside an admin chat channel
+ ///
+ public bool RequiresAdmin { get; protected set; }
+ ///
+ /// Shorthand for accessing
+ ///
+ protected ServerInstance Instance { get { return CommandInfo.Value.Server; } }
+
+ ///
+ public override ExitCode DoRun(IList parameters)
+ {
+ if (RequiresAdmin)
+ {
+ var Info = CommandInfo.Value;
+ if (!Info.IsAdmin)
+ {
+ OutputProc("You are not authorized to use that command!");
+ return ExitCode.BadCommand;
+ }
+ if (!Info.IsAdminChannel)
+ {
+ OutputProc("Use this command in an admin channel!");
+ return ExitCode.BadCommand;
+ }
+ }
+ return base.DoRun(parameters);
+ }
+ }
+}
diff --git a/TGServerService/ChatCommands/CommandInfo.cs b/TGServerService/ChatCommands/CommandInfo.cs
new file mode 100644
index 0000000000..913bd50e70
--- /dev/null
+++ b/TGServerService/ChatCommands/CommandInfo.cs
@@ -0,0 +1,25 @@
+namespace TGServerService.ChatCommands
+{
+ ///
+ /// Metadata about the currently running
+ ///
+ sealed class CommandInfo
+ {
+ ///
+ /// If the was invoked by an admin
+ ///
+ public bool IsAdmin { get; set; }
+ ///
+ /// If the was invoked from an admin chat channel
+ ///
+ public bool IsAdminChannel { get; set; }
+ ///
+ /// The name of the invoker
+ ///
+ public string Speaker { get; set; }
+ ///
+ /// A reference to the that runs the that heard the
+ ///
+ public ServerInstance Server { get; set; }
+ }
+}
diff --git a/TGServerService/ChatCommands/KekCommand.cs b/TGServerService/ChatCommands/KekCommand.cs
new file mode 100644
index 0000000000..1c2eda51c6
--- /dev/null
+++ b/TGServerService/ChatCommands/KekCommand.cs
@@ -0,0 +1,31 @@
+using System.Collections.Generic;
+
+namespace TGServerService.ChatCommands
+{
+ ///
+ /// kek
+ ///
+ sealed class KekCommand : ChatCommand
+ {
+ ///
+ /// Construct a
+ ///
+ public KekCommand()
+ {
+ Keyword = "kek";
+ }
+
+ ///
+ protected override ExitCode Run(IList parameters)
+ {
+ OutputProc("kek");
+ return ExitCode.Normal;
+ }
+
+ ///
+ public override string GetHelpText()
+ {
+ return "kek";
+ }
+ }
+}
diff --git a/TGServerService/ChatCommands/PullRequestsCommand.cs b/TGServerService/ChatCommands/PullRequestsCommand.cs
new file mode 100644
index 0000000000..50495174c5
--- /dev/null
+++ b/TGServerService/ChatCommands/PullRequestsCommand.cs
@@ -0,0 +1,45 @@
+using System.Collections.Generic;
+
+namespace TGServerService.ChatCommands
+{
+ ///
+ /// Retrieve the list of test-merged github pull requests
+ ///
+ sealed class PullRequestsCommand : ChatCommand
+ {
+ ///
+ /// Construct a
+ ///
+ public PullRequestsCommand()
+ {
+ Keyword = "prs";
+ }
+
+ ///
+ protected override ExitCode Run(IList parameters)
+ {
+ var PRs = Instance.MergedPullRequests(out string res);
+ if (PRs == null)
+ {
+ OutputProc(res);
+ return ExitCode.ServerError;
+ }
+ if (PRs.Count == 0)
+ OutputProc("None!");
+ else
+ {
+ res = "";
+ foreach (var I in PRs)
+ res += "#" + I.Number + " ";
+ OutputProc(res);
+ }
+ return ExitCode.Normal;
+ }
+
+ ///
+ public override string GetHelpText()
+ {
+ return "Gets the currently merged pull requests in the repository";
+ }
+ }
+}
diff --git a/TGServerService/ChatCommands/RevisionCommand.cs b/TGServerService/ChatCommands/RevisionCommand.cs
new file mode 100644
index 0000000000..18b28b96ac
--- /dev/null
+++ b/TGServerService/ChatCommands/RevisionCommand.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+
+namespace TGServerService.ChatCommands
+{
+ ///
+ /// Retrieves the git SHA of the live DreamDaemon code
+ ///
+ sealed class RevisionCommand : ChatCommand
+ {
+ ///
+ /// Construct a
+ ///
+ public RevisionCommand()
+ {
+ Keyword = "revision";
+ }
+ ///
+ protected override ExitCode Run(IList parameters)
+ {
+ var res = Instance.LiveSha();
+ if (res == "UNKNOWN")
+ {
+ OutputProc(res);
+ return ExitCode.ServerError;
+ }
+ OutputProc(String.Format("^{0}", res));
+ return ExitCode.Normal;
+ }
+
+ ///
+ public override string GetHelpText()
+ {
+ return "Prints the current code revision of the repository (not the server)";
+ }
+ }
+}
diff --git a/TGServerService/ChatCommands/RootChatCommand.cs b/TGServerService/ChatCommands/RootChatCommand.cs
new file mode 100644
index 0000000000..82bb3e172e
--- /dev/null
+++ b/TGServerService/ChatCommands/RootChatCommand.cs
@@ -0,0 +1,25 @@
+using System.Collections.Generic;
+using TGServiceInterface;
+
+namespace TGServerService.ChatCommands
+{
+ ///
+ /// The main root chat command
+ ///
+ sealed class RootChatCommand : RootCommand
+ {
+ ///
+ /// Construct a
+ ///
+ /// List of s supplied by DreamDaemon
+ public RootChatCommand(List serverCommands)
+ {
+ var tmp = new List { new PullRequestsCommand(), new VersionCommand(), new RevisionCommand(), new ByondCommand(), new KekCommand() };
+ if (serverCommands != null)
+ tmp.AddRange(serverCommands);
+ Children = tmp.ToArray();
+ serverCommands = new List();
+ PrintHelpList = true;
+ }
+ }
+}
diff --git a/TGServerService/ChatCommands/ServerChatCommand.cs b/TGServerService/ChatCommands/ServerChatCommand.cs
new file mode 100644
index 0000000000..f7551e60af
--- /dev/null
+++ b/TGServerService/ChatCommands/ServerChatCommand.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+
+namespace TGServerService.ChatCommands
+{
+ ///
+ /// s generated by DreamDaemon via the API
+ ///
+ sealed class ServerChatCommand : ChatCommand
+ {
+ ///
+ /// The help text for the
+ ///
+ readonly string HelpText;
+
+ ///
+ /// Construct a
+ ///
+ /// The invocation of the
+ /// The help text of the
+ /// If set to , the cannot be invoked by a non-admin or outside an admin chat channel
+ /// The number of parameters the requires
+ public ServerChatCommand(string name, string helpText, bool adminOnly, int requiredParameters)
+ {
+ Keyword = name;
+ RequiresAdmin = adminOnly;
+ HelpText = helpText;
+ RequiredParameters = requiredParameters;
+ }
+
+ ///
+ public override string GetHelpText()
+ {
+ return HelpText;
+ }
+
+ ///
+ protected override ExitCode Run(IList parameters)
+ {
+ var res = Instance.SendCommand(String.Format("{0};sender={1};custom={2}", Keyword, CommandInfo.Value.Speaker, Program.SanitizeTopicString(String.Join(" ", parameters))));
+ if (res != "SUCCESS" && !String.IsNullOrWhiteSpace(res))
+ OutputProc(res);
+ return ExitCode.Normal;
+ }
+ }
+}
diff --git a/TGServerService/ChatCommands/VersionCommand.cs b/TGServerService/ChatCommands/VersionCommand.cs
new file mode 100644
index 0000000000..d066d83971
--- /dev/null
+++ b/TGServerService/ChatCommands/VersionCommand.cs
@@ -0,0 +1,31 @@
+using System.Collections.Generic;
+
+namespace TGServerService.ChatCommands
+{
+ ///
+ /// Retrieve the current service version
+ ///
+ sealed class VersionCommand : ChatCommand
+ {
+ ///
+ /// Construct a
+ ///
+ public VersionCommand()
+ {
+ Keyword = "version";
+ }
+
+ ///
+ protected override ExitCode Run(IList parameters)
+ {
+ OutputProc(Instance.Version());
+ return ExitCode.Normal;
+ }
+
+ ///
+ public override string GetHelpText()
+ {
+ return "Gets the running service version";
+ }
+ }
+}
diff --git a/TGServerService/LockDependancies.txt b/TGServerService/LockDependancies.txt
deleted file mode 100644
index 032a584196..0000000000
--- a/TGServerService/LockDependancies.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-RepoLock protects the repo for the full duration of short operations
-RepoBusy protects the repo for long operations
-
-lock RepoLock and check RepoBusy to see if you can use the repo
-
-configLock is only for atomically reading and writing the config directory
-
-compilerLock protects the compilerCurrentStatus and lastCompilerError vars
-
-byondLock protects the updateStat and lastError vars
-
-watchdogLock protects the currentStatus var
\ No newline at end of file
diff --git a/TGServerService/ProjectInstaller.Designer.cs b/TGServerService/ProjectInstaller.Designer.cs
deleted file mode 100644
index 82180bdcf6..0000000000
--- a/TGServerService/ProjectInstaller.Designer.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-namespace TGServerService
-{
- public partial class ProjectInstaller
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
- this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
- //
- // serviceProcessInstaller1
- //
- this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
- this.serviceProcessInstaller1.Password = null;
- this.serviceProcessInstaller1.Username = null;
- //
- // serviceInstaller1
- //
- this.serviceInstaller1.Description = "/tg/station Server Service";
- this.serviceInstaller1.DisplayName = "TG Station Server";
- this.serviceInstaller1.ServiceName = "TG Station Server";
- this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
- //
- // ProjectInstaller
- //
- this.Installers.AddRange(new System.Configuration.Install.Installer[] {
- this.serviceProcessInstaller1,
- this.serviceInstaller1});
-
- }
-
- #endregion
-
- ///
- /// The project's
- ///
- private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;
- ///
- /// The project's
- ///
- private System.ServiceProcess.ServiceInstaller serviceInstaller1;
- }
-}
\ No newline at end of file
diff --git a/TGServerService/ProjectInstaller.cs b/TGServerService/ProjectInstaller.cs
index 12a82fa238..2f4d75524d 100644
--- a/TGServerService/ProjectInstaller.cs
+++ b/TGServerService/ProjectInstaller.cs
@@ -1,10 +1,11 @@
using System.ComponentModel;
using System.Configuration.Install;
+using System.ServiceProcess;
namespace TGServerService
{
///
- /// This tells the .msi there is a Windows in this that needs installation
+ /// This tells the .msi there is a Windows in this that needs installation
///
[RunInstaller(true)]
public partial class ProjectInstaller : Installer
@@ -14,7 +15,21 @@ namespace TGServerService
///
public ProjectInstaller()
{
- InitializeComponent();
+ Installers.AddRange(new Installer[] {
+ new ServiceProcessInstaller
+ {
+ Account = ServiceAccount.LocalSystem,
+ Password = null,
+ Username = null
+ },
+ new ServiceInstaller
+ {
+ Description = "/tg/station Server Service",
+ DisplayName = "TG Station Server",
+ ServiceName = "TG Station Server",
+ StartType = ServiceStartMode.Automatic
+ }
+ });
}
}
}
diff --git a/TGServerService/ProjectInstaller.resx b/TGServerService/ProjectInstaller.resx
deleted file mode 100644
index 235f1b0bfb..0000000000
--- a/TGServerService/ProjectInstaller.resx
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 17, 56
-
-
- 196, 17
-
-
- False
-
-
\ No newline at end of file
diff --git a/TGServerService/Service.cs b/TGServerService/Service.cs
index fd90609d12..19b630527b 100644
--- a/TGServerService/Service.cs
+++ b/TGServerService/Service.cs
@@ -103,8 +103,8 @@ namespace TGServerService
Config.UpgradeRequired = false;
Config.Save();
}
- ActiveService = this;
ServiceName = "TG Station Server";
+ ActiveService = this;
Run(this);
}
finally
diff --git a/TGServerService/TGServerService.csproj b/TGServerService/TGServerService.csproj
index 759d3fcac8..ff077bacc3 100644
--- a/TGServerService/TGServerService.csproj
+++ b/TGServerService/TGServerService.csproj
@@ -82,6 +82,15 @@
+
+
+
+
+
+
+
+
+
@@ -90,7 +99,6 @@
-
@@ -111,9 +119,6 @@
Component
-
- ProjectInstaller.cs
-
Component
@@ -133,11 +138,6 @@
Settings.Designer.cs
-
-
- ProjectInstaller.cs
-
-
{ac4e7e8b-f83a-481c-a8b0-8fa4e8ae59ab}
@@ -145,9 +145,9 @@
-
+