version 2.2 stable
This commit is contained in:
parent
65cf3566db
commit
305817d00c
@ -10,6 +10,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using SharedLibraryCore.Localization;
|
||||
using IW4MAdmin.Application.Migration;
|
||||
|
||||
namespace IW4MAdmin.Application
|
||||
{
|
||||
@ -42,6 +43,9 @@ namespace IW4MAdmin.Application
|
||||
Console.CancelKeyPress += new ConsoleCancelEventHandler(OnCancelKey);
|
||||
|
||||
CheckDirectories();
|
||||
// do any needed migrations
|
||||
// todo: move out
|
||||
ConfigurationMigration.MoveConfigFolder10518(null);
|
||||
|
||||
ServerManager = ApplicationManager.GetInstance();
|
||||
Localization.Configure.Initialize(ServerManager.GetApplicationSettings().Configuration()?.CustomLocale);
|
||||
|
@ -53,9 +53,6 @@ namespace IW4MAdmin.Application
|
||||
|
||||
private ApplicationManager()
|
||||
{
|
||||
// do any needed migrations
|
||||
// todo: move out
|
||||
ConfigurationMigration.MoveConfigFolder10518(Logger);
|
||||
_servers = new List<Server>();
|
||||
Commands = new List<Command>();
|
||||
TaskStatuses = new List<AsyncStatus>();
|
||||
|
@ -30,7 +30,7 @@ namespace IW4MAdmin.Application.Migration
|
||||
|
||||
if (!Directory.Exists(configDirectory))
|
||||
{
|
||||
log.WriteDebug($"Creating directory for configs {configDirectory}");
|
||||
log?.WriteDebug($"Creating directory for configs {configDirectory}");
|
||||
Directory.CreateDirectory(configDirectory);
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ namespace IW4MAdmin.Application.Migration
|
||||
|
||||
foreach (var configFile in configurationFiles)
|
||||
{
|
||||
log.WriteDebug($"Moving config file {configFile}");
|
||||
log?.WriteDebug($"Moving config file {configFile}");
|
||||
string destinationPath = Path.Join("Configuration", configFile);
|
||||
if (!File.Exists(destinationPath))
|
||||
{
|
||||
@ -51,7 +51,7 @@ namespace IW4MAdmin.Application.Migration
|
||||
if (!File.Exists(Path.Join("Database", "Database.db")) &&
|
||||
File.Exists("Database.db"))
|
||||
{
|
||||
log.WriteDebug("Moving database file");
|
||||
log?.WriteDebug("Moving database file");
|
||||
File.Move("Database.db", Path.Join("Database", "Database.db"));
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||
_customcallbacks.gsc = _customcallbacks.gsc
|
||||
README.md = README.md
|
||||
RunPublishPre.cmd = RunPublishPre.cmd
|
||||
RunPublishRelease.cmd = RunPublishRelease.cmd
|
||||
version.txt = version.txt
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
@ -18,7 +18,9 @@ namespace Tests
|
||||
{
|
||||
File.WriteAllText("test_mp.log", "test_log_file");
|
||||
|
||||
Manager = Program.ServerManager;
|
||||
IW4MAdmin.Application.Localization.Configure.Initialize("en-US");
|
||||
|
||||
Manager = ApplicationManager.GetInstance();
|
||||
|
||||
var config = new ApplicationConfiguration
|
||||
{
|
||||
@ -43,6 +45,7 @@ namespace Tests
|
||||
Manager.ConfigHandler.Set(config);
|
||||
|
||||
Manager.Init().Wait();
|
||||
|
||||
Task.Run(() => Manager.Start());
|
||||
}
|
||||
|
||||
|
@ -188,6 +188,22 @@ namespace Tests
|
||||
|
||||
resetEvent.Wait(5000);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PrintCommands()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("|Name |Alias|Description |Requires Target|Syntax |Required Level|");
|
||||
sb.AppendLine("|--------------| -----| --------------------------------------------------------| -----------------| -------------| ----------------|");
|
||||
|
||||
foreach (var command in Manager.GetCommands().OrderByDescending(c => c.Permission).ThenBy(c => c.Name))
|
||||
{
|
||||
sb.AppendLine($"|{command.Name}|{command.Alias}|{command.Description}|{command.RequiresTarget}|{command.Syntax.Substring(8).EscapeMarkdown()}|{command.Permission}|");
|
||||
}
|
||||
|
||||
Assert.True(false, sb.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user