mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-27 07:04:57 +01:00
Merge upstream (wew, thats a big one)
This commit is contained in:
@@ -1,13 +1,58 @@
|
||||
namespace TGServerService
|
||||
using TGServiceInterface;
|
||||
|
||||
namespace TGServerService
|
||||
{
|
||||
//since we can't quite remove old config options this is here as a dumping ground for them
|
||||
/// <summary>
|
||||
/// Used to migrate old config settings
|
||||
/// </summary>
|
||||
class DeprecatedInstanceConfig : InstanceConfig
|
||||
{
|
||||
//do not use CurrentVersion in this function
|
||||
//simply migrate from Version to Version + 1
|
||||
public void Migrate()
|
||||
/// <summary>
|
||||
/// Convert the 3.1 .NET settings file to a config json
|
||||
/// </summary>
|
||||
/// <returns>A saved <see cref="InstanceConfig"/> based off the old .NET setting file</returns>
|
||||
public static InstanceConfig CreateFromNETSettings()
|
||||
{
|
||||
var Config = Properties.Settings.Default;
|
||||
var result = new DeprecatedInstanceConfig()
|
||||
{
|
||||
InstanceDir = (string)Config.GetPreviousVersion("ServerDirectory"),
|
||||
ProjectName = (string)Config.GetPreviousVersion("ProjectName"),
|
||||
Port = (ushort)Config.GetPreviousVersion("ServerPort"),
|
||||
CommitterName = (string)Config.GetPreviousVersion("CommitterName"),
|
||||
CommitterEmail = (string)Config.GetPreviousVersion("CommitterEmail"),
|
||||
Security = (DreamDaemonSecurity)Config.GetPreviousVersion("ServerSecurity"),
|
||||
Autostart = (bool)Config.GetPreviousVersion("DDAutoStart"),
|
||||
ChatProviderData = (string)Config.GetPreviousVersion("ChatProviderData"),
|
||||
ChatProviderEntropy = (string)Config.GetPreviousVersion("ChatProviderEntropy"),
|
||||
ReattachRequired = (bool)Config.GetPreviousVersion("ReattachToDD"),
|
||||
ReattachProcessID = (int)Config.GetPreviousVersion("ReattachPID"),
|
||||
ReattachPort = (ushort)Config.GetPreviousVersion("ReattachPort"),
|
||||
ReattachCommsKey = (string)Config.GetPreviousVersion("ReattachCommsKey"),
|
||||
ReattachAPIVersion = (string)Config.GetPreviousVersion("ReattachAPIVersion"),
|
||||
AutoUpdateInterval = (ulong)Config.GetPreviousVersion("AutoUpdateInterval"),
|
||||
AuthorizedUserGroupSID = (string)Config.GetPreviousVersion("AuthorizedGroupSID")
|
||||
};
|
||||
result.MigrateToCurrentVersion();
|
||||
result.Save();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Migrates the <see cref="DeprecatedInstanceConfig"/> from <see cref="Version"/> to <see cref="MigrateToCurrentVersion"/>
|
||||
/// </summary>
|
||||
public void MigrateToCurrentVersion()
|
||||
{
|
||||
for (; Version < CurrentVersion; ++Version)
|
||||
Migrate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Migrates the <see cref="DeprecatedInstanceConfig"/> from <see cref="Version"/> to <see cref="Version"/> + 1
|
||||
/// </summary>
|
||||
void Migrate()
|
||||
{
|
||||
//Not needed so far
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user