-added back player history graphs (past 12 hours every 15 minutes)
-fixed issue with configurationmanager files and threading -servers on webfront listed in descending player count -fixed resolution of tempban times from console feedback -Added tests plugin to simulate functionality
This commit is contained in:
@ -1,35 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SharedLibrary.Helpers
|
||||
{
|
||||
public class ConfigurationManager
|
||||
{
|
||||
Dictionary<string, Dictionary<string, object>> ConfigurationSet;
|
||||
ConcurrentDictionary<string, Dictionary<string, object>> ConfigurationSet;
|
||||
Type PluginType;
|
||||
|
||||
public ConfigurationManager(Type PluginType)
|
||||
{
|
||||
ConfigurationSet = new Dictionary<string, Dictionary<string, object>>();
|
||||
ConfigurationSet = new ConcurrentDictionary<string, Dictionary<string, object>>();
|
||||
this.PluginType = PluginType;
|
||||
}
|
||||
|
||||
public void AddConfiguration(Server S)
|
||||
{
|
||||
/* if (ConfigurationSet.ContainsKey(S.ToString()))
|
||||
{
|
||||
S.Logger.WriteWarning($"not adding server configuration for {S} as it already exists");
|
||||
return;
|
||||
}*/
|
||||
|
||||
try
|
||||
{
|
||||
var Config = Interfaces.Serialize<Dictionary<string, object>>.Read($"config/{PluginType.ToString()}_{S.ToString()}.cfg");
|
||||
lock (ConfigurationSet)
|
||||
{
|
||||
ConfigurationSet.Add(S.ToString(), Config);
|
||||
}
|
||||
ConfigurationSet.TryAdd(S.ToString(), Config);
|
||||
}
|
||||
|
||||
catch (Exceptions.SerializeException)
|
||||
{
|
||||
ConfigurationSet.Add(S.ToString(), new Dictionary<string, object>());
|
||||
ConfigurationSet.TryAdd(S.ToString(), new Dictionary<string, object>());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void AddProperty(Server S, KeyValuePair<string, object> Property)
|
||||
|
@ -4,12 +4,45 @@ namespace SharedLibrary.Helpers
|
||||
{
|
||||
public class PlayerHistory
|
||||
{
|
||||
public PlayerHistory(DateTime w, int cNum)
|
||||
public PlayerHistory(int cNum)
|
||||
{
|
||||
When = w;
|
||||
Players = cNum;
|
||||
DateTime t = DateTime.UtcNow;
|
||||
When = new DateTime(t.Year, t.Month, t.Day, t.Hour, 5 * (int)Math.Round(t.Minute / 5.0), 0);
|
||||
PlayerCount = cNum;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
public PlayerHistory(DateTime t, int cNum)
|
||||
{
|
||||
When = new DateTime(t.Year, t.Month, t.Day, t.Hour, 15 * (int)Math.Round(t.Minute / 15.0), 0);
|
||||
PlayerCount = cNum;
|
||||
}
|
||||
#endif
|
||||
|
||||
private DateTime When;
|
||||
private int PlayerCount;
|
||||
|
||||
/// <summary>
|
||||
/// Used by CanvasJS as a point on the x axis
|
||||
/// </summary>
|
||||
public double x
|
||||
{
|
||||
get
|
||||
{
|
||||
return (When - DateTime.MinValue).TotalSeconds;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Used by CanvasJS as a point on the y axis
|
||||
/// </summary>
|
||||
public int y
|
||||
{
|
||||
get
|
||||
{
|
||||
return PlayerCount;
|
||||
}
|
||||
}
|
||||
public DateTime When { get; private set; }
|
||||
public int Players { get; private set; }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user