1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-12 08:08:06 -05:00

add page list to manager so we can inject pages into the layout view

This commit is contained in:
RaidMax
2018-08-03 17:10:20 -05:00
parent c44ff8e46a
commit 7956a8cfba
9 changed files with 80 additions and 5 deletions

View File

@ -46,6 +46,7 @@ namespace IW4MAdmin.Application
EventApi Api;
GameEventHandler Handler;
ManualResetEventSlim OnEvent;
readonly IPageList PageList;
private ApplicationManager()
{
@ -63,6 +64,7 @@ namespace IW4MAdmin.Application
ConfigHandler = new BaseConfigurationHandler<ApplicationConfiguration>("IW4MAdminSettings");
StartTime = DateTime.UtcNow;
OnEvent = new ManualResetEventSlim();
PageList = new PageList();
}
public IList<Server> GetServers()
@ -519,5 +521,7 @@ namespace IW4MAdmin.Application
}
public IList<Assembly> GetPluginAssemblies() => SharedLibraryCore.Plugins.PluginImporter.PluginAssemblies;
public IPageList GetPageList() => PageList;
}
}

26
Application/PageList.cs Normal file
View File

@ -0,0 +1,26 @@
using SharedLibraryCore.Interfaces;
using System;
using System.Collections.Generic;
using System.Text;
namespace IW4MAdmin.Application
{
/// <summary>
/// implementatin of IPageList that supports basic
/// pages title and page location for webfront
/// </summary>
class PageList : IPageList
{
/// <summary>
/// Pages dictionary
/// Key = page name
/// Value = page location (url)
/// </summary>
public IDictionary<string, string> Pages { get; set; }
public PageList()
{
Pages = new Dictionary<string, string>();
}
}
}

View File

@ -26,7 +26,7 @@ namespace IW4MAdmin
{
public class IW4MServer : Server
{
private static Index loc = Utilities.CurrentLocalization.LocalizationIndex;
private static readonly Index loc = Utilities.CurrentLocalization.LocalizationIndex;
private GameLogEvent LogEvent;
private ClientAuthentication AuthQueue;
@ -170,8 +170,6 @@ namespace IW4MAdmin
// we need to update their new ip and name to the virtual property
client.Name = polledPlayer.Name;
client.IPAddress = polledPlayer.IPAddress;
await Manager.GetClientService().Update(client);
}
else
@ -181,6 +179,8 @@ namespace IW4MAdmin
client.Name = existingAlias.Name;
client.IPAddress = existingAlias.IPAddress;
}
await Manager.GetClientService().Update(client);
player = client.AsPlayer();
}
@ -288,7 +288,7 @@ namespace IW4MAdmin
if (cNum >= 0 && Players[cNum] != null)
{
Player Leaving = Players[cNum];
Logger.WriteInfo($"Client {Leaving} disconnecting...");
Logger.WriteInfo($"Client {Leaving}, state {Leaving.State.ToString()} disconnecting...");
if (!Leaving.IsAuthenticated || Leaving.State != Player.ClientState.Connected)
{