2015-04-27 13:40:57 -04:00
|
|
|
|
using System;
|
|
|
|
|
|
2018-04-08 02:44:42 -04:00
|
|
|
|
namespace SharedLibraryCore.Helpers
|
2015-04-27 13:40:57 -04:00
|
|
|
|
{
|
2015-08-22 02:04:30 -04:00
|
|
|
|
public class PlayerHistory
|
2015-04-27 13:40:57 -04:00
|
|
|
|
{
|
2017-11-02 12:49:45 -04:00
|
|
|
|
// how many minutes between updates
|
|
|
|
|
public static readonly int UpdateInterval = 5;
|
|
|
|
|
|
2017-09-27 16:07:43 -04:00
|
|
|
|
public PlayerHistory(int cNum)
|
2015-04-27 13:40:57 -04:00
|
|
|
|
{
|
2017-09-27 16:07:43 -04:00
|
|
|
|
DateTime t = DateTime.UtcNow;
|
2017-11-02 12:49:45 -04:00
|
|
|
|
When = new DateTime(t.Year, t.Month, t.Day, t.Hour, Math.Min(59, UpdateInterval * (int)Math.Round(t.Minute / (float)UpdateInterval)), 0);
|
2017-09-27 16:07:43 -04:00
|
|
|
|
PlayerCount = cNum;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
|
public PlayerHistory(DateTime t, int cNum)
|
|
|
|
|
{
|
2017-11-02 12:49:45 -04:00
|
|
|
|
When = new DateTime(t.Year, t.Month, t.Day, t.Hour, Math.Min(59, UpdateInterval * (int)Math.Round(t.Minute / (float)UpdateInterval)), 0);
|
2017-09-27 16:07:43 -04:00
|
|
|
|
PlayerCount = cNum;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
private DateTime When;
|
|
|
|
|
private int PlayerCount;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Used by CanvasJS as a point on the x axis
|
|
|
|
|
/// </summary>
|
2017-10-15 21:40:27 -04:00
|
|
|
|
public string x
|
2017-09-27 16:07:43 -04:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2017-10-15 21:40:27 -04:00
|
|
|
|
return When.ToString("yyyy-MM-ddTHH:mm:ssZ");
|
2017-09-27 16:07:43 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Used by CanvasJS as a point on the y axis
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int y
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return PlayerCount;
|
|
|
|
|
}
|
2015-04-27 13:40:57 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|