mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-27 15:07:03 +01:00
Massive sanity reorganization of project structure
Overall: - Removed all 'TG' prefixes on classes and enums Service: - TGStationServer => ServerInstance - TGServerService => Service - Moved all ServerInstance partial classes to a subfolder - Moved ChatProvider classes, delegate, and interface to a namespace - Moved EventID and ChatMessageType to their own .cs files - Moved SanitizeTopicString to Program - ServerService.cs => Service.cs - Fixed ProjectInstaller being in it's own namespace instead of TGServerService Interface: - Moved ExitCode enum to Command class - Moved all components to a namespace - Moved all component enums to Enumerations.cs - DDInteropCallHolder => DreamDaemonBridge - Move PullRequestInfo and DreamDaemonBridge to their own .cs files - Changes the type of ChannelFactory cache from Dictionary<Type, ChannelFactory> to IDictionary<Type, ChannelFactory>
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.ServiceModel;
|
||||
using TGServiceInterface.Components;
|
||||
|
||||
namespace TGServerService
|
||||
{
|
||||
//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
|
||||
|
||||
//this line basically says make one instance of the service, use it multithreaded for requests, and never delete it
|
||||
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.Single)]
|
||||
partial class ServerInstance : IDisposable, ITGSService, ITGConnectivity
|
||||
{
|
||||
|
||||
//call partial constructors/destructors from here
|
||||
//called when the service is started
|
||||
public ServerInstance()
|
||||
{
|
||||
FindTheDroidsWereLookingFor();
|
||||
InitChat();
|
||||
InitRepo();
|
||||
InitByond();
|
||||
InitCompiler();
|
||||
InitDreamDaemon();
|
||||
}
|
||||
|
||||
//called when the service is stopped
|
||||
void RunDisposals()
|
||||
{
|
||||
DisposeDreamDaemon();
|
||||
DisposeCompiler();
|
||||
DisposeByond();
|
||||
DisposeRepo();
|
||||
DisposeChat();
|
||||
}
|
||||
|
||||
//public api
|
||||
public string Version()
|
||||
{
|
||||
return Service.Version;
|
||||
}
|
||||
|
||||
//public api
|
||||
public void VerifyConnection() { }
|
||||
|
||||
//public api
|
||||
public void PrepareForUpdate()
|
||||
{
|
||||
Properties.Settings.Default.ReattachToDD = true;
|
||||
SendMessage("SERVICE: Update started...", ChatMessageType.DeveloperInfo);
|
||||
}
|
||||
|
||||
//mostly generated code with a call to RunDisposals()
|
||||
//you don't need to open this
|
||||
#region IDisposable Support
|
||||
private bool disposedValue = false; // To detect redundant calls
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!disposedValue)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
RunDisposals();
|
||||
// TODO: dispose managed state (managed objects).
|
||||
}
|
||||
|
||||
// TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
|
||||
// TODO: set large fields to null.
|
||||
|
||||
disposedValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: override a finalizer only if Dispose(bool disposing) above has code to free unmanaged resources.
|
||||
// ~TGStationServer() {
|
||||
// // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
|
||||
// Dispose(false);
|
||||
// }
|
||||
|
||||
// This code added to correctly implement the disposable pattern.
|
||||
public void Dispose()
|
||||
{
|
||||
// Do not change this code. Put cleanup code in Dispose(bool disposing) above.
|
||||
Dispose(true);
|
||||
// TODO: uncomment the following line if the finalizer is overridden above.
|
||||
// GC.SuppressFinalize(this);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user