Clears BYOND cache on every reboot

This commit is contained in:
Cyberboss
2017-12-07 10:06:05 -05:00
parent c98d9b28d4
commit 042d9f18f7
2 changed files with 18 additions and 0 deletions
+17
View File
@@ -53,6 +53,11 @@ namespace TGS.Server
/// </summary>
const string ByondNoPromptTrustedMode = "trusted-check 0";
/// <summary>
/// Contains cache shit that needs to be cleared out every startup
/// </summary>
static readonly string ByondCacheDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), ByondDirectory, "cache");
/// <summary>
/// The status of the BYOND updater
/// </summary>
@@ -103,6 +108,18 @@ namespace TGS.Server
CleanByondStaging();
}
}
/// <summary>
/// Attempts to clear the <see cref="ByondCacheDirectory"/>
/// </summary>
void ClearCacheFolder()
{
try
{
Helpers.DeleteDirectory(ByondCacheDirectory, true, null);
}
catch { }
}
/// <summary>
/// Checks if the updater is considered busy
+1
View File
@@ -605,6 +605,7 @@ namespace TGS.Server
StartingSecurity = Config.Security;
Proc.StartInfo.Arguments = String.Format("{0} -port {1} {5}-close -verbose -params \"server_service={3}&server_service_version={4}&{6}={7}\" -{2} -public", DMB, Config.Port, SecurityWord(), serviceCommsKey, Version(), Config.Webclient ? "-webclient " : "", SPInstanceName, Config.Name);
UpdateBridgeDll(true);
ClearCacheFolder();
lock (topicLock)
{
GameAPIVersion = null; //needs updating