diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 9dc136a1df..b839e64b22 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -28,11 +28,11 @@ Visual Studio comes with the nuget package manager. To install the dependencies, ##### (Optional) Installing WiX Toolset and Visual Studio Extension -The [WiX Toolset](http://wixtoolset.org/) is used for creating the installer .msi (Not the .exe, which is a standard C# program wrapper to the .msi). Building and modifying this is not required for debugging and development of the service but necessary if you want to debug tweaks to the installer configuration. You can download the Wix Toolset and Visual studio extension [here](http://wixtoolset.org/releases/). This will allow you to build `TGServiceInstaller.wixproj` just like all the other projects. +The [WiX Toolset](http://wixtoolset.org/) is used for creating the installer .msi (Not the .exe, which is a standard C# program wrapper to the .msi). Building and modifying this is not required for debugging and development of the service but necessary if you want to debug tweaks to the installer configuration. You can download the Wix Toolset and Visual studio extension [here](http://wixtoolset.org/releases/). This will allow you to build `TGS.Installer.wixproj` just like all the other projects. #### Debugging -So you've built the project and everything's good, right? Now you have to debug it. Debugging the command line and control panel are easy enough, just launch them like any other process. Debugging the TGServerService itself though requires a bit of finagling due to how Windows services work. +So you've built the project and everything's good, right? Now you have to debug it. Debugging the command line and control panel are easy enough, just launch them like any other process. Debugging the TGS.Server.Service itself though requires a bit of finagling due to how Windows services work. 1. Uninstall any release versions of TG Station Server 3 you may have on your machine 1. Open an administrative Windows cmd prompt diff --git a/AssemblyInfo.global.cs b/AssemblyInfo.global.cs index 2e9b5ff98f..56e3f1eec0 100644 --- a/AssemblyInfo.global.cs +++ b/AssemblyInfo.global.cs @@ -7,4 +7,4 @@ using System.Runtime.CompilerServices; [assembly: AssemblyFileVersion("3.2.0.5")] [assembly: AssemblyInformationalVersion("3.2.0.5")] -[assembly: InternalsVisibleTo("TGServiceTests")] +[assembly: InternalsVisibleTo("TGS.Tests")] diff --git a/README.md b/README.md index 21bdb7331a..e99ccffc5f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build status](https://ci.appveyor.com/api/projects/status/7t1h7bvuha0p9j5f?svg=true)](https://ci.appveyor.com/project/Cyberboss/tgstation-server-tools) [![Build Status](https://travis-ci.org/tgstation/tgstation-server.svg?branch=master)](https://travis-ci.org/tgstation/tgstation-server) [![codecov](https://codecov.io/gh/tgstation/tgstation-server/branch/master/graph/badge.svg)](https://codecov.io/gh/tgstation/tgstation-server) -[![GitHub license](https://img.shields.io/github/license/tgstation/tgstation-server.svg)](https://github.com/tgstation/tgstation-server/blob/master/LICENSE) [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/tgstation/tgstation-server.svg)](http://isitmaintained.com/project/tgstation/tgstation-server "Average time to resolve an issue") [![NuGet version](https://badge.fury.io/nu/TGServiceInterface.svg)](https://badge.fury.io/nu/TGServiceInterface) +[![GitHub license](https://img.shields.io/github/license/tgstation/tgstation-server.svg)](https://github.com/tgstation/tgstation-server/blob/master/LICENSE) [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/tgstation/tgstation-server.svg)](http://isitmaintained.com/project/tgstation/tgstation-server "Average time to resolve an issue") [![NuGet version](https://badge.fury.io/nu/TTGServiceInterface.svg)](https://badge.fury.io/nu/TGServiceInterface) [![forthebadge](http://forthebadge.com/images/badges/made-with-c-sharp.svg)](http://forthebadge.com) [![forinfinityandbyond](https://user-images.githubusercontent.com/5211576/29499758-4efff304-85e6-11e7-8267-62919c3688a9.gif)](https://www.reddit.com/r/SS13/comments/5oplxp/what_is_the_main_problem_with_byond_as_an_engine/dclbu1a) @@ -191,7 +191,7 @@ You can clear all active test merges using `Reset to Origin Branch` in the `Repo ### Viewing Server Logs * Logs are stored in the Windows event viewer under `Windows Logs` -> `Application`. You'll need to filter this list for `TG Station Server` -* Every event type is keyed with an ID. A complete listing of these IDs and their purpose can be found [here](https://github.com/tgstation/tgstation-server/blob/master/TGServerService/EventID.cs). +* Every event type is keyed with an ID. A complete listing of these IDs and their purpose can be found [here](https://github.com/tgstation/tgstation-server/blob/master/TGS.Server.Service/EventID.cs). * You can also import the custom view `View TGS3 Logs.xml` in this folder to have them automatically filtered ### Enabling upstream changelog generation diff --git a/TGCommandLine/AdminCommands.cs b/TGS.CommandLine/AdminCommands.cs similarity index 96% rename from TGCommandLine/AdminCommands.cs rename to TGS.CommandLine/AdminCommands.cs index aedddd15b1..953c002b07 100644 --- a/TGCommandLine/AdminCommands.cs +++ b/TGS.CommandLine/AdminCommands.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGCommandLine +namespace TGS.CommandLine { class AdminCommand : InstanceRootCommand { diff --git a/TGCommandLine/App.config b/TGS.CommandLine/App.config similarity index 100% rename from TGCommandLine/App.config rename to TGS.CommandLine/App.config diff --git a/TGCommandLine/BYONDCommands.cs b/TGS.CommandLine/BYONDCommands.cs similarity index 97% rename from TGCommandLine/BYONDCommands.cs rename to TGS.CommandLine/BYONDCommands.cs index 2666104e44..869c1ccfd3 100644 --- a/TGCommandLine/BYONDCommands.cs +++ b/TGS.CommandLine/BYONDCommands.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Threading; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGCommandLine +namespace TGS.CommandLine { class BYONDCommand : InstanceRootCommand { diff --git a/TGCommandLine/ChatCommands.cs b/TGS.CommandLine/ChatCommands.cs similarity index 99% rename from TGCommandLine/ChatCommands.cs rename to TGS.CommandLine/ChatCommands.cs index 651520457d..bf5fd5d3aa 100644 --- a/TGCommandLine/ChatCommands.cs +++ b/TGS.CommandLine/ChatCommands.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGCommandLine +namespace TGS.CommandLine { class IRCCommand : InstanceRootCommand { diff --git a/TGCommandLine/ConfigCommands.cs b/TGS.CommandLine/ConfigCommands.cs similarity index 97% rename from TGCommandLine/ConfigCommands.cs rename to TGS.CommandLine/ConfigCommands.cs index 0aae903ed4..ab4191a5d6 100644 --- a/TGCommandLine/ConfigCommands.cs +++ b/TGS.CommandLine/ConfigCommands.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.IO; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGCommandLine +namespace TGS.CommandLine { class ConfigCommand : InstanceRootCommand { diff --git a/TGCommandLine/ConsoleCommand.cs b/TGS.CommandLine/ConsoleCommand.cs similarity index 80% rename from TGCommandLine/ConsoleCommand.cs rename to TGS.CommandLine/ConsoleCommand.cs index 5e5274775a..1aa0e3f773 100644 --- a/TGCommandLine/ConsoleCommand.cs +++ b/TGS.CommandLine/ConsoleCommand.cs @@ -1,6 +1,6 @@ -using TGServiceInterface; +using TGS.Interface; -namespace TGCommandLine +namespace TGS.CommandLine { abstract class ConsoleCommand : Command { diff --git a/TGCommandLine/DDCommands.cs b/TGS.CommandLine/DDCommands.cs similarity index 94% rename from TGCommandLine/DDCommands.cs rename to TGS.CommandLine/DDCommands.cs index ef518c8911..9681589cf8 100644 --- a/TGCommandLine/DDCommands.cs +++ b/TGS.CommandLine/DDCommands.cs @@ -1,315 +1,315 @@ -using System; -using System.Collections.Generic; -using TGServiceInterface; -using TGServiceInterface.Components; - -namespace TGCommandLine -{ - class DDCommand : InstanceRootCommand - { - public DDCommand() - { - Keyword = "dd"; - 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() - { - return "Manage DreamDaemon"; - } - } - - class DDWorldAnnounceCommand : ConsoleCommand - { - 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 = Interface.GetComponent().WorldAnnounce(String.Join(" ", parameters)); - OutputProc(res ?? "Success!"); - return res == null ? ExitCode.Normal : ExitCode.ServerError; - } - } - - class DDStartCommand : ConsoleCommand - { - public DDStartCommand() - { - Keyword = "start"; - } - - public override string GetHelpText() - { - return "Starts the server and watchdog"; - } - - protected override ExitCode Run(IList parameters) - { - var res = Interface.GetComponent().Start(); - OutputProc(res ?? "Success!"); - return res == null ? ExitCode.Normal : ExitCode.ServerError; - } - } - - class DDStopCommand : ConsoleCommand - { - public DDStopCommand() - { - Keyword = "stop"; - } - public override string GetArgumentString() - { - return "[--graceful]"; - } - - public override string GetHelpText() - { - return "Stops the server and watchdog optionally waiting for the current round to end"; - } - - protected override ExitCode Run(IList parameters) - { - var DD = Interface.GetComponent(); - if (parameters.Count > 0 && parameters[0].ToLower() == "--graceful") - { - if (DD.DaemonStatus() != DreamDaemonStatus.Online) - { - OutputProc("Error: The game is not currently running!"); - return ExitCode.ServerError; - } - DD.RequestStop(); - return ExitCode.Normal; - } - var res = DD.Stop(); - OutputProc(res ?? "Success!"); - return res == null ? ExitCode.Normal : ExitCode.ServerError; - } - } - class DDRestartCommand : ConsoleCommand - { - public DDRestartCommand() - { - Keyword = "restart"; - } - - public override string GetArgumentString() - { - return "[--graceful]"; - } - protected override ExitCode Run(IList parameters) - { - var DD = Interface.GetComponent(); - if (parameters.Count > 0 && parameters[0].ToLower() == "--graceful") - { - if (DD.DaemonStatus() != DreamDaemonStatus.Online) - { - OutputProc("Error: The game is not currently running!"); - return ExitCode.ServerError; - } - DD.RequestRestart(); - return ExitCode.Normal; - } - var res = DD.Restart(); - OutputProc(res ?? "Success!"); - return res == null ? ExitCode.Normal : ExitCode.ServerError; - } - - public override string GetHelpText() - { - return "Restarts the server and watchdog optionally waiting for the current round to end"; - } - } - class DDStatusCommand : ConsoleCommand - { - public DDStatusCommand() - { - Keyword = "status"; - } - - public override string GetHelpText() - { - return "Gets the current status of the watchdog and server"; - } - - protected override ExitCode Run(IList parameters) - { - var DD = Interface.GetComponent(); - OutputProc(DD.StatusString(true)); - if (DD.ShutdownInProgress()) - OutputProc("The server will shutdown once the current round completes."); - var pc = DD.PlayerCount(); - if (pc != -1) - OutputProc(pc + " connected clients"); - return ExitCode.Normal; - } - } - - class DDAutostartCommand : ConsoleCommand - { - public DDAutostartCommand() - { - Keyword = "autostart"; - RequiredParameters = 1; - } - - protected override ExitCode Run(IList parameters) - { - var DD = Interface.GetComponent(); - switch (parameters[0].ToLower()) - { - case "on": - DD.SetAutostart(true); - break; - case "off": - DD.SetAutostart(false); - break; - case "check": - OutputProc("Autostart is: " + (DD.Autostart() ? "On" : "Off")); - 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 autostarting of the game server with the service"; - } - } - class DDWebclientCommand : ConsoleCommand - { - public DDWebclientCommand() - { - Keyword = "webclient"; - RequiredParameters = 1; - } - - protected override ExitCode Run(IList parameters) - { - var DD = Interface.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 : ConsoleCommand - { - public DDPortCommand() - { - Keyword = "set-port"; - RequiredParameters = 1; - } - - protected override ExitCode Run(IList parameters) - { - ushort port; - try - { - port = Convert.ToUInt16(parameters[0]); - } - catch - { - OutputProc("Invalid port number!"); - return ExitCode.BadCommand; - } - - Interface.GetComponent().SetPort(port); - return ExitCode.Normal; - } - - public override string GetArgumentString() - { - return ""; - } - - public override string GetHelpText() - { - return "Sets the port DreamDaemon will open the server on. Requires a server restart to apply and queues a graceful one up"; - } - } - - class DDSecurityCommand : ConsoleCommand - { - public DDSecurityCommand() - { - Keyword = "set-security"; - RequiredParameters = 1; - } - - protected override ExitCode Run(IList parameters) - { - DreamDaemonSecurity sec; - switch (parameters[0].ToLower()) - { - case "safe": - sec = DreamDaemonSecurity.Safe; - break; - case "ultra": - case "ultrasafe": - sec = DreamDaemonSecurity.Ultrasafe; - break; - case "trust": - case "trusted": - sec = DreamDaemonSecurity.Trusted; - break; - default: - OutputProc("Invalid security word!"); - return ExitCode.BadCommand; - } - Interface.GetComponent().SetSecurityLevel(sec); - return ExitCode.Normal; - } - - public override string GetArgumentString() - { - return ""; - } - - public override string GetHelpText() - { - return "Sets the visibility option for the DreamDaemon world"; - } - } -} +using System; +using System.Collections.Generic; +using TGS.Interface; +using TGS.Interface.Components; + +namespace TGS.CommandLine +{ + class DDCommand : InstanceRootCommand + { + public DDCommand() + { + Keyword = "dd"; + 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() + { + return "Manage DreamDaemon"; + } + } + + class DDWorldAnnounceCommand : ConsoleCommand + { + 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 = Interface.GetComponent().WorldAnnounce(String.Join(" ", parameters)); + OutputProc(res ?? "Success!"); + return res == null ? ExitCode.Normal : ExitCode.ServerError; + } + } + + class DDStartCommand : ConsoleCommand + { + public DDStartCommand() + { + Keyword = "start"; + } + + public override string GetHelpText() + { + return "Starts the server and watchdog"; + } + + protected override ExitCode Run(IList parameters) + { + var res = Interface.GetComponent().Start(); + OutputProc(res ?? "Success!"); + return res == null ? ExitCode.Normal : ExitCode.ServerError; + } + } + + class DDStopCommand : ConsoleCommand + { + public DDStopCommand() + { + Keyword = "stop"; + } + public override string GetArgumentString() + { + return "[--graceful]"; + } + + public override string GetHelpText() + { + return "Stops the server and watchdog optionally waiting for the current round to end"; + } + + protected override ExitCode Run(IList parameters) + { + var DD = Interface.GetComponent(); + if (parameters.Count > 0 && parameters[0].ToLower() == "--graceful") + { + if (DD.DaemonStatus() != DreamDaemonStatus.Online) + { + OutputProc("Error: The game is not currently running!"); + return ExitCode.ServerError; + } + DD.RequestStop(); + return ExitCode.Normal; + } + var res = DD.Stop(); + OutputProc(res ?? "Success!"); + return res == null ? ExitCode.Normal : ExitCode.ServerError; + } + } + class DDRestartCommand : ConsoleCommand + { + public DDRestartCommand() + { + Keyword = "restart"; + } + + public override string GetArgumentString() + { + return "[--graceful]"; + } + protected override ExitCode Run(IList parameters) + { + var DD = Interface.GetComponent(); + if (parameters.Count > 0 && parameters[0].ToLower() == "--graceful") + { + if (DD.DaemonStatus() != DreamDaemonStatus.Online) + { + OutputProc("Error: The game is not currently running!"); + return ExitCode.ServerError; + } + DD.RequestRestart(); + return ExitCode.Normal; + } + var res = DD.Restart(); + OutputProc(res ?? "Success!"); + return res == null ? ExitCode.Normal : ExitCode.ServerError; + } + + public override string GetHelpText() + { + return "Restarts the server and watchdog optionally waiting for the current round to end"; + } + } + class DDStatusCommand : ConsoleCommand + { + public DDStatusCommand() + { + Keyword = "status"; + } + + public override string GetHelpText() + { + return "Gets the current status of the watchdog and server"; + } + + protected override ExitCode Run(IList parameters) + { + var DD = Interface.GetComponent(); + OutputProc(DD.StatusString(true)); + if (DD.ShutdownInProgress()) + OutputProc("The server will shutdown once the current round completes."); + var pc = DD.PlayerCount(); + if (pc != -1) + OutputProc(pc + " connected clients"); + return ExitCode.Normal; + } + } + + class DDAutostartCommand : ConsoleCommand + { + public DDAutostartCommand() + { + Keyword = "autostart"; + RequiredParameters = 1; + } + + protected override ExitCode Run(IList parameters) + { + var DD = Interface.GetComponent(); + switch (parameters[0].ToLower()) + { + case "on": + DD.SetAutostart(true); + break; + case "off": + DD.SetAutostart(false); + break; + case "check": + OutputProc("Autostart is: " + (DD.Autostart() ? "On" : "Off")); + 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 autostarting of the game server with the service"; + } + } + class DDWebclientCommand : ConsoleCommand + { + public DDWebclientCommand() + { + Keyword = "webclient"; + RequiredParameters = 1; + } + + protected override ExitCode Run(IList parameters) + { + var DD = Interface.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 : ConsoleCommand + { + public DDPortCommand() + { + Keyword = "set-port"; + RequiredParameters = 1; + } + + protected override ExitCode Run(IList parameters) + { + ushort port; + try + { + port = Convert.ToUInt16(parameters[0]); + } + catch + { + OutputProc("Invalid port number!"); + return ExitCode.BadCommand; + } + + Interface.GetComponent().SetPort(port); + return ExitCode.Normal; + } + + public override string GetArgumentString() + { + return ""; + } + + public override string GetHelpText() + { + return "Sets the port DreamDaemon will open the server on. Requires a server restart to apply and queues a graceful one up"; + } + } + + class DDSecurityCommand : ConsoleCommand + { + public DDSecurityCommand() + { + Keyword = "set-security"; + RequiredParameters = 1; + } + + protected override ExitCode Run(IList parameters) + { + DreamDaemonSecurity sec; + switch (parameters[0].ToLower()) + { + case "safe": + sec = DreamDaemonSecurity.Safe; + break; + case "ultra": + case "ultrasafe": + sec = DreamDaemonSecurity.Ultrasafe; + break; + case "trust": + case "trusted": + sec = DreamDaemonSecurity.Trusted; + break; + default: + OutputProc("Invalid security word!"); + return ExitCode.BadCommand; + } + Interface.GetComponent().SetSecurityLevel(sec); + return ExitCode.Normal; + } + + public override string GetArgumentString() + { + return ""; + } + + public override string GetHelpText() + { + return "Sets the visibility option for the DreamDaemon world"; + } + } +} diff --git a/TGCommandLine/DMCommands.cs b/TGS.CommandLine/DMCommands.cs similarity index 98% rename from TGCommandLine/DMCommands.cs rename to TGS.CommandLine/DMCommands.cs index cbc1ef6ae2..380f2307e7 100644 --- a/TGCommandLine/DMCommands.cs +++ b/TGS.CommandLine/DMCommands.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Threading; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGCommandLine +namespace TGS.CommandLine { class DMCommand : InstanceRootCommand { diff --git a/TGCommandLine/InstanceRootCommand.cs b/TGS.CommandLine/InstanceRootCommand.cs similarity index 94% rename from TGCommandLine/InstanceRootCommand.cs rename to TGS.CommandLine/InstanceRootCommand.cs index f430785e26..107fe20689 100644 --- a/TGCommandLine/InstanceRootCommand.cs +++ b/TGS.CommandLine/InstanceRootCommand.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; -using TGServiceInterface; +using TGS.Interface; -namespace TGCommandLine +namespace TGS.CommandLine { abstract class InstanceRootCommand : RootCommand { diff --git a/TGCommandLine/Program.cs b/TGS.CommandLine/Program.cs similarity index 95% rename from TGCommandLine/Program.cs rename to TGS.CommandLine/Program.cs index c1e7c18465..a9157d9512 100644 --- a/TGCommandLine/Program.cs +++ b/TGS.CommandLine/Program.cs @@ -1,285 +1,285 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using TGServiceInterface; -using TGServiceInterface.Components; - -namespace TGCommandLine -{ - class Program - { - static bool interactive = false, saidSrvVersion = false; - static IServerInterface currentInterface; - static Command.ExitCode RunCommandLine(IList argsAsList) - { - //first lookup the connection string - bool badConnectionString = false; - for (var I = 0; I < argsAsList.Count - 1; ++I) { - var lowerarg = argsAsList[I].ToLower(); - if (lowerarg == "-c" || lowerarg == "--connect") - { - var connectionString = argsAsList[I + 1]; - var splits = connectionString.Split('@'); - var userpass = splits[0].Split(':'); - if (splits.Length != 2 || userpass.Length != 2) - { - badConnectionString = true; - break; - } - var addrport = splits[1].Split(':'); - if (addrport.Length != 2) - { - badConnectionString = true; - break; - } - var username = userpass[0]; - var password = userpass[1]; - var address = addrport[0]; - ushort port; - try - { - port = Convert.ToUInt16(addrport[1]); - } - catch - { - badConnectionString = true; - break; - } - if(String.IsNullOrWhiteSpace(username) || String.IsNullOrWhiteSpace(password) || String.IsNullOrWhiteSpace(address)) - { - badConnectionString = true; - break; - } - argsAsList.RemoveAt(I); - argsAsList.RemoveAt(I); - ReplaceInterface(new ServerInterface(address, port, username, password)); - break; - } - } - - if (badConnectionString) - { - Console.WriteLine("Remote connection usage: <-c/--connect> username:password@address:port"); - return Command.ExitCode.BadCommand; - } - - var res = currentInterface.ConnectionStatus(out string error); - if (!res.HasFlag(ConnectivityLevel.Connected)) - { - Console.WriteLine("Unable to connect to service: " + error); - Console.WriteLine("Remote connection usage: <-c/--connect> username:password@address:port"); - return Command.ExitCode.ConnectionError; - } - - if (!res.HasFlag(ConnectivityLevel.Authenticated)) - { - Console.WriteLine("Authentication error: Username/password/windows identity is not authorized!"); - return Command.ExitCode.ConnectionError; - } - - if (!SentVMMWarning && currentInterface.VersionMismatch(out error)) - { - SentVMMWarning = true; - Console.WriteLine(error); - } - else if (interactive && !saidSrvVersion) - { - Console.WriteLine("Connectd to service version: " + currentInterface.GetServiceComponent().Version()); - saidSrvVersion = true; - } - - try - { - return new CLICommand(currentInterface).DoRun(argsAsList); - } - catch (Exception e) - { - Console.WriteLine("Error: " + e.ToString()); - return Command.ExitCode.ConnectionError; - }; - } - - static void ReplaceInterface(IServerInterface I) - { - currentInterface = I; - ConsoleCommand.Interface = I; - InstanceRootCommand.currentInterface = I; - saidSrvVersion = false; - } - - public static string ReadLineSecure() - { - string result = ""; - while (true) - { - ConsoleKeyInfo i = Console.ReadKey(true); - if (i.Key == ConsoleKey.Enter) - { - break; - } - else if (i.Key == ConsoleKey.Backspace) - { - if (result.Length > 0) - { - result = result.Substring(0, result.Length - 1); - Console.Write("\b \b"); - } - } - else - { - result += i.KeyChar; - Console.Write("*"); - } - } - Console.WriteLine(); - return result; - } - static bool SentVMMWarning = false; - static string AcceptedBadCert; - static bool BadCertificateInteractive(string message) - { - if (AcceptedBadCert == message) - return true; - Console.WriteLine(message); - Console.Write("Do you wish to continue? NOT RECCOMENDED! (y/N): "); - var result = Console.ReadLine().Trim().ToLower(); - if (result == "y" || result == "yes") - { - AcceptedBadCert = message; - return true; - } - return false; - } - - /// - /// Tries to set 's to , outputting appropriate messages - /// - /// The name of the to test - /// If , does not output on success - /// if a was achieved with , otherwise - static bool CheckInstanceConnectivity(string instanceName, bool silentSuccess) - { - var res = currentInterface.ConnectToInstance(instanceName); - if (!res.HasFlag(ConnectivityLevel.Connected)) - Console.WriteLine("Unable to connect to instance! Does it exist?"); - else if (!res.HasFlag(ConnectivityLevel.Authenticated)) - Console.WriteLine("The current user is not authorized to use this instance!"); - else - { - if(!silentSuccess) - Console.WriteLine("Successfully conected to instance!"); - return true; - } - return false; - } - - static int Main(string[] args) - { - ReplaceInterface(new ServerInterface()); - Command.OutputProcVar.Value = Console.WriteLine; - if (args.Length != 0) - { - var argsAsList = new List(args); - for (var I = 0; I < argsAsList.Count - 1; ++I) - { - if (argsAsList[I].ToLower() == "--instance") - { - if (!CheckInstanceConnectivity(args[I + 1], true)) - return (int)Command.ExitCode.ConnectionError; - argsAsList.RemoveRange(I, 2); - break; - } - else if (argsAsList[I].ToLower() == "--disable-ssl-verification") //im just not even going to document this because i hate it so much - { - argsAsList.RemoveAt(I); - --I; - ServerInterface.SetBadCertificateHandler(_ => false); - } - } - return (int)RunCommandLine(argsAsList); - } - //interactive mode - ServerInterface.SetBadCertificateHandler(BadCertificateInteractive); - Console.WriteLine("Type 'instance' to connect to a server instance"); - Console.WriteLine("Type 'remote' to connect to a remote service"); - while (true) - { - Console.Write("Enter command: "); - var NextCommand = Console.ReadLine(); - switch (NextCommand.ToLower()) - { - case "instance": - Console.Write("Enter instance name: "); - CheckInstanceConnectivity(Console.ReadLine(), false); - break; - case "remote": - SentVMMWarning = false; - Console.Write("Enter server address: "); - var address = Console.ReadLine(); - Console.Write("Enter server port: "); - ushort port; - try{ - port = Convert.ToUInt16(Console.ReadLine()); - } - catch - { - Console.WriteLine("Error: Bad port!"); - break; - } - Console.Write("Enter username: "); - var username = Console.ReadLine(); - Console.Write("Enter password: "); - var password = ReadLineSecure(); - ReplaceInterface(new ServerInterface(address, port, username, password)); - var res = currentInterface.ConnectionStatus(out string error); - if (!res.HasFlag(ConnectivityLevel.Connected)) - { - Console.WriteLine("Unable to connect: " + error); - ReplaceInterface(new ServerInterface()); - } - else if (!res.HasFlag(ConnectivityLevel.Authenticated)) - { - Console.WriteLine("Authentication error: Username/password/windows identity is not authorized! Returning to local mode..."); - ReplaceInterface(new ServerInterface()); - } - else - { - Console.WriteLine("Connected remotely"); - if (currentInterface.VersionMismatch(out error)) - { - SentVMMWarning = true; - Console.WriteLine(error); - } - Console.WriteLine("Type 'disconnect' to return to local mode"); - } - break; - case "disconnect": - SentVMMWarning = false; - ReplaceInterface(new ServerInterface()); - Console.WriteLine("Switch to local mode"); - break; - case "quit": - case "exit": - return (int)Command.ExitCode.Normal; -#if DEBUG - case "debug-upgrade": - currentInterface.GetComponent().PrepareForUpdate(); - return (int)Command.ExitCode.Normal; -#endif - default: - //linq voodoo to get quoted strings - var formattedCommand = NextCommand.Split('"') - .Select((element, index) => index % 2 == 0 // If even index - ? element.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) // Split the item - : new string[] { element }) // Keep the entire item - .SelectMany(element => element).ToList(); - - formattedCommand = formattedCommand.Select(x => x.Trim()).ToList(); - formattedCommand.Remove(""); - RunCommandLine(formattedCommand); - break; - } - } - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using TGS.Interface; +using TGS.Interface.Components; + +namespace TGS.CommandLine +{ + class Program + { + static bool interactive = false, saidSrvVersion = false; + static IServerInterface currentInterface; + static Command.ExitCode RunCommandLine(IList argsAsList) + { + //first lookup the connection string + bool badConnectionString = false; + for (var I = 0; I < argsAsList.Count - 1; ++I) { + var lowerarg = argsAsList[I].ToLower(); + if (lowerarg == "-c" || lowerarg == "--connect") + { + var connectionString = argsAsList[I + 1]; + var splits = connectionString.Split('@'); + var userpass = splits[0].Split(':'); + if (splits.Length != 2 || userpass.Length != 2) + { + badConnectionString = true; + break; + } + var addrport = splits[1].Split(':'); + if (addrport.Length != 2) + { + badConnectionString = true; + break; + } + var username = userpass[0]; + var password = userpass[1]; + var address = addrport[0]; + ushort port; + try + { + port = Convert.ToUInt16(addrport[1]); + } + catch + { + badConnectionString = true; + break; + } + if(String.IsNullOrWhiteSpace(username) || String.IsNullOrWhiteSpace(password) || String.IsNullOrWhiteSpace(address)) + { + badConnectionString = true; + break; + } + argsAsList.RemoveAt(I); + argsAsList.RemoveAt(I); + ReplaceInterface(new ServerInterface(address, port, username, password)); + break; + } + } + + if (badConnectionString) + { + Console.WriteLine("Remote connection usage: <-c/--connect> username:password@address:port"); + return Command.ExitCode.BadCommand; + } + + var res = currentInterface.ConnectionStatus(out string error); + if (!res.HasFlag(ConnectivityLevel.Connected)) + { + Console.WriteLine("Unable to connect to service: " + error); + Console.WriteLine("Remote connection usage: <-c/--connect> username:password@address:port"); + return Command.ExitCode.ConnectionError; + } + + if (!res.HasFlag(ConnectivityLevel.Authenticated)) + { + Console.WriteLine("Authentication error: Username/password/windows identity is not authorized!"); + return Command.ExitCode.ConnectionError; + } + + if (!SentVMMWarning && currentInterface.VersionMismatch(out error)) + { + SentVMMWarning = true; + Console.WriteLine(error); + } + else if (interactive && !saidSrvVersion) + { + Console.WriteLine("Connectd to service version: " + currentInterface.GetServiceComponent().Version()); + saidSrvVersion = true; + } + + try + { + return new CLICommand(currentInterface).DoRun(argsAsList); + } + catch (Exception e) + { + Console.WriteLine("Error: " + e.ToString()); + return Command.ExitCode.ConnectionError; + }; + } + + static void ReplaceInterface(IServerInterface I) + { + currentInterface = I; + ConsoleCommand.Interface = I; + InstanceRootCommand.currentInterface = I; + saidSrvVersion = false; + } + + public static string ReadLineSecure() + { + string result = ""; + while (true) + { + ConsoleKeyInfo i = Console.ReadKey(true); + if (i.Key == ConsoleKey.Enter) + { + break; + } + else if (i.Key == ConsoleKey.Backspace) + { + if (result.Length > 0) + { + result = result.Substring(0, result.Length - 1); + Console.Write("\b \b"); + } + } + else + { + result += i.KeyChar; + Console.Write("*"); + } + } + Console.WriteLine(); + return result; + } + static bool SentVMMWarning = false; + static string AcceptedBadCert; + static bool BadCertificateInteractive(string message) + { + if (AcceptedBadCert == message) + return true; + Console.WriteLine(message); + Console.Write("Do you wish to continue? NOT RECCOMENDED! (y/N): "); + var result = Console.ReadLine().Trim().ToLower(); + if (result == "y" || result == "yes") + { + AcceptedBadCert = message; + return true; + } + return false; + } + + /// + /// Tries to set 's to , outputting appropriate messages + /// + /// The name of the to test + /// If , does not output on success + /// if a was achieved with , otherwise + static bool CheckInstanceConnectivity(string instanceName, bool silentSuccess) + { + var res = currentInterface.ConnectToInstance(instanceName); + if (!res.HasFlag(ConnectivityLevel.Connected)) + Console.WriteLine("Unable to connect to instance! Does it exist?"); + else if (!res.HasFlag(ConnectivityLevel.Authenticated)) + Console.WriteLine("The current user is not authorized to use this instance!"); + else + { + if(!silentSuccess) + Console.WriteLine("Successfully conected to instance!"); + return true; + } + return false; + } + + static int Main(string[] args) + { + ReplaceInterface(new ServerInterface()); + Command.OutputProcVar.Value = Console.WriteLine; + if (args.Length != 0) + { + var argsAsList = new List(args); + for (var I = 0; I < argsAsList.Count - 1; ++I) + { + if (argsAsList[I].ToLower() == "--instance") + { + if (!CheckInstanceConnectivity(args[I + 1], true)) + return (int)Command.ExitCode.ConnectionError; + argsAsList.RemoveRange(I, 2); + break; + } + else if (argsAsList[I].ToLower() == "--disable-ssl-verification") //im just not even going to document this because i hate it so much + { + argsAsList.RemoveAt(I); + --I; + ServerInterface.SetBadCertificateHandler(_ => false); + } + } + return (int)RunCommandLine(argsAsList); + } + //interactive mode + ServerInterface.SetBadCertificateHandler(BadCertificateInteractive); + Console.WriteLine("Type 'instance' to connect to a server instance"); + Console.WriteLine("Type 'remote' to connect to a remote service"); + while (true) + { + Console.Write("Enter command: "); + var NextCommand = Console.ReadLine(); + switch (NextCommand.ToLower()) + { + case "instance": + Console.Write("Enter instance name: "); + CheckInstanceConnectivity(Console.ReadLine(), false); + break; + case "remote": + SentVMMWarning = false; + Console.Write("Enter server address: "); + var address = Console.ReadLine(); + Console.Write("Enter server port: "); + ushort port; + try{ + port = Convert.ToUInt16(Console.ReadLine()); + } + catch + { + Console.WriteLine("Error: Bad port!"); + break; + } + Console.Write("Enter username: "); + var username = Console.ReadLine(); + Console.Write("Enter password: "); + var password = ReadLineSecure(); + ReplaceInterface(new ServerInterface(address, port, username, password)); + var res = currentInterface.ConnectionStatus(out string error); + if (!res.HasFlag(ConnectivityLevel.Connected)) + { + Console.WriteLine("Unable to connect: " + error); + ReplaceInterface(new ServerInterface()); + } + else if (!res.HasFlag(ConnectivityLevel.Authenticated)) + { + Console.WriteLine("Authentication error: Username/password/windows identity is not authorized! Returning to local mode..."); + ReplaceInterface(new ServerInterface()); + } + else + { + Console.WriteLine("Connected remotely"); + if (currentInterface.VersionMismatch(out error)) + { + SentVMMWarning = true; + Console.WriteLine(error); + } + Console.WriteLine("Type 'disconnect' to return to local mode"); + } + break; + case "disconnect": + SentVMMWarning = false; + ReplaceInterface(new ServerInterface()); + Console.WriteLine("Switch to local mode"); + break; + case "quit": + case "exit": + return (int)Command.ExitCode.Normal; +#if DEBUG + case "debug-upgrade": + currentInterface.GetComponent().PrepareForUpdate(); + return (int)Command.ExitCode.Normal; +#endif + default: + //linq voodoo to get quoted strings + var formattedCommand = NextCommand.Split('"') + .Select((element, index) => index % 2 == 0 // If even index + ? element.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) // Split the item + : new string[] { element }) // Keep the entire item + .SelectMany(element => element).ToList(); + + formattedCommand = formattedCommand.Select(x => x.Trim()).ToList(); + formattedCommand.Remove(""); + RunCommandLine(formattedCommand); + break; + } + } + } + } +} diff --git a/TGCommandLine/Properties/AssemblyInfo.cs b/TGS.CommandLine/Properties/AssemblyInfo.cs similarity index 97% rename from TGCommandLine/Properties/AssemblyInfo.cs rename to TGS.CommandLine/Properties/AssemblyInfo.cs index 7017cbba7f..ba9129eaba 100644 --- a/TGCommandLine/Properties/AssemblyInfo.cs +++ b/TGS.CommandLine/Properties/AssemblyInfo.cs @@ -1,17 +1,17 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("TGStation Server Commandline")] -[assembly: AssemblyDescription("CLI for the TG Station Server Service")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("9ad1f086-a83e-4d14-a844-58a9471106b6")] +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("TGStation Server Commandline")] +[assembly: AssemblyDescription("CLI for the TG Station Server Service")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("9ad1f086-a83e-4d14-a844-58a9471106b6")] diff --git a/TGCommandLine/RepoCommands.cs b/TGS.CommandLine/RepoCommands.cs similarity index 99% rename from TGCommandLine/RepoCommands.cs rename to TGS.CommandLine/RepoCommands.cs index 9e3fe3e658..a24a26d68f 100644 --- a/TGCommandLine/RepoCommands.cs +++ b/TGS.CommandLine/RepoCommands.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGCommandLine +namespace TGS.CommandLine { class RepoCommand : RootCommand { diff --git a/TGCommandLine/RootCommands.cs b/TGS.CommandLine/RootCommands.cs similarity index 98% rename from TGCommandLine/RootCommands.cs rename to TGS.CommandLine/RootCommands.cs index 552e7b1bf7..de6edae4ac 100644 --- a/TGCommandLine/RootCommands.cs +++ b/TGS.CommandLine/RootCommands.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGCommandLine +namespace TGS.CommandLine { class CLICommand : RootCommand { diff --git a/TGCommandLine/ServiceCommands.cs b/TGS.CommandLine/ServiceCommands.cs similarity index 97% rename from TGCommandLine/ServiceCommands.cs rename to TGS.CommandLine/ServiceCommands.cs index a52cd40dec..833469d0c8 100644 --- a/TGCommandLine/ServiceCommands.cs +++ b/TGS.CommandLine/ServiceCommands.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGCommandLine +namespace TGS.CommandLine { /// /// Used for managing the components @@ -316,7 +316,7 @@ namespace TGCommandLine } /// - /// Command for calling + /// Command for calling /// class ServiceRemoteAccessPortCommand : ConsoleCommand { @@ -343,7 +343,7 @@ namespace TGCommandLine } /// - /// Command for calling + /// Command for calling /// class ServiceSetRemoteAccessPortCommand : ConsoleCommand { diff --git a/TGCommandLine/TGCommandLine.csproj b/TGS.CommandLine/TGS.CommandLine.csproj similarity index 92% rename from TGCommandLine/TGCommandLine.csproj rename to TGS.CommandLine/TGS.CommandLine.csproj index b228dbaccc..a4086c5979 100644 --- a/TGCommandLine/TGCommandLine.csproj +++ b/TGS.CommandLine/TGS.CommandLine.csproj @@ -6,7 +6,7 @@ AnyCPU {89191F69-B18E-4B59-B72E-E12F9B6811A0} Exe - TGCommandLine + TGS.CommandLine TGCommandLine v4.5.2 512 @@ -31,7 +31,7 @@ bin\Release\ TRACE - bin\x86\Release\TGCommandLine.xml + bin\x86\Release\TGS.CommandLine.xml true true pdbonly @@ -63,9 +63,9 @@ - + {ac4e7e8b-f83a-481c-a8b0-8fa4e8ae59ab} - TGServiceInterface + TGS.Interface diff --git a/TGCommandLine/tgs.ico b/TGS.CommandLine/tgs.ico similarity index 100% rename from TGCommandLine/tgs.ico rename to TGS.CommandLine/tgs.ico diff --git a/TGControlPanel/App.config b/TGS.ControlPanel/App.config similarity index 82% rename from TGControlPanel/App.config rename to TGS.ControlPanel/App.config index 16dd5b3a27..f753d0fbb0 100644 --- a/TGControlPanel/App.config +++ b/TGS.ControlPanel/App.config @@ -3,8 +3,8 @@ -
-
+
+
@@ -13,7 +13,7 @@ - + 0 @@ -50,12 +50,12 @@ - - + + 0 - + https://github.com/tgstation/tgstation.git diff --git a/TGControlPanel/ControlPanel/ByondPage.cs b/TGS.ControlPanel/ControlPanel/ByondPage.cs similarity index 96% rename from TGControlPanel/ControlPanel/ByondPage.cs rename to TGS.ControlPanel/ControlPanel/ByondPage.cs index 1e65d7daa2..4935b7b3e4 100644 --- a/TGControlPanel/ControlPanel/ByondPage.cs +++ b/TGS.ControlPanel/ControlPanel/ByondPage.cs @@ -1,9 +1,9 @@ using System; using System.Windows.Forms; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGControlPanel +namespace TGS.ControlPanel { partial class ControlPanel { diff --git a/TGControlPanel/ControlPanel/ChatPage.cs b/TGS.ControlPanel/ControlPanel/ChatPage.cs similarity index 98% rename from TGControlPanel/ControlPanel/ChatPage.cs rename to TGS.ControlPanel/ControlPanel/ChatPage.cs index bea75efbff..96a666d5c6 100644 --- a/TGControlPanel/ControlPanel/ChatPage.cs +++ b/TGS.ControlPanel/ControlPanel/ChatPage.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Windows.Forms; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGControlPanel +namespace TGS.ControlPanel { partial class ControlPanel { diff --git a/TGControlPanel/ControlPanel/ControlPanel.Designer.cs b/TGS.ControlPanel/ControlPanel/ControlPanel.Designer.cs similarity index 99% rename from TGControlPanel/ControlPanel/ControlPanel.Designer.cs rename to TGS.ControlPanel/ControlPanel/ControlPanel.Designer.cs index 2091401f42..ba5d05108f 100644 --- a/TGControlPanel/ControlPanel/ControlPanel.Designer.cs +++ b/TGS.ControlPanel/ControlPanel/ControlPanel.Designer.cs @@ -1,4 +1,4 @@ -namespace TGControlPanel +namespace TGS.ControlPanel { partial class ControlPanel { diff --git a/TGControlPanel/ControlPanel/ControlPanel.cs b/TGS.ControlPanel/ControlPanel/ControlPanel.cs similarity index 97% rename from TGControlPanel/ControlPanel/ControlPanel.cs rename to TGS.ControlPanel/ControlPanel/ControlPanel.cs index f662e50cae..eff20b2e33 100644 --- a/TGControlPanel/ControlPanel/ControlPanel.cs +++ b/TGS.ControlPanel/ControlPanel/ControlPanel.cs @@ -2,10 +2,10 @@ using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGControlPanel +namespace TGS.ControlPanel { /// /// The main form diff --git a/TGControlPanel/ControlPanel/ControlPanel.resx b/TGS.ControlPanel/ControlPanel/ControlPanel.resx similarity index 100% rename from TGControlPanel/ControlPanel/ControlPanel.resx rename to TGS.ControlPanel/ControlPanel/ControlPanel.resx diff --git a/TGControlPanel/ControlPanel/RepoPage.cs b/TGS.ControlPanel/ControlPanel/RepoPage.cs similarity index 99% rename from TGControlPanel/ControlPanel/RepoPage.cs rename to TGS.ControlPanel/ControlPanel/RepoPage.cs index 6e99c62277..c6b5658e9d 100644 --- a/TGControlPanel/ControlPanel/RepoPage.cs +++ b/TGS.ControlPanel/ControlPanel/RepoPage.cs @@ -2,10 +2,10 @@ using System.ComponentModel; using System.Windows.Forms; using System.Threading; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGControlPanel +namespace TGS.ControlPanel { partial class ControlPanel { diff --git a/TGControlPanel/ControlPanel/ServerPage.cs b/TGS.ControlPanel/ControlPanel/ServerPage.cs similarity index 99% rename from TGControlPanel/ControlPanel/ServerPage.cs rename to TGS.ControlPanel/ControlPanel/ServerPage.cs index 10b5363383..406b402fd4 100644 --- a/TGControlPanel/ControlPanel/ServerPage.cs +++ b/TGS.ControlPanel/ControlPanel/ServerPage.cs @@ -5,10 +5,10 @@ using System.ComponentModel; using System.Reflection; using System.Threading.Tasks; using System.Windows.Forms; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGControlPanel +namespace TGS.ControlPanel { partial class ControlPanel { diff --git a/TGControlPanel/ControlPanel/StaticPage.cs b/TGS.ControlPanel/ControlPanel/StaticPage.cs similarity index 99% rename from TGControlPanel/ControlPanel/StaticPage.cs rename to TGS.ControlPanel/ControlPanel/StaticPage.cs index f944570837..0d53e7b680 100644 --- a/TGControlPanel/ControlPanel/StaticPage.cs +++ b/TGS.ControlPanel/ControlPanel/StaticPage.cs @@ -2,10 +2,10 @@ using System.Collections.Generic; using System.IO; using System.Windows.Forms; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGControlPanel +namespace TGS.ControlPanel { partial class ControlPanel { diff --git a/TGControlPanel/CountedForm.cs b/TGS.ControlPanel/CountedForm.cs similarity index 97% rename from TGControlPanel/CountedForm.cs rename to TGS.ControlPanel/CountedForm.cs index 37d7df2607..03ac979ab5 100644 --- a/TGControlPanel/CountedForm.cs +++ b/TGS.ControlPanel/CountedForm.cs @@ -1,6 +1,6 @@ using System.Windows.Forms; -namespace TGControlPanel +namespace TGS.ControlPanel { /// /// Calls when all s are d diff --git a/TGControlPanel/GithubLoginPrompt.Designer.cs b/TGS.ControlPanel/GithubLoginPrompt.Designer.cs similarity index 99% rename from TGControlPanel/GithubLoginPrompt.Designer.cs rename to TGS.ControlPanel/GithubLoginPrompt.Designer.cs index 04df96ab1a..6035c273a7 100644 --- a/TGControlPanel/GithubLoginPrompt.Designer.cs +++ b/TGS.ControlPanel/GithubLoginPrompt.Designer.cs @@ -1,4 +1,4 @@ -namespace TGControlPanel +namespace TGS.ControlPanel { partial class GitHubLoginPrompt { diff --git a/TGControlPanel/GithubLoginPrompt.cs b/TGS.ControlPanel/GithubLoginPrompt.cs similarity index 96% rename from TGControlPanel/GithubLoginPrompt.cs rename to TGS.ControlPanel/GithubLoginPrompt.cs index a90c7353cc..8d676d1646 100644 --- a/TGControlPanel/GithubLoginPrompt.cs +++ b/TGS.ControlPanel/GithubLoginPrompt.cs @@ -2,9 +2,9 @@ using System; using System.Threading.Tasks; using System.Windows.Forms; -using TGServiceInterface; +using TGS.Interface; -namespace TGControlPanel +namespace TGS.ControlPanel { /// /// Used for recieving a GitHub API key for use in @@ -76,7 +76,7 @@ namespace TGControlPanel try { client.Credentials = new Credentials(UsernameTextBox.Text, PasswordTextBox.Text); - var token = await client.Authorization.Create(new NewAuthorization { Note = "TGControlPanel token to bypass rate limiting" }); + var token = await client.Authorization.Create(new NewAuthorization { Note = "TGS.ControlPanel token to bypass rate limiting" }); APIKey = token.Token; } catch (AuthorizationException) diff --git a/TGControlPanel/GithubLoginPrompt.resx b/TGS.ControlPanel/GithubLoginPrompt.resx similarity index 100% rename from TGControlPanel/GithubLoginPrompt.resx rename to TGS.ControlPanel/GithubLoginPrompt.resx diff --git a/TGControlPanel/InstanceSelector.Designer.cs b/TGS.ControlPanel/InstanceSelector.Designer.cs similarity index 99% rename from TGControlPanel/InstanceSelector.Designer.cs rename to TGS.ControlPanel/InstanceSelector.Designer.cs index cfaf0a5ab5..87ce1038b7 100644 --- a/TGControlPanel/InstanceSelector.Designer.cs +++ b/TGS.ControlPanel/InstanceSelector.Designer.cs @@ -1,4 +1,4 @@ -namespace TGControlPanel +namespace TGS.ControlPanel { partial class InstanceSelector { diff --git a/TGControlPanel/InstanceSelector.cs b/TGS.ControlPanel/InstanceSelector.cs similarity index 99% rename from TGControlPanel/InstanceSelector.cs rename to TGS.ControlPanel/InstanceSelector.cs index ba46fc11f6..504b2218b9 100644 --- a/TGControlPanel/InstanceSelector.cs +++ b/TGS.ControlPanel/InstanceSelector.cs @@ -2,10 +2,10 @@ using System.Collections.Generic; using System.Threading.Tasks; using System.Windows.Forms; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGControlPanel +namespace TGS.ControlPanel { /// /// Form used for managing manipulation functions diff --git a/TGControlPanel/InstanceSelector.resx b/TGS.ControlPanel/InstanceSelector.resx similarity index 100% rename from TGControlPanel/InstanceSelector.resx rename to TGS.ControlPanel/InstanceSelector.resx diff --git a/TGControlPanel/Login.Designer.cs b/TGS.ControlPanel/Login.Designer.cs similarity index 99% rename from TGControlPanel/Login.Designer.cs rename to TGS.ControlPanel/Login.Designer.cs index ab89ca606b..2e7a9afbc6 100644 --- a/TGControlPanel/Login.Designer.cs +++ b/TGS.ControlPanel/Login.Designer.cs @@ -1,4 +1,4 @@ -namespace TGControlPanel +namespace TGS.ControlPanel { partial class Login { diff --git a/TGControlPanel/Login.cs b/TGS.ControlPanel/Login.cs similarity index 98% rename from TGControlPanel/Login.cs rename to TGS.ControlPanel/Login.cs index 882592d1cc..4897e5260d 100644 --- a/TGControlPanel/Login.cs +++ b/TGS.ControlPanel/Login.cs @@ -1,8 +1,8 @@ using System; using System.Windows.Forms; -using TGServiceInterface; +using TGS.Interface; -namespace TGControlPanel +namespace TGS.ControlPanel { sealed partial class Login : CountedForm { diff --git a/TGControlPanel/Login.resx b/TGS.ControlPanel/Login.resx similarity index 100% rename from TGControlPanel/Login.resx rename to TGS.ControlPanel/Login.resx diff --git a/TGControlPanel/Program.cs b/TGS.ControlPanel/Program.cs similarity index 98% rename from TGControlPanel/Program.cs rename to TGS.ControlPanel/Program.cs index 4865d338df..c0598cbdd9 100644 --- a/TGControlPanel/Program.cs +++ b/TGS.ControlPanel/Program.cs @@ -1,9 +1,9 @@ using System; using System.Windows.Forms; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGControlPanel +namespace TGS.ControlPanel { static class Program { diff --git a/TGControlPanel/Properties/AssemblyInfo.cs b/TGS.ControlPanel/Properties/AssemblyInfo.cs similarity index 97% rename from TGControlPanel/Properties/AssemblyInfo.cs rename to TGS.ControlPanel/Properties/AssemblyInfo.cs index 8b5fb88ca1..1f05bee96e 100644 --- a/TGControlPanel/Properties/AssemblyInfo.cs +++ b/TGS.ControlPanel/Properties/AssemblyInfo.cs @@ -1,16 +1,16 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("TGStation Server Control Panel")] -[assembly: AssemblyDescription("Control panel for the TG Station Server Service")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("394e7643-6b8c-416f-ab18-95ac12648cdc")] +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("TGStation Server Control Panel")] +[assembly: AssemblyDescription("Control panel for the TG Station Server Service")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("394e7643-6b8c-416f-ab18-95ac12648cdc")] diff --git a/TGControlPanel/Properties/Settings.Designer.cs b/TGS.ControlPanel/Properties/Settings.Designer.cs similarity index 99% rename from TGControlPanel/Properties/Settings.Designer.cs rename to TGS.ControlPanel/Properties/Settings.Designer.cs index 86ec264975..50131930ce 100644 --- a/TGControlPanel/Properties/Settings.Designer.cs +++ b/TGS.ControlPanel/Properties/Settings.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace TGControlPanel.Properties { +namespace TGS.ControlPanel.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] diff --git a/TGControlPanel/Properties/Settings.settings b/TGS.ControlPanel/Properties/Settings.settings similarity index 95% rename from TGControlPanel/Properties/Settings.settings rename to TGS.ControlPanel/Properties/Settings.settings index 54c6fc8cd4..2a1efd2454 100644 --- a/TGControlPanel/Properties/Settings.settings +++ b/TGS.ControlPanel/Properties/Settings.settings @@ -1,5 +1,5 @@  - + diff --git a/TGControlPanel/ServerOpForm.cs b/TGS.ControlPanel/ServerOpForm.cs similarity index 63% rename from TGControlPanel/ServerOpForm.cs rename to TGS.ControlPanel/ServerOpForm.cs index 2a886e742d..d3843c7c2b 100644 --- a/TGControlPanel/ServerOpForm.cs +++ b/TGS.ControlPanel/ServerOpForm.cs @@ -2,10 +2,10 @@ using System.Threading.Tasks; using System.Windows.Forms; -namespace TGControlPanel +namespace TGS.ControlPanel { /// - /// Used to provide an ATP function for calls into an + /// Used to provide an ATP function for calls into an /// #if !DEBUG abstract class ServerOpForm : Form @@ -14,9 +14,9 @@ namespace TGControlPanel #endif { /// - /// Used to wrap calls in a non-blocking fashion while disabling the and enabling the wait cursor + /// Used to wrap calls in a non-blocking fashion while disabling the and enabling the wait cursor /// - /// The operation to wrap + /// The operation to wrap /// A wrapping protected Task WrapServerOp(Action action) { diff --git a/TGControlPanel/TGControlPanel.csproj b/TGS.ControlPanel/TGS.ControlPanel.csproj similarity index 95% rename from TGControlPanel/TGControlPanel.csproj rename to TGS.ControlPanel/TGS.ControlPanel.csproj index fb3db6a4a6..8866aebb61 100644 --- a/TGControlPanel/TGControlPanel.csproj +++ b/TGS.ControlPanel/TGS.ControlPanel.csproj @@ -6,7 +6,7 @@ AnyCPU {394E7643-6B8C-416F-AB18-95AC12648CDC} WinExe - TGControlPanel + TGS.ControlPanel TGControlPanel v4.5.2 512 @@ -30,7 +30,7 @@ bin\Release\ TRACE - bin\x86\Release\TGControlPanel.xml + bin\x86\Release\TGS.ControlPanel.xml true true pdbonly @@ -139,9 +139,9 @@ - + {ac4e7e8b-f83a-481c-a8b0-8fa4e8ae59ab} - TGServiceInterface + TGS.Interface diff --git a/TGControlPanel/TestMergeManager.Designer.cs b/TGS.ControlPanel/TestMergeManager.Designer.cs similarity index 99% rename from TGControlPanel/TestMergeManager.Designer.cs rename to TGS.ControlPanel/TestMergeManager.Designer.cs index ab229d5fdd..e73ba3944e 100644 --- a/TGControlPanel/TestMergeManager.Designer.cs +++ b/TGS.ControlPanel/TestMergeManager.Designer.cs @@ -1,4 +1,4 @@ -namespace TGControlPanel +namespace TGS.ControlPanel { partial class TestMergeManager { diff --git a/TGControlPanel/TestMergeManager.cs b/TGS.ControlPanel/TestMergeManager.cs similarity index 99% rename from TGControlPanel/TestMergeManager.cs rename to TGS.ControlPanel/TestMergeManager.cs index d766e3dfe0..f609142431 100644 --- a/TGControlPanel/TestMergeManager.cs +++ b/TGS.ControlPanel/TestMergeManager.cs @@ -4,10 +4,10 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGControlPanel +namespace TGS.ControlPanel { sealed partial class TestMergeManager : ServerOpForm { diff --git a/TGControlPanel/TestMergeManager.resx b/TGS.ControlPanel/TestMergeManager.resx similarity index 100% rename from TGControlPanel/TestMergeManager.resx rename to TGS.ControlPanel/TestMergeManager.resx diff --git a/TGControlPanel/packages.config b/TGS.ControlPanel/packages.config similarity index 100% rename from TGControlPanel/packages.config rename to TGS.ControlPanel/packages.config diff --git a/TGControlPanel/tgs.ico b/TGS.ControlPanel/tgs.ico similarity index 100% rename from TGControlPanel/tgs.ico rename to TGS.ControlPanel/tgs.ico diff --git a/TGInstallerWrapper/App.config b/TGS.Installer.UI/App.config similarity index 100% rename from TGInstallerWrapper/App.config rename to TGS.Installer.UI/App.config diff --git a/TGInstallerWrapper/FodyWeavers.xml b/TGS.Installer.UI/FodyWeavers.xml similarity index 100% rename from TGInstallerWrapper/FodyWeavers.xml rename to TGS.Installer.UI/FodyWeavers.xml diff --git a/TGInstallerWrapper/Main.Designer.cs b/TGS.Installer.UI/Main.Designer.cs similarity index 99% rename from TGInstallerWrapper/Main.Designer.cs rename to TGS.Installer.UI/Main.Designer.cs index 885db27148..0ed1cf9dec 100644 --- a/TGInstallerWrapper/Main.Designer.cs +++ b/TGS.Installer.UI/Main.Designer.cs @@ -2,7 +2,7 @@ using System.Diagnostics; using System.Reflection; -namespace TGInstallerWrapper +namespace TGS.Installer.UI { partial class Main { diff --git a/TGInstallerWrapper/Main.cs b/TGS.Installer.UI/Main.cs similarity index 90% rename from TGInstallerWrapper/Main.cs rename to TGS.Installer.UI/Main.cs index df1b275a83..745db41727 100644 --- a/TGInstallerWrapper/Main.cs +++ b/TGS.Installer.UI/Main.cs @@ -6,10 +6,10 @@ using System.IO; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGInstallerWrapper +namespace TGS.Installer.UI { partial class Main : Form { @@ -149,12 +149,12 @@ namespace TGInstallerWrapper { while (true) { - var res = PromptKillProcesses("TGCommandLine"); + var res = PromptKillProcesses("TGS.CommandLine"); if (res == PKillType.Aborted) return; else if (res == PKillType.Killed) continue; - res = PromptKillProcesses("TGControlPanel"); + res = PromptKillProcesses("TGS.ControlPanel"); if (res == PKillType.Aborted) return; else if (res == PKillType.Killed) @@ -183,8 +183,8 @@ namespace TGInstallerWrapper ShowLogCheckbox.Enabled = false; InstallButton.Text = "Installing..."; - var msipath = Path.Combine(tempDir, "TGServiceInstaller.msi"); - File.WriteAllBytes(msipath, Properties.Resources.TGServiceInstaller); + var msipath = Path.Combine(tempDir, "TGS.Installer.msi"); + File.WriteAllBytes(msipath, Properties.Resources.TGSInstaller); File.WriteAllBytes(Path.Combine(tempDir, "cab1.cab"), Properties.Resources.cab1); ProgressBar.Style = ProgressBarStyle.Marquee; @@ -193,13 +193,13 @@ namespace TGInstallerWrapper if (ShowLogCheckbox.Checked) { logfile = Path.Combine(tempDir, "tgsinstall.log"); - Installer.EnableLog(InstallLogModes.Verbose | InstallLogModes.PropertyDump, logfile); + Microsoft.Deployment.WindowsInstaller.Installer.EnableLog(InstallLogModes.Verbose | InstallLogModes.PropertyDump, logfile); } var cl = String.Join(" ", args); - Installer.SetInternalUI(InstallUIOptions.Silent); - Installer.SetExternalUI(OnUIUpdate, InstallLogModes.Progress); + Microsoft.Deployment.WindowsInstaller.Installer.SetInternalUI(InstallUIOptions.Silent); + Microsoft.Deployment.WindowsInstaller.Installer.SetExternalUI(OnUIUpdate, InstallLogModes.Progress); - await Task.Factory.StartNew(() => Installer.InstallProduct(msipath, cl)); + await Task.Factory.StartNew(() => Microsoft.Deployment.WindowsInstaller.Installer.InstallProduct(msipath, cl)); if (cancelled) { diff --git a/TGInstallerWrapper/Main.resx b/TGS.Installer.UI/Main.resx similarity index 100% rename from TGInstallerWrapper/Main.resx rename to TGS.Installer.UI/Main.resx diff --git a/TGInstallerWrapper/Program.cs b/TGS.Installer.UI/Program.cs similarity index 91% rename from TGInstallerWrapper/Program.cs rename to TGS.Installer.UI/Program.cs index 96dc421f86..851a948e3b 100644 --- a/TGInstallerWrapper/Program.cs +++ b/TGS.Installer.UI/Program.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Forms; -namespace TGInstallerWrapper +namespace TGS.Installer.UI { static class Program { diff --git a/TGInstallerWrapper/Properties/AssemblyInfo.cs b/TGS.Installer.UI/Properties/AssemblyInfo.cs similarity index 100% rename from TGInstallerWrapper/Properties/AssemblyInfo.cs rename to TGS.Installer.UI/Properties/AssemblyInfo.cs diff --git a/TGInstallerWrapper/Properties/Resources.Designer.cs b/TGS.Installer.UI/Properties/Resources.Designer.cs similarity index 91% rename from TGInstallerWrapper/Properties/Resources.Designer.cs rename to TGS.Installer.UI/Properties/Resources.Designer.cs index cd95f1bb4f..9a0670c601 100644 --- a/TGInstallerWrapper/Properties/Resources.Designer.cs +++ b/TGS.Installer.UI/Properties/Resources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace TGInstallerWrapper.Properties { +namespace TGS.Installer.UI.Properties { using System; @@ -39,7 +39,7 @@ namespace TGInstallerWrapper.Properties { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TGInstallerWrapper.Properties.Resources", typeof(Resources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TGS.Installer.UI.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; @@ -73,9 +73,9 @@ namespace TGInstallerWrapper.Properties { /// /// Looks up a localized resource of type System.Byte[]. /// - internal static byte[] TGServiceInstaller { + internal static byte[] TGSInstaller { get { - object obj = ResourceManager.GetObject("TGServiceInstaller", resourceCulture); + object obj = ResourceManager.GetObject("TGSInstaller", resourceCulture); return ((byte[])(obj)); } } diff --git a/TGInstallerWrapper/Properties/Resources.resx b/TGS.Installer.UI/Properties/Resources.resx similarity index 93% rename from TGInstallerWrapper/Properties/Resources.resx rename to TGS.Installer.UI/Properties/Resources.resx index 223c76093a..7e63714e76 100644 --- a/TGInstallerWrapper/Properties/Resources.resx +++ b/TGS.Installer.UI/Properties/Resources.resx @@ -119,9 +119,9 @@ - ..\..\TGServiceInstaller\bin\Release\cab1.cab;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + ..\..\TGS.Installer\bin\Release\cab1.cab;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\..\TGServiceInstaller\bin\Release\TGServiceInstaller.msi;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\..\TGS.Installer\bin\Release\TGServiceInstaller.msi;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file diff --git a/TGInstallerWrapper/TGInstallerWrapper.csproj b/TGS.Installer.UI/TGS.Installer.UI.csproj similarity index 96% rename from TGInstallerWrapper/TGInstallerWrapper.csproj rename to TGS.Installer.UI/TGS.Installer.UI.csproj index d84f79b22a..3329911b4a 100644 --- a/TGInstallerWrapper/TGInstallerWrapper.csproj +++ b/TGS.Installer.UI/TGS.Installer.UI.csproj @@ -6,7 +6,7 @@ AnyCPU {8956D4C3-BFB9-448E-BF5F-EE7E6F9996F9} WinExe - TGInstallerWrapper + TGS.Installer.UI TG Station Server Installer v4.5.2 512 @@ -89,9 +89,9 @@ - + {ac4e7e8b-f83a-481c-a8b0-8fa4e8ae59ab} - TGServiceInterface + TGS.Interface diff --git a/TGInstallerWrapper/app.manifest b/TGS.Installer.UI/app.manifest similarity index 100% rename from TGInstallerWrapper/app.manifest rename to TGS.Installer.UI/app.manifest diff --git a/TGInstallerWrapper/packages.config b/TGS.Installer.UI/packages.config similarity index 100% rename from TGInstallerWrapper/packages.config rename to TGS.Installer.UI/packages.config diff --git a/TGInstallerWrapper/tgs.ico b/TGS.Installer.UI/tgs.ico similarity index 100% rename from TGInstallerWrapper/tgs.ico rename to TGS.Installer.UI/tgs.ico diff --git a/TGServiceInstaller/Product.wxs b/TGS.Installer/Product.wxs similarity index 71% rename from TGServiceInstaller/Product.wxs rename to TGS.Installer/Product.wxs index d188e2477d..a65794dd14 100644 --- a/TGServiceInstaller/Product.wxs +++ b/TGS.Installer/Product.wxs @@ -1,152 +1,152 @@ - - - - - - - - - - - - - - - - - - - - - Installed AND NOT UPGRADINGPRODUCTCODE - - - - - - - - - - - - - - - - - - - - - - - - - - INSTALLSHORTCUTSTART = 1 - - - - - - - - - - - INSTALLSHORTCUTDESK = 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + Installed AND NOT UPGRADINGPRODUCTCODE + + + + + + + + + + + + + + + + + + + + + + + + + + INSTALLSHORTCUTSTART = 1 + + + + + + + + + + + INSTALLSHORTCUTDESK = 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TGServiceInstaller/TGServiceInstaller.wixproj b/TGS.Installer/TGS.Installer.wixproj similarity index 85% rename from TGServiceInstaller/TGServiceInstaller.wixproj rename to TGS.Installer/TGS.Installer.wixproj index c2985570e2..6d26789638 100644 --- a/TGServiceInstaller/TGServiceInstaller.wixproj +++ b/TGS.Installer/TGS.Installer.wixproj @@ -1,90 +1,90 @@ - - - - Debug - x86 - 3.10 - 154435f6-0890-42d4-9aec-b743d4fbc1cb - 2.0 - TGServiceInstaller - Package - - - bin\$(Configuration)\ - obj\$(Configuration)\ - Debug - - - bin\$(Configuration)\ - obj\$(Configuration)\ - True - True - - - - - - - TGControlPanel - {394e7643-6b8c-416f-ab18-95ac12648cdc} - True - True - Binaries;Content;Satellites - INSTALLFOLDER - - - TGCommandLine - {89191f69-b18e-4b59-b72e-e12f9b6811a0} - True - True - Binaries;Content;Satellites - INSTALLFOLDER - - - TGDreamDaemonBridge - {9a01ef03-8eae-45cb-8b87-4a17bd904557} - True - True - Binaries;Content;Satellites - INSTALLFOLDER - - - TGServerService - {f32eda25-0855-411c-af5e-f0d042917e2d} - True - True - Binaries;Content;Satellites - INSTALLFOLDER - - - TGServiceInterface - {ac4e7e8b-f83a-481c-a8b0-8fa4e8ae59ab} - True - True - Binaries;Content;Satellites - INSTALLFOLDER - - - - - - - - - - - - powershell -Command "& \"$(SolutionDir)Tools/SignBasics.ps1\"" - - - powershell -Command "& \"$(SolutionDir)Tools/SignMSI.ps1\"" - - - + + + + Debug + x86 + 3.10 + 154435f6-0890-42d4-9aec-b743d4fbc1cb + 2.0 + TGServiceInstaller + Package + + + bin\$(Configuration)\ + obj\$(Configuration)\ + Debug + + + bin\$(Configuration)\ + obj\$(Configuration)\ + True + True + + + + + + + TGS.ControlPanel + {394e7643-6b8c-416f-ab18-95ac12648cdc} + True + True + Binaries;Content;Satellites + INSTALLFOLDER + + + TGS.CommandLine + {89191f69-b18e-4b59-b72e-e12f9b6811a0} + True + True + Binaries;Content;Satellites + INSTALLFOLDER + + + TGS.Interface.Bridge + {9a01ef03-8eae-45cb-8b87-4a17bd904557} + True + True + Binaries;Content;Satellites + INSTALLFOLDER + + + TGS.Server.Service + {f32eda25-0855-411c-af5e-f0d042917e2d} + True + True + Binaries;Content;Satellites + INSTALLFOLDER + + + TGS.Interface + {ac4e7e8b-f83a-481c-a8b0-8fa4e8ae59ab} + True + True + Binaries;Content;Satellites + INSTALLFOLDER + + + + + + + + + + + + powershell -Command "& \"$(SolutionDir)Tools/SignBasics.ps1\"" + + + powershell -Command "& \"$(SolutionDir)Tools/SignMSI.ps1\"" + + + \ No newline at end of file diff --git a/TGDreamDaemonBridge/DreamDaemonBridge.cs b/TGS.Interface.Bridge/DreamDaemonBridge.cs similarity index 92% rename from TGDreamDaemonBridge/DreamDaemonBridge.cs rename to TGS.Interface.Bridge/DreamDaemonBridge.cs index 07835d4232..7a6795c39a 100644 --- a/TGDreamDaemonBridge/DreamDaemonBridge.cs +++ b/TGS.Interface.Bridge/DreamDaemonBridge.cs @@ -2,10 +2,10 @@ using RGiesecke.DllExport; using System; using System.Collections.Generic; using System.Runtime.InteropServices; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGDreamDaemonBridge +namespace TGS.Interface.Bridge { /// /// Holds the proc that DD calls to access diff --git a/TGDreamDaemonBridge/FodyWeavers.xml b/TGS.Interface.Bridge/FodyWeavers.xml similarity index 100% rename from TGDreamDaemonBridge/FodyWeavers.xml rename to TGS.Interface.Bridge/FodyWeavers.xml diff --git a/TGDreamDaemonBridge/Properties/AssemblyInfo.cs b/TGS.Interface.Bridge/Properties/AssemblyInfo.cs similarity index 100% rename from TGDreamDaemonBridge/Properties/AssemblyInfo.cs rename to TGS.Interface.Bridge/Properties/AssemblyInfo.cs diff --git a/TGDreamDaemonBridge/TGDreamDaemonBridge.csproj b/TGS.Interface.Bridge/TGS.Interface.Bridge.csproj similarity index 95% rename from TGDreamDaemonBridge/TGDreamDaemonBridge.csproj rename to TGS.Interface.Bridge/TGS.Interface.Bridge.csproj index 0cb0c67596..d960e47808 100644 --- a/TGDreamDaemonBridge/TGDreamDaemonBridge.csproj +++ b/TGS.Interface.Bridge/TGS.Interface.Bridge.csproj @@ -7,7 +7,7 @@ {9A01EF03-8EAE-45CB-8B87-4A17BD904557} Library Properties - TGDreamDaemonBridge + TGS.Interface.Bridge TGDreamDaemonBridge v4.5.2 512 @@ -59,9 +59,9 @@ - + {ac4e7e8b-f83a-481c-a8b0-8fa4e8ae59ab} - TGServiceInterface + TGS.Interface diff --git a/TGDreamDaemonBridge/packages.config b/TGS.Interface.Bridge/packages.config similarity index 100% rename from TGDreamDaemonBridge/packages.config rename to TGS.Interface.Bridge/packages.config diff --git a/TGServiceInterface/ChatSetupInfo.cs b/TGS.Interface/ChatSetupInfo.cs similarity index 96% rename from TGServiceInterface/ChatSetupInfo.cs rename to TGS.Interface/ChatSetupInfo.cs index 1f2d0d1967..6a1c346d2b 100644 --- a/TGServiceInterface/ChatSetupInfo.cs +++ b/TGS.Interface/ChatSetupInfo.cs @@ -1,344 +1,344 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using System.Web.Script.Serialization; - -namespace TGServiceInterface -{ - /// - /// For setting up authentication no matter the chat provider - /// - [DataContract] - [KnownType(typeof(IRCSetupInfo))] - [KnownType(typeof(DiscordSetupInfo))] - public class ChatSetupInfo - { - const int AdminListIndex = 0; - const int AdminModeIndex = 1; - const int AdminChannelIndex = 2; - const int DevChannelIndex = 3; - const int WDChannelIndex = 4; - const int GameChannelIndex = 5; - const int ProviderIndex = 6; - const int EnabledIndex = 7; - /// - /// Starting index of which child classes should use to write their custom data to - /// - protected const int BaseIndex = 8; - /// - /// Set to if a child constructor should use the baseInfo parameter of to initialize it's property fields, otherwise - /// - protected readonly bool InitializeFields; - - /// - /// Raw access to the underlying data - /// - [DataMember] - public IList DataFields { get; protected set; } - - /// - /// Constructs a from optional - /// - /// The that this is for - /// Optional past data - /// The number of fields in this chat provider - protected internal ChatSetupInfo(ChatProvider provider, ChatSetupInfo baseInfo, int numFields) - { - numFields += BaseIndex; - InitializeFields = baseInfo == null || baseInfo.DataFields.Count != numFields; - - if (InitializeFields) - { - DataFields = new List(numFields); - for (var I = 0; I < numFields; ++I) - DataFields.Add(null); - - AdminList = new List(); - AdminChannels = new List(); - DevChannels = new List(); - GameChannels = new List(); - WatchdogChannels = new List(); - AdminsAreSpecial = false; - Enabled = false; - } - else - DataFields = baseInfo.DataFields; - Provider = provider; - Specialize(true); //to check we have a valid provider - } - - /// - /// Recreates as the correct child - /// - /// If , is returned provided is a valid - /// A new based on the type - ChatSetupInfo Specialize(bool checkOnly) - { - switch (Provider) - { - case ChatProvider.IRC: - if (!checkOnly) - return new IRCSetupInfo(this); - break; - case ChatProvider.Discord: - if (!checkOnly) - return new DiscordSetupInfo(this); - break; - default: - throw new Exception("Invalid provider!"); - } - return null; - } - - /// - /// Properly formats a name for the - /// - /// The to format - /// The formatted - protected virtual string SanitizeChannelName(string channel) - { - return Specialize(false).SanitizeChannelName(channel); - } - - /// - /// Sanitizes a list of - /// - /// A of strings - void SanitizeChannelNames(IList channelnames) - { - for (var I = 0; I < channelnames.Count; ++I) - - if (String.IsNullOrWhiteSpace(channelnames[I])) - { - channelnames.RemoveAt(I); - --I; - } - else - channelnames[I] = SanitizeChannelName(channelnames[I].Trim()); - } - - /// - /// Constructs a from a data list - /// - /// The data - public ChatSetupInfo(IList DeserializedData) - { - DataFields = DeserializedData; - Specialize(false); //ensure provider type is valid - } - /// - /// The list of admin entries - /// - public List AdminList - { - get { return new JavaScriptSerializer().Deserialize>(DataFields[AdminListIndex]); } - set { DataFields[AdminListIndex] = new JavaScriptSerializer().Serialize(value); } - } - /// - /// If AdminList corresponds to a Provider specific recognization method - /// - public bool AdminsAreSpecial - { - get { return Convert.ToBoolean(DataFields[AdminModeIndex]); } - set { DataFields[AdminModeIndex] = Convert.ToString(value); } - } - /// - /// The channels from which admin commands/messages can be sent/received - /// - public List AdminChannels - { - get { return new JavaScriptSerializer().Deserialize>(DataFields[AdminChannelIndex]); } - set - { - SanitizeChannelNames(value); - DataFields[AdminChannelIndex] = new JavaScriptSerializer().Serialize(value); - } - } - /// - /// The channels to which repo and compile messages are sent - /// - public List DevChannels - { - get { return new JavaScriptSerializer().Deserialize>(DataFields[DevChannelIndex]); } - set - { - SanitizeChannelNames(value); - DataFields[DevChannelIndex] = new JavaScriptSerializer().Serialize(value); - } - } - /// - /// The channels to which watchdog messages are sent - /// - public List WatchdogChannels - { - get { return new JavaScriptSerializer().Deserialize>(DataFields[WDChannelIndex]); } - set - { - SanitizeChannelNames(value); - DataFields[WDChannelIndex] = new JavaScriptSerializer().Serialize(value); - } - } - /// - /// The channels to which game messages are sent - /// - public List GameChannels - { - get { return new JavaScriptSerializer().Deserialize>(DataFields[GameChannelIndex]); } - set - { - SanitizeChannelNames(value); - DataFields[GameChannelIndex] = new JavaScriptSerializer().Serialize(value); - } - } - /// - /// If this chat provider is enabled - /// - public bool Enabled - { - get { return Convert.ToBoolean(DataFields[EnabledIndex]); } - set { DataFields[EnabledIndex] = Convert.ToString(value); } - } - - /// - /// The type of provider - /// - public ChatProvider Provider - { - get { return (ChatProvider)Convert.ToInt32(DataFields[ProviderIndex]); } - set { DataFields[ProviderIndex] = Convert.ToString((int)value); } - } - } - - /// - /// Chat provider for IRC. Admin entries should be user nicknames in normal mode or required channel flags in special mode - /// - [DataContract] - public sealed class IRCSetupInfo : ChatSetupInfo - { - const int URLIndex = 0; - const int PortIndex = 1; - const int NickIndex = 2; - const int AuthTargetIndex = 3; - const int AuthMessageIndex = 4; - const int AuthLevelIndex = 5; - const int FieldsLen = 6; - - /// - /// Construct IRC setup info from optional generic info. Defaults to TGS3 on rizons IRC server - /// - /// Optional generic info - public IRCSetupInfo(ChatSetupInfo baseInfo = null) : base(ChatProvider.IRC, baseInfo, FieldsLen) - { - if (!InitializeFields) - return; - - Nickname = "TGS3"; - URL = "irc.rizon.net"; - Port = 6667; - AuthTarget = ""; - AuthMessage = ""; - AdminsAreSpecial = true; - AuthLevel = IRCMode.Op; - } - - /// - protected override string SanitizeChannelName(string working) - { - if (working[0] != '#') - return "#" + working; - return working; - } - - /// - /// The port of the IRC server - /// - public ushort Port - { - get { return Convert.ToUInt16(DataFields[BaseIndex + PortIndex]); } - set { DataFields[BaseIndex + PortIndex] = value.ToString(); } - } - /// - /// The URL of the IRC server - /// - public string URL - { - get { return DataFields[BaseIndex + URLIndex]; } - set { DataFields[BaseIndex + URLIndex] = value; } - } - /// - /// The nickname of the IRC bot - /// - public string Nickname - { - get { return DataFields[BaseIndex + NickIndex]; } - set { DataFields[BaseIndex + NickIndex] = value; } - } - /// - /// The target for sending authentication messages - /// - public string AuthTarget - { - get { return DataFields[BaseIndex + AuthTargetIndex]; } - set { DataFields[BaseIndex + AuthTargetIndex] = value; } - } - /// - /// The authentication message - /// - public string AuthMessage - { - get { return DataFields[BaseIndex + AuthMessageIndex]; } - set { DataFields[BaseIndex + AuthMessageIndex] = value; } - } - /// - /// The minimum mode required to use admin bot commands when in special auth mode - /// - public IRCMode AuthLevel - { - get { return (IRCMode)Convert.ToInt32(DataFields[BaseIndex + AuthLevelIndex]); } - set { DataFields[BaseIndex + AuthLevelIndex] = Convert.ToString((int)value); } - } - } - - /// - /// Chat provider for Discord. Admin entires should be user ids in normal mode or group ids in special mode - /// - [DataContract] - public sealed class DiscordSetupInfo : ChatSetupInfo - { - const int BotTokenIndex = 0; - const int FieldsLen = 1; - /// - /// Construct Discord setup info from optional generic info. Default is not a valid discord bot tokent - /// - /// Optional generic info - public DiscordSetupInfo(ChatSetupInfo baseInfo = null) : base(ChatProvider.Discord, baseInfo, FieldsLen) - { - if (!InitializeFields) - return; - BotToken = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; //needless to say, this is fake - } - /// - protected override string SanitizeChannelName(string working) - { - working = working.Replace("<", "").Replace(">", "").Replace("&", ""); //filter out some stuff that can come in the copypasta - try - { - Convert.ToUInt64(working); - } - catch - { - throw new Exception("Invalid Discord channel ID!"); - } - return working; - } - - /// - /// The Discord bot token to use. See https://discordapp.com/developers/applications/me for registering bot accounts - /// - public string BotToken - { - get { return DataFields[BaseIndex + BotTokenIndex]; } - set { DataFields[BaseIndex + BotTokenIndex] = value; } - } - } -} +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Web.Script.Serialization; + +namespace TGS.Interface +{ + /// + /// For setting up authentication no matter the chat provider + /// + [DataContract] + [KnownType(typeof(IRCSetupInfo))] + [KnownType(typeof(DiscordSetupInfo))] + public class ChatSetupInfo + { + const int AdminListIndex = 0; + const int AdminModeIndex = 1; + const int AdminChannelIndex = 2; + const int DevChannelIndex = 3; + const int WDChannelIndex = 4; + const int GameChannelIndex = 5; + const int ProviderIndex = 6; + const int EnabledIndex = 7; + /// + /// Starting index of which child classes should use to write their custom data to + /// + protected const int BaseIndex = 8; + /// + /// Set to if a child constructor should use the baseInfo parameter of to initialize it's property fields, otherwise + /// + protected readonly bool InitializeFields; + + /// + /// Raw access to the underlying data + /// + [DataMember] + public IList DataFields { get; protected set; } + + /// + /// Constructs a from optional + /// + /// The that this is for + /// Optional past data + /// The number of fields in this chat provider + protected internal ChatSetupInfo(ChatProvider provider, ChatSetupInfo baseInfo, int numFields) + { + numFields += BaseIndex; + InitializeFields = baseInfo == null || baseInfo.DataFields.Count != numFields; + + if (InitializeFields) + { + DataFields = new List(numFields); + for (var I = 0; I < numFields; ++I) + DataFields.Add(null); + + AdminList = new List(); + AdminChannels = new List(); + DevChannels = new List(); + GameChannels = new List(); + WatchdogChannels = new List(); + AdminsAreSpecial = false; + Enabled = false; + } + else + DataFields = baseInfo.DataFields; + Provider = provider; + Specialize(true); //to check we have a valid provider + } + + /// + /// Recreates as the correct child + /// + /// If , is returned provided is a valid + /// A new based on the type + ChatSetupInfo Specialize(bool checkOnly) + { + switch (Provider) + { + case ChatProvider.IRC: + if (!checkOnly) + return new IRCSetupInfo(this); + break; + case ChatProvider.Discord: + if (!checkOnly) + return new DiscordSetupInfo(this); + break; + default: + throw new Exception("Invalid provider!"); + } + return null; + } + + /// + /// Properly formats a name for the + /// + /// The to format + /// The formatted + protected virtual string SanitizeChannelName(string channel) + { + return Specialize(false).SanitizeChannelName(channel); + } + + /// + /// Sanitizes a list of + /// + /// A of strings + void SanitizeChannelNames(IList channelnames) + { + for (var I = 0; I < channelnames.Count; ++I) + + if (String.IsNullOrWhiteSpace(channelnames[I])) + { + channelnames.RemoveAt(I); + --I; + } + else + channelnames[I] = SanitizeChannelName(channelnames[I].Trim()); + } + + /// + /// Constructs a from a data list + /// + /// The data + public ChatSetupInfo(IList DeserializedData) + { + DataFields = DeserializedData; + Specialize(false); //ensure provider type is valid + } + /// + /// The list of admin entries + /// + public List AdminList + { + get { return new JavaScriptSerializer().Deserialize>(DataFields[AdminListIndex]); } + set { DataFields[AdminListIndex] = new JavaScriptSerializer().Serialize(value); } + } + /// + /// If AdminList corresponds to a Provider specific recognization method + /// + public bool AdminsAreSpecial + { + get { return Convert.ToBoolean(DataFields[AdminModeIndex]); } + set { DataFields[AdminModeIndex] = Convert.ToString(value); } + } + /// + /// The channels from which admin commands/messages can be sent/received + /// + public List AdminChannels + { + get { return new JavaScriptSerializer().Deserialize>(DataFields[AdminChannelIndex]); } + set + { + SanitizeChannelNames(value); + DataFields[AdminChannelIndex] = new JavaScriptSerializer().Serialize(value); + } + } + /// + /// The channels to which repo and compile messages are sent + /// + public List DevChannels + { + get { return new JavaScriptSerializer().Deserialize>(DataFields[DevChannelIndex]); } + set + { + SanitizeChannelNames(value); + DataFields[DevChannelIndex] = new JavaScriptSerializer().Serialize(value); + } + } + /// + /// The channels to which watchdog messages are sent + /// + public List WatchdogChannels + { + get { return new JavaScriptSerializer().Deserialize>(DataFields[WDChannelIndex]); } + set + { + SanitizeChannelNames(value); + DataFields[WDChannelIndex] = new JavaScriptSerializer().Serialize(value); + } + } + /// + /// The channels to which game messages are sent + /// + public List GameChannels + { + get { return new JavaScriptSerializer().Deserialize>(DataFields[GameChannelIndex]); } + set + { + SanitizeChannelNames(value); + DataFields[GameChannelIndex] = new JavaScriptSerializer().Serialize(value); + } + } + /// + /// If this chat provider is enabled + /// + public bool Enabled + { + get { return Convert.ToBoolean(DataFields[EnabledIndex]); } + set { DataFields[EnabledIndex] = Convert.ToString(value); } + } + + /// + /// The type of provider + /// + public ChatProvider Provider + { + get { return (ChatProvider)Convert.ToInt32(DataFields[ProviderIndex]); } + set { DataFields[ProviderIndex] = Convert.ToString((int)value); } + } + } + + /// + /// Chat provider for IRC. Admin entries should be user nicknames in normal mode or required channel flags in special mode + /// + [DataContract] + public sealed class IRCSetupInfo : ChatSetupInfo + { + const int URLIndex = 0; + const int PortIndex = 1; + const int NickIndex = 2; + const int AuthTargetIndex = 3; + const int AuthMessageIndex = 4; + const int AuthLevelIndex = 5; + const int FieldsLen = 6; + + /// + /// Construct IRC setup info from optional generic info. Defaults to TGS3 on rizons IRC server + /// + /// Optional generic info + public IRCSetupInfo(ChatSetupInfo baseInfo = null) : base(ChatProvider.IRC, baseInfo, FieldsLen) + { + if (!InitializeFields) + return; + + Nickname = "TGS3"; + URL = "irc.rizon.net"; + Port = 6667; + AuthTarget = ""; + AuthMessage = ""; + AdminsAreSpecial = true; + AuthLevel = IRCMode.Op; + } + + /// + protected override string SanitizeChannelName(string working) + { + if (working[0] != '#') + return "#" + working; + return working; + } + + /// + /// The port of the IRC server + /// + public ushort Port + { + get { return Convert.ToUInt16(DataFields[BaseIndex + PortIndex]); } + set { DataFields[BaseIndex + PortIndex] = value.ToString(); } + } + /// + /// The URL of the IRC server + /// + public string URL + { + get { return DataFields[BaseIndex + URLIndex]; } + set { DataFields[BaseIndex + URLIndex] = value; } + } + /// + /// The nickname of the IRC bot + /// + public string Nickname + { + get { return DataFields[BaseIndex + NickIndex]; } + set { DataFields[BaseIndex + NickIndex] = value; } + } + /// + /// The target for sending authentication messages + /// + public string AuthTarget + { + get { return DataFields[BaseIndex + AuthTargetIndex]; } + set { DataFields[BaseIndex + AuthTargetIndex] = value; } + } + /// + /// The authentication message + /// + public string AuthMessage + { + get { return DataFields[BaseIndex + AuthMessageIndex]; } + set { DataFields[BaseIndex + AuthMessageIndex] = value; } + } + /// + /// The minimum mode required to use admin bot commands when in special auth mode + /// + public IRCMode AuthLevel + { + get { return (IRCMode)Convert.ToInt32(DataFields[BaseIndex + AuthLevelIndex]); } + set { DataFields[BaseIndex + AuthLevelIndex] = Convert.ToString((int)value); } + } + } + + /// + /// Chat provider for Discord. Admin entires should be user ids in normal mode or group ids in special mode + /// + [DataContract] + public sealed class DiscordSetupInfo : ChatSetupInfo + { + const int BotTokenIndex = 0; + const int FieldsLen = 1; + /// + /// Construct Discord setup info from optional generic info. Default is not a valid discord bot tokent + /// + /// Optional generic info + public DiscordSetupInfo(ChatSetupInfo baseInfo = null) : base(ChatProvider.Discord, baseInfo, FieldsLen) + { + if (!InitializeFields) + return; + BotToken = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; //needless to say, this is fake + } + /// + protected override string SanitizeChannelName(string working) + { + working = working.Replace("<", "").Replace(">", "").Replace("&", ""); //filter out some stuff that can come in the copypasta + try + { + Convert.ToUInt64(working); + } + catch + { + throw new Exception("Invalid Discord channel ID!"); + } + return working; + } + + /// + /// The Discord bot token to use. See https://discordapp.com/developers/applications/me for registering bot accounts + /// + public string BotToken + { + get { return DataFields[BaseIndex + BotTokenIndex]; } + set { DataFields[BaseIndex + BotTokenIndex] = value; } + } + } +} diff --git a/TGServiceInterface/Command.cs b/TGS.Interface/Command.cs similarity index 99% rename from TGServiceInterface/Command.cs rename to TGS.Interface/Command.cs index 5355a0d55e..ac64ab1914 100644 --- a/TGServiceInterface/Command.cs +++ b/TGS.Interface/Command.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Threading; -namespace TGServiceInterface +namespace TGS.Interface { /// /// Helper for creating a text tree diff --git a/TGServiceInterface/Components/Administration.cs b/TGS.Interface/Components/Administration.cs similarity index 97% rename from TGServiceInterface/Components/Administration.cs rename to TGS.Interface/Components/Administration.cs index b177312820..884c5b725a 100644 --- a/TGServiceInterface/Components/Administration.cs +++ b/TGS.Interface/Components/Administration.cs @@ -1,6 +1,6 @@ using System.ServiceModel; -namespace TGServiceInterface.Components +namespace TGS.Interface.Components { /// /// Manage the group that is used to access the service, can only be used by an administrator diff --git a/TGServiceInterface/Components/Byond.cs b/TGS.Interface/Components/Byond.cs similarity index 97% rename from TGServiceInterface/Components/Byond.cs rename to TGS.Interface/Components/Byond.cs index d640179d6c..7563000999 100644 --- a/TGServiceInterface/Components/Byond.cs +++ b/TGS.Interface/Components/Byond.cs @@ -1,6 +1,6 @@ using System.ServiceModel; -namespace TGServiceInterface.Components +namespace TGS.Interface.Components { /// diff --git a/TGServiceInterface/Components/Chat.cs b/TGS.Interface/Components/Chat.cs similarity index 97% rename from TGServiceInterface/Components/Chat.cs rename to TGS.Interface/Components/Chat.cs index e52659d3f7..5333e4e649 100644 --- a/TGServiceInterface/Components/Chat.cs +++ b/TGS.Interface/Components/Chat.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.ServiceModel; -namespace TGServiceInterface.Components +namespace TGS.Interface.Components { /// /// Interface for handling chat bot diff --git a/TGServiceInterface/Components/Compiler.cs b/TGS.Interface/Components/Compiler.cs similarity index 98% rename from TGServiceInterface/Components/Compiler.cs rename to TGS.Interface/Components/Compiler.cs index f5b261fb62..ce87ff125e 100644 --- a/TGServiceInterface/Components/Compiler.cs +++ b/TGS.Interface/Components/Compiler.cs @@ -1,6 +1,6 @@ using System.ServiceModel; -namespace TGServiceInterface.Components +namespace TGS.Interface.Components { /// /// For managing the Game A/B/Live folders, compiling, and hotswapping them diff --git a/TGServiceInterface/Components/Config.cs b/TGS.Interface/Components/Config.cs similarity index 98% rename from TGServiceInterface/Components/Config.cs rename to TGS.Interface/Components/Config.cs index 1055352aad..5b33051d0d 100644 --- a/TGServiceInterface/Components/Config.cs +++ b/TGS.Interface/Components/Config.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.ServiceModel; -namespace TGServiceInterface.Components +namespace TGS.Interface.Components { /// /// For modifying the in game config diff --git a/TGServiceInterface/Components/Connectivity.cs b/TGS.Interface/Components/Connectivity.cs similarity index 91% rename from TGServiceInterface/Components/Connectivity.cs rename to TGS.Interface/Components/Connectivity.cs index d3077d3dd9..d7c5b57f64 100644 --- a/TGServiceInterface/Components/Connectivity.cs +++ b/TGS.Interface/Components/Connectivity.cs @@ -1,6 +1,6 @@ using System.ServiceModel; -namespace TGServiceInterface.Components +namespace TGS.Interface.Components { /// /// Used for testing connections to the service without authentication diff --git a/TGServiceInterface/Components/DreamDaemon.cs b/TGS.Interface/Components/DreamDaemon.cs similarity index 99% rename from TGServiceInterface/Components/DreamDaemon.cs rename to TGS.Interface/Components/DreamDaemon.cs index b21fdda493..0892e3f8a1 100644 --- a/TGServiceInterface/Components/DreamDaemon.cs +++ b/TGS.Interface/Components/DreamDaemon.cs @@ -1,6 +1,6 @@ using System.ServiceModel; -namespace TGServiceInterface.Components +namespace TGS.Interface.Components { /// diff --git a/TGServiceInterface/Components/Instance.cs b/TGS.Interface/Components/Instance.cs similarity index 93% rename from TGServiceInterface/Components/Instance.cs rename to TGS.Interface/Components/Instance.cs index c4c771d4ef..1cc79e153b 100644 --- a/TGServiceInterface/Components/Instance.cs +++ b/TGS.Interface/Components/Instance.cs @@ -1,6 +1,6 @@ using System.ServiceModel; -namespace TGServiceInterface.Components +namespace TGS.Interface.Components { /// /// Metadata for a server instance diff --git a/TGServiceInterface/Components/InstanceManager.cs b/TGS.Interface/Components/InstanceManager.cs similarity index 98% rename from TGServiceInterface/Components/InstanceManager.cs rename to TGS.Interface/Components/InstanceManager.cs index 3467c009c1..f148acb644 100644 --- a/TGServiceInterface/Components/InstanceManager.cs +++ b/TGS.Interface/Components/InstanceManager.cs @@ -1,6 +1,6 @@ using System.ServiceModel; -namespace TGServiceInterface.Components +namespace TGS.Interface.Components { /// /// Used for managing s diff --git a/TGServiceInterface/Components/Interop.cs b/TGS.Interface/Components/Interop.cs similarity index 93% rename from TGServiceInterface/Components/Interop.cs rename to TGS.Interface/Components/Interop.cs index e57e74cb08..80dc2c7c7c 100644 --- a/TGServiceInterface/Components/Interop.cs +++ b/TGS.Interface/Components/Interop.cs @@ -1,6 +1,6 @@ using System.ServiceModel; -namespace TGServiceInterface.Components +namespace TGS.Interface.Components { /// /// Used by DreamDaemon to access the interop API with call()(). Restrictions are in place so that only a DreamDaemon instance launched by the service can use this API diff --git a/TGServiceInterface/Components/Landing.cs b/TGS.Interface/Components/Landing.cs similarity index 94% rename from TGServiceInterface/Components/Landing.cs rename to TGS.Interface/Components/Landing.cs index a1d18c8c88..da7cd28b9e 100644 --- a/TGServiceInterface/Components/Landing.cs +++ b/TGS.Interface/Components/Landing.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.ServiceModel; -namespace TGServiceInterface.Components +namespace TGS.Interface.Components { /// /// Used for general authentication and listing s diff --git a/TGServiceInterface/Components/Repository.cs b/TGS.Interface/Components/Repository.cs similarity index 99% rename from TGServiceInterface/Components/Repository.cs rename to TGS.Interface/Components/Repository.cs index 9e0f83105e..f9a395a915 100644 --- a/TGServiceInterface/Components/Repository.cs +++ b/TGS.Interface/Components/Repository.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.ServiceModel; -namespace TGServiceInterface.Components +namespace TGS.Interface.Components { /// /// Interface for managing the code repository diff --git a/TGServiceInterface/Components/Service.cs b/TGS.Interface/Components/Service.cs similarity index 97% rename from TGServiceInterface/Components/Service.cs rename to TGS.Interface/Components/Service.cs index d9fecd397f..17fc5f7096 100644 --- a/TGServiceInterface/Components/Service.cs +++ b/TGS.Interface/Components/Service.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.ServiceModel; -namespace TGServiceInterface.Components +namespace TGS.Interface.Components { /// /// Interface for managing the service diff --git a/TGServiceInterface/Enumerations.cs b/TGS.Interface/Enumerations.cs similarity index 99% rename from TGServiceInterface/Enumerations.cs rename to TGS.Interface/Enumerations.cs index 5f65b463b0..b1d9586769 100644 --- a/TGServiceInterface/Enumerations.cs +++ b/TGS.Interface/Enumerations.cs @@ -1,6 +1,6 @@ using System; -namespace TGServiceInterface +namespace TGS.Interface { /// /// Description of the connectivity level to an or the diff --git a/TGServiceInterface/Helpers.cs b/TGS.Interface/Helpers.cs similarity index 98% rename from TGServiceInterface/Helpers.cs rename to TGS.Interface/Helpers.cs index 471d84ccfd..a7780a1aba 100644 --- a/TGServiceInterface/Helpers.cs +++ b/TGS.Interface/Helpers.cs @@ -2,7 +2,7 @@ using System.Security.Cryptography; using System.Text; -namespace TGServiceInterface +namespace TGS.Interface { /// /// Helper functions used across the server suite diff --git a/TGServiceInterface/InstanceMetadata.cs b/TGS.Interface/InstanceMetadata.cs similarity index 96% rename from TGServiceInterface/InstanceMetadata.cs rename to TGS.Interface/InstanceMetadata.cs index 5a08e5b355..d98677bbe6 100644 --- a/TGServiceInterface/InstanceMetadata.cs +++ b/TGS.Interface/InstanceMetadata.cs @@ -1,6 +1,6 @@ using System.Runtime.Serialization; -namespace TGServiceInterface +namespace TGS.Interface { /// /// Metadata about an diff --git a/TGServiceInterface/Properties/AssemblyInfo.cs b/TGS.Interface/Properties/AssemblyInfo.cs similarity index 98% rename from TGServiceInterface/Properties/AssemblyInfo.cs rename to TGS.Interface/Properties/AssemblyInfo.cs index 1e86b8b310..c9d6fe7641 100644 --- a/TGServiceInterface/Properties/AssemblyInfo.cs +++ b/TGS.Interface/Properties/AssemblyInfo.cs @@ -1,16 +1,16 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("TGStation Server Service Interface")] -[assembly: AssemblyDescription("Used by user programs to access the TGStation Server Service")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("ac4e7e8b-f83a-481c-a8b0-8fa4e8ae59ab")] +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("TGStation Server Service Interface")] +[assembly: AssemblyDescription("Used by user programs to access the TGStation Server Service")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ac4e7e8b-f83a-481c-a8b0-8fa4e8ae59ab")] diff --git a/TGServiceInterface/PullRequestInfo.cs b/TGS.Interface/PullRequestInfo.cs similarity index 97% rename from TGServiceInterface/PullRequestInfo.cs rename to TGS.Interface/PullRequestInfo.cs index 6f6635ab7b..58eab112ff 100644 --- a/TGServiceInterface/PullRequestInfo.cs +++ b/TGS.Interface/PullRequestInfo.cs @@ -1,6 +1,6 @@ using System.Runtime.Serialization; -namespace TGServiceInterface +namespace TGS.Interface { /// /// Information about a pull request diff --git a/TGServiceInterface/RootCommand.cs b/TGS.Interface/RootCommand.cs similarity index 99% rename from TGServiceInterface/RootCommand.cs rename to TGS.Interface/RootCommand.cs index 90b26f352e..129c772478 100644 --- a/TGServiceInterface/RootCommand.cs +++ b/TGS.Interface/RootCommand.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace TGServiceInterface +namespace TGS.Interface { /// /// Helper for creating commands that contain sub commands diff --git a/TGServiceInterface/ServerInterface.cs b/TGS.Interface/ServerInterface.cs similarity index 99% rename from TGServiceInterface/ServerInterface.cs rename to TGS.Interface/ServerInterface.cs index 62608e7cf9..e92e630e19 100644 --- a/TGServiceInterface/ServerInterface.cs +++ b/TGS.Interface/ServerInterface.cs @@ -7,9 +7,9 @@ using System.Net.Security; using System.Reflection; using System.Security.Principal; using System.ServiceModel; -using TGServiceInterface.Components; +using TGS.Interface.Components; -namespace TGServiceInterface +namespace TGS.Interface { /// /// Main for communicating the diff --git a/TGServiceInterface/TGServiceInterface.csproj b/TGS.Interface/TGS.Interface.csproj similarity index 92% rename from TGServiceInterface/TGServiceInterface.csproj rename to TGS.Interface/TGS.Interface.csproj index c5a0a379a6..fa07f5838f 100644 --- a/TGServiceInterface/TGServiceInterface.csproj +++ b/TGS.Interface/TGS.Interface.csproj @@ -1,81 +1,81 @@ - - - - - Debug - AnyCPU - {AC4E7E8B-F83A-481C-A8B0-8FA4E8AE59AB} - Library - Properties - TGServiceInterface - TGServiceInterface - v4.5.2 - 512 - - - tgs.ico - - - true - bin\Debug\ - DEBUG;TRACE - full - AnyCPU - prompt - MinimumRecommendedRules.ruleset - - - bin\Release\ - TRACE - bin\x86\Release\TGServiceInterface.xml - true - true - pdbonly - AnyCPU - prompt - MinimumRecommendedRules.ruleset - false - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + AnyCPU + {AC4E7E8B-F83A-481C-A8B0-8FA4E8AE59AB} + Library + Properties + TGS.Interface + TGServiceInterface + v4.5.2 + 512 + + + tgs.ico + + + true + bin\Debug\ + DEBUG;TRACE + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + + + bin\Release\ + TRACE + bin\x86\Release\TGS.Interface.xml + true + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + false + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TGServiceInterface/TGServiceInterface.nuspec b/TGS.Interface/TGS.Interface.nuspec similarity index 96% rename from TGServiceInterface/TGServiceInterface.nuspec rename to TGS.Interface/TGS.Interface.nuspec index 44637c7556..80bbf50f80 100644 --- a/TGServiceInterface/TGServiceInterface.nuspec +++ b/TGS.Interface/TGS.Interface.nuspec @@ -1,7 +1,7 @@ - $id$ + TGServiceInterface $version$ Cyberboss https://github.com/tgstation/tgstation-server/blob/master/LICENSE diff --git a/TGServerService/tgs.ico b/TGS.Interface/tgs.ico similarity index 100% rename from TGServerService/tgs.ico rename to TGS.Interface/tgs.ico diff --git a/TGServerService/App.config b/TGS.Server.Service/App.config similarity index 60% rename from TGServerService/App.config rename to TGS.Server.Service/App.config index 42fede526f..cfd0a6b77d 100644 --- a/TGServerService/App.config +++ b/TGS.Server.Service/App.config @@ -2,15 +2,15 @@ -
-
+
+
- + C:\Python27 @@ -23,6 +23,6 @@ 38607 - + diff --git a/TGServerService/ChatCommands/ByondCommand.cs b/TGS.Server.Service/ChatCommands/ByondCommand.cs similarity index 93% rename from TGServerService/ChatCommands/ByondCommand.cs rename to TGS.Server.Service/ChatCommands/ByondCommand.cs index 27cd19dadf..5cc1a90740 100644 --- a/TGServerService/ChatCommands/ByondCommand.cs +++ b/TGS.Server.Service/ChatCommands/ByondCommand.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; -using TGServiceInterface; +using TGS.Interface; -namespace TGServerService.ChatCommands +namespace TGS.Server.Service.ChatCommands { /// /// Retrieve the installed, staged, or latest availab diff --git a/TGServerService/ChatCommands/ChatCommand.cs b/TGS.Server.Service/ChatCommands/ChatCommand.cs similarity index 95% rename from TGServerService/ChatCommands/ChatCommand.cs rename to TGS.Server.Service/ChatCommands/ChatCommand.cs index 17794613fa..7137fa0447 100644 --- a/TGServerService/ChatCommands/ChatCommand.cs +++ b/TGS.Server.Service/ChatCommands/ChatCommand.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; using System.Threading; -using TGServiceInterface; +using TGS.Interface; -namespace TGServerService.ChatCommands +namespace TGS.Server.Service.ChatCommands { /// /// A command heard by a diff --git a/TGServerService/ChatCommands/CommandInfo.cs b/TGS.Server.Service/ChatCommands/CommandInfo.cs similarity index 94% rename from TGServerService/ChatCommands/CommandInfo.cs rename to TGS.Server.Service/ChatCommands/CommandInfo.cs index 913bd50e70..bc6ae15eed 100644 --- a/TGServerService/ChatCommands/CommandInfo.cs +++ b/TGS.Server.Service/ChatCommands/CommandInfo.cs @@ -1,4 +1,4 @@ -namespace TGServerService.ChatCommands +namespace TGS.Server.Service.ChatCommands { /// /// Metadata about the currently running diff --git a/TGServerService/ChatCommands/KekCommand.cs b/TGS.Server.Service/ChatCommands/KekCommand.cs similarity index 91% rename from TGServerService/ChatCommands/KekCommand.cs rename to TGS.Server.Service/ChatCommands/KekCommand.cs index 1c2eda51c6..6fe495690c 100644 --- a/TGServerService/ChatCommands/KekCommand.cs +++ b/TGS.Server.Service/ChatCommands/KekCommand.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace TGServerService.ChatCommands +namespace TGS.Server.Service.ChatCommands { /// /// kek diff --git a/TGServerService/ChatCommands/PullRequestsCommand.cs b/TGS.Server.Service/ChatCommands/PullRequestsCommand.cs similarity index 95% rename from TGServerService/ChatCommands/PullRequestsCommand.cs rename to TGS.Server.Service/ChatCommands/PullRequestsCommand.cs index 50495174c5..f3046931cc 100644 --- a/TGServerService/ChatCommands/PullRequestsCommand.cs +++ b/TGS.Server.Service/ChatCommands/PullRequestsCommand.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace TGServerService.ChatCommands +namespace TGS.Server.Service.ChatCommands { /// /// Retrieve the list of test-merged github pull requests diff --git a/TGServerService/ChatCommands/RevisionCommand.cs b/TGS.Server.Service/ChatCommands/RevisionCommand.cs similarity index 94% rename from TGServerService/ChatCommands/RevisionCommand.cs rename to TGS.Server.Service/ChatCommands/RevisionCommand.cs index 18b28b96ac..3b91cdebd9 100644 --- a/TGServerService/ChatCommands/RevisionCommand.cs +++ b/TGS.Server.Service/ChatCommands/RevisionCommand.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace TGServerService.ChatCommands +namespace TGS.Server.Service.ChatCommands { /// /// Retrieves the git SHA of the live DreamDaemon code diff --git a/TGServerService/ChatCommands/RootChatCommand.cs b/TGS.Server.Service/ChatCommands/RootChatCommand.cs similarity index 91% rename from TGServerService/ChatCommands/RootChatCommand.cs rename to TGS.Server.Service/ChatCommands/RootChatCommand.cs index 82bb3e172e..1fac6ee2ce 100644 --- a/TGServerService/ChatCommands/RootChatCommand.cs +++ b/TGS.Server.Service/ChatCommands/RootChatCommand.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; -using TGServiceInterface; +using TGS.Interface; -namespace TGServerService.ChatCommands +namespace TGS.Server.Service.ChatCommands { /// /// The main root chat command diff --git a/TGServerService/ChatCommands/ServerChatCommand.cs b/TGS.Server.Service/ChatCommands/ServerChatCommand.cs similarity index 97% rename from TGServerService/ChatCommands/ServerChatCommand.cs rename to TGS.Server.Service/ChatCommands/ServerChatCommand.cs index f7551e60af..0729409c1e 100644 --- a/TGServerService/ChatCommands/ServerChatCommand.cs +++ b/TGS.Server.Service/ChatCommands/ServerChatCommand.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace TGServerService.ChatCommands +namespace TGS.Server.Service.ChatCommands { /// /// s generated by DreamDaemon via the API diff --git a/TGServerService/ChatCommands/VersionCommand.cs b/TGS.Server.Service/ChatCommands/VersionCommand.cs similarity index 93% rename from TGServerService/ChatCommands/VersionCommand.cs rename to TGS.Server.Service/ChatCommands/VersionCommand.cs index d066d83971..afbd926c02 100644 --- a/TGServerService/ChatCommands/VersionCommand.cs +++ b/TGS.Server.Service/ChatCommands/VersionCommand.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace TGServerService.ChatCommands +namespace TGS.Server.Service.ChatCommands { /// /// Retrieve the current service version diff --git a/TGServerService/ChatProviders/ChatProvider.cs b/TGS.Server.Service/ChatProviders/ChatProvider.cs similarity index 97% rename from TGServerService/ChatProviders/ChatProvider.cs rename to TGS.Server.Service/ChatProviders/ChatProvider.cs index da6ff62999..dbcf6d14d7 100644 --- a/TGServerService/ChatProviders/ChatProvider.cs +++ b/TGS.Server.Service/ChatProviders/ChatProvider.cs @@ -1,7 +1,7 @@ using System; -using TGServiceInterface; +using TGS.Interface; -namespace TGServerService.ChatProviders +namespace TGS.Server.Service.ChatProviders { /// /// Callback for the chat provider recieving a diff --git a/TGServerService/ChatProviders/DiscordChatProvider.cs b/TGS.Server.Service/ChatProviders/DiscordChatProvider.cs similarity index 99% rename from TGServerService/ChatProviders/DiscordChatProvider.cs rename to TGS.Server.Service/ChatProviders/DiscordChatProvider.cs index 1b347b0de2..1b2a936cb5 100644 --- a/TGServerService/ChatProviders/DiscordChatProvider.cs +++ b/TGS.Server.Service/ChatProviders/DiscordChatProvider.cs @@ -4,9 +4,9 @@ using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using TGServiceInterface; +using TGS.Interface; -namespace TGServerService.ChatProviders +namespace TGS.Server.Service.ChatProviders { /// /// for Discord: https://discordapp.com/ diff --git a/TGServerService/ChatProviders/IRCChatProvider.cs b/TGS.Server.Service/ChatProviders/IRCChatProvider.cs similarity index 99% rename from TGServerService/ChatProviders/IRCChatProvider.cs rename to TGS.Server.Service/ChatProviders/IRCChatProvider.cs index a41a7fd72b..550f3a1aee 100644 --- a/TGServerService/ChatProviders/IRCChatProvider.cs +++ b/TGS.Server.Service/ChatProviders/IRCChatProvider.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Threading; -using TGServiceInterface; +using TGS.Interface; using Meebey.SmartIrc4net; -namespace TGServerService.ChatProviders +namespace TGS.Server.Service.ChatProviders { /// /// for internet relay chat diff --git a/TGServerService/DeprecatedInstanceConfig.cs b/TGS.Server.Service/DeprecatedInstanceConfig.cs similarity index 99% rename from TGServerService/DeprecatedInstanceConfig.cs rename to TGS.Server.Service/DeprecatedInstanceConfig.cs index 9eff86cc04..c6127601af 100644 --- a/TGServerService/DeprecatedInstanceConfig.cs +++ b/TGS.Server.Service/DeprecatedInstanceConfig.cs @@ -1,7 +1,7 @@ using System; using System.Configuration; -namespace TGServerService +namespace TGS.Server.Service { /// /// Used to migrate old config settings diff --git a/TGServerService/EventID.cs b/TGS.Server.Service/EventID.cs similarity index 68% rename from TGServerService/EventID.cs rename to TGS.Server.Service/EventID.cs index dab2bca4dd..ef542764dd 100644 --- a/TGServerService/EventID.cs +++ b/TGS.Server.Service/EventID.cs @@ -1,6 +1,6 @@ using System; -namespace TGServerService +namespace TGS.Server.Service { /// /// Various events and their IDs in no particular order. Found in the Windows event log. These key incremented by 100 and are guaranteed to never be reused in the future. In the windows event viewer, these IDs will be offset by the to distinguish events between instances. Each event ID may be information, a warning, or error and will be documented accordingly. Warnings will occur due to user, data, or network errors. Errors will occur due to filesystem errors or hard faults @@ -20,7 +20,7 @@ namespace TGServerService /// ChatProviderStartFail = 300, /// - /// Error: When a bad is passed + /// Error: When a bad is passed /// InvalidChatProvider = 400, /// @@ -41,38 +41,38 @@ namespace TGServerService /// BYONDUpdateComplete = 800, /// - /// Error: Failed to move the with TGServiceInterface.Components.ITGAdministration.MoveServer(string) + /// Error: Failed to move the with TGS.Interface.Components.ITGAdministration.MoveServer(string) /// [Obsolete("Not in use anymore", true)] ServerMoveFailed = 900, /// - /// Warning: Failed to delete the old directory during a TGServiceInterface.Components.ITGAdministration.MoveServer(string) operation + /// Warning: Failed to delete the old directory during a TGS.Interface.Components.ITGAdministration.MoveServer(string) operation /// [Obsolete("Not in use anymore", true)] ServerMovePartial = 1000, /// - /// Info: Successful completion of a TGServiceInterface.Components.ITGAdministration.MoveServer(string) operation + /// Info: Successful completion of a TGS.Interface.Components.ITGAdministration.MoveServer(string) operation /// [Obsolete("Not in use anymore", true)] ServerMoveComplete = 1100, /// - /// Error: An internal error occurred during a operation + /// Error: An internal error occurred during a operation /// DMCompileCrash = 1200, /// - /// Error: An internal error occurred during a operation + /// Error: An internal error occurred during a operation /// DMInitializeCrash = 1300, /// - /// Warning: Compile failure of the target .dme in a operation + /// Warning: Compile failure of the target .dme in a operation /// DMCompileError = 1400, /// - /// Info: Successful completion of a operation + /// Info: Successful completion of a operation /// DMCompileSuccess = 1500, /// - /// Info: Successful completion of a operation + /// Info: Successful completion of a operation /// DMCompileCancel = 1600, /// @@ -88,7 +88,7 @@ namespace TGServerService /// DDWatchdogCrash = 1900, /// - /// Info: The watchdog has exited, either for an or , or operation + /// Info: The watchdog has exited, either for an or , or operation /// DDWatchdogExit = 2000, /// @@ -101,15 +101,15 @@ namespace TGServerService /// DDWatchdogRebootingServer = 2200, /// - /// Info: The watchdog is performing a operation + /// Info: The watchdog is performing a operation /// DDWatchdogRestart = 2300, /// - /// Info: Successful completion of a operation + /// Info: Successful completion of a operation /// DDWatchdogRestarted = 2400, /// - /// Info: Successful completion of a operation + /// Info: Successful completion of a operation /// DDWatchdogStarted = 2500, /// @@ -157,35 +157,35 @@ namespace TGServerService [Obsolete("Not in use anymore", true)] NudgeCrash = 3400, /// - /// Info: Successful completion of a operation + /// Info: Successful completion of a operation /// RepoClone = 3500, /// - /// Warning: An error occurred during a operation + /// Warning: An error occurred during a operation /// RepoCloneFail = 3600, /// - /// Info: Successful completion of a operation + /// Info: Successful completion of a operation /// RepoCheckout = 3700, /// - /// Warning: An error occurred during a operation + /// Warning: An error occurred during a operation /// RepoCheckoutFail = 3800, /// - /// Info: Successful completion of a operation with a parameter + /// Info: Successful completion of a operation with a parameter /// RepoHardUpdate = 3900, /// - /// Warning: An error occurred during a operation with a parameter + /// Warning: An error occurred during a operation with a parameter /// RepoHardUpdateFail = 4000, /// - /// Info: Successful completion of a operation with a parameter + /// Info: Successful completion of a operation with a parameter /// RepoMergeUpdate = 4100, /// - /// Warning: An error occurred during a operation with a parameter + /// Warning: An error occurred during a operation with a parameter /// RepoMergeUpdateFail = 4200, /// @@ -197,19 +197,19 @@ namespace TGServerService /// RepoBackupTagFail = 4400, /// - /// Info: Successful completion of a operation with a parameter + /// Info: Successful completion of a operation with a parameter /// RepoResetTracked = 4500, /// - /// Warning: An error occurred during a operation with a parameter + /// Warning: An error occurred during a operation with a parameter /// RepoResetTrackedFail = 4600, /// - /// Info: Successful completion of a operation with a parameter + /// Info: Successful completion of a operation with a parameter /// RepoReset = 4700, /// - /// Warning: An error occurred during a operation with a parameter + /// Warning: An error occurred during a operation with a parameter /// RepoResetFail = 4800, /// @@ -217,11 +217,11 @@ namespace TGServerService /// RepoPRListError = 4900, /// - /// Info: Successful completion of a operation + /// Info: Successful completion of a operation /// RepoPRMerge = 5000, /// - /// Warning: An error occurred during a operation + /// Warning: An error occurred during a operation /// RepoPRMergeFail = 5100, /// @@ -233,27 +233,27 @@ namespace TGServerService /// RepoCommitFail = 5300, /// - /// Info: Successful completion of a operation + /// Info: Successful completion of a operation /// RepoPush = 5400, /// - /// Warning: An error occurred during a operation + /// Warning: An error occurred during a operation /// RepoPushFail = 5500, /// - /// Info: Successful completion of a operation + /// Info: Successful completion of a operation /// RepoChangelog = 5600, /// - /// Warning: An error occurred during a operation + /// Warning: An error occurred during a operation /// RepoChangelogFail = 5700, /// - /// Info: When the dll is updated for the + /// Info: When the dll is updated for the /// BridgeDLLUpdated = 5800, /// - /// Error: An error occurred while updating the dll for the + /// Error: An error occurred while updating the dll for the /// BridgeDLLUpdateFail = 5900, /// @@ -269,7 +269,7 @@ namespace TGServerService /// WorldReboot = 6200, /// - /// Info: When the output of is applied to the live + /// Info: When the output of is applied to the live /// ServerUpdateApplied = 6300, /// @@ -287,7 +287,7 @@ namespace TGServerService /// Submodule = 6600, /// - /// This event is of type or . It occurs when a user different from the previous one tries and either succeeds or fails to access a . DreamDaemon itself successfully accessing will not trigger this + /// This event is of type or . It occurs when a user different from the previous one tries and either succeeds or fails to access a . DreamDaemon itself successfully accessing will not trigger this /// Authentication = 6700, /// @@ -299,7 +299,7 @@ namespace TGServerService /// PreactionFail = 6900, /// - /// Warning: When a command from DreamDaemon fails + /// Warning: When a command from DreamDaemon fails /// InteropCallException = 7000, /// diff --git a/TGServerService/InstanceConfig.cs b/TGS.Server.Service/InstanceConfig.cs similarity index 99% rename from TGServerService/InstanceConfig.cs rename to TGS.Server.Service/InstanceConfig.cs index a7afc8ab5f..d824c418c0 100644 --- a/TGServerService/InstanceConfig.cs +++ b/TGS.Server.Service/InstanceConfig.cs @@ -1,8 +1,8 @@ using System.IO; using System.Web.Script.Serialization; -using TGServiceInterface; +using TGS.Interface; -namespace TGServerService +namespace TGS.Server.Service { /// /// Configuration settings for a diff --git a/TGServerService/MessageType.cs b/TGS.Server.Service/MessageType.cs similarity index 94% rename from TGServerService/MessageType.cs rename to TGS.Server.Service/MessageType.cs index 8db0cf2298..803a3fb4a5 100644 --- a/TGServerService/MessageType.cs +++ b/TGS.Server.Service/MessageType.cs @@ -1,6 +1,6 @@ using System; -namespace TGServerService +namespace TGS.Server.Service { /// /// Type of chat message, these may be OR'd together diff --git a/TGServerService/ProcessExtension.cs b/TGS.Server.Service/ProcessExtension.cs similarity index 98% rename from TGServerService/ProcessExtension.cs rename to TGS.Server.Service/ProcessExtension.cs index ecf336a9a0..fab7bebdcc 100644 --- a/TGServerService/ProcessExtension.cs +++ b/TGS.Server.Service/ProcessExtension.cs @@ -2,7 +2,7 @@ using System.Diagnostics; using System.Runtime.InteropServices; -namespace TGServerService +namespace TGS.Server.Service { /// /// Helpers to ing and a . Lightly massaged code from https://stackoverflow.com/a/13109774. Documentation linked from MSDN on 20/10/2017 diff --git a/TGServerService/Program.cs b/TGS.Server.Service/Program.cs similarity index 99% rename from TGServerService/Program.cs rename to TGS.Server.Service/Program.cs index 1394802800..8d12789234 100644 --- a/TGServerService/Program.cs +++ b/TGS.Server.Service/Program.cs @@ -4,7 +4,7 @@ using System.IO; using System.ServiceProcess; using System.Threading.Tasks; -namespace TGServerService +namespace TGS.Server.Service { static class Program { diff --git a/TGServerService/ProjectInstaller.cs b/TGS.Server.Service/ProjectInstaller.cs similarity index 96% rename from TGServerService/ProjectInstaller.cs rename to TGS.Server.Service/ProjectInstaller.cs index f5c0f1a911..10c319e3d0 100644 --- a/TGServerService/ProjectInstaller.cs +++ b/TGS.Server.Service/ProjectInstaller.cs @@ -2,7 +2,7 @@ using System.Configuration.Install; using System.ServiceProcess; -namespace TGServerService +namespace TGS.Server.Service { /// /// This tells the .msi there is a Windows in this that needs installation diff --git a/TGServerService/Properties/AssemblyInfo.cs b/TGS.Server.Service/Properties/AssemblyInfo.cs similarity index 97% rename from TGServerService/Properties/AssemblyInfo.cs rename to TGS.Server.Service/Properties/AssemblyInfo.cs index e9ebd6fc8c..b7a644ae25 100644 --- a/TGServerService/Properties/AssemblyInfo.cs +++ b/TGS.Server.Service/Properties/AssemblyInfo.cs @@ -1,16 +1,16 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("TGStation Server Service")] -[assembly: AssemblyDescription("Server Service for running BYOND games")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("f32eda25-0855-411c-af5e-f0d042917e2d")] +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("TGStation Server Service")] +[assembly: AssemblyDescription("Server Service for running BYOND games")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f32eda25-0855-411c-af5e-f0d042917e2d")] diff --git a/TGServerService/Properties/Settings.Designer.cs b/TGS.Server.Service/Properties/Settings.Designer.cs similarity index 98% rename from TGServerService/Properties/Settings.Designer.cs rename to TGS.Server.Service/Properties/Settings.Designer.cs index 1bbb0d95f0..9b807e1637 100644 --- a/TGServerService/Properties/Settings.Designer.cs +++ b/TGS.Server.Service/Properties/Settings.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace TGServerService.Properties { +namespace TGS.Server.Service.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] diff --git a/TGServerService/Properties/Settings.settings b/TGS.Server.Service/Properties/Settings.settings similarity index 91% rename from TGServerService/Properties/Settings.settings rename to TGS.Server.Service/Properties/Settings.settings index 447b6c7ee3..3770ccac32 100644 --- a/TGServerService/Properties/Settings.settings +++ b/TGS.Server.Service/Properties/Settings.settings @@ -1,5 +1,5 @@  - + diff --git a/TGServerService/RepoConfig.cs b/TGS.Server.Service/RepoConfig.cs similarity index 97% rename from TGServerService/RepoConfig.cs rename to TGS.Server.Service/RepoConfig.cs index d406e658ff..d3b7cf2d5b 100644 --- a/TGServerService/RepoConfig.cs +++ b/TGS.Server.Service/RepoConfig.cs @@ -4,7 +4,7 @@ using System.IO; using System.Linq; using System.Web.Script.Serialization; -namespace TGServerService +namespace TGS.Server.Service { /// /// Repository specific information for a @@ -12,7 +12,7 @@ namespace TGServerService sealed class RepoConfig : IEquatable { /// - /// If this json is setup to support + /// If this json is setup to support /// public readonly bool ChangelogSupport; /// diff --git a/TGServerService/RootAuthorizationManager.cs b/TGS.Server.Service/RootAuthorizationManager.cs similarity index 95% rename from TGServerService/RootAuthorizationManager.cs rename to TGS.Server.Service/RootAuthorizationManager.cs index f3f45d0983..4c62acb8a7 100644 --- a/TGServerService/RootAuthorizationManager.cs +++ b/TGS.Server.Service/RootAuthorizationManager.cs @@ -4,9 +4,9 @@ using System.Diagnostics; using System.Linq; using System.Security.Principal; using System.ServiceModel; -using TGServiceInterface.Components; +using TGS.Interface.Components; -namespace TGServerService +namespace TGS.Server.Service { /// /// A used to determine only if the caller is an admin diff --git a/TGServerService/ServerInstance/Administration.cs b/TGS.Server.Service/ServerInstance/Administration.cs similarity index 98% rename from TGServerService/ServerInstance/Administration.cs rename to TGS.Server.Service/ServerInstance/Administration.cs index affe43a2b7..03b7caf1c3 100644 --- a/TGServerService/ServerInstance/Administration.cs +++ b/TGS.Server.Service/ServerInstance/Administration.cs @@ -3,10 +3,10 @@ using System.DirectoryServices.AccountManagement; using System.Security.Principal; using System.ServiceModel; using System.Threading; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGServerService +namespace TGS.Server.Service { //note this only works with MACHINE LOCAL groups and admins for now //if someone wants AD shit, code it yourself diff --git a/TGServerService/ServerInstance/Byond.cs b/TGS.Server.Service/ServerInstance/Byond.cs similarity index 99% rename from TGServerService/ServerInstance/Byond.cs rename to TGS.Server.Service/ServerInstance/Byond.cs index 2b902a52f6..bd00bfb10f 100644 --- a/TGServerService/ServerInstance/Byond.cs +++ b/TGS.Server.Service/ServerInstance/Byond.cs @@ -5,10 +5,10 @@ using System.IO.Compression; using System.Net; using System.Text.RegularExpressions; using System.Threading; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGServerService +namespace TGS.Server.Service { sealed partial class ServerInstance : ITGByond { diff --git a/TGServerService/ServerInstance/Chat.cs b/TGS.Server.Service/ServerInstance/Chat.cs similarity index 97% rename from TGServerService/ServerInstance/Chat.cs rename to TGS.Server.Service/ServerInstance/Chat.cs index ede8605480..8c6bb66464 100644 --- a/TGServerService/ServerInstance/Chat.cs +++ b/TGS.Server.Service/ServerInstance/Chat.cs @@ -2,12 +2,12 @@ using System.Linq; using System.Collections.Generic; using System.Web.Script.Serialization; -using TGServerService.ChatCommands; -using TGServerService.ChatProviders; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Server.Service.ChatCommands; +using TGS.Server.Service.ChatProviders; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGServerService +namespace TGS.Server.Service { sealed partial class ServerInstance : ITGChat { diff --git a/TGServerService/ServerInstance/Compiler.cs b/TGS.Server.Service/ServerInstance/Compiler.cs similarity index 99% rename from TGServerService/ServerInstance/Compiler.cs rename to TGS.Server.Service/ServerInstance/Compiler.cs index 6ccda81072..dd5a2867ea 100644 --- a/TGServerService/ServerInstance/Compiler.cs +++ b/TGS.Server.Service/ServerInstance/Compiler.cs @@ -6,10 +6,10 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Text; using System.Threading; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGServerService +namespace TGS.Server.Service { sealed partial class ServerInstance : ITGCompiler { diff --git a/TGServerService/ServerInstance/Config.cs b/TGS.Server.Service/ServerInstance/Config.cs similarity index 99% rename from TGServerService/ServerInstance/Config.cs rename to TGS.Server.Service/ServerInstance/Config.cs index d59fef5909..af81f094cc 100644 --- a/TGServerService/ServerInstance/Config.cs +++ b/TGS.Server.Service/ServerInstance/Config.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.IO; using System.ServiceModel; -using TGServiceInterface.Components; +using TGS.Interface.Components; -namespace TGServerService +namespace TGS.Server.Service { //knobs and such sealed partial class ServerInstance : ITGConfig diff --git a/TGServerService/ServerInstance/DreamDaemon.cs b/TGS.Server.Service/ServerInstance/DreamDaemon.cs similarity index 99% rename from TGServerService/ServerInstance/DreamDaemon.cs rename to TGS.Server.Service/ServerInstance/DreamDaemon.cs index 0321025126..1682f4b7a5 100644 --- a/TGServerService/ServerInstance/DreamDaemon.cs +++ b/TGS.Server.Service/ServerInstance/DreamDaemon.cs @@ -5,10 +5,10 @@ using System.Linq; using System.Reflection; using System.Threading; using System.Timers; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGServerService +namespace TGS.Server.Service { //manages the dd window. //It's not possible to actually click it while starting it in CL mode, so in order to change visibility, security, etc. It restarts the process when the world reboots @@ -537,7 +537,7 @@ namespace TGServerService //We could be debugging from the project directory if (!File.Exists(BridgePath)) //A little hackish debug mode doctoring never hurt anyone - BridgePath = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(InterfacePath)))), "TGDreamDaemonBridge/bin/x86/Debug", BridgeDLLName); + BridgePath = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(InterfacePath)))), "TGS.Interface.Bridge/bin/x86/Debug", BridgeDLLName); #endif try { diff --git a/TGServerService/ServerInstance/Interop.cs b/TGS.Server.Service/ServerInstance/Interop.cs similarity index 98% rename from TGServerService/ServerInstance/Interop.cs rename to TGS.Server.Service/ServerInstance/Interop.cs index ba64d4a372..621b0502cc 100644 --- a/TGServerService/ServerInstance/Interop.cs +++ b/TGS.Server.Service/ServerInstance/Interop.cs @@ -6,11 +6,11 @@ using System.Text; using System.Threading; using System.Web.Script.Serialization; using System.Web.Security; -using TGServerService.ChatCommands; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Server.Service.ChatCommands; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGServerService +namespace TGS.Server.Service { //handles talking between the world and us sealed partial class ServerInstance : ITGInterop diff --git a/TGServerService/ServerInstance/PreactionHandler.cs b/TGS.Server.Service/ServerInstance/PreactionHandler.cs similarity index 99% rename from TGServerService/ServerInstance/PreactionHandler.cs rename to TGS.Server.Service/ServerInstance/PreactionHandler.cs index 84bc7d8ff9..f3991ef8f6 100644 --- a/TGServerService/ServerInstance/PreactionHandler.cs +++ b/TGS.Server.Service/ServerInstance/PreactionHandler.cs @@ -2,7 +2,7 @@ using System.Diagnostics; using System.IO; -namespace TGServerService +namespace TGS.Server.Service { // Some useful functions for triggering pre action events sealed partial class ServerInstance diff --git a/TGServerService/ServerInstance/Repository.cs b/TGS.Server.Service/ServerInstance/Repository.cs similarity index 99% rename from TGServerService/ServerInstance/Repository.cs rename to TGS.Server.Service/ServerInstance/Repository.cs index 993da4654b..4ff01a7cb9 100644 --- a/TGServerService/ServerInstance/Repository.cs +++ b/TGS.Server.Service/ServerInstance/Repository.cs @@ -7,10 +7,10 @@ using System.Linq; using System.Net; using System.Threading; using System.Web.Script.Serialization; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGServerService +namespace TGS.Server.Service { sealed partial class ServerInstance : ITGRepository, IDisposable { @@ -81,7 +81,7 @@ namespace TGServerService /// Repository Repo; /// - /// Used for reporting operation progress to the + /// Used for reporting operation progress to the /// int currentProgress = -1; diff --git a/TGServerService/ServerInstance/ServerInstance.cs b/TGS.Server.Service/ServerInstance/ServerInstance.cs similarity index 98% rename from TGServerService/ServerInstance/ServerInstance.cs rename to TGS.Server.Service/ServerInstance/ServerInstance.cs index dca0af9150..64ef3506ca 100644 --- a/TGServerService/ServerInstance/ServerInstance.cs +++ b/TGS.Server.Service/ServerInstance/ServerInstance.cs @@ -2,9 +2,9 @@ using System.Diagnostics; using System.IO; using System.ServiceModel; -using TGServiceInterface.Components; +using TGS.Interface.Components; -namespace TGServerService +namespace TGS.Server.Service { //I know the fact that this is one massive partial class is gonna trigger everyone //There really was no other succinct way to do it (<= He's lying through his teeth, don't listen to him) diff --git a/TGServerService/Service.cs b/TGS.Server.Service/Service.cs similarity index 96% rename from TGServerService/Service.cs rename to TGS.Server.Service/Service.cs index 75f0f23cac..99ec13e82e 100644 --- a/TGServerService/Service.cs +++ b/TGS.Server.Service/Service.cs @@ -1,693 +1,693 @@ -using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Diagnostics; -using System.IO; -using System.Security.Principal; -using System.ServiceModel; -using System.ServiceProcess; -using TGServiceInterface; -using TGServiceInterface.Components; - -namespace TGServerService -{ - /// - /// The windows service the application runs as - /// - [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.Single)] - class Service : ServiceBase, ITGSService, ITGConnectivity, ITGLanding, ITGInstanceManager - { - /// - /// The logging ID used for events - /// - public const byte LoggingID = 0; - - /// - /// The service version based on the - /// - public static readonly string VersionString = "/tg/station 13 Server Service v" + FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion; - - /// - /// Singleton instance - /// - static Service ActiveService; - - /// - /// Cancels WCF's user impersonation to allow clean access to writing log files - /// - public static void CancelImpersonation() - { - WindowsIdentity.Impersonate(IntPtr.Zero); - } - - /// - /// Writes an event to Windows the event log - /// - /// The log message - /// The of the message - /// The of the event - /// The logging source ID for the event - public static void WriteEntry(string message, EventID id, EventLogEntryType eventType, byte loggingID) - { - ActiveService.EventLog.WriteEntry(message, eventType, (int)id + loggingID); - } - - /// - /// Checks an for illegal characters - /// - /// The name to check - /// if contains no illegal characters, error message otherwise - static string CheckInstanceName(string instanceName) - { - char[] bannedCharacters = { ';', '&', '=', '%' }; - foreach (var I in bannedCharacters) - if (instanceName.Contains(I.ToString())) - return "Instance names may not contain the following characters: ';', '&', '=', or '%'"; - return null; - } - - /// - /// Sets up ServiceName and - /// - public Service() - { - ServiceName = "TG Station Server"; - if (ActiveService != null) - throw new Exception("There is already a Service instance running!"); - ActiveService = this; - } - - /// - /// Clears - /// - /// if this method was invoked from , otherwise it was invoked by the finalizer - protected override void Dispose(bool disposing) - { - ActiveService = null; - base.Dispose(disposing); - } - - /// - /// The WCF host that contains connects to - /// - ServiceHost serviceHost; - /// - /// Map of to the respective hosting the - /// - IDictionary hosts; - /// - /// List of s in use - /// - IList UsedLoggingIDs = new List(); - - /// - /// Migrates the .NET config from to + 1 - /// - /// The version to migrate from - void MigrateSettings(int oldVersion) - { - var Config = Properties.Settings.Default; - switch (oldVersion) - { - case 6: //switch to per-instance configs - var IC = DeprecatedInstanceConfig.CreateFromNETSettings(); - IC.Save(); - Config.InstancePaths.Add(IC.Directory); - break; - } - } - - /// - /// Enumerates configured s. Detaches those that fail to load - /// - /// Each configured - IEnumerable GetInstanceConfigs() - { - var pathsToRemove = new List(); - lock (this) - { - var IPS = Properties.Settings.Default.InstancePaths; - foreach (var I in IPS) - { - IInstanceConfig ic; - try - { - ic = InstanceConfig.Load(I); - } - catch (Exception e) - { - WriteEntry(String.Format("Unable load instance config at path {0}. Error: {1} Detaching...", I, e.ToString()), EventID.InstanceInitializationFailure, EventLogEntryType.Error, LoggingID); - pathsToRemove.Add(I); - continue; - } - yield return ic; - } - foreach (var I in pathsToRemove) - IPS.Remove(I); - } - } - - /// - /// Overrides and saves the configured if requested by command line parameters - /// - /// The command line parameters for the - void ChangePortFromCommandLine(string[] args) - { - var Config = Properties.Settings.Default; - - for (var I = 0; I < args.Length - 1; ++I) - if (args[I].ToLower() == "-port") - { - try - { - var res = Convert.ToUInt16(args[I + 1]); - if (res == 0) - throw new Exception("Cannot bind to port 0"); - Config.RemoteAccessPort = res; - } - catch (Exception e) - { - throw new Exception("Invalid argument for \"-port\"", e); - } - Config.Save(); - break; - } - } - - /// - /// Called by the Windows service manager. Initializes and starts configured s - /// - /// Command line arguments for the - protected override void OnStart(string[] args) - { - Environment.CurrentDirectory = Directory.CreateDirectory(Path.GetTempPath() + "/TGStationServerService").FullName; //MOVE THIS POINTER BECAUSE ONE TIME I ALMOST ACCIDENTALLY NUKED MYSELF BY REFACTORING! http://imgur.com/zvGEpJD.png - - SetupConfig(); - - ChangePortFromCommandLine(args); - - SetupService(); - - SetupInstances(); - - OnlineAllHosts(); - } - - /// - /// Writes some changes to the that always need to be done. - /// - void PrePrepConfig() - { - var Config = Properties.Settings.Default; - - if (Config.InstancePaths == null) - Config.InstancePaths = new StringCollection(); - } - - /// - /// Upgrades up the service configuration - /// - void SetupConfig() - { - var Config = Properties.Settings.Default; - if (Config.UpgradeRequired) - { - var newVersion = Config.SettingsVersion; - Config.Upgrade(); - - PrePrepConfig(); - - for (var oldVersion = Config.SettingsVersion; oldVersion < newVersion; ++oldVersion) - MigrateSettings(oldVersion); - - Config.SettingsVersion = newVersion; - - Config.UpgradeRequired = false; - Config.Save(); - } - else - PrePrepConfig(); - } - - /// - /// Creates the for - /// - void SetupService() - { - serviceHost = CreateHost(this, ServerInterface.MasterInterfaceName); - foreach (var I in ServerInterface.ValidServiceInterfaces) - AddEndpoint(serviceHost, I); - serviceHost.Authorization.ServiceAuthorizationManager = new RootAuthorizationManager(); //only admins can diddle us - } - - /// - /// Opens all created s - /// - void OnlineAllHosts() - { - serviceHost.Open(); - foreach (var I in hosts) - I.Value.Open(); - } - - /// - /// Creates a for using the default pipe, CloseTimeout for the , and the configured - /// - /// The - /// The URL to access components on the - /// The created - static ServiceHost CreateHost(object singleton, string endpointPostfix) - { - return new ServiceHost(singleton, new Uri[] { new Uri(String.Format("net.pipe://localhost/{0}", endpointPostfix)), new Uri(String.Format("https://localhost:{0}/{1}", Properties.Settings.Default.RemoteAccessPort, endpointPostfix)) }) - { - CloseTimeout = new TimeSpan(0, 0, 5) - }; - } - - /// - /// Creates s for all s as listed in , detaches bad ones - /// - void SetupInstances() - { - hosts = new Dictionary(); - var pathsToRemove = new List(); - var seenNames = new List(); - foreach (var I in GetInstanceConfigs()) - { - if (seenNames.Contains(I.Name)) - { - WriteEntry(String.Format("Instance at {0} has a duplicate name! Detaching...", I.Directory), EventID.InstanceInitializationFailure, EventLogEntryType.Error, LoggingID); - pathsToRemove.Add(I.Directory); - } - if (I.Enabled && SetupInstance(I) == null) - pathsToRemove.Add(I.Directory); - else - seenNames.Add(I.Name); - } - foreach (var I in pathsToRemove) - Properties.Settings.Default.InstancePaths.Remove(I); - } - - /// - /// Unlocks a acquired with - /// - /// The to unlock - void UnlockLoggingID(byte ID) - { - lock (UsedLoggingIDs) - { - UsedLoggingIDs.Remove(ID); - } - } - - /// - /// Gets and locks a - /// - /// A logging ID for the must be released using - byte LockLoggingID() - { - lock (UsedLoggingIDs) - { - for (byte I = 1; I < 100; ++I) - if (!UsedLoggingIDs.Contains(I)) - { - UsedLoggingIDs.Add(I); - return I; - } - } - throw new Exception("All logging IDs in use!"); - } - - /// - /// Creates and starts a for a at - /// - /// The for the - /// The inactive on success, on failure - ServiceHost SetupInstance(IInstanceConfig config) - { - ServerInstance instance; - string instanceName; - try - { - if (hosts.ContainsKey(config.Directory)) - { - var datInstance = ((ServerInstance)hosts[config.Directory].SingletonInstance); - WriteEntry(String.Format("Unable to start instance at path {0}. Has the same name as instance at path {1}. Detaching...", config.Directory, datInstance.ServerDirectory()), EventID.InstanceInitializationFailure, EventLogEntryType.Error, LoggingID); - return null; - } - if (!config.Enabled) - return null; - var ID = LockLoggingID(); - WriteEntry(String.Format("Instance {0} ({1}) assigned logging ID {2}", config.Name, config.Directory, ID), EventID.InstanceIDAssigned, EventLogEntryType.Information, ID); - instanceName = config.Name; - instance = new ServerInstance(config, ID); - } - catch (Exception e) - { - WriteEntry(String.Format("Unable to start instance at path {0}. Detaching... Error: {1}", config.Directory, e.ToString()), EventID.InstanceInitializationFailure, EventLogEntryType.Error, LoggingID); - return null; - } - - var host = CreateHost(instance, String.Format("{0}/{1}", ServerInterface.InstanceInterfaceName, instanceName)); - hosts.Add(instanceName, host); - - foreach (var J in ServerInterface.ValidInstanceInterfaces) - AddEndpoint(host, J); - - host.Authorization.ServiceAuthorizationManager = instance; - return host; - } - - /// - /// Adds a WCF endpoint for a component - /// - /// The service host to add the component to - /// The type of the component - void AddEndpoint(ServiceHost host, Type typetype) - { - var bindingName = typetype.Name; - host.AddServiceEndpoint(typetype, new NetNamedPipeBinding() { SendTimeout = new TimeSpan(0, 0, 30), MaxReceivedMessageSize = ServerInterface.TransferLimitLocal }, bindingName); - var httpsBinding = new WSHttpBinding() - { - SendTimeout = new TimeSpan(0, 0, 40), - MaxReceivedMessageSize = ServerInterface.TransferLimitRemote - }; - var requireAuth = typetype.Name != typeof(ITGConnectivity).Name; - httpsBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; - httpsBinding.Security.Mode = requireAuth ? SecurityMode.TransportWithMessageCredential : SecurityMode.Transport; //do not require auth for a connectivity check - httpsBinding.Security.Message.ClientCredentialType = requireAuth ? MessageCredentialType.UserName : MessageCredentialType.None; - host.AddServiceEndpoint(typetype, httpsBinding, bindingName); - } - - /// - /// Shuts down all active s and calls on it's - /// - protected override void OnStop() - { - lock (this) - { - try - { - foreach (var I in hosts) - { - var host = I.Value; - var instance = (ServerInstance)host.SingletonInstance; - host.Close(); - instance.Dispose(); - UnlockLoggingID(instance.LoggingID); - } - } - catch (Exception e) - { - WriteEntry(e.ToString(), EventID.ServiceShutdownFail, EventLogEntryType.Error, LoggingID); - } - serviceHost.Close(); - } - Properties.Settings.Default.Save(); - ActiveService = null; - } - - /// - public void VerifyConnection() { } - - /// - public void PrepareForUpdate() - { - foreach (var I in hosts) - ((ServerInstance)I.Value.SingletonInstance).Reattach(false); - } - - /// - public ushort RemoteAccessPort() - { - return Properties.Settings.Default.RemoteAccessPort; - } - - /// - public string SetRemoteAccessPort(ushort port) - { - if (port == 0) - return "Cannot bind to port 0"; - Properties.Settings.Default.RemoteAccessPort = port; - return null; - } - - /// - public string Version() - { - return VersionString; - } - - /// - public bool SetPythonPath(string path) - { - if (!Directory.Exists(path)) - return false; - Properties.Settings.Default.PythonPath = Path.GetFullPath(path); - return true; - } - - /// - public string PythonPath() - { - return Properties.Settings.Default.PythonPath; - } - - /// - public IList ListInstances() - { - var result = new List(); - lock (this) - foreach (var ic in GetInstanceConfigs()) - result.Add(new InstanceMetadata - { - Name = ic.Name, - Path = ic.Directory, - Enabled = ic.Enabled, - LoggingID = (byte)(ic.Enabled ? ((ServerInstance)hosts[ic.Name].SingletonInstance).LoggingID : 0) - }); - return result; - } - - /// - public string CreateInstance(string Name, string path) - { - path = Program.NormalizePath(path); - var res = CheckInstanceName(Name); - if (res != null) - return res; - if (File.Exists(path) || Directory.Exists(path)) - return "Cannot create instance at pre-existing path!"; - var Config = Properties.Settings.Default; - lock (this) - { - if (Config.InstancePaths.Contains(path)) - return String.Format("Instance at {0} already exists!", path); - foreach (var oic in GetInstanceConfigs()) - if (Name == oic.Name) - return String.Format("Instance named {0} already exists!", oic.Name); - IInstanceConfig ic; - try - { - ic = new InstanceConfig(path) - { - Name = Name - }; - Directory.CreateDirectory(path); - ic.Save(); - Properties.Settings.Default.InstancePaths.Add(path); - } - catch (Exception e) - { - return e.ToString(); - } - return SetupOneInstance(ic); - } - } - - /// - /// Starts and onlines an instance located at - /// - /// The for the - /// on success, error message on failure - string SetupOneInstance(IInstanceConfig config) - { - if (!config.Enabled) - return null; - try - { - var host = SetupInstance(config); - if (host != null) - host.Open(); - else - lock (this) - Properties.Settings.Default.InstancePaths.Remove(config.Directory); - return null; - } - catch (Exception e) - { - return "Instance set up but an error occurred while starting it: " + e.ToString(); - } - } - - /// - public string ImportInstance(string path) - { - path = Program.NormalizePath(path); - var Config = Properties.Settings.Default; - lock (this) - { - if (Config.InstancePaths.Contains(path)) - return String.Format("Instance at {0} already exists!", path); - if(!Directory.Exists(path)) - return String.Format("There is no instance located at {0}!", path); - IInstanceConfig ic; - try - { - ic = InstanceConfig.Load(path); - foreach(var oic in GetInstanceConfigs()) - if(ic.Name == oic.Name) - return String.Format("Instance named {0} already exists!", oic.Name); - ic.Save(); - Properties.Settings.Default.InstancePaths.Add(path); - } - catch (Exception e) - { - return e.ToString(); - } - return SetupOneInstance(ic); - } - } - - /// - public bool InstanceEnabled(string Name) - { - lock(this) - { - return hosts.ContainsKey(Name); - } - } - - /// - public string SetInstanceEnabled(string Name, bool enabled) - { - return SetInstanceEnabledImpl(Name, enabled, out string path); - } - - - /// - /// Sets a 's enabled status - /// - /// The whom's status should be changed - /// to enable the , to disable it - /// The path to the modified - /// on success, error message on failure - string SetInstanceEnabledImpl(string Name, bool enabled, out string path) - { - path = null; - lock (this) - { - var hostIsOnline = hosts.ContainsKey(Name); - if (enabled) - { - if (hostIsOnline) - return null; - foreach (var ic in GetInstanceConfigs()) - if (ic.Name == Name) - { - path = ic.Directory; - ic.Enabled = true; - ic.Save(); - return SetupOneInstance(ic); - } - return String.Format("Instance {0} does not exist!", Name); - } - else - { - if (!hostIsOnline) - return null; - var host = hosts[Name]; - hosts.Remove(Name); - var inst = (ServerInstance)host.SingletonInstance; - host.Close(); - path = inst.ServerDirectory(); - inst.Offline(); - inst.Dispose(); - UnlockLoggingID(inst.LoggingID); - return null; - } - } - } - - /// - public string RenameInstance(string name, string new_name) - { - if (name == new_name) - return null; - var res = CheckInstanceName(new_name); - if (res != null) - return res; - lock (this) - { - //we have to check em all anyway - IInstanceConfig the_droid_were_looking_for = null; - foreach (var ic in GetInstanceConfigs()) - if (ic.Name == name) - { - the_droid_were_looking_for = ic; - break; - } - else if (ic.Name == new_name) - return String.Format("There is already another instance named {0}!", new_name); - if (the_droid_were_looking_for == null) - return String.Format("There is no instance named {0}!", name); - var ie = InstanceEnabled(name); - if(ie) - SetInstanceEnabled(name, false); - the_droid_were_looking_for.Name = new_name; - string result = ""; - try - { - the_droid_were_looking_for.Save(); - result = null; - } - catch(Exception e) - { - result = "Could not save instance config! Error: " + e.ToString(); - } - finally - { - if (ie) - { - var resRestore = SetInstanceEnabled(new_name, true); - if (resRestore != null) - result = (result + " " + resRestore).Trim(); - } - } - return result; - } - } - - /// - public string DetachInstance(string name) - { - lock (this) - { - var res = SetInstanceEnabledImpl(name, false, out string path); - if (res != null) - return res; - if (path == null) //gotta find it ourselves - foreach (var ic in GetInstanceConfigs()) - if (ic.Name == name) - { - path = ic.Directory; - break; - } - if (path == null) - return String.Format("No instance named {0} exists!", name); - Properties.Settings.Default.InstancePaths.Remove(path); - return null; - } - } - } -} +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Diagnostics; +using System.IO; +using System.Security.Principal; +using System.ServiceModel; +using System.ServiceProcess; +using TGS.Interface; +using TGS.Interface.Components; + +namespace TGS.Server.Service +{ + /// + /// The windows service the application runs as + /// + [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.Single)] + class Service : ServiceBase, ITGSService, ITGConnectivity, ITGLanding, ITGInstanceManager + { + /// + /// The logging ID used for events + /// + public const byte LoggingID = 0; + + /// + /// The service version based on the + /// + public static readonly string VersionString = "/tg/station 13 Server Service v" + FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion; + + /// + /// Singleton instance + /// + static Service ActiveService; + + /// + /// Cancels WCF's user impersonation to allow clean access to writing log files + /// + public static void CancelImpersonation() + { + WindowsIdentity.Impersonate(IntPtr.Zero); + } + + /// + /// Writes an event to Windows the event log + /// + /// The log message + /// The of the message + /// The of the event + /// The logging source ID for the event + public static void WriteEntry(string message, EventID id, EventLogEntryType eventType, byte loggingID) + { + ActiveService.EventLog.WriteEntry(message, eventType, (int)id + loggingID); + } + + /// + /// Checks an for illegal characters + /// + /// The name to check + /// if contains no illegal characters, error message otherwise + static string CheckInstanceName(string instanceName) + { + char[] bannedCharacters = { ';', '&', '=', '%' }; + foreach (var I in bannedCharacters) + if (instanceName.Contains(I.ToString())) + return "Instance names may not contain the following characters: ';', '&', '=', or '%'"; + return null; + } + + /// + /// Sets up ServiceName and + /// + public Service() + { + ServiceName = "TG Station Server"; + if (ActiveService != null) + throw new Exception("There is already a Service instance running!"); + ActiveService = this; + } + + /// + /// Clears + /// + /// if this method was invoked from , otherwise it was invoked by the finalizer + protected override void Dispose(bool disposing) + { + ActiveService = null; + base.Dispose(disposing); + } + + /// + /// The WCF host that contains connects to + /// + ServiceHost serviceHost; + /// + /// Map of to the respective hosting the + /// + IDictionary hosts; + /// + /// List of s in use + /// + IList UsedLoggingIDs = new List(); + + /// + /// Migrates the .NET config from to + 1 + /// + /// The version to migrate from + void MigrateSettings(int oldVersion) + { + var Config = Properties.Settings.Default; + switch (oldVersion) + { + case 6: //switch to per-instance configs + var IC = DeprecatedInstanceConfig.CreateFromNETSettings(); + IC.Save(); + Config.InstancePaths.Add(IC.Directory); + break; + } + } + + /// + /// Enumerates configured s. Detaches those that fail to load + /// + /// Each configured + IEnumerable GetInstanceConfigs() + { + var pathsToRemove = new List(); + lock (this) + { + var IPS = Properties.Settings.Default.InstancePaths; + foreach (var I in IPS) + { + IInstanceConfig ic; + try + { + ic = InstanceConfig.Load(I); + } + catch (Exception e) + { + WriteEntry(String.Format("Unable load instance config at path {0}. Error: {1} Detaching...", I, e.ToString()), EventID.InstanceInitializationFailure, EventLogEntryType.Error, LoggingID); + pathsToRemove.Add(I); + continue; + } + yield return ic; + } + foreach (var I in pathsToRemove) + IPS.Remove(I); + } + } + + /// + /// Overrides and saves the configured if requested by command line parameters + /// + /// The command line parameters for the + void ChangePortFromCommandLine(string[] args) + { + var Config = Properties.Settings.Default; + + for (var I = 0; I < args.Length - 1; ++I) + if (args[I].ToLower() == "-port") + { + try + { + var res = Convert.ToUInt16(args[I + 1]); + if (res == 0) + throw new Exception("Cannot bind to port 0"); + Config.RemoteAccessPort = res; + } + catch (Exception e) + { + throw new Exception("Invalid argument for \"-port\"", e); + } + Config.Save(); + break; + } + } + + /// + /// Called by the Windows service manager. Initializes and starts configured s + /// + /// Command line arguments for the + protected override void OnStart(string[] args) + { + Environment.CurrentDirectory = Directory.CreateDirectory(Path.GetTempPath() + "/TGStationServerService").FullName; //MOVE THIS POINTER BECAUSE ONE TIME I ALMOST ACCIDENTALLY NUKED MYSELF BY REFACTORING! http://imgur.com/zvGEpJD.png + + SetupConfig(); + + ChangePortFromCommandLine(args); + + SetupService(); + + SetupInstances(); + + OnlineAllHosts(); + } + + /// + /// Writes some changes to the that always need to be done. + /// + void PrePrepConfig() + { + var Config = Properties.Settings.Default; + + if (Config.InstancePaths == null) + Config.InstancePaths = new StringCollection(); + } + + /// + /// Upgrades up the service configuration + /// + void SetupConfig() + { + var Config = Properties.Settings.Default; + if (Config.UpgradeRequired) + { + var newVersion = Config.SettingsVersion; + Config.Upgrade(); + + PrePrepConfig(); + + for (var oldVersion = Config.SettingsVersion; oldVersion < newVersion; ++oldVersion) + MigrateSettings(oldVersion); + + Config.SettingsVersion = newVersion; + + Config.UpgradeRequired = false; + Config.Save(); + } + else + PrePrepConfig(); + } + + /// + /// Creates the for + /// + void SetupService() + { + serviceHost = CreateHost(this, ServerInterface.MasterInterfaceName); + foreach (var I in ServerInterface.ValidServiceInterfaces) + AddEndpoint(serviceHost, I); + serviceHost.Authorization.ServiceAuthorizationManager = new RootAuthorizationManager(); //only admins can diddle us + } + + /// + /// Opens all created s + /// + void OnlineAllHosts() + { + serviceHost.Open(); + foreach (var I in hosts) + I.Value.Open(); + } + + /// + /// Creates a for using the default pipe, CloseTimeout for the , and the configured + /// + /// The + /// The URL to access components on the + /// The created + static ServiceHost CreateHost(object singleton, string endpointPostfix) + { + return new ServiceHost(singleton, new Uri[] { new Uri(String.Format("net.pipe://localhost/{0}", endpointPostfix)), new Uri(String.Format("https://localhost:{0}/{1}", Properties.Settings.Default.RemoteAccessPort, endpointPostfix)) }) + { + CloseTimeout = new TimeSpan(0, 0, 5) + }; + } + + /// + /// Creates s for all s as listed in , detaches bad ones + /// + void SetupInstances() + { + hosts = new Dictionary(); + var pathsToRemove = new List(); + var seenNames = new List(); + foreach (var I in GetInstanceConfigs()) + { + if (seenNames.Contains(I.Name)) + { + WriteEntry(String.Format("Instance at {0} has a duplicate name! Detaching...", I.Directory), EventID.InstanceInitializationFailure, EventLogEntryType.Error, LoggingID); + pathsToRemove.Add(I.Directory); + } + if (I.Enabled && SetupInstance(I) == null) + pathsToRemove.Add(I.Directory); + else + seenNames.Add(I.Name); + } + foreach (var I in pathsToRemove) + Properties.Settings.Default.InstancePaths.Remove(I); + } + + /// + /// Unlocks a acquired with + /// + /// The to unlock + void UnlockLoggingID(byte ID) + { + lock (UsedLoggingIDs) + { + UsedLoggingIDs.Remove(ID); + } + } + + /// + /// Gets and locks a + /// + /// A logging ID for the must be released using + byte LockLoggingID() + { + lock (UsedLoggingIDs) + { + for (byte I = 1; I < 100; ++I) + if (!UsedLoggingIDs.Contains(I)) + { + UsedLoggingIDs.Add(I); + return I; + } + } + throw new Exception("All logging IDs in use!"); + } + + /// + /// Creates and starts a for a at + /// + /// The for the + /// The inactive on success, on failure + ServiceHost SetupInstance(IInstanceConfig config) + { + ServerInstance instance; + string instanceName; + try + { + if (hosts.ContainsKey(config.Directory)) + { + var datInstance = ((ServerInstance)hosts[config.Directory].SingletonInstance); + WriteEntry(String.Format("Unable to start instance at path {0}. Has the same name as instance at path {1}. Detaching...", config.Directory, datInstance.ServerDirectory()), EventID.InstanceInitializationFailure, EventLogEntryType.Error, LoggingID); + return null; + } + if (!config.Enabled) + return null; + var ID = LockLoggingID(); + WriteEntry(String.Format("Instance {0} ({1}) assigned logging ID {2}", config.Name, config.Directory, ID), EventID.InstanceIDAssigned, EventLogEntryType.Information, ID); + instanceName = config.Name; + instance = new ServerInstance(config, ID); + } + catch (Exception e) + { + WriteEntry(String.Format("Unable to start instance at path {0}. Detaching... Error: {1}", config.Directory, e.ToString()), EventID.InstanceInitializationFailure, EventLogEntryType.Error, LoggingID); + return null; + } + + var host = CreateHost(instance, String.Format("{0}/{1}", ServerInterface.InstanceInterfaceName, instanceName)); + hosts.Add(instanceName, host); + + foreach (var J in ServerInterface.ValidInstanceInterfaces) + AddEndpoint(host, J); + + host.Authorization.ServiceAuthorizationManager = instance; + return host; + } + + /// + /// Adds a WCF endpoint for a component + /// + /// The service host to add the component to + /// The type of the component + void AddEndpoint(ServiceHost host, Type typetype) + { + var bindingName = typetype.Name; + host.AddServiceEndpoint(typetype, new NetNamedPipeBinding() { SendTimeout = new TimeSpan(0, 0, 30), MaxReceivedMessageSize = ServerInterface.TransferLimitLocal }, bindingName); + var httpsBinding = new WSHttpBinding() + { + SendTimeout = new TimeSpan(0, 0, 40), + MaxReceivedMessageSize = ServerInterface.TransferLimitRemote + }; + var requireAuth = typetype.Name != typeof(ITGConnectivity).Name; + httpsBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; + httpsBinding.Security.Mode = requireAuth ? SecurityMode.TransportWithMessageCredential : SecurityMode.Transport; //do not require auth for a connectivity check + httpsBinding.Security.Message.ClientCredentialType = requireAuth ? MessageCredentialType.UserName : MessageCredentialType.None; + host.AddServiceEndpoint(typetype, httpsBinding, bindingName); + } + + /// + /// Shuts down all active s and calls on it's + /// + protected override void OnStop() + { + lock (this) + { + try + { + foreach (var I in hosts) + { + var host = I.Value; + var instance = (ServerInstance)host.SingletonInstance; + host.Close(); + instance.Dispose(); + UnlockLoggingID(instance.LoggingID); + } + } + catch (Exception e) + { + WriteEntry(e.ToString(), EventID.ServiceShutdownFail, EventLogEntryType.Error, LoggingID); + } + serviceHost.Close(); + } + Properties.Settings.Default.Save(); + ActiveService = null; + } + + /// + public void VerifyConnection() { } + + /// + public void PrepareForUpdate() + { + foreach (var I in hosts) + ((ServerInstance)I.Value.SingletonInstance).Reattach(false); + } + + /// + public ushort RemoteAccessPort() + { + return Properties.Settings.Default.RemoteAccessPort; + } + + /// + public string SetRemoteAccessPort(ushort port) + { + if (port == 0) + return "Cannot bind to port 0"; + Properties.Settings.Default.RemoteAccessPort = port; + return null; + } + + /// + public string Version() + { + return VersionString; + } + + /// + public bool SetPythonPath(string path) + { + if (!Directory.Exists(path)) + return false; + Properties.Settings.Default.PythonPath = Path.GetFullPath(path); + return true; + } + + /// + public string PythonPath() + { + return Properties.Settings.Default.PythonPath; + } + + /// + public IList ListInstances() + { + var result = new List(); + lock (this) + foreach (var ic in GetInstanceConfigs()) + result.Add(new InstanceMetadata + { + Name = ic.Name, + Path = ic.Directory, + Enabled = ic.Enabled, + LoggingID = (byte)(ic.Enabled ? ((ServerInstance)hosts[ic.Name].SingletonInstance).LoggingID : 0) + }); + return result; + } + + /// + public string CreateInstance(string Name, string path) + { + path = Program.NormalizePath(path); + var res = CheckInstanceName(Name); + if (res != null) + return res; + if (File.Exists(path) || Directory.Exists(path)) + return "Cannot create instance at pre-existing path!"; + var Config = Properties.Settings.Default; + lock (this) + { + if (Config.InstancePaths.Contains(path)) + return String.Format("Instance at {0} already exists!", path); + foreach (var oic in GetInstanceConfigs()) + if (Name == oic.Name) + return String.Format("Instance named {0} already exists!", oic.Name); + IInstanceConfig ic; + try + { + ic = new InstanceConfig(path) + { + Name = Name + }; + Directory.CreateDirectory(path); + ic.Save(); + Properties.Settings.Default.InstancePaths.Add(path); + } + catch (Exception e) + { + return e.ToString(); + } + return SetupOneInstance(ic); + } + } + + /// + /// Starts and onlines an instance located at + /// + /// The for the + /// on success, error message on failure + string SetupOneInstance(IInstanceConfig config) + { + if (!config.Enabled) + return null; + try + { + var host = SetupInstance(config); + if (host != null) + host.Open(); + else + lock (this) + Properties.Settings.Default.InstancePaths.Remove(config.Directory); + return null; + } + catch (Exception e) + { + return "Instance set up but an error occurred while starting it: " + e.ToString(); + } + } + + /// + public string ImportInstance(string path) + { + path = Program.NormalizePath(path); + var Config = Properties.Settings.Default; + lock (this) + { + if (Config.InstancePaths.Contains(path)) + return String.Format("Instance at {0} already exists!", path); + if(!Directory.Exists(path)) + return String.Format("There is no instance located at {0}!", path); + IInstanceConfig ic; + try + { + ic = InstanceConfig.Load(path); + foreach(var oic in GetInstanceConfigs()) + if(ic.Name == oic.Name) + return String.Format("Instance named {0} already exists!", oic.Name); + ic.Save(); + Properties.Settings.Default.InstancePaths.Add(path); + } + catch (Exception e) + { + return e.ToString(); + } + return SetupOneInstance(ic); + } + } + + /// + public bool InstanceEnabled(string Name) + { + lock(this) + { + return hosts.ContainsKey(Name); + } + } + + /// + public string SetInstanceEnabled(string Name, bool enabled) + { + return SetInstanceEnabledImpl(Name, enabled, out string path); + } + + + /// + /// Sets a 's enabled status + /// + /// The whom's status should be changed + /// to enable the , to disable it + /// The path to the modified + /// on success, error message on failure + string SetInstanceEnabledImpl(string Name, bool enabled, out string path) + { + path = null; + lock (this) + { + var hostIsOnline = hosts.ContainsKey(Name); + if (enabled) + { + if (hostIsOnline) + return null; + foreach (var ic in GetInstanceConfigs()) + if (ic.Name == Name) + { + path = ic.Directory; + ic.Enabled = true; + ic.Save(); + return SetupOneInstance(ic); + } + return String.Format("Instance {0} does not exist!", Name); + } + else + { + if (!hostIsOnline) + return null; + var host = hosts[Name]; + hosts.Remove(Name); + var inst = (ServerInstance)host.SingletonInstance; + host.Close(); + path = inst.ServerDirectory(); + inst.Offline(); + inst.Dispose(); + UnlockLoggingID(inst.LoggingID); + return null; + } + } + } + + /// + public string RenameInstance(string name, string new_name) + { + if (name == new_name) + return null; + var res = CheckInstanceName(new_name); + if (res != null) + return res; + lock (this) + { + //we have to check em all anyway + IInstanceConfig the_droid_were_looking_for = null; + foreach (var ic in GetInstanceConfigs()) + if (ic.Name == name) + { + the_droid_were_looking_for = ic; + break; + } + else if (ic.Name == new_name) + return String.Format("There is already another instance named {0}!", new_name); + if (the_droid_were_looking_for == null) + return String.Format("There is no instance named {0}!", name); + var ie = InstanceEnabled(name); + if(ie) + SetInstanceEnabled(name, false); + the_droid_were_looking_for.Name = new_name; + string result = ""; + try + { + the_droid_were_looking_for.Save(); + result = null; + } + catch(Exception e) + { + result = "Could not save instance config! Error: " + e.ToString(); + } + finally + { + if (ie) + { + var resRestore = SetInstanceEnabled(new_name, true); + if (resRestore != null) + result = (result + " " + resRestore).Trim(); + } + } + return result; + } + } + + /// + public string DetachInstance(string name) + { + lock (this) + { + var res = SetInstanceEnabledImpl(name, false, out string path); + if (res != null) + return res; + if (path == null) //gotta find it ourselves + foreach (var ic in GetInstanceConfigs()) + if (ic.Name == name) + { + path = ic.Directory; + break; + } + if (path == null) + return String.Format("No instance named {0} exists!", name); + Properties.Settings.Default.InstancePaths.Remove(path); + return null; + } + } + } +} diff --git a/TGServerService/TGServerService.csproj b/TGS.Server.Service/TGS.Server.Service.csproj similarity index 97% rename from TGServerService/TGServerService.csproj rename to TGS.Server.Service/TGS.Server.Service.csproj index 71ec660335..37e2262efc 100644 --- a/TGServerService/TGServerService.csproj +++ b/TGS.Server.Service/TGS.Server.Service.csproj @@ -7,7 +7,7 @@ AnyCPU {F32EDA25-0855-411C-AF5E-F0D042917E2D} WinExe - TGServerService + TGS.Server.Service TGServerService v4.5.2 512 @@ -32,7 +32,7 @@ bin\Release\ TRACE - bin\x86\Release\TGServerService.xml + bin\x86\Release\TGS.Server.Service.xml true true pdbonly @@ -143,9 +143,9 @@ - + {ac4e7e8b-f83a-481c-a8b0-8fa4e8ae59ab} - TGServiceInterface + TGS.Interface diff --git a/TGServerService/packages.config b/TGS.Server.Service/packages.config similarity index 100% rename from TGServerService/packages.config rename to TGS.Server.Service/packages.config diff --git a/TGServiceInterface/tgs.ico b/TGS.Server.Service/tgs.ico similarity index 100% rename from TGServiceInterface/tgs.ico rename to TGS.Server.Service/tgs.ico diff --git a/TGServiceTests/CommandLine/Commands/Repository/RepositoryCommandTest.cs b/TGS.Tests/CommandLine/Commands/Repository/RepositoryCommandTest.cs similarity index 86% rename from TGServiceTests/CommandLine/Commands/Repository/RepositoryCommandTest.cs rename to TGS.Tests/CommandLine/Commands/Repository/RepositoryCommandTest.cs index 0c80b404da..04d6bc1343 100644 --- a/TGServiceTests/CommandLine/Commands/Repository/RepositoryCommandTest.cs +++ b/TGS.Tests/CommandLine/Commands/Repository/RepositoryCommandTest.cs @@ -1,9 +1,9 @@ using Moq; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; using TGServiceTests; -namespace TGCommandLine.Commands.Repository.Tests +namespace TGS.CommandLine.Commands.Repository.Tests { public abstract class RepositoryCommandTest : OutputProcOverriderTest { diff --git a/TGServiceTests/CommandLine/Commands/Repository/TestRepoSetPushTestmergeCommitsCommand.cs b/TGS.Tests/CommandLine/Commands/Repository/TestRepoSetPushTestmergeCommitsCommand.cs similarity index 93% rename from TGServiceTests/CommandLine/Commands/Repository/TestRepoSetPushTestmergeCommitsCommand.cs rename to TGS.Tests/CommandLine/Commands/Repository/TestRepoSetPushTestmergeCommitsCommand.cs index 9810387d9c..54df717166 100644 --- a/TGServiceTests/CommandLine/Commands/Repository/TestRepoSetPushTestmergeCommitsCommand.cs +++ b/TGS.Tests/CommandLine/Commands/Repository/TestRepoSetPushTestmergeCommitsCommand.cs @@ -1,10 +1,10 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using System.Collections.Generic; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGCommandLine.Commands.Repository.Tests +namespace TGS.CommandLine.Commands.Repository.Tests { /// /// Tests for diff --git a/TGServiceTests/CommandLine/Commands/Repository/TestRepoStatusCommand.cs b/TGS.Tests/CommandLine/Commands/Repository/TestRepoStatusCommand.cs similarity index 92% rename from TGServiceTests/CommandLine/Commands/Repository/TestRepoStatusCommand.cs rename to TGS.Tests/CommandLine/Commands/Repository/TestRepoStatusCommand.cs index 10b4656086..3efebced20 100644 --- a/TGServiceTests/CommandLine/Commands/Repository/TestRepoStatusCommand.cs +++ b/TGS.Tests/CommandLine/Commands/Repository/TestRepoStatusCommand.cs @@ -1,10 +1,10 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using System.Collections.Generic; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGCommandLine.Commands.Repository.Tests +namespace TGS.CommandLine.Commands.Repository.Tests { /// /// Tests for diff --git a/TGServiceTests/ControlPanel/TestInstanceSelector.cs b/TGS.Tests/ControlPanel/TestInstanceSelector.cs similarity index 88% rename from TGServiceTests/ControlPanel/TestInstanceSelector.cs rename to TGS.Tests/ControlPanel/TestInstanceSelector.cs index e5f9da9cd3..913d89017d 100644 --- a/TGServiceTests/ControlPanel/TestInstanceSelector.cs +++ b/TGS.Tests/ControlPanel/TestInstanceSelector.cs @@ -1,10 +1,10 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using System.Collections.Generic; -using TGServiceInterface; -using TGServiceInterface.Components; +using TGS.Interface; +using TGS.Interface.Components; -namespace TGControlPanel.Tests +namespace TGS.ControlPanel.Tests { /// /// Tests for diff --git a/TGServiceTests/OutputProcOverriderTest.cs b/TGS.Tests/OutputProcOverriderTest.cs similarity index 95% rename from TGServiceTests/OutputProcOverriderTest.cs rename to TGS.Tests/OutputProcOverriderTest.cs index d118f07faf..f73a473e0a 100644 --- a/TGServiceTests/OutputProcOverriderTest.cs +++ b/TGS.Tests/OutputProcOverriderTest.cs @@ -1,5 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using TGServiceInterface; +using TGS.Interface; namespace TGServiceTests { diff --git a/TGServiceTests/Properties/AssemblyInfo.cs b/TGS.Tests/Properties/AssemblyInfo.cs similarity index 100% rename from TGServiceTests/Properties/AssemblyInfo.cs rename to TGS.Tests/Properties/AssemblyInfo.cs diff --git a/TGServiceTests/Service/ServiceAccessor.cs b/TGS.Tests/Service/ServiceAccessor.cs similarity index 93% rename from TGServiceTests/Service/ServiceAccessor.cs rename to TGS.Tests/Service/ServiceAccessor.cs index 97c20d0d78..adf073c53e 100644 --- a/TGServiceTests/Service/ServiceAccessor.cs +++ b/TGS.Tests/Service/ServiceAccessor.cs @@ -1,6 +1,6 @@  -namespace TGServerService.Tests +namespace TGS.Server.Service.Tests { /// /// For accessing service control methods of diff --git a/TGServiceTests/Service/TestInstanceConfig.cs b/TGS.Tests/Service/TestInstanceConfig.cs similarity index 97% rename from TGServiceTests/Service/TestInstanceConfig.cs rename to TGS.Tests/Service/TestInstanceConfig.cs index 586ccd4990..a319a968ef 100644 --- a/TGServiceTests/Service/TestInstanceConfig.cs +++ b/TGS.Tests/Service/TestInstanceConfig.cs @@ -2,7 +2,7 @@ using System.IO; using TGServiceTests; -namespace TGServerService.Tests +namespace TGS.Server.Service.Tests { /// /// Tests for diff --git a/TGServiceTests/Service/TestServerInstance.cs b/TGS.Tests/Service/TestServerInstance.cs similarity index 97% rename from TGServiceTests/Service/TestServerInstance.cs rename to TGS.Tests/Service/TestServerInstance.cs index e8c8629549..7888567999 100644 --- a/TGServiceTests/Service/TestServerInstance.cs +++ b/TGS.Tests/Service/TestServerInstance.cs @@ -2,7 +2,7 @@ using Moq; using TGServiceTests; -namespace TGServerService.Tests +namespace TGS.Server.Service.Tests { /// /// Tests for diff --git a/TGServiceTests/Service/TestService.cs b/TGS.Tests/Service/TestService.cs similarity index 98% rename from TGServiceTests/Service/TestService.cs rename to TGS.Tests/Service/TestService.cs index 8c19056596..249517064f 100644 --- a/TGServiceTests/Service/TestService.cs +++ b/TGS.Tests/Service/TestService.cs @@ -1,7 +1,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using TGServiceTests; -namespace TGServerService.Tests +namespace TGS.Server.Service.Tests { /// /// Tests for diff --git a/TGServiceTests/ServiceInterface/TestHelpers.cs b/TGS.Tests/ServiceInterface/TestHelpers.cs similarity index 98% rename from TGServiceTests/ServiceInterface/TestHelpers.cs rename to TGS.Tests/ServiceInterface/TestHelpers.cs index 6a0086bd7c..2742f1e854 100644 --- a/TGServiceTests/ServiceInterface/TestHelpers.cs +++ b/TGS.Tests/ServiceInterface/TestHelpers.cs @@ -1,7 +1,7 @@ using System; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace TGServiceInterface.Tests +namespace TGS.Interface.Tests { /// /// Tests for diff --git a/TGServiceTests/ServiceInterface/TestInterface.cs b/TGS.Tests/ServiceInterface/TestInterface.cs similarity index 97% rename from TGServiceTests/ServiceInterface/TestInterface.cs rename to TGS.Tests/ServiceInterface/TestInterface.cs index f8fa81420a..cd4f55ac9d 100644 --- a/TGServiceTests/ServiceInterface/TestInterface.cs +++ b/TGS.Tests/ServiceInterface/TestInterface.cs @@ -2,9 +2,9 @@ using System.Net; using System.ServiceModel; using Microsoft.VisualStudio.TestTools.UnitTesting; -using TGServiceInterface.Components; +using TGS.Interface.Components; -namespace TGServiceInterface.Tests +namespace TGS.Interface.Tests { /// /// Tests for diff --git a/TGServiceTests/TGServiceTests.csproj b/TGS.Tests/TGS.Tests.csproj similarity index 91% rename from TGServiceTests/TGServiceTests.csproj rename to TGS.Tests/TGS.Tests.csproj index f61981f9ee..ba749c6384 100644 --- a/TGServiceTests/TGServiceTests.csproj +++ b/TGS.Tests/TGS.Tests.csproj @@ -1,116 +1,116 @@ - - - - - Debug - AnyCPU - {FB693FFB-17E3-4E84-8CBF-6FFA9C8FD971} - Library - Properties - TGServiceTests - TGServiceTests - v4.6.1 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 15.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - false - - - - ..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll - - - ..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll - - - ..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll - - - ..\packages\Moq.4.7.145\lib\net45\Moq.dll - - - - - - - - - - - - - - - - - - Component - - - - - - - - - - - - - - {89191f69-b18e-4b59-b72e-e12f9b6811a0} - TGCommandLine - - - {394e7643-6b8c-416f-ab18-95ac12648cdc} - TGControlPanel - - - {8956d4c3-bfb9-448e-bf5f-ee7e6f9996f9} - TGInstallerWrapper - - - {f32eda25-0855-411c-af5e-f0d042917e2d} - TGServerService - - - {ac4e7e8b-f83a-481c-a8b0-8fa4e8ae59ab} - TGServiceInterface - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - + + + + + Debug + AnyCPU + {FB693FFB-17E3-4E84-8CBF-6FFA9C8FD971} + Library + Properties + TGS.Tests + TGS.Tests + v4.6.1 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + false + + + + ..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll + + + ..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + + + ..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + + + ..\packages\Moq.4.7.145\lib\net45\Moq.dll + + + + + + + + + + + + + + + + + + Component + + + + + + + + + + + + + + {89191f69-b18e-4b59-b72e-e12f9b6811a0} + TGCommandLine + + + {394e7643-6b8c-416f-ab18-95ac12648cdc} + TGControlPanel + + + {8956d4c3-bfb9-448e-bf5f-ee7e6f9996f9} + TGInstallerWrapper + + + {f32eda25-0855-411c-af5e-f0d042917e2d} + TGServerService + + + {ac4e7e8b-f83a-481c-a8b0-8fa4e8ae59ab} + TGServiceInterface + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/TGServiceTests/TempDirectoryRequiredTest.cs b/TGS.Tests/TempDirectoryRequiredTest.cs similarity index 100% rename from TGServiceTests/TempDirectoryRequiredTest.cs rename to TGS.Tests/TempDirectoryRequiredTest.cs diff --git a/TGServiceTests/packages.config b/TGS.Tests/packages.config similarity index 100% rename from TGServiceTests/packages.config rename to TGS.Tests/packages.config diff --git a/TGStationServer3.sln b/TGStationServer3.sln index 19f07e4862..8759bbedc0 100644 --- a/TGStationServer3.sln +++ b/TGStationServer3.sln @@ -3,15 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27004.2006 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TGServerService", "TGServerService\TGServerService.csproj", "{F32EDA25-0855-411C-AF5E-F0D042917E2D}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TGS.Server.Service", "TGS.Server.Service\TGS.Server.Service.csproj", "{F32EDA25-0855-411C-AF5E-F0D042917E2D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TGControlPanel", "TGControlPanel\TGControlPanel.csproj", "{394E7643-6B8C-416F-AB18-95AC12648CDC}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TGS.ControlPanel", "TGS.ControlPanel\TGS.ControlPanel.csproj", "{394E7643-6B8C-416F-AB18-95AC12648CDC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TGCommandLine", "TGCommandLine\TGCommandLine.csproj", "{89191F69-B18E-4B59-B72E-E12F9B6811A0}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TGS.CommandLine", "TGS.CommandLine\TGS.CommandLine.csproj", "{89191F69-B18E-4B59-B72E-E12F9B6811A0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TGServiceInterface", "TGServiceInterface\TGServiceInterface.csproj", "{AC4E7E8B-F83A-481C-A8B0-8FA4E8AE59AB}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TGS.Interface", "TGS.Interface\TGS.Interface.csproj", "{AC4E7E8B-F83A-481C-A8B0-8FA4E8AE59AB}" EndProject -Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "TGServiceInstaller", "TGServiceInstaller\TGServiceInstaller.wixproj", "{154435F6-0890-42D4-9AEC-B743D4FBC1CB}" +Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "TGS.Installer", "TGS.Installer\TGS.Installer.wixproj", "{154435F6-0890-42D4-9AEC-B743D4FBC1CB}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2D8FC6AA-1D33-44B6-81C2-35ED7A87EDBC}" ProjectSection(SolutionItems) = preProject @@ -24,7 +24,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution tgs.ico = tgs.ico EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TGInstallerWrapper", "TGInstallerWrapper\TGInstallerWrapper.csproj", "{8956D4C3-BFB9-448E-BF5F-EE7E6F9996F9}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TGS.Installer.UI", "TGS.Installer.UI\TGS.Installer.UI.csproj", "{8956D4C3-BFB9-448E-BF5F-EE7E6F9996F9}" ProjectSection(ProjectDependencies) = postProject {AC4E7E8B-F83A-481C-A8B0-8FA4E8AE59AB} = {AC4E7E8B-F83A-481C-A8B0-8FA4E8AE59AB} {154435F6-0890-42D4-9AEC-B743D4FBC1CB} = {154435F6-0890-42D4-9AEC-B743D4FBC1CB} @@ -93,9 +93,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{287B .github\CONTRIBUTING.md = .github\CONTRIBUTING.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TGDreamDaemonBridge", "TGDreamDaemonBridge\TGDreamDaemonBridge.csproj", "{9A01EF03-8EAE-45CB-8B87-4A17BD904557}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TGS.Interface.Bridge", "TGS.Interface.Bridge\TGS.Interface.Bridge.csproj", "{9A01EF03-8EAE-45CB-8B87-4A17BD904557}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TGServiceTests", "TGServiceTests\TGServiceTests.csproj", "{FB693FFB-17E3-4E84-8CBF-6FFA9C8FD971}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TGS.Tests", "TGS.Tests\TGS.Tests.csproj", "{FB693FFB-17E3-4E84-8CBF-6FFA9C8FD971}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Tools/CoverageExclusions.runsettings b/Tools/CoverageExclusions.runsettings index 92eee55060..9cf93cc0e8 100644 --- a/Tools/CoverageExclusions.runsettings +++ b/Tools/CoverageExclusions.runsettings @@ -10,7 +10,7 @@ - .*\\TGServiceTests\\.* + .*\\TGS.Tests\\.* diff --git a/Tools/PostCIBuild.ps1 b/Tools/PostCIBuild.ps1 index 69110e5756..5c76553308 100644 --- a/Tools/PostCIBuild.ps1 +++ b/Tools/PostCIBuild.ps1 @@ -10,12 +10,12 @@ function CodeSign #Sign the output files if (Test-Path env:snk_passphrase) { - CodeSign "$bf/TGServiceTests/bin/Release/TGServiceTests.dll" - CodeSign "$bf/TGInstallerWrapper/bin/Release/TG Station Server Installer.exe" + CodeSign "$bf/TGS.Tests/bin/Release/TGS.Tests.dll" + CodeSign "$bf/TGS.Installer.UI/bin/Release/TG Station Server Installer.exe" $env:snk_passphrase = "" } -$src = "$bf\TGInstallerWrapper\bin\Release" +$src = "$bf\TGS.Installer.UI\bin\Release" $version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("$src\TG Station Server Installer.exe").FileVersion $destination = "$bf\TGS3-Server-v$version.exe" @@ -28,10 +28,10 @@ $destination_md5sha = "$bf\MD5-SHA1-Server-v$version.txt" $src2 = "$bf\ClientApps" [system.io.directory]::CreateDirectory($src2) -Copy-Item "$bf\TGCommandLine\bin\Release\TGCommandLine.exe" "$src2\TGCommandLine.exe" -Copy-Item "$bf\TGControlPanel\bin\Release\TGControlPanel.exe" "$src2\TGControlPanel.exe" -Copy-Item "$bf\TGControlPanel\bin\Release\Octokit.dll" "$src2\Octokit.dll" -Copy-Item "$bf\TGServiceInterface\bin\Release\TGServiceInterface.dll" "$src2\TGServiceInterface.dll" +Copy-Item "$bf\TGS.CommandLine\bin\Release\TGCommandLine.exe" "$src2\TGCommandLine.exe" +Copy-Item "$bf\TGS.ControlPanel\bin\Release\TGControlPanel.exe" "$src2\TGControlPanel.exe" +Copy-Item "$bf\TGS.ControlPanel\bin\Release\Octokit.dll" "$src2\Octokit.dll" +Copy-Item "$bf\TGS.Interface\bin\Release\TGServiceInterface.dll" "$src2\TGServiceInterface.dll" $dest2 = "$bf\TGS3-Client-v$version.zip" diff --git a/Tools/SignBasics.ps1 b/Tools/SignBasics.ps1 index a0941adb99..a87d6920c9 100644 --- a/Tools/SignBasics.ps1 +++ b/Tools/SignBasics.ps1 @@ -9,9 +9,9 @@ function CodeSign #Sign the output files if (Test-Path env:snk_passphrase) { - CodeSign "$bf/TGCommandLine/bin/Release/TGCommandLine.exe" - CodeSign "$bf/TGControlPanel/bin/Release/TGControlPanel.exe" - CodeSign "$bf/TGServerService/bin/Release/TGServerService.exe" - CodeSign "$bf/TGDreamDaemonBridge/bin/x86/Release/TGDreamDaemonBridge.dll" - CodeSign "$bf/TGServiceInterface/bin/Release/TGServiceInterface.dll" + CodeSign "$bf/TGS.CommandLine/bin/Release/TGCommandLine.exe" + CodeSign "$bf/TGS.ControlPanel/bin/Release/TGControlPanel.exe" + CodeSign "$bf/TGS.Server.Service/bin/Release/TGServerService.exe" + CodeSign "$bf/TGS.Interface.Bridge/bin/x86/Release/TGDreamDaemonBridge.dll" + CodeSign "$bf/TGS.Interface/bin/Release/TGServiceInterface.dll" } diff --git a/Tools/SignMSI.ps1 b/Tools/SignMSI.ps1 index 50d76dbdbd..dd921d188b 100644 --- a/Tools/SignMSI.ps1 +++ b/Tools/SignMSI.ps1 @@ -9,5 +9,5 @@ function CodeSign #Sign the output files if (Test-Path env:snk_passphrase) { - CodeSign "$bf/TGServiceInstaller/bin/Release/TGServiceInstaller.msi" + CodeSign "$bf/TGS.Installer/bin/Release/TGServiceInstaller.msi" } diff --git a/appveyor.yml b/appveyor.yml index 724d59cbe9..476fddd2c7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -34,11 +34,11 @@ build: after_build: - ps: Tools/PostCIBuild.ps1 - ps: if($env:APPVEYOR_REPO_COMMIT_MESSAGE -match "\[TGSDeploy\]"){$env:TGSDeploy = "Do it."} - - ps: $env:TGSVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("$env:APPVEYOR_BUILD_FOLDER/TGServerService/bin/Release/TGServerService.exe").FileVersion + - ps: $env:TGSVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("$env:APPVEYOR_BUILD_FOLDER/TGS.Server.Service/bin/Release/TGS.Server.Service.exe").FileVersion test_script: - set path=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\CommonExtensions\Microsoft\TestWindow;%path% - copy "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions\appveyor.*" "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions" /y - - vstest.console /logger:Appveyor "TGServiceTests\bin\Release\TGServiceTests.dll" /Enablecodecoverage /Settings:"Tools/CoverageExclusions.runsettings" /inIsolation /Platform:x64 + - vstest.console /logger:Appveyor "TGS.Tests\bin\Release\TGS.Tests.dll" /Enablecodecoverage /Settings:"Tools/CoverageExclusions.runsettings" /inIsolation /Platform:x64 after_test: - ps: Tools/UploadCoverage.ps1 - ps: Tools/BuildDox.ps1