From 9cf57736a43b22803220140fd2ecf61ea94a3f36 Mon Sep 17 00:00:00 2001 From: Brett Hewitson Date: Mon, 16 May 2022 19:02:32 +1000 Subject: [PATCH 1/3] Project Build Mode Changes --- .../ARKServerManager.Common.csproj | 2 +- src/ARKServerManager/ARKServerManager.csproj | 10 ++ .../ConanServerManager.Common.csproj | 2 +- .../ConanServerManager.csproj | 10 ++ src/Plugin.Common/Plugin.Common.csproj | 2 +- src/Plugin.Discord/Plugin.Discord.csproj | 2 +- src/Server-Managers.sln | 93 +++++++++++++------ .../ServerManager.Common.csproj | 2 +- .../ServerManager.Discord.csproj | 5 +- .../ServerManager.Updater.csproj | 2 +- .../ServerManager.WebApplication.csproj | 5 +- 11 files changed, 94 insertions(+), 41 deletions(-) diff --git a/src/ARKServerManager.Common/ARKServerManager.Common.csproj b/src/ARKServerManager.Common/ARKServerManager.Common.csproj index 7f2c4d66..12828701 100644 --- a/src/ARKServerManager.Common/ARKServerManager.Common.csproj +++ b/src/ARKServerManager.Common/ARKServerManager.Common.csproj @@ -1,6 +1,6 @@  - Debug;Release;Debug - Beta + Debug;Release net462 diff --git a/src/ARKServerManager/ARKServerManager.csproj b/src/ARKServerManager/ARKServerManager.csproj index 15616b94..22b8ccaa 100644 --- a/src/ARKServerManager/ARKServerManager.csproj +++ b/src/ARKServerManager/ARKServerManager.csproj @@ -136,6 +136,16 @@ true + + true + bin\Debug - ServerMonitor\ + TRACE;DEBUG + full + AnyCPU + 7.3 + prompt + true + ..\packages\DotNetZip.1.13.8\lib\net40\DotNetZip.dll diff --git a/src/ConanServerManager.Common/ConanServerManager.Common.csproj b/src/ConanServerManager.Common/ConanServerManager.Common.csproj index f932d07f..8e7de9be 100644 --- a/src/ConanServerManager.Common/ConanServerManager.Common.csproj +++ b/src/ConanServerManager.Common/ConanServerManager.Common.csproj @@ -1,6 +1,6 @@  - Debug;Release;Debug - Beta + Debug;Release net462 diff --git a/src/ConanServerManager/ConanServerManager.csproj b/src/ConanServerManager/ConanServerManager.csproj index d37b3eca..467f0588 100644 --- a/src/ConanServerManager/ConanServerManager.csproj +++ b/src/ConanServerManager/ConanServerManager.csproj @@ -123,6 +123,16 @@ false + + true + bin\Debug - ServerMonitor\ + DEBUG;TRACE + full + AnyCPU + 7.3 + prompt + true + ..\packages\DotNetZip.1.13.8\lib\net40\DotNetZip.dll diff --git a/src/Plugin.Common/Plugin.Common.csproj b/src/Plugin.Common/Plugin.Common.csproj index bd7566f4..5834c4c7 100644 --- a/src/Plugin.Common/Plugin.Common.csproj +++ b/src/Plugin.Common/Plugin.Common.csproj @@ -1,6 +1,6 @@  - Debug;Release;Debug - Beta + Debug;Release net462 diff --git a/src/Plugin.Discord/Plugin.Discord.csproj b/src/Plugin.Discord/Plugin.Discord.csproj index 8bfb7b03..9ea73234 100644 --- a/src/Plugin.Discord/Plugin.Discord.csproj +++ b/src/Plugin.Discord/Plugin.Discord.csproj @@ -1,6 +1,6 @@  - Debug;Release;Debug - Beta + Debug;Release net462 diff --git a/src/Server-Managers.sln b/src/Server-Managers.sln index cee803cb..79f521bb 100644 --- a/src/Server-Managers.sln +++ b/src/Server-Managers.sln @@ -50,7 +50,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UnitTests", "UnitTests", "{ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServerManager.Common.UnitTests", "ServerManager.Common.UnitTests\ServerManager.Common.UnitTests.csproj", "{18271A4E-6135-466A-BCF8-80E25446F454}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QueryMaster.UnitTests", "QueryMaster.UnitTests\QueryMaster.UnitTests.csproj", "{A2EEBC18-DAD8-415D-98E4-258EB12369C7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QueryMaster.UnitTests", "QueryMaster.UnitTests\QueryMaster.UnitTests.csproj", "{A2EEBC18-DAD8-415D-98E4-258EB12369C7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -58,6 +58,7 @@ Global Debug - AutoShutdown|Any CPU = Debug - AutoShutdown|Any CPU Debug - AutoUpdate|Any CPU = Debug - AutoUpdate|Any CPU Debug - Beta|Any CPU = Debug - Beta|Any CPU + Debug - ServerMonitor|Any CPU = Debug - ServerMonitor|Any CPU Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection @@ -68,8 +69,10 @@ Global {7C99D9F7-0C65-4116-927A-94EB018C88FD}.Debug - AutoShutdown|Any CPU.Build.0 = Debug|Any CPU {7C99D9F7-0C65-4116-927A-94EB018C88FD}.Debug - AutoUpdate|Any CPU.ActiveCfg = Debug|Any CPU {7C99D9F7-0C65-4116-927A-94EB018C88FD}.Debug - AutoUpdate|Any CPU.Build.0 = Debug|Any CPU - {7C99D9F7-0C65-4116-927A-94EB018C88FD}.Debug - Beta|Any CPU.ActiveCfg = Debug - Beta|Any CPU - {7C99D9F7-0C65-4116-927A-94EB018C88FD}.Debug - Beta|Any CPU.Build.0 = Debug - Beta|Any CPU + {7C99D9F7-0C65-4116-927A-94EB018C88FD}.Debug - Beta|Any CPU.ActiveCfg = Debug|Any CPU + {7C99D9F7-0C65-4116-927A-94EB018C88FD}.Debug - Beta|Any CPU.Build.0 = Debug|Any CPU + {7C99D9F7-0C65-4116-927A-94EB018C88FD}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug|Any CPU + {7C99D9F7-0C65-4116-927A-94EB018C88FD}.Debug - ServerMonitor|Any CPU.Build.0 = Debug|Any CPU {7C99D9F7-0C65-4116-927A-94EB018C88FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7C99D9F7-0C65-4116-927A-94EB018C88FD}.Debug|Any CPU.Build.0 = Debug|Any CPU {7C99D9F7-0C65-4116-927A-94EB018C88FD}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -80,8 +83,10 @@ Global {715461E8-4E54-4993-80A8-8E72892135E0}.Debug - AutoShutdown|Any CPU.Build.0 = Debug|Any CPU {715461E8-4E54-4993-80A8-8E72892135E0}.Debug - AutoUpdate|Any CPU.ActiveCfg = Debug|Any CPU {715461E8-4E54-4993-80A8-8E72892135E0}.Debug - AutoUpdate|Any CPU.Build.0 = Debug|Any CPU - {715461E8-4E54-4993-80A8-8E72892135E0}.Debug - Beta|Any CPU.ActiveCfg = Debug - Beta|Any CPU - {715461E8-4E54-4993-80A8-8E72892135E0}.Debug - Beta|Any CPU.Build.0 = Debug - Beta|Any CPU + {715461E8-4E54-4993-80A8-8E72892135E0}.Debug - Beta|Any CPU.ActiveCfg = Debug|Any CPU + {715461E8-4E54-4993-80A8-8E72892135E0}.Debug - Beta|Any CPU.Build.0 = Debug|Any CPU + {715461E8-4E54-4993-80A8-8E72892135E0}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug|Any CPU + {715461E8-4E54-4993-80A8-8E72892135E0}.Debug - ServerMonitor|Any CPU.Build.0 = Debug|Any CPU {715461E8-4E54-4993-80A8-8E72892135E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {715461E8-4E54-4993-80A8-8E72892135E0}.Debug|Any CPU.Build.0 = Debug|Any CPU {715461E8-4E54-4993-80A8-8E72892135E0}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -92,8 +97,10 @@ Global {E4EDA8B8-006C-4D41-822F-F64B6DB0021F}.Debug - AutoShutdown|Any CPU.Build.0 = Debug|Any CPU {E4EDA8B8-006C-4D41-822F-F64B6DB0021F}.Debug - AutoUpdate|Any CPU.ActiveCfg = Debug|Any CPU {E4EDA8B8-006C-4D41-822F-F64B6DB0021F}.Debug - AutoUpdate|Any CPU.Build.0 = Debug|Any CPU - {E4EDA8B8-006C-4D41-822F-F64B6DB0021F}.Debug - Beta|Any CPU.ActiveCfg = Debug - Beta|Any CPU - {E4EDA8B8-006C-4D41-822F-F64B6DB0021F}.Debug - Beta|Any CPU.Build.0 = Debug - Beta|Any CPU + {E4EDA8B8-006C-4D41-822F-F64B6DB0021F}.Debug - Beta|Any CPU.ActiveCfg = Debug|Any CPU + {E4EDA8B8-006C-4D41-822F-F64B6DB0021F}.Debug - Beta|Any CPU.Build.0 = Debug|Any CPU + {E4EDA8B8-006C-4D41-822F-F64B6DB0021F}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug|Any CPU + {E4EDA8B8-006C-4D41-822F-F64B6DB0021F}.Debug - ServerMonitor|Any CPU.Build.0 = Debug|Any CPU {E4EDA8B8-006C-4D41-822F-F64B6DB0021F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E4EDA8B8-006C-4D41-822F-F64B6DB0021F}.Debug|Any CPU.Build.0 = Debug|Any CPU {E4EDA8B8-006C-4D41-822F-F64B6DB0021F}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -104,8 +111,10 @@ Global {679FE859-9A82-4FFB-A758-C1E8DF915F58}.Debug - AutoShutdown|Any CPU.Build.0 = Debug|Any CPU {679FE859-9A82-4FFB-A758-C1E8DF915F58}.Debug - AutoUpdate|Any CPU.ActiveCfg = Debug|Any CPU {679FE859-9A82-4FFB-A758-C1E8DF915F58}.Debug - AutoUpdate|Any CPU.Build.0 = Debug|Any CPU - {679FE859-9A82-4FFB-A758-C1E8DF915F58}.Debug - Beta|Any CPU.ActiveCfg = Debug - Beta|Any CPU - {679FE859-9A82-4FFB-A758-C1E8DF915F58}.Debug - Beta|Any CPU.Build.0 = Debug - Beta|Any CPU + {679FE859-9A82-4FFB-A758-C1E8DF915F58}.Debug - Beta|Any CPU.ActiveCfg = Debug|Any CPU + {679FE859-9A82-4FFB-A758-C1E8DF915F58}.Debug - Beta|Any CPU.Build.0 = Debug|Any CPU + {679FE859-9A82-4FFB-A758-C1E8DF915F58}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug|Any CPU + {679FE859-9A82-4FFB-A758-C1E8DF915F58}.Debug - ServerMonitor|Any CPU.Build.0 = Debug|Any CPU {679FE859-9A82-4FFB-A758-C1E8DF915F58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {679FE859-9A82-4FFB-A758-C1E8DF915F58}.Debug|Any CPU.Build.0 = Debug|Any CPU {679FE859-9A82-4FFB-A758-C1E8DF915F58}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -116,8 +125,10 @@ Global {936EF260-FECF-4E9E-A21E-092D65931C7D}.Debug - AutoShutdown|Any CPU.Build.0 = Debug|Any CPU {936EF260-FECF-4E9E-A21E-092D65931C7D}.Debug - AutoUpdate|Any CPU.ActiveCfg = Debug|Any CPU {936EF260-FECF-4E9E-A21E-092D65931C7D}.Debug - AutoUpdate|Any CPU.Build.0 = Debug|Any CPU - {936EF260-FECF-4E9E-A21E-092D65931C7D}.Debug - Beta|Any CPU.ActiveCfg = Debug - Beta|Any CPU - {936EF260-FECF-4E9E-A21E-092D65931C7D}.Debug - Beta|Any CPU.Build.0 = Debug - Beta|Any CPU + {936EF260-FECF-4E9E-A21E-092D65931C7D}.Debug - Beta|Any CPU.ActiveCfg = Debug|Any CPU + {936EF260-FECF-4E9E-A21E-092D65931C7D}.Debug - Beta|Any CPU.Build.0 = Debug|Any CPU + {936EF260-FECF-4E9E-A21E-092D65931C7D}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug|Any CPU + {936EF260-FECF-4E9E-A21E-092D65931C7D}.Debug - ServerMonitor|Any CPU.Build.0 = Debug|Any CPU {936EF260-FECF-4E9E-A21E-092D65931C7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {936EF260-FECF-4E9E-A21E-092D65931C7D}.Debug|Any CPU.Build.0 = Debug|Any CPU {936EF260-FECF-4E9E-A21E-092D65931C7D}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -128,8 +139,10 @@ Global {3E0C9EE6-780F-4FEF-BA03-E38062A5FDB6}.Debug - AutoShutdown|Any CPU.Build.0 = Debug|Any CPU {3E0C9EE6-780F-4FEF-BA03-E38062A5FDB6}.Debug - AutoUpdate|Any CPU.ActiveCfg = Debug|Any CPU {3E0C9EE6-780F-4FEF-BA03-E38062A5FDB6}.Debug - AutoUpdate|Any CPU.Build.0 = Debug|Any CPU - {3E0C9EE6-780F-4FEF-BA03-E38062A5FDB6}.Debug - Beta|Any CPU.ActiveCfg = Debug - Beta|Any CPU - {3E0C9EE6-780F-4FEF-BA03-E38062A5FDB6}.Debug - Beta|Any CPU.Build.0 = Debug - Beta|Any CPU + {3E0C9EE6-780F-4FEF-BA03-E38062A5FDB6}.Debug - Beta|Any CPU.ActiveCfg = Debug|Any CPU + {3E0C9EE6-780F-4FEF-BA03-E38062A5FDB6}.Debug - Beta|Any CPU.Build.0 = Debug|Any CPU + {3E0C9EE6-780F-4FEF-BA03-E38062A5FDB6}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug|Any CPU + {3E0C9EE6-780F-4FEF-BA03-E38062A5FDB6}.Debug - ServerMonitor|Any CPU.Build.0 = Debug|Any CPU {3E0C9EE6-780F-4FEF-BA03-E38062A5FDB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3E0C9EE6-780F-4FEF-BA03-E38062A5FDB6}.Debug|Any CPU.Build.0 = Debug|Any CPU {3E0C9EE6-780F-4FEF-BA03-E38062A5FDB6}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -140,8 +153,10 @@ Global {D2EE1483-021F-4900-BBE8-88338D1386F4}.Debug - AutoShutdown|Any CPU.Build.0 = Debug|Any CPU {D2EE1483-021F-4900-BBE8-88338D1386F4}.Debug - AutoUpdate|Any CPU.ActiveCfg = Debug|Any CPU {D2EE1483-021F-4900-BBE8-88338D1386F4}.Debug - AutoUpdate|Any CPU.Build.0 = Debug|Any CPU - {D2EE1483-021F-4900-BBE8-88338D1386F4}.Debug - Beta|Any CPU.ActiveCfg = Debug - Beta|Any CPU - {D2EE1483-021F-4900-BBE8-88338D1386F4}.Debug - Beta|Any CPU.Build.0 = Debug - Beta|Any CPU + {D2EE1483-021F-4900-BBE8-88338D1386F4}.Debug - Beta|Any CPU.ActiveCfg = Debug|Any CPU + {D2EE1483-021F-4900-BBE8-88338D1386F4}.Debug - Beta|Any CPU.Build.0 = Debug|Any CPU + {D2EE1483-021F-4900-BBE8-88338D1386F4}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug|Any CPU + {D2EE1483-021F-4900-BBE8-88338D1386F4}.Debug - ServerMonitor|Any CPU.Build.0 = Debug|Any CPU {D2EE1483-021F-4900-BBE8-88338D1386F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D2EE1483-021F-4900-BBE8-88338D1386F4}.Debug|Any CPU.Build.0 = Debug|Any CPU {D2EE1483-021F-4900-BBE8-88338D1386F4}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -154,6 +169,8 @@ Global {F7A82C6A-32CD-4847-AD16-D79ADC72746E}.Debug - AutoUpdate|Any CPU.Build.0 = Debug - AutoUpdate|Any CPU {F7A82C6A-32CD-4847-AD16-D79ADC72746E}.Debug - Beta|Any CPU.ActiveCfg = Debug - Beta|Any CPU {F7A82C6A-32CD-4847-AD16-D79ADC72746E}.Debug - Beta|Any CPU.Build.0 = Debug - Beta|Any CPU + {F7A82C6A-32CD-4847-AD16-D79ADC72746E}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug - ServerMonitor|Any CPU + {F7A82C6A-32CD-4847-AD16-D79ADC72746E}.Debug - ServerMonitor|Any CPU.Build.0 = Debug - ServerMonitor|Any CPU {F7A82C6A-32CD-4847-AD16-D79ADC72746E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F7A82C6A-32CD-4847-AD16-D79ADC72746E}.Debug|Any CPU.Build.0 = Debug|Any CPU {F7A82C6A-32CD-4847-AD16-D79ADC72746E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -164,8 +181,10 @@ Global {96832688-29BD-464F-9DCE-482E37BFC751}.Debug - AutoShutdown|Any CPU.Build.0 = Debug|Any CPU {96832688-29BD-464F-9DCE-482E37BFC751}.Debug - AutoUpdate|Any CPU.ActiveCfg = Debug|Any CPU {96832688-29BD-464F-9DCE-482E37BFC751}.Debug - AutoUpdate|Any CPU.Build.0 = Debug|Any CPU - {96832688-29BD-464F-9DCE-482E37BFC751}.Debug - Beta|Any CPU.ActiveCfg = Debug - Beta|Any CPU - {96832688-29BD-464F-9DCE-482E37BFC751}.Debug - Beta|Any CPU.Build.0 = Debug - Beta|Any CPU + {96832688-29BD-464F-9DCE-482E37BFC751}.Debug - Beta|Any CPU.ActiveCfg = Debug|Any CPU + {96832688-29BD-464F-9DCE-482E37BFC751}.Debug - Beta|Any CPU.Build.0 = Debug|Any CPU + {96832688-29BD-464F-9DCE-482E37BFC751}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug|Any CPU + {96832688-29BD-464F-9DCE-482E37BFC751}.Debug - ServerMonitor|Any CPU.Build.0 = Debug|Any CPU {96832688-29BD-464F-9DCE-482E37BFC751}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {96832688-29BD-464F-9DCE-482E37BFC751}.Debug|Any CPU.Build.0 = Debug|Any CPU {96832688-29BD-464F-9DCE-482E37BFC751}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -178,6 +197,8 @@ Global {95D4E57F-06F9-4B41-BEBB-2A8E81759BD2}.Debug - AutoUpdate|Any CPU.Build.0 = Debug - AutoUpdate|Any CPU {95D4E57F-06F9-4B41-BEBB-2A8E81759BD2}.Debug - Beta|Any CPU.ActiveCfg = Debug - Beta|Any CPU {95D4E57F-06F9-4B41-BEBB-2A8E81759BD2}.Debug - Beta|Any CPU.Build.0 = Debug - Beta|Any CPU + {95D4E57F-06F9-4B41-BEBB-2A8E81759BD2}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug - ServerMonitor|Any CPU + {95D4E57F-06F9-4B41-BEBB-2A8E81759BD2}.Debug - ServerMonitor|Any CPU.Build.0 = Debug - ServerMonitor|Any CPU {95D4E57F-06F9-4B41-BEBB-2A8E81759BD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {95D4E57F-06F9-4B41-BEBB-2A8E81759BD2}.Debug|Any CPU.Build.0 = Debug|Any CPU {95D4E57F-06F9-4B41-BEBB-2A8E81759BD2}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -188,8 +209,10 @@ Global {4CA9C894-518F-42D7-BBE2-CFDFE7A03F8A}.Debug - AutoShutdown|Any CPU.Build.0 = Debug|Any CPU {4CA9C894-518F-42D7-BBE2-CFDFE7A03F8A}.Debug - AutoUpdate|Any CPU.ActiveCfg = Debug|Any CPU {4CA9C894-518F-42D7-BBE2-CFDFE7A03F8A}.Debug - AutoUpdate|Any CPU.Build.0 = Debug|Any CPU - {4CA9C894-518F-42D7-BBE2-CFDFE7A03F8A}.Debug - Beta|Any CPU.ActiveCfg = Debug - Beta|Any CPU - {4CA9C894-518F-42D7-BBE2-CFDFE7A03F8A}.Debug - Beta|Any CPU.Build.0 = Debug - Beta|Any CPU + {4CA9C894-518F-42D7-BBE2-CFDFE7A03F8A}.Debug - Beta|Any CPU.ActiveCfg = Debug|Any CPU + {4CA9C894-518F-42D7-BBE2-CFDFE7A03F8A}.Debug - Beta|Any CPU.Build.0 = Debug|Any CPU + {4CA9C894-518F-42D7-BBE2-CFDFE7A03F8A}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug|Any CPU + {4CA9C894-518F-42D7-BBE2-CFDFE7A03F8A}.Debug - ServerMonitor|Any CPU.Build.0 = Debug|Any CPU {4CA9C894-518F-42D7-BBE2-CFDFE7A03F8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4CA9C894-518F-42D7-BBE2-CFDFE7A03F8A}.Debug|Any CPU.Build.0 = Debug|Any CPU {4CA9C894-518F-42D7-BBE2-CFDFE7A03F8A}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -200,8 +223,10 @@ Global {DD0A2401-99B8-4DE1-B8ED-9B075172F8AF}.Debug - AutoShutdown|Any CPU.Build.0 = Debug|Any CPU {DD0A2401-99B8-4DE1-B8ED-9B075172F8AF}.Debug - AutoUpdate|Any CPU.ActiveCfg = Debug|Any CPU {DD0A2401-99B8-4DE1-B8ED-9B075172F8AF}.Debug - AutoUpdate|Any CPU.Build.0 = Debug|Any CPU - {DD0A2401-99B8-4DE1-B8ED-9B075172F8AF}.Debug - Beta|Any CPU.ActiveCfg = Debug - Beta|Any CPU - {DD0A2401-99B8-4DE1-B8ED-9B075172F8AF}.Debug - Beta|Any CPU.Build.0 = Debug - Beta|Any CPU + {DD0A2401-99B8-4DE1-B8ED-9B075172F8AF}.Debug - Beta|Any CPU.ActiveCfg = Debug|Any CPU + {DD0A2401-99B8-4DE1-B8ED-9B075172F8AF}.Debug - Beta|Any CPU.Build.0 = Debug|Any CPU + {DD0A2401-99B8-4DE1-B8ED-9B075172F8AF}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug|Any CPU + {DD0A2401-99B8-4DE1-B8ED-9B075172F8AF}.Debug - ServerMonitor|Any CPU.Build.0 = Debug|Any CPU {DD0A2401-99B8-4DE1-B8ED-9B075172F8AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DD0A2401-99B8-4DE1-B8ED-9B075172F8AF}.Debug|Any CPU.Build.0 = Debug|Any CPU {DD0A2401-99B8-4DE1-B8ED-9B075172F8AF}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -212,8 +237,10 @@ Global {630422CA-4BCC-4D1D-9701-87D8EAF0B209}.Debug - AutoShutdown|Any CPU.Build.0 = Debug|Any CPU {630422CA-4BCC-4D1D-9701-87D8EAF0B209}.Debug - AutoUpdate|Any CPU.ActiveCfg = Debug|Any CPU {630422CA-4BCC-4D1D-9701-87D8EAF0B209}.Debug - AutoUpdate|Any CPU.Build.0 = Debug|Any CPU - {630422CA-4BCC-4D1D-9701-87D8EAF0B209}.Debug - Beta|Any CPU.ActiveCfg = Debug - Beta|Any CPU - {630422CA-4BCC-4D1D-9701-87D8EAF0B209}.Debug - Beta|Any CPU.Build.0 = Debug - Beta|Any CPU + {630422CA-4BCC-4D1D-9701-87D8EAF0B209}.Debug - Beta|Any CPU.ActiveCfg = Debug|Any CPU + {630422CA-4BCC-4D1D-9701-87D8EAF0B209}.Debug - Beta|Any CPU.Build.0 = Debug|Any CPU + {630422CA-4BCC-4D1D-9701-87D8EAF0B209}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug|Any CPU + {630422CA-4BCC-4D1D-9701-87D8EAF0B209}.Debug - ServerMonitor|Any CPU.Build.0 = Debug|Any CPU {630422CA-4BCC-4D1D-9701-87D8EAF0B209}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {630422CA-4BCC-4D1D-9701-87D8EAF0B209}.Debug|Any CPU.Build.0 = Debug|Any CPU {630422CA-4BCC-4D1D-9701-87D8EAF0B209}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -224,8 +251,10 @@ Global {39C42E58-36BD-4C6B-9AD2-7F9EBCA7A68A}.Debug - AutoShutdown|Any CPU.Build.0 = Debug|Any CPU {39C42E58-36BD-4C6B-9AD2-7F9EBCA7A68A}.Debug - AutoUpdate|Any CPU.ActiveCfg = Debug|Any CPU {39C42E58-36BD-4C6B-9AD2-7F9EBCA7A68A}.Debug - AutoUpdate|Any CPU.Build.0 = Debug|Any CPU - {39C42E58-36BD-4C6B-9AD2-7F9EBCA7A68A}.Debug - Beta|Any CPU.ActiveCfg = Debug - Beta|Any CPU - {39C42E58-36BD-4C6B-9AD2-7F9EBCA7A68A}.Debug - Beta|Any CPU.Build.0 = Debug - Beta|Any CPU + {39C42E58-36BD-4C6B-9AD2-7F9EBCA7A68A}.Debug - Beta|Any CPU.ActiveCfg = Debug|Any CPU + {39C42E58-36BD-4C6B-9AD2-7F9EBCA7A68A}.Debug - Beta|Any CPU.Build.0 = Debug|Any CPU + {39C42E58-36BD-4C6B-9AD2-7F9EBCA7A68A}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug|Any CPU + {39C42E58-36BD-4C6B-9AD2-7F9EBCA7A68A}.Debug - ServerMonitor|Any CPU.Build.0 = Debug|Any CPU {39C42E58-36BD-4C6B-9AD2-7F9EBCA7A68A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {39C42E58-36BD-4C6B-9AD2-7F9EBCA7A68A}.Debug|Any CPU.Build.0 = Debug|Any CPU {39C42E58-36BD-4C6B-9AD2-7F9EBCA7A68A}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -238,6 +267,8 @@ Global {A8BFC452-5BE8-41E7-BD1D-C29B944185CE}.Debug - AutoUpdate|Any CPU.Build.0 = Debug|Any CPU {A8BFC452-5BE8-41E7-BD1D-C29B944185CE}.Debug - Beta|Any CPU.ActiveCfg = Debug|Any CPU {A8BFC452-5BE8-41E7-BD1D-C29B944185CE}.Debug - Beta|Any CPU.Build.0 = Debug|Any CPU + {A8BFC452-5BE8-41E7-BD1D-C29B944185CE}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug|Any CPU + {A8BFC452-5BE8-41E7-BD1D-C29B944185CE}.Debug - ServerMonitor|Any CPU.Build.0 = Debug|Any CPU {A8BFC452-5BE8-41E7-BD1D-C29B944185CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A8BFC452-5BE8-41E7-BD1D-C29B944185CE}.Debug|Any CPU.Build.0 = Debug|Any CPU {A8BFC452-5BE8-41E7-BD1D-C29B944185CE}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -249,6 +280,8 @@ Global {1434D87A-E9FC-48B9-BEC9-E5A3003F1F2E}.Debug - AutoUpdate|Any CPU.Build.0 = Debug|Any CPU {1434D87A-E9FC-48B9-BEC9-E5A3003F1F2E}.Debug - Beta|Any CPU.ActiveCfg = Debug|Any CPU {1434D87A-E9FC-48B9-BEC9-E5A3003F1F2E}.Debug - Beta|Any CPU.Build.0 = Debug|Any CPU + {1434D87A-E9FC-48B9-BEC9-E5A3003F1F2E}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug|Any CPU + {1434D87A-E9FC-48B9-BEC9-E5A3003F1F2E}.Debug - ServerMonitor|Any CPU.Build.0 = Debug|Any CPU {1434D87A-E9FC-48B9-BEC9-E5A3003F1F2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1434D87A-E9FC-48B9-BEC9-E5A3003F1F2E}.Debug|Any CPU.Build.0 = Debug|Any CPU {1434D87A-E9FC-48B9-BEC9-E5A3003F1F2E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -258,8 +291,10 @@ Global {C4C8000D-5E45-497C-A218-B95A1567010E}.Debug - AutoShutdown|Any CPU.Build.0 = Debug|Any CPU {C4C8000D-5E45-497C-A218-B95A1567010E}.Debug - AutoUpdate|Any CPU.ActiveCfg = Debug|Any CPU {C4C8000D-5E45-497C-A218-B95A1567010E}.Debug - AutoUpdate|Any CPU.Build.0 = Debug|Any CPU - {C4C8000D-5E45-497C-A218-B95A1567010E}.Debug - Beta|Any CPU.ActiveCfg = Debug - Beta|Any CPU - {C4C8000D-5E45-497C-A218-B95A1567010E}.Debug - Beta|Any CPU.Build.0 = Debug - Beta|Any CPU + {C4C8000D-5E45-497C-A218-B95A1567010E}.Debug - Beta|Any CPU.ActiveCfg = Debug|Any CPU + {C4C8000D-5E45-497C-A218-B95A1567010E}.Debug - Beta|Any CPU.Build.0 = Debug|Any CPU + {C4C8000D-5E45-497C-A218-B95A1567010E}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug|Any CPU + {C4C8000D-5E45-497C-A218-B95A1567010E}.Debug - ServerMonitor|Any CPU.Build.0 = Debug|Any CPU {C4C8000D-5E45-497C-A218-B95A1567010E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C4C8000D-5E45-497C-A218-B95A1567010E}.Debug|Any CPU.Build.0 = Debug|Any CPU {C4C8000D-5E45-497C-A218-B95A1567010E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -272,6 +307,8 @@ Global {18271A4E-6135-466A-BCF8-80E25446F454}.Debug - AutoUpdate|Any CPU.Build.0 = Debug|Any CPU {18271A4E-6135-466A-BCF8-80E25446F454}.Debug - Beta|Any CPU.ActiveCfg = Debug|Any CPU {18271A4E-6135-466A-BCF8-80E25446F454}.Debug - Beta|Any CPU.Build.0 = Debug|Any CPU + {18271A4E-6135-466A-BCF8-80E25446F454}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug|Any CPU + {18271A4E-6135-466A-BCF8-80E25446F454}.Debug - ServerMonitor|Any CPU.Build.0 = Debug|Any CPU {18271A4E-6135-466A-BCF8-80E25446F454}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {18271A4E-6135-466A-BCF8-80E25446F454}.Debug|Any CPU.Build.0 = Debug|Any CPU {18271A4E-6135-466A-BCF8-80E25446F454}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -283,6 +320,8 @@ Global {A2EEBC18-DAD8-415D-98E4-258EB12369C7}.Debug - AutoUpdate|Any CPU.Build.0 = Debug|Any CPU {A2EEBC18-DAD8-415D-98E4-258EB12369C7}.Debug - Beta|Any CPU.ActiveCfg = Debug|Any CPU {A2EEBC18-DAD8-415D-98E4-258EB12369C7}.Debug - Beta|Any CPU.Build.0 = Debug|Any CPU + {A2EEBC18-DAD8-415D-98E4-258EB12369C7}.Debug - ServerMonitor|Any CPU.ActiveCfg = Debug|Any CPU + {A2EEBC18-DAD8-415D-98E4-258EB12369C7}.Debug - ServerMonitor|Any CPU.Build.0 = Debug|Any CPU {A2EEBC18-DAD8-415D-98E4-258EB12369C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A2EEBC18-DAD8-415D-98E4-258EB12369C7}.Debug|Any CPU.Build.0 = Debug|Any CPU {A2EEBC18-DAD8-415D-98E4-258EB12369C7}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/src/ServerManager.Common/ServerManager.Common.csproj b/src/ServerManager.Common/ServerManager.Common.csproj index ad48231c..a198879e 100644 --- a/src/ServerManager.Common/ServerManager.Common.csproj +++ b/src/ServerManager.Common/ServerManager.Common.csproj @@ -1,6 +1,6 @@  - Debug;Release;Debug - Beta + Debug;Release net462 diff --git a/src/ServerManager.Discord/ServerManager.Discord.csproj b/src/ServerManager.Discord/ServerManager.Discord.csproj index 61b8feca..5c1770d9 100644 --- a/src/ServerManager.Discord/ServerManager.Discord.csproj +++ b/src/ServerManager.Discord/ServerManager.Discord.csproj @@ -1,6 +1,6 @@  - Debug;Release;Debug - Beta + Debug;Release net462 @@ -11,9 +11,6 @@ none false - - $(DefineConstants);DEBUG - diff --git a/src/ServerManager.Updater/ServerManager.Updater.csproj b/src/ServerManager.Updater/ServerManager.Updater.csproj index d6353b86..3a1d2c5a 100644 --- a/src/ServerManager.Updater/ServerManager.Updater.csproj +++ b/src/ServerManager.Updater/ServerManager.Updater.csproj @@ -1,6 +1,6 @@  - Debug;Release;Debug - Beta + Debug;Release Exe diff --git a/src/ServerManager.WebApplication/ServerManager.WebApplication.csproj b/src/ServerManager.WebApplication/ServerManager.WebApplication.csproj index 66ad6a9e..cb68ceb5 100644 --- a/src/ServerManager.WebApplication/ServerManager.WebApplication.csproj +++ b/src/ServerManager.WebApplication/ServerManager.WebApplication.csproj @@ -2,7 +2,7 @@ net5.0 - Debug;Release;Debug - Beta + Debug;Release Art\favicon.ico @@ -14,9 +14,6 @@ AnyCPU - - AnyCPU - From 3f4cc944b77448fa819567d97720da20dad410e7 Mon Sep 17 00:00:00 2001 From: Brett Hewitson Date: Tue, 17 May 2022 00:31:26 +1000 Subject: [PATCH 2/3] Server Monitor Changes - added Start, Stop, Restart, Update and Backup buttons and functionality. --- src/ARKServerManager/ARKServerManager.csproj | 1 + src/ARKServerManager/Art/Restart.ico | Bin 0 -> 102134 bytes .../Globalization/en-US/en-US.xaml | 24 +- .../Windows/ServerMonitorWindow.xaml | 144 ++++- .../Windows/ServerMonitorWindow.xaml.cs | 568 +++++++++++++++++ src/ConanServerManager/Art/Restart.ico | Bin 0 -> 102134 bytes .../ConanServerManager.csproj | 1 + .../Globalization/en-US/en-US.xaml | 24 +- .../Windows/ServerMonitorWindow.xaml | 136 ++++- .../Windows/ServerMonitorWindow.xaml.cs | 570 +++++++++++++++++- 10 files changed, 1445 insertions(+), 23 deletions(-) create mode 100644 src/ARKServerManager/Art/Restart.ico create mode 100644 src/ConanServerManager/Art/Restart.ico diff --git a/src/ARKServerManager/ARKServerManager.csproj b/src/ARKServerManager/ARKServerManager.csproj index 22b8ccaa..b505318f 100644 --- a/src/ARKServerManager/ARKServerManager.csproj +++ b/src/ARKServerManager/ARKServerManager.csproj @@ -366,6 +366,7 @@ + Always diff --git a/src/ARKServerManager/Art/Restart.ico b/src/ARKServerManager/Art/Restart.ico new file mode 100644 index 0000000000000000000000000000000000000000..3e07dd1e5dbac768eff7c468250f8e9dd1477596 GIT binary patch literal 102134 zcmeHQ4QwP=eV;ww;RGV=3ZVuX@KkE=d?9yP(jB|_~I%2yETw&APfBE~7Igdkw4QYnelt`RAyMPQRl)r0uF{rzU= zzkd7n&CHwGnf0#iQT}=JzW!go|NFl;v+F&_DLKz^rl%d0u5;IZ$C-B==fVp+^*=w~ zalVZ<*X`6lgK=+uzT=e3Vf|MfXY-|wQ>k?7v)4Gzr(W+ko)^~7D>>i(Gsl?)PfUe` zPCE*x0>1in_mM-+!X*bCl>1Pg54s-oAm}>_M-Dv&`Y-hTJBV%UJ3k!DInLdefQ}q0 zq5Vam4=!AC=y8-E!n_+7E}gw%;pMYeqP*$uqlf+)ZQlyU969(R&I#ss=N|er`u`qu z*&Wwhf8e@z{q4TDKm0o{JpPqq)%h>qdgQJ@s+_-Y+3e-$Z-PEed7)hD{J~)EB?n)8 z+x53h-1vv@-GAj@J^tLb3kz4h>?I3F10I-j@I1`D z9&^71y6pCAZ<@I3JY z;w!-8o0#)@=N|KXMw zLiSS&M`!!zpL$xGe=OwD)ghQ4ssE{t{abRoKIqXu2mhJzJ7tF-^tXwh|3v)MP4NT$ z!`N5i_jT6=@%y%|_&ut{?`I&lvj*bV&z0f&xf$!{!$F(|vEH+O23o(%6YaKFYPTIH z9dQolGS47&IY>`IK4X5VA%~eR=pW<^*dF8z_-^0b%qN!|yb5daB>MjuZ9l;M84~Y7 zY&#i@33CtX^m&IDc=AG<^Nypl;tS@M{TTCd&_{8P9Cq+&@P7jL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YCw&9*}#!r*G&>Pz$8`IPSiX^#}R3&m7ckBx3;B6QjKGXH4aqZ)HuukHnt7jKf>) z^JH!jCG_x9=rZv6GjAJ!Q!QuwSHQ23^+wy_>qZKHXMWbV^)qxy^E|+~9K{&m9-T)H zSOTBI_PLbU^K4L=23)Weo&UpY;j6*-oef|v^$AYUQYiTO};rB6UO9_jy~!X>P8(^9JAc};4!@&b`&WSHhDStM*PXM@V3SRX;InBE&tNT3d(4PBQ}RmYj? z)N!}iZev!+(CetOEGlC*2Z93&4qQ~r4H@Tk1gs06)sBGG&U7*e1T2dl8yz`bhb>rk z7zw*}yVDbng3M)(+zhyElJ_bV*$AX;uyviB&j#$zlFJ4quLs&f`9(~{r1d}?e1NeX zCT(1(V=S302X5^6$O9(J0WR=Sc<*5hMN_~kC=ky&1duoR;QzShpbKQO4)GLl)>+&P z)LUkK5(+Njzi>DNpfjj<5G=6{7U6UXAdaX*J6?0BuT$OCpb7!rR8aRi^~v_~)H>Dg zR3Tt_YE`K_?bXTE$pF#Lh{g4w&VUK7xwDhY=nu4K!_>yaGF;fLPi_YFP#wA`sILZ- z`M>r_Z>Fmr>Wh!DzRa%Rn)_aFededV^{JnEbBqJICeP7*O1<4%p9tzQnhLRht6u7_ zFRJ}cn{aH6AAx$3{)YZ7|8(r%s!z6cfA;x%M#V?Rql4FK*FlSqF&?(+?UStQ@z4`5 zlS=#`o)~{>y!FMS7O#3d_r<%i9;UD!^!1{zCw;y3tj7&!PG7J3de+x_Uq0|)VBn%K zUo6ugx(p@n^?b7``Dq4$h`D;c(({>~@AQ1A=gT$)gY_bD4({l&;PQfc=l^VAisPs` z7KABOeI}^3!+fsidwoC9_X{kqfB~YS!^i9J?d~`5&0>(00?!5Eggdk%w0PHdGdI~Sz@ literal 0 HcmV?d00001 diff --git a/src/ARKServerManager/Globalization/en-US/en-US.xaml b/src/ARKServerManager/Globalization/en-US/en-US.xaml index dc7d809c..c2a65f54 100644 --- a/src/ARKServerManager/Globalization/en-US/en-US.xaml +++ b/src/ARKServerManager/Globalization/en-US/en-US.xaml @@ -440,6 +440,7 @@ Server Monitor + Selected Total Servers: Server Map @@ -449,6 +450,13 @@ Status Create a desktop shortcut to open this form directly. + Start the selected servers. + Stop the selected servers. + Restart the selected servers. + Update the selected servers. + Backup the selected servers. + Select all servers. + Unselect all servers. Open the Player List window. Open the RCON window. Start the server. @@ -459,7 +467,21 @@ Server Update Error Another server is being upgraded, wait until the upgrade has finished and try again. Confirm Window Close - You are currently perform a server update, closing the window with disconnect you from steamcmd. Do you want to continue closing the window? + You are currently performing a server update, closing the window will disconnect you from steamcmd. Do you want to continue closing the window? + Confirm Start Servers + You are about to start the selected servers. Do you want to continue? + Confirm Stop Servers + You are about to stop the selected servers. Do you want to continue? + Confirm Restart Servers + You are about to restart the selected servers. Do you want to continue? + Confirm Update Servers + You are about to update the selected servers. Do you want to continue? + Confirm Backup Servers + You are about to backup the selected servers. Do you want to continue? + Selected Servers Error + You have not selected any servers. Selected one or more servers in the list and try again. + Close Server Monitor Error + The server monitor window cannot be closed at this time. One or more of the servers is currently starting, shutting down or restarting. diff --git a/src/ARKServerManager/Windows/ServerMonitorWindow.xaml b/src/ARKServerManager/Windows/ServerMonitorWindow.xaml index d2791ff9..95ff243c 100644 --- a/src/ARKServerManager/Windows/ServerMonitorWindow.xaml +++ b/src/ARKServerManager/Windows/ServerMonitorWindow.xaml @@ -4,6 +4,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:tb="http://www.hardcodet.net/taskbar" + xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" + xmlns:sm="clr-namespace:ServerManagerTool" + xmlns:smw="clr-namespace:ServerManagerTool.Windows" xmlns:clib="clr-namespace:ServerManagerTool.Common.Lib;assembly=ServerManager.Common" xmlns:com="clr-namespace:ServerManagerTool.Common;assembly=ServerManager.Common" xmlns:enum="clr-namespace:ServerManagerTool.Enums" @@ -18,21 +21,31 @@ - + + - + - + + + - + + + + + + + + @@ -41,12 +54,95 @@ - + + + + + + + + + + + + + + + - - + + + + - + @@ -544,7 +664,7 @@ - + @@ -557,7 +677,7 @@ Visibility="{Binding IsStandAloneWindow, Converter={StaticResource BooleanToVisibilityConverter}}" ToolTipText="{Binding Title}" IconSource="../Art/favicon.ico" - LeftClickCommand="{Binding ShowWindowCommand, ElementName=ServerMonitorUI}"> + LeftClickCommand="{Binding ShowWindowCommand, ElementName=ServerMonitorUI}" Grid.ColumnSpan="2"> diff --git a/src/ARKServerManager/Windows/ServerMonitorWindow.xaml.cs b/src/ARKServerManager/Windows/ServerMonitorWindow.xaml.cs index f23ac64e..34dd543b 100644 --- a/src/ARKServerManager/Windows/ServerMonitorWindow.xaml.cs +++ b/src/ARKServerManager/Windows/ServerMonitorWindow.xaml.cs @@ -2,6 +2,7 @@ using NLog; using ServerManagerTool.Common.Lib; using ServerManagerTool.Common.Utils; +using ServerManagerTool.DiscordBot.Enums; using ServerManagerTool.Enums; using ServerManagerTool.Lib; using ServerManagerTool.Plugin.Common; @@ -16,7 +17,9 @@ using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; +using System.Windows.Documents; using System.Windows.Input; +using System.Windows.Media; using WPFSharp.Globalizer; namespace ServerManagerTool.Windows @@ -26,17 +29,39 @@ namespace ServerManagerTool.Windows /// public partial class ServerMonitorWindow : Window { + public class ServerMonitorOutput_Error : Run + { + public ServerMonitorOutput_Error(string value) + : base(value) + { + Foreground = Brushes.Red; + } + } + + public class ServerMonitorOutput_Success : Run + { + public ServerMonitorOutput_Success(string value) + : base(value) + { + Foreground = Brushes.Green; + } + } + private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly List Windows = new List(); private readonly GlobalizedApplication _globalizer = GlobalizedApplication.Instance; private CancellationTokenSource _upgradeCancellationSource = null; private ActionQueue _versionChecker; + private readonly Dictionary _currentProfileCommands = new Dictionary(); + + private bool HasRunningCommands => _currentProfileCommands.Count > 0; public static readonly DependencyProperty ServerManagerProperty = DependencyProperty.Register(nameof(ServerManager), typeof(ServerManager), typeof(ServerMonitorWindow), new PropertyMetadata(null)); public static readonly DependencyProperty LatestServerManagerVersionProperty = DependencyProperty.Register(nameof(LatestServerManagerVersion), typeof(Version), typeof(ServerMonitorWindow), new PropertyMetadata(new Version())); public static readonly DependencyProperty ShowUpdateButtonProperty = DependencyProperty.Register(nameof(ShowUpdateButton), typeof(bool), typeof(ServerMonitorWindow), new PropertyMetadata(false)); public static readonly DependencyProperty IsStandAloneWindowProperty = DependencyProperty.Register(nameof(IsStandAloneWindow), typeof(bool), typeof(ServerMonitorWindow), new PropertyMetadata(false)); + public static readonly DependencyProperty CancellationTokenSourceProperty = DependencyProperty.Register(nameof(CancellationTokenSource), typeof(CancellationTokenSource), typeof(ServerMonitorWindow)); public ServerMonitorWindow() : this(null) { @@ -89,6 +114,12 @@ namespace ServerManagerTool.Windows set { SetValue(IsStandAloneWindowProperty, value); } } + public CancellationTokenSource CancellationTokenSource + { + get { return (CancellationTokenSource)GetValue(CancellationTokenSourceProperty); } + set { SetValue(CancellationTokenSourceProperty, value); } + } + private void ServerMonitorWindow_Loaded(object sender, RoutedEventArgs e) { if (ServerManager == null) @@ -156,6 +187,14 @@ namespace ServerManagerTool.Windows protected override void OnClosing(CancelEventArgs e) { + if (HasRunningCommands) + { + MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_RunningProcesses_ConfirmLabel"), _globalizer.GetResourceString("ServerMonitor_RunningProcesses_ConfirmTitle"), MessageBoxButton.OK, MessageBoxImage.Error); + + e.Cancel = true; + return; + } + if (this.OwnedWindows.OfType().Any()) { if (MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_CloseWindow_ConfirmLabel"), _globalizer.GetResourceString("ServerMonitor_CloseWindow_ConfirmTitle"), MessageBoxButton.YesNo, MessageBoxImage.Warning) != MessageBoxResult.Yes) @@ -409,6 +448,29 @@ namespace ServerManagerTool.Windows } } + public void AddErrorBlockContent(string message) + { + var p = new Paragraph(); + + p.Inlines.Add(new ServerMonitorOutput_Error(message)); + + ConsoleContent.Blocks.Add(p); + } + + public void AddMessageBlockContent(string message) + { + var p = new Paragraph(); + + p.Inlines.Add(new ServerMonitorOutput_Success(message)); + + ConsoleContent.Blocks.Add(p); + } + + public void ClearBlockContents() + { + ConsoleContent.Blocks.Clear(); + } + private async Task CheckForUpdates() { string url = App.Instance.BetaVersion ? Config.Default.LatestASMBetaVersionUrl : Config.Default.LatestASMVersionUrl; @@ -816,5 +878,511 @@ namespace ServerManagerTool.Windows } #endregion + + private async void BackupServers_Click(object sender, RoutedEventArgs e) + { + if (CancellationTokenSource != null) + return; + + var serverList = ServerManager.Servers.Where(s => s.Selected); + if (serverList.IsEmpty()) + { + MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_NoServersSelected_ErrorLabel"), _globalizer.GetResourceString("ServerMonitor_NoServersSelected_ErrorTitle"), MessageBoxButton.OK, MessageBoxImage.Error); + return; + } + + var result = MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_BackupServers_ConfirmLabel"), _globalizer.GetResourceString("ServerMonitor_BackupServers_ConfirmTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question); + if (result != MessageBoxResult.Yes) + return; + + ClearBlockContents(); + + var profileList = new List(); + + foreach (var server in serverList) + { + // check if another command is being run against the profile + if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID)) + { + AddErrorBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName)); + continue; + } + + switch (server.Runtime.Status) + { + case ServerStatus.Initializing: + case ServerStatus.Stopping: + case ServerStatus.Uninstalled: + case ServerStatus.Unknown: + case ServerStatus.Updating: + AddErrorBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString)); + continue; + } + + _currentProfileCommands.Add(server.Profile.ProfileID, CommandType.Backup); + profileList.Add(ServerProfileSnapshot.Create(server.Profile)); + } + + CancellationTokenSource = new CancellationTokenSource(); + var token = CancellationTokenSource.Token; + var tasks = new List(); + + foreach (var profile in profileList) + { + var app = new ServerApp(true) + { + DeleteOldBackupFiles = !Config.Default.AutoBackup_EnableBackup, + OutputLogs = false, + SendAlerts = true, + SendEmails = false, + ServerProcess = ServerProcessType.Backup, + ServerStatusChangeCallback = (ServerStatus serverStatus) => + { + TaskUtils.RunOnUIThreadAsync(() => + { + var server = ServerManager.Instance.Servers.FirstOrDefault(s => string.Equals(profile.ProfileId, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)); + if (server != null) + { + server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown); + } + }).Wait(token); + } + }; + + var task = Task.Run(() => + { + app.PerformProfileBackup(profile, token); + _currentProfileCommands.Remove(profile.ProfileId); + }, token); + + tasks.Add(task); + + AddMessageBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_BackupRequested"), profile.ServerName)); + } + + try + { + await Task.WhenAll(tasks); + } + catch { } + finally + { + CancellationTokenSource?.Dispose(); + CancellationTokenSource = null; + } + } + + private async void RestartServers_Click(object sender, RoutedEventArgs e) + { + if (CancellationTokenSource != null) + return; + + var serverList = ServerManager.Servers.Where(s => s.Selected); + if (serverList.IsEmpty()) + { + MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_NoServersSelected_ErrorLabel"), _globalizer.GetResourceString("ServerMonitor_NoServersSelected_ErrorTitle"), MessageBoxButton.OK, MessageBoxImage.Error); + return; + } + + var result = MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_RestartServers_ConfirmLabel"), _globalizer.GetResourceString("ServerMonitor_RestartServers_ConfirmTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question); + if (result != MessageBoxResult.Yes) + return; + + ClearBlockContents(); + + var profileList = new List(); + + foreach (var server in serverList) + { + // check if another command is being run against the profile + if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID)) + { + AddErrorBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName)); + continue; + } + + switch (server.Runtime.Status) + { + case ServerStatus.Initializing: + case ServerStatus.Stopping: + case ServerStatus.Uninstalled: + case ServerStatus.Unknown: + AddErrorBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString)); + continue; + + case ServerStatus.Updating: + AddErrorBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileUpdating"), server.Profile.ProfileName)); + continue; + } + + _currentProfileCommands.Add(server.Profile.ProfileID, CommandType.Restart); + var profile = ServerProfileSnapshot.Create(server.Profile); + profile.AutoRestartIfShutdown = true; + profileList.Add(profile); + } + + CancellationTokenSource = new CancellationTokenSource(); + var token = CancellationTokenSource.Token; + var tasks = new List(); + + foreach (var profile in profileList) + { + var app = new ServerApp(true) + { + DeleteOldBackupFiles = !Config.Default.AutoBackup_EnableBackup, + OutputLogs = false, + SendAlerts = true, + SendEmails = false, + ServerProcess = ServerProcessType.Restart, + ServerStatusChangeCallback = (ServerStatus serverStatus) => + { + TaskUtils.RunOnUIThreadAsync(() => + { + var server = ServerManager.Instance.Servers.FirstOrDefault(s => string.Equals(profile.ProfileId, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)); + if (server != null) + { + server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown); + } + }).Wait(token); + } + }; + + var task = Task.Run(() => + { + app.PerformProfileShutdown(profile, true, false, false, false, token); + _currentProfileCommands.Remove(profile.ProfileId); + }, token); + + tasks.Add(task); + + AddMessageBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_RestartRequested"), profile.ServerName)); + } + + try + { + await Task.WhenAll(tasks); + } + catch { } + finally + { + CancellationTokenSource?.Dispose(); + CancellationTokenSource = null; + } + } + + private async void StartServers_Click(object sender, RoutedEventArgs e) + { + if (CancellationTokenSource != null) + return; + + var serverList = ServerManager.Servers.Where(s => s.Selected); + if (serverList.IsEmpty()) + { + MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_NoServersSelected_ErrorLabel"), _globalizer.GetResourceString("ServerMonitor_NoServersSelected_ErrorTitle"), MessageBoxButton.OK, MessageBoxImage.Error); + return; + } + + var result = MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_StartServers_ConfirmLabel"), _globalizer.GetResourceString("ServerMonitor_StartServers_ConfirmTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question); + if (result != MessageBoxResult.Yes) + return; + + ClearBlockContents(); + + var profileList = new List(); + + foreach (var server in serverList) + { + // check if another command is being run against the profile + if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID)) + { + AddErrorBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName)); + continue; + } + + switch (server.Runtime.Status) + { + case ServerStatus.Initializing: + case ServerStatus.Stopping: + case ServerStatus.Running: + case ServerStatus.Uninstalled: + case ServerStatus.Unknown: + AddErrorBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString)); + continue; + + case ServerStatus.Updating: + AddErrorBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileUpdating"), server.Profile.ProfileName)); + continue; + } + + _currentProfileCommands.Add(server.Profile.ProfileID, CommandType.Start); + var profile = ServerProfileSnapshot.Create(server.Profile); + profile.AutoRestartIfShutdown = true; + profileList.Add(profile); + } + + CancellationTokenSource = new CancellationTokenSource(); + var token = CancellationTokenSource.Token; + var tasks = new List(); + + foreach (var profile in profileList) + { + var app = new ServerApp(true) + { + DeleteOldBackupFiles = !Config.Default.AutoBackup_EnableBackup, + OutputLogs = false, + SendAlerts = true, + SendEmails = false, + ServerProcess = ServerProcessType.Restart, + ServerStatusChangeCallback = (ServerStatus serverStatus) => + { + TaskUtils.RunOnUIThreadAsync(() => + { + var server = ServerManager.Instance.Servers.FirstOrDefault(s => string.Equals(profile.ProfileId, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)); + if (server != null) + { + server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown); + } + }).Wait(token); + } + }; + + var task = Task.Run(() => + { + app.PerformProfileShutdown(profile, true, false, false, false, token); + _currentProfileCommands.Remove(profile.ProfileId); + }, token); + + tasks.Add(task); + + AddMessageBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_StartRequested"), profile.ServerName)); + } + + try + { + await Task.WhenAll(tasks); + } + catch { } + finally + { + CancellationTokenSource?.Dispose(); + CancellationTokenSource = null; + } + } + + private async void StopServers_Click(object sender, RoutedEventArgs e) + { + if (CancellationTokenSource != null) + return; + + var serverList = ServerManager.Servers.Where(s => s.Selected); + if (serverList.IsEmpty()) + { + MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_NoServersSelected_ErrorLabel"), _globalizer.GetResourceString("ServerMonitor_NoServersSelected_ErrorTitle"), MessageBoxButton.OK, MessageBoxImage.Error); + return; + } + + var result = MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_StopServers_ConfirmLabel"), _globalizer.GetResourceString("ServerMonitor_StopServers_ConfirmTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question); + if (result != MessageBoxResult.Yes) + return; + + ClearBlockContents(); + + var profileList = new List(); + + foreach (var server in serverList) + { + // check if another command is being run against the profile + if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID)) + { + AddErrorBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName)); + continue; + } + + switch (server.Runtime.Status) + { + case ServerStatus.Initializing: + case ServerStatus.Stopping: + case ServerStatus.Stopped: + case ServerStatus.Uninstalled: + case ServerStatus.Unknown: + AddErrorBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString)); + continue; + + case ServerStatus.Updating: + AddErrorBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileUpdating"), server.Profile.ProfileName)); + continue; + } + + _currentProfileCommands.Add(server.Profile.ProfileID, CommandType.Stop); + profileList.Add(ServerProfileSnapshot.Create(server.Profile)); + } + + CancellationTokenSource = new CancellationTokenSource(); + var token = CancellationTokenSource.Token; + var tasks = new List(); + + foreach (var profile in profileList) + { + var app = new ServerApp(true) + { + DeleteOldBackupFiles = !Config.Default.AutoBackup_EnableBackup, + OutputLogs = false, + SendAlerts = true, + SendEmails = false, + ServerProcess = ServerProcessType.Shutdown, + ServerStatusChangeCallback = (ServerStatus serverStatus) => + { + TaskUtils.RunOnUIThreadAsync(() => + { + var server = ServerManager.Instance.Servers.FirstOrDefault(s => string.Equals(profile.ProfileId, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)); + if (server != null) + { + server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown); + } + }).Wait(token); + } + }; + + var task = Task.Run(() => + { + app.PerformProfileShutdown(profile, false, false, false, false, token); + _currentProfileCommands.Remove(profile.ProfileId); + }, token); + + tasks.Add(task); + + AddMessageBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_ShutdownRequested"), profile.ServerName)); + } + + try + { + await Task.WhenAll(tasks); + } + catch { } + finally + { + CancellationTokenSource?.Dispose(); + CancellationTokenSource = null; + } + } + + private async void UpdateServers_Click(object sender, RoutedEventArgs e) + { + if (CancellationTokenSource != null) + return; + + var serverList = ServerManager.Servers.Where(s => s.Selected); + if (serverList.IsEmpty()) + { + MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_NoServersSelected_ErrorLabel"), _globalizer.GetResourceString("ServerMonitor_NoServersSelected_ErrorTitle"), MessageBoxButton.OK, MessageBoxImage.Error); + return; + } + + var result = MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_UpdateServers_ConfirmLabel"), _globalizer.GetResourceString("ServerMonitor_UpdateServers_ConfirmTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question); + if (result != MessageBoxResult.Yes) + return; + + ClearBlockContents(); + + var profileList = new List(); + + foreach (var server in serverList) + { + var performRestart = false; + + // check if another command is being run against the profile + if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID)) + { + AddErrorBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName)); + continue; + } + + switch (server.Runtime.Status) + { + case ServerStatus.Running: + performRestart = true; + break; + + case ServerStatus.Initializing: + case ServerStatus.Stopping: + case ServerStatus.Unknown: + AddErrorBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString)); + continue; + + case ServerStatus.Updating: + AddErrorBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileUpdating"), server.Profile.ProfileName)); + continue; + } + + _currentProfileCommands.Add(server.Profile.ProfileID, CommandType.Update); + var profile = ServerProfileSnapshot.Create(server.Profile); + profile.RestartAfterShutdown1 = performRestart; // use this property to trigger a restart + profileList.Add(profile); + } + + CancellationTokenSource = new CancellationTokenSource(); + var token = CancellationTokenSource.Token; + var tasks = new List(); + + foreach (var profile in profileList) + { + var app = new ServerApp(true) + { + DeleteOldBackupFiles = !Config.Default.AutoBackup_EnableBackup, + OutputLogs = false, + SendAlerts = true, + SendEmails = false, + ServerProcess = ServerProcessType.Update, + ServerStatusChangeCallback = (ServerStatus serverStatus) => + { + TaskUtils.RunOnUIThreadAsync(() => + { + var server = ServerManager.Instance.Servers.FirstOrDefault(s => string.Equals(profile.ProfileId, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)); + if (server != null) + { + server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown); + } + }).Wait(token); + } + }; + + var task = Task.Run(() => + { + app.PerformProfileShutdown(profile, profile.RestartAfterShutdown1, true, false, false, token); + _currentProfileCommands.Remove(profile.ProfileId); + }, token); + + tasks.Add(task); + + AddMessageBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_UpdateRequested"), profile.ServerName)); + } + + try + { + await Task.WhenAll(tasks); + } + catch { } + finally + { + CancellationTokenSource?.Dispose(); + CancellationTokenSource = null; + } + } + + private void SelectAllServers_Click(object sender, RoutedEventArgs e) + { + foreach (var server in ServerManager.Servers) + { + server.Selected = true; + } + } + + private void UnselectAllServers_Click(object sender, RoutedEventArgs e) + { + foreach (var server in ServerManager.Servers) + { + server.Selected = false; + } + } } } diff --git a/src/ConanServerManager/Art/Restart.ico b/src/ConanServerManager/Art/Restart.ico new file mode 100644 index 0000000000000000000000000000000000000000..3e07dd1e5dbac768eff7c468250f8e9dd1477596 GIT binary patch literal 102134 zcmeHQ4QwP=eV;ww;RGV=3ZVuX@KkE=d?9yP(jB|_~I%2yETw&APfBE~7Igdkw4QYnelt`RAyMPQRl)r0uF{rzU= zzkd7n&CHwGnf0#iQT}=JzW!go|NFl;v+F&_DLKz^rl%d0u5;IZ$C-B==fVp+^*=w~ zalVZ<*X`6lgK=+uzT=e3Vf|MfXY-|wQ>k?7v)4Gzr(W+ko)^~7D>>i(Gsl?)PfUe` zPCE*x0>1in_mM-+!X*bCl>1Pg54s-oAm}>_M-Dv&`Y-hTJBV%UJ3k!DInLdefQ}q0 zq5Vam4=!AC=y8-E!n_+7E}gw%;pMYeqP*$uqlf+)ZQlyU969(R&I#ss=N|er`u`qu z*&Wwhf8e@z{q4TDKm0o{JpPqq)%h>qdgQJ@s+_-Y+3e-$Z-PEed7)hD{J~)EB?n)8 z+x53h-1vv@-GAj@J^tLb3kz4h>?I3F10I-j@I1`D z9&^71y6pCAZ<@I3JY z;w!-8o0#)@=N|KXMw zLiSS&M`!!zpL$xGe=OwD)ghQ4ssE{t{abRoKIqXu2mhJzJ7tF-^tXwh|3v)MP4NT$ z!`N5i_jT6=@%y%|_&ut{?`I&lvj*bV&z0f&xf$!{!$F(|vEH+O23o(%6Y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Sz@ literal 0 HcmV?d00001 diff --git a/src/ConanServerManager/ConanServerManager.csproj b/src/ConanServerManager/ConanServerManager.csproj index 467f0588..e1053835 100644 --- a/src/ConanServerManager/ConanServerManager.csproj +++ b/src/ConanServerManager/ConanServerManager.csproj @@ -297,6 +297,7 @@ + Designer PreserveNewest diff --git a/src/ConanServerManager/Globalization/en-US/en-US.xaml b/src/ConanServerManager/Globalization/en-US/en-US.xaml index 36c7d163..a55a7174 100644 --- a/src/ConanServerManager/Globalization/en-US/en-US.xaml +++ b/src/ConanServerManager/Globalization/en-US/en-US.xaml @@ -400,6 +400,7 @@ Server Monitor + Selected Total Servers: Server Map @@ -409,6 +410,13 @@ Status Create a desktop shortcut to open this form directly. + Start the selected servers. + Stop the selected servers. + Restart the selected servers. + Update the selected servers. + Backup the selected servers. + Select all servers. + Unselect all servers. Open the Player List window. Open the RCON window. Start the server. @@ -419,7 +427,21 @@ Server Update Error Another server is being upgraded, wait until the upgrade has finished and try again. Confirm Window Close - You are currently perform a server update, closing the window with disconnect you from steamcmd. Do you want to continue closing the window? + You are currently performing a server update, closing the window will disconnect you from steamcmd. Do you want to continue closing the window? + Confirm Start Servers + You are about to start the selected servers. Do you want to continue? + Confirm Stop Servers + You are about to stop the selected servers. Do you want to continue? + Confirm Restart Servers + You are about to restart the selected servers. Do you want to continue? + Confirm Update Servers + You are about to update the selected servers. Do you want to continue? + Confirm Backup Servers + You are about to backup the selected servers. Do you want to continue? + Selected Servers Error + You have not selected any servers. Selected one or more servers in the list and try again. + Close Server Monitor Error + The server monitor window cannot be closed at this time. One or more of the servers is currently starting, shutting down or restarting. diff --git a/src/ConanServerManager/Windows/ServerMonitorWindow.xaml b/src/ConanServerManager/Windows/ServerMonitorWindow.xaml index 8d28adf1..9c8b12f6 100644 --- a/src/ConanServerManager/Windows/ServerMonitorWindow.xaml +++ b/src/ConanServerManager/Windows/ServerMonitorWindow.xaml @@ -4,6 +4,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:tb="http://www.hardcodet.net/taskbar" + xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" + xmlns:sm="clr-namespace:ServerManagerTool" + xmlns:smw="clr-namespace:ServerManagerTool.Windows" xmlns:clib="clr-namespace:ServerManagerTool.Common.Lib;assembly=ServerManager.Common" xmlns:com="clr-namespace:ServerManagerTool.Common;assembly=ServerManager.Common" xmlns:enum="clr-namespace:ServerManagerTool.Enums" @@ -19,6 +22,7 @@ + @@ -28,11 +32,20 @@ - + + + - + + + + + + + + @@ -41,12 +54,95 @@ - + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ARKServerManager/Windows/ServerMonitorWindow.xaml.cs b/src/ARKServerManager/Windows/ServerMonitorWindow.xaml.cs index 34dd543b..17faf776 100644 --- a/src/ARKServerManager/Windows/ServerMonitorWindow.xaml.cs +++ b/src/ARKServerManager/Windows/ServerMonitorWindow.xaml.cs @@ -53,6 +53,7 @@ namespace ServerManagerTool.Windows private readonly GlobalizedApplication _globalizer = GlobalizedApplication.Instance; private CancellationTokenSource _upgradeCancellationSource = null; private ActionQueue _versionChecker; + private ActionQueue _canExecuteChecker; private readonly Dictionary _currentProfileCommands = new Dictionary(); private bool HasRunningCommands => _currentProfileCommands.Count > 0; @@ -152,6 +153,9 @@ namespace ServerManagerTool.Windows _versionChecker = new ActionQueue(); _versionChecker.PostAction(CheckForUpdates).DoNotWait(); } + + _canExecuteChecker = new ActionQueue(); + _canExecuteChecker.PostAction(RaiseCanExecuteChanged).DoNotWait(); } private void ServerMonitorWindow_LocationChanged(object sender, EventArgs e) @@ -205,7 +209,9 @@ namespace ServerManagerTool.Windows } Windows.Remove(this); + _versionChecker?.DisposeAsync().DoNotWait(); + _canExecuteChecker?.DisposeAsync().DoNotWait(); base.OnClosing(e); } @@ -517,6 +523,14 @@ namespace ServerManagerTool.Windows return new ServerMonitorWindow(serverManager); } + public async Task RaiseCanExecuteChanged() + { + await TaskUtils.RunOnUIThreadAsync(() => CommandManager.InvalidateRequerySuggested()); + await Task.Delay(5000); + + _canExecuteChecker?.PostAction(RaiseCanExecuteChanged).DoNotWait(); + } + private void SetWindowTitle() { if (!string.IsNullOrWhiteSpace(App.Instance.Title)) @@ -764,6 +778,114 @@ namespace ServerManagerTool.Windows } } + public ICommand BackupServersCommand + { + get + { + return new RelayCommand( + execute: async (_) => + { + await BackupSelectedServersAsync(); + }, + canExecute: (_) => + { + return ServerManager?.Servers != null && ServerManager.Servers.Count > 0 && ServerManager.Servers.Any(s => s.Selected) && ServerManager.Servers.All(s => s.Runtime.Status != ServerStatus.Unknown) + && CancellationTokenSource == null; + } + ); + } + } + + public ICommand RestartServersCommand + { + get + { + return new RelayCommand( + execute: async (_) => + { + await RestartSelectedServersAsync(); + }, + canExecute: (_) => + { + return ServerManager?.Servers != null && ServerManager.Servers.Count > 0 && ServerManager.Servers.Any(s => s.Selected) && ServerManager.Servers.All(s => s.Runtime.Status != ServerStatus.Unknown) + && CancellationTokenSource == null; + } + ); + } + } + + public ICommand ShutdownServersCommand + { + get + { + return new RelayCommand( + execute: async (_) => + { + await StopSelectedServersAsync(true); + }, + canExecute: (_) => + { + return ServerManager?.Servers != null && ServerManager.Servers.Count > 0 && ServerManager.Servers.Any(s => s.Selected) && ServerManager.Servers.All(s => s.Runtime.Status != ServerStatus.Unknown) + && CancellationTokenSource == null; + } + ); + } + } + + public ICommand StartServersCommand + { + get + { + return new RelayCommand( + execute: async (_) => + { + await StartSelectedServersAsync(); + }, + canExecute: (_) => + { + return ServerManager?.Servers != null && ServerManager.Servers.Count > 0 && ServerManager.Servers.Any(s => s.Selected) && ServerManager.Servers.All(s => s.Runtime.Status != ServerStatus.Unknown) + && CancellationTokenSource == null; + } + ); + } + } + + public ICommand StopServersCommand + { + get + { + return new RelayCommand( + execute: async (_) => + { + await StopSelectedServersAsync(false); + }, + canExecute: (_) => + { + return ServerManager?.Servers != null && ServerManager.Servers.Count > 0 && ServerManager.Servers.Any(s => s.Selected) && ServerManager.Servers.All(s => s.Runtime.Status != ServerStatus.Unknown) + && CancellationTokenSource == null; + } + ); + } + } + + public ICommand UpdateServersCommand + { + get + { + return new RelayCommand( + execute: async (_) => + { + await UpdateSelectedServersAsync(); + }, + canExecute: (_) => + { + return ServerManager?.Servers != null && ServerManager.Servers.Count > 0 && ServerManager.Servers.Any(s => s.Selected) && ServerManager.Servers.All(s => s.Runtime.Status != ServerStatus.Unknown) + && CancellationTokenSource == null; + } + ); + } + } + #region Drag and Drop public static readonly DependencyProperty DraggedItemProperty = DependencyProperty.Register(nameof(DraggedItem), typeof(Server), typeof(ServerMonitorWindow), new PropertyMetadata(null)); @@ -879,7 +1001,23 @@ namespace ServerManagerTool.Windows #endregion - private async void BackupServers_Click(object sender, RoutedEventArgs e) + private void SelectAllServers_Click(object sender, RoutedEventArgs e) + { + foreach (var server in ServerManager.Servers) + { + server.Selected = true; + } + } + + private void UnselectAllServers_Click(object sender, RoutedEventArgs e) + { + foreach (var server in ServerManager.Servers) + { + server.Selected = false; + } + } + + private async Task BackupSelectedServersAsync() { if (CancellationTokenSource != null) return; @@ -972,7 +1110,7 @@ namespace ServerManagerTool.Windows } } - private async void RestartServers_Click(object sender, RoutedEventArgs e) + private async Task RestartSelectedServersAsync() { if (CancellationTokenSource != null) return; @@ -1070,7 +1208,7 @@ namespace ServerManagerTool.Windows } } - private async void StartServers_Click(object sender, RoutedEventArgs e) + private async Task StartSelectedServersAsync() { if (CancellationTokenSource != null) return; @@ -1169,7 +1307,7 @@ namespace ServerManagerTool.Windows } } - private async void StopServers_Click(object sender, RoutedEventArgs e) + private async Task StopSelectedServersAsync(bool shutdown) { if (CancellationTokenSource != null) return; @@ -1181,7 +1319,9 @@ namespace ServerManagerTool.Windows return; } - var result = MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_StopServers_ConfirmLabel"), _globalizer.GetResourceString("ServerMonitor_StopServers_ConfirmTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question); + var result = shutdown + ? MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_ShutdownServers_ConfirmLabel"), _globalizer.GetResourceString("ServerMonitor_ShutdownServers_ConfirmTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question) + : MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_StopServers_ConfirmLabel"), _globalizer.GetResourceString("ServerMonitor_StopServers_ConfirmTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question); if (result != MessageBoxResult.Yes) return; @@ -1225,11 +1365,13 @@ namespace ServerManagerTool.Windows { var app = new ServerApp(true) { + BackupWorldFile = shutdown, DeleteOldBackupFiles = !Config.Default.AutoBackup_EnableBackup, OutputLogs = false, + PerformWorldSave = shutdown, SendAlerts = true, SendEmails = false, - ServerProcess = ServerProcessType.Shutdown, + ServerProcess = shutdown ? ServerProcessType.Shutdown : ServerProcessType.Stop, ServerStatusChangeCallback = (ServerStatus serverStatus) => { TaskUtils.RunOnUIThreadAsync(() => @@ -1243,6 +1385,9 @@ namespace ServerManagerTool.Windows } }; + if (!shutdown) + app.ShutdownInterval = 0; + var task = Task.Run(() => { app.PerformProfileShutdown(profile, false, false, false, false, token); @@ -1251,7 +1396,10 @@ namespace ServerManagerTool.Windows tasks.Add(task); - AddMessageBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_ShutdownRequested"), profile.ServerName)); + if (shutdown) + AddMessageBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_ShutdownRequested"), profile.ServerName)); + else + AddMessageBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_StopRequested"), profile.ServerName)); } try @@ -1266,7 +1414,7 @@ namespace ServerManagerTool.Windows } } - private async void UpdateServers_Click(object sender, RoutedEventArgs e) + private async Task UpdateSelectedServersAsync() { if (CancellationTokenSource != null) return; @@ -1368,21 +1516,5 @@ namespace ServerManagerTool.Windows CancellationTokenSource = null; } } - - private void SelectAllServers_Click(object sender, RoutedEventArgs e) - { - foreach (var server in ServerManager.Servers) - { - server.Selected = true; - } - } - - private void UnselectAllServers_Click(object sender, RoutedEventArgs e) - { - foreach (var server in ServerManager.Servers) - { - server.Selected = false; - } - } } } diff --git a/src/ConanServerManager/Globalization/en-US/en-US.xaml b/src/ConanServerManager/Globalization/en-US/en-US.xaml index a55a7174..eac1a72c 100644 --- a/src/ConanServerManager/Globalization/en-US/en-US.xaml +++ b/src/ConanServerManager/Globalization/en-US/en-US.xaml @@ -411,6 +411,9 @@ Create a desktop shortcut to open this form directly. Start the selected servers. + Shutdown Selected Servers + Shutdown the selected servers. + Stop Selected Servers Stop the selected servers. Restart the selected servers. Update the selected servers. @@ -428,6 +431,8 @@ Another server is being upgraded, wait until the upgrade has finished and try again. Confirm Window Close You are currently performing a server update, closing the window will disconnect you from steamcmd. Do you want to continue closing the window? + Confirm Shutdown Servers + You are about to shutdown the selected servers. Do you want to continue? Confirm Start Servers You are about to start the selected servers. Do you want to continue? Confirm Stop Servers diff --git a/src/ConanServerManager/Lib/ServerApp.cs b/src/ConanServerManager/Lib/ServerApp.cs index 21b4ab81..482a0979 100644 --- a/src/ConanServerManager/Lib/ServerApp.cs +++ b/src/ConanServerManager/Lib/ServerApp.cs @@ -103,6 +103,7 @@ namespace ServerManagerTool.Lib public bool DeleteOldBackupFiles = Config.Default.AutoBackup_DeleteOldFiles; public int ExitCode = EXITCODE_NORMALEXIT; public bool OutputLogs = false; + public bool PerformWorldSave = Config.Default.ServerShutdown_EnableWorldSave; public bool SendAlerts = false; public bool SendEmails = false; public string ShutdownReason = null; @@ -259,11 +260,14 @@ namespace ServerManagerTool.Lib ServerStatusChangeCallback?.Invoke(ServerStatus.Stopped); - // make a backup of the current profile and config files. - CreateProfileBackupArchiveFile(_profile); + if (ServerProcess != ServerProcessType.Stop) + { + // make a backup of the current profile and config files. + CreateProfileBackupArchiveFile(_profile); - if (ExitCode != EXITCODE_NORMALEXIT) - return; + if (ExitCode != EXITCODE_NORMALEXIT) + return; + } if (BackupWorldFile) { @@ -286,10 +290,10 @@ namespace ServerManagerTool.Lib { ServerStatusChangeCallback?.Invoke(ServerStatus.Stopped); } - } - if (ExitCode != EXITCODE_NORMALEXIT) - return; + if (ExitCode != EXITCODE_NORMALEXIT) + return; + } // check if this is a shutdown only, or a shutdown and restart. if (restartServer) @@ -580,7 +584,7 @@ namespace ServerManagerTool.Lib // BH - commented out until funcom provide a way to send a save command // check if we need to perform a world save - //if (serverAccessible && Config.Default.ServerShutdown_EnableWorldSave) + //if (serverAccessible && PerformWorldSave) //{ // try // { @@ -717,6 +721,7 @@ namespace ServerManagerTool.Lib if (process.HasExited) { process.Close(); + if (Config.Default.EmailNotify_ShutdownRestart) SendEmail($"{_profile.ProfileName} server shutdown", $"The server has been shutdown to perform the {ServerProcess} process.", false); } diff --git a/src/ConanServerManager/Utils/DiscordBotHelper.cs b/src/ConanServerManager/Utils/DiscordBotHelper.cs index 49994593..036b9ea6 100644 --- a/src/ConanServerManager/Utils/DiscordBotHelper.cs +++ b/src/ConanServerManager/Utils/DiscordBotHelper.cs @@ -58,11 +58,11 @@ namespace ServerManagerTool.Utils return new List { string.Format(_globalizer.GetResourceString("DiscordBot_CommandNotEnabled"), commandType) }; case CommandType.Shutdown: if (Config.Default.AllowDiscordShutdown) - return ShutdownServer(channelId, profileIdOrAlias, token); + return StopServer(channelId, profileIdOrAlias, true, token); return new List { string.Format(_globalizer.GetResourceString("DiscordBot_CommandNotEnabled"), commandType) }; case CommandType.Stop: if (Config.Default.AllowDiscordStop) - return StopServer(channelId, profileIdOrAlias, token); + return StopServer(channelId, profileIdOrAlias, false, token); return new List { string.Format(_globalizer.GetResourceString("DiscordBot_CommandNotEnabled"), commandType) }; case CommandType.Start: if (Config.Default.AllowDiscordStart) @@ -471,111 +471,7 @@ namespace ServerManagerTool.Utils return responseList; } - private static IList ShutdownServer(string channelId, string profileIdOrAlias, CancellationToken token) - { - if (string.IsNullOrWhiteSpace(profileIdOrAlias)) - { - return new List { string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMissing"), CommandType.Shutdown) }; - } - - var profileList = new List(); - var responseList = new List(); - - TaskUtils.RunOnUIThreadAsync(() => - { - var serverList = ServerManager.Instance.Servers.Where(s => - string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase) - && ( - string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase) - || !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase) - || !string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase) - ) - ); - - if (serverList.IsEmpty()) - { - if (!string.IsNullOrWhiteSpace(Config.Default.DiscordBotAllServersKeyword) && string.Equals(profileIdOrAlias, Config.Default.DiscordBotAllServersKeyword, StringComparison.OrdinalIgnoreCase)) - { - responseList.Add(_globalizer.GetResourceString("DiscordBot_NoChannelProfiles")); - } - else - { - responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileIdOrAlias)); - } - } - else - { - foreach (var server in serverList) - { - if (!server.Profile.AllowDiscordShutdown) - { - responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Shutdown, server.Profile.ProfileName)); - continue; - } - - // check if another command is being run against the profile - if (_currentProfileCommands.ContainsKey(server.Profile.ProfileID)) - { - responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[server.Profile.ProfileID], server.Profile.ProfileName)); - continue; - } - - switch (server.Runtime.Status) - { - case ServerStatus.Initializing: - case ServerStatus.Stopping: - case ServerStatus.Stopped: - case ServerStatus.Uninstalled: - case ServerStatus.Unknown: - responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileBadStatus"), server.Profile.ProfileName, server.Runtime.StatusString)); - continue; - - case ServerStatus.Updating: - responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileUpdating"), server.Profile.ProfileName)); - continue; - } - - _currentProfileCommands.Add(server.Profile.ProfileID, CommandType.Shutdown); - profileList.Add(ServerProfileSnapshot.Create(server.Profile)); - } - } - }).Wait(token); - - foreach (var profile in profileList) - { - var app = new ServerApp(true) - { - DeleteOldBackupFiles = !Config.Default.AutoBackup_EnableBackup, - OutputLogs = false, - SendAlerts = true, - SendEmails = false, - ServerProcess = ServerProcessType.Shutdown, - ServerStatusChangeCallback = (ServerStatus serverStatus) => - { - TaskUtils.RunOnUIThreadAsync(() => - { - var server = ServerManager.Instance.Servers.FirstOrDefault(s => string.Equals(profile.ProfileId, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)); - if (server != null) - { - server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown); - } - }).Wait(token); - } - }; - - Task.Run(() => - { - app.PerformProfileShutdown(profile, false, false, false, false, token); - _currentProfileCommands.Remove(profile.ProfileId); - }, token); - - responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ShutdownRequested"), profile.ServerName)); - } - - return responseList; - } - - private static IList StopServer(string channelId, string profileIdOrAlias, CancellationToken token) + private static IList StopServer(string channelId, string profileIdOrAlias, bool shutdown, CancellationToken token) { if (string.IsNullOrWhiteSpace(profileIdOrAlias)) { @@ -649,12 +545,13 @@ namespace ServerManagerTool.Utils { var app = new ServerApp(true) { + BackupWorldFile = shutdown, DeleteOldBackupFiles = !Config.Default.AutoBackup_EnableBackup, OutputLogs = false, + PerformWorldSave = shutdown, SendAlerts = true, SendEmails = false, - ServerProcess = ServerProcessType.Stop, - ShutdownInterval = 0, + ServerProcess = shutdown ? ServerProcessType.Shutdown : ServerProcessType.Stop, ServerStatusChangeCallback = (ServerStatus serverStatus) => { TaskUtils.RunOnUIThreadAsync(() => @@ -668,13 +565,19 @@ namespace ServerManagerTool.Utils } }; + if (!shutdown) + app.ShutdownInterval = 0; + Task.Run(() => { app.PerformProfileShutdown(profile, false, false, false, false, token); _currentProfileCommands.Remove(profile.ProfileId); }, token); - responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_StopRequested"), profile.ServerName)); + if (shutdown) + responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_ShutdownRequested"), profile.ServerName)); + else + responseList.Add(string.Format(_globalizer.GetResourceString("DiscordBot_StopRequested"), profile.ServerName)); } return responseList; diff --git a/src/ConanServerManager/Windows/ServerMonitorWindow.xaml b/src/ConanServerManager/Windows/ServerMonitorWindow.xaml index 9c8b12f6..7721108b 100644 --- a/src/ConanServerManager/Windows/ServerMonitorWindow.xaml +++ b/src/ConanServerManager/Windows/ServerMonitorWindow.xaml @@ -6,9 +6,9 @@ xmlns:tb="http://www.hardcodet.net/taskbar" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:sm="clr-namespace:ServerManagerTool" - xmlns:smw="clr-namespace:ServerManagerTool.Windows" xmlns:clib="clr-namespace:ServerManagerTool.Common.Lib;assembly=ServerManager.Common" xmlns:com="clr-namespace:ServerManagerTool.Common;assembly=ServerManager.Common" + xmlns:controls="clr-namespace:ServerManagerTool.Common.Controls;assembly=ServerManager.Common" xmlns:enum="clr-namespace:ServerManagerTool.Enums" xmlns:vm="clr-namespace:ServerManagerTool.Lib.ViewModel" mc:Ignorable="d" @@ -24,6 +24,13 @@ + + + + + + + @@ -54,89 +61,49 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ConanServerManager/Windows/ServerMonitorWindow.xaml.cs b/src/ConanServerManager/Windows/ServerMonitorWindow.xaml.cs index b2ee9381..2e57dec5 100644 --- a/src/ConanServerManager/Windows/ServerMonitorWindow.xaml.cs +++ b/src/ConanServerManager/Windows/ServerMonitorWindow.xaml.cs @@ -53,6 +53,7 @@ namespace ServerManagerTool.Windows private readonly GlobalizedApplication _globalizer = GlobalizedApplication.Instance; private CancellationTokenSource _upgradeCancellationSource = null; private ActionQueue _versionChecker; + private ActionQueue _canExecuteChecker; private readonly Dictionary _currentProfileCommands = new Dictionary(); private bool HasRunningCommands => _currentProfileCommands.Count > 0; @@ -152,6 +153,9 @@ namespace ServerManagerTool.Windows _versionChecker = new ActionQueue(); _versionChecker.PostAction(CheckForUpdates).DoNotWait(); } + + _canExecuteChecker = new ActionQueue(); + _canExecuteChecker.PostAction(RaiseCanExecuteChanged).DoNotWait(); } private void ServerMonitorWindow_LocationChanged(object sender, EventArgs e) @@ -205,7 +209,9 @@ namespace ServerManagerTool.Windows } Windows.Remove(this); + _versionChecker?.DisposeAsync().DoNotWait(); + _canExecuteChecker?.DisposeAsync().DoNotWait(); base.OnClosing(e); } @@ -517,6 +523,14 @@ namespace ServerManagerTool.Windows return new ServerMonitorWindow(serverManager); } + public async Task RaiseCanExecuteChanged() + { + await TaskUtils.RunOnUIThreadAsync(() => CommandManager.InvalidateRequerySuggested()); + await Task.Delay(5000); + + _canExecuteChecker?.PostAction(RaiseCanExecuteChanged).DoNotWait(); + } + private void SetWindowTitle() { if (!string.IsNullOrWhiteSpace(App.Instance.Title)) @@ -761,6 +775,114 @@ namespace ServerManagerTool.Windows } } + public ICommand BackupServersCommand + { + get + { + return new RelayCommand( + execute: async (_) => + { + await BackupSelectedServersAsync(); + }, + canExecute: (_) => + { + return ServerManager?.Servers != null && ServerManager.Servers.Count > 0 && ServerManager.Servers.Any(s => s.Selected) && ServerManager.Servers.All(s => s.Runtime.Status != ServerStatus.Unknown) + && CancellationTokenSource == null; + } + ); + } + } + + public ICommand RestartServersCommand + { + get + { + return new RelayCommand( + execute: async (_) => + { + await RestartSelectedServersAsync(); + }, + canExecute: (_) => + { + return ServerManager?.Servers != null && ServerManager.Servers.Count > 0 && ServerManager.Servers.Any(s => s.Selected) && ServerManager.Servers.All(s => s.Runtime.Status != ServerStatus.Unknown) + && CancellationTokenSource == null; + } + ); + } + } + + public ICommand ShutdownServersCommand + { + get + { + return new RelayCommand( + execute: async (_) => + { + await StopSelectedServersAsync(true); + }, + canExecute: (_) => + { + return ServerManager?.Servers != null && ServerManager.Servers.Count > 0 && ServerManager.Servers.Any(s => s.Selected) && ServerManager.Servers.All(s => s.Runtime.Status != ServerStatus.Unknown) + && CancellationTokenSource == null; + } + ); + } + } + + public ICommand StartServersCommand + { + get + { + return new RelayCommand( + execute: async (_) => + { + await StartSelectedServersAsync(); + }, + canExecute: (_) => + { + return ServerManager?.Servers != null && ServerManager.Servers.Count > 0 && ServerManager.Servers.Any(s => s.Selected) && ServerManager.Servers.All(s => s.Runtime.Status != ServerStatus.Unknown) + && CancellationTokenSource == null; + } + ); + } + } + + public ICommand StopServersCommand + { + get + { + return new RelayCommand( + execute: async (_) => + { + await StopSelectedServersAsync(false); + }, + canExecute: (_) => + { + return ServerManager?.Servers != null && ServerManager.Servers.Count > 0 && ServerManager.Servers.Any(s => s.Selected) && ServerManager.Servers.All(s => s.Runtime.Status != ServerStatus.Unknown) + && CancellationTokenSource == null; + } + ); + } + } + + public ICommand UpdateServersCommand + { + get + { + return new RelayCommand( + execute: async (_) => + { + await UpdateSelectedServersAsync(); + }, + canExecute: (_) => + { + return ServerManager?.Servers != null && ServerManager.Servers.Count > 0 && ServerManager.Servers.Any(s => s.Selected) && ServerManager.Servers.All(s => s.Runtime.Status != ServerStatus.Unknown) + && CancellationTokenSource == null; + } + ); + } + } + #region Drag and Drop public static readonly DependencyProperty DraggedItemProperty = DependencyProperty.Register(nameof(DraggedItem), typeof(Server), typeof(ServerMonitorWindow), new PropertyMetadata(null)); @@ -876,7 +998,23 @@ namespace ServerManagerTool.Windows #endregion - private async void BackupServers_Click(object sender, RoutedEventArgs e) + private void SelectAllServers_Click(object sender, RoutedEventArgs e) + { + foreach (var server in ServerManager.Servers) + { + server.Selected = true; + } + } + + private void UnselectAllServers_Click(object sender, RoutedEventArgs e) + { + foreach (var server in ServerManager.Servers) + { + server.Selected = false; + } + } + + private async Task BackupSelectedServersAsync() { if (CancellationTokenSource != null) return; @@ -969,7 +1107,7 @@ namespace ServerManagerTool.Windows } } - private async void RestartServers_Click(object sender, RoutedEventArgs e) + private async Task RestartSelectedServersAsync() { if (CancellationTokenSource != null) return; @@ -1067,7 +1205,7 @@ namespace ServerManagerTool.Windows } } - private async void StartServers_Click(object sender, RoutedEventArgs e) + private async Task StartSelectedServersAsync() { if (CancellationTokenSource != null) return; @@ -1166,7 +1304,7 @@ namespace ServerManagerTool.Windows } } - private async void StopServers_Click(object sender, RoutedEventArgs e) + private async Task StopSelectedServersAsync(bool shutdown) { if (CancellationTokenSource != null) return; @@ -1178,7 +1316,9 @@ namespace ServerManagerTool.Windows return; } - var result = MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_StopServers_ConfirmLabel"), _globalizer.GetResourceString("ServerMonitor_StopServers_ConfirmTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question); + var result = shutdown + ? MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_ShutdownServers_ConfirmLabel"), _globalizer.GetResourceString("ServerMonitor_ShutdownServers_ConfirmTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question) + : MessageBox.Show(_globalizer.GetResourceString("ServerMonitor_StopServers_ConfirmLabel"), _globalizer.GetResourceString("ServerMonitor_StopServers_ConfirmTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question); if (result != MessageBoxResult.Yes) return; @@ -1222,11 +1362,13 @@ namespace ServerManagerTool.Windows { var app = new ServerApp(true) { + BackupWorldFile = shutdown, DeleteOldBackupFiles = !Config.Default.AutoBackup_EnableBackup, OutputLogs = false, + PerformWorldSave = shutdown, SendAlerts = true, SendEmails = false, - ServerProcess = ServerProcessType.Shutdown, + ServerProcess = shutdown ? ServerProcessType.Shutdown : ServerProcessType.Stop, ServerStatusChangeCallback = (ServerStatus serverStatus) => { TaskUtils.RunOnUIThreadAsync(() => @@ -1240,6 +1382,9 @@ namespace ServerManagerTool.Windows } }; + if (!shutdown) + app.ShutdownInterval = 0; + var task = Task.Run(() => { app.PerformProfileShutdown(profile, false, false, false, false, token); @@ -1248,7 +1393,10 @@ namespace ServerManagerTool.Windows tasks.Add(task); - AddMessageBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_ShutdownRequested"), profile.ServerName)); + if (shutdown) + AddMessageBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_ShutdownRequested"), profile.ServerName)); + else + AddMessageBlockContent(string.Format(_globalizer.GetResourceString("DiscordBot_StopRequested"), profile.ServerName)); } try @@ -1263,7 +1411,7 @@ namespace ServerManagerTool.Windows } } - private async void UpdateServers_Click(object sender, RoutedEventArgs e) + private async Task UpdateSelectedServersAsync() { if (CancellationTokenSource != null) return; @@ -1365,21 +1513,5 @@ namespace ServerManagerTool.Windows CancellationTokenSource = null; } } - - private void SelectAllServers_Click(object sender, RoutedEventArgs e) - { - foreach (var server in ServerManager.Servers) - { - server.Selected = true; - } - } - - private void UnselectAllServers_Click(object sender, RoutedEventArgs e) - { - foreach (var server in ServerManager.Servers) - { - server.Selected = false; - } - } } } diff --git a/src/ServerManager.Common/Lib/ActionQueue.cs b/src/ServerManager.Common/Lib/ActionQueue.cs index 714c0092..aab396c4 100644 --- a/src/ServerManager.Common/Lib/ActionQueue.cs +++ b/src/ServerManager.Common/Lib/ActionQueue.cs @@ -19,7 +19,6 @@ namespace ServerManagerTool.Common.Lib public ActionQueue(TaskScheduler scheduler = null) { this.workQueue = new ActionBlock(a => a.Invoke(), new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 1, TaskScheduler = scheduler ?? TaskScheduler.Default }); - } public Task PostAction(Func action) diff --git a/src/ServerManager.Common/Lib/RelayCommand.cs b/src/ServerManager.Common/Lib/RelayCommand.cs index f65cd0e2..f2221418 100644 --- a/src/ServerManager.Common/Lib/RelayCommand.cs +++ b/src/ServerManager.Common/Lib/RelayCommand.cs @@ -31,10 +31,7 @@ namespace ServerManagerTool.Common.Lib /// The execution status logic. public RelayCommand(Action execute, Predicate canExecute) { - if (execute == null) - throw new ArgumentNullException("execute"); - - _execute = execute; + _execute = execute ?? throw new ArgumentNullException("execute"); _canExecute = canExecute; } @@ -53,7 +50,7 @@ namespace ServerManagerTool.Common.Lib { try { - return _canExecute == null ? true : _canExecute((T)parameter); + return _canExecute == null || _canExecute((T)parameter); } catch (Exception) {