Class Stats
Inheritance
System.Object
Stats
Implements
System.IDisposable
Assembly: Eco.Stats.dll
Syntax
public class Stats : Object, IStats, IDisplayablePlugin, IGUIPlugin, IServerPlugin, IHasDisplayTabs, IDisplayTab, IThreadedPlugin, IShutdownablePlugin, IInitializablePlugin, IConfigurablePlugin, IEditablePlugin, IDisposable
Constructors
Stats()
Declaration
Stats(PluginConfig<StatsConfig>, String)
Declaration
public Stats(PluginConfig<StatsConfig> config, string storageDirectory)
Parameters
Fields
GetStatsTime
Declaration
public static Func<double> GetStatsTime
Field Value
Type |
Description |
System.Func<System.Double> |
|
Properties
ParamChanged
Declaration
public ThreadSafeAction<object, string> ParamChanged { get; set; }
Property Value
PluginConfig
Declaration
public IPluginConfig PluginConfig { get; }
Property Value
Methods
AddIndex(String, String)
Declaration
public void AddIndex(string collectionName, string propName)
Parameters
Type |
Name |
Description |
System.String |
collectionName |
|
System.String |
propName |
|
AddIndex(Type, String)
Declaration
public void AddIndex(Type type, string propName)
Parameters
Type |
Name |
Description |
System.Type |
type |
|
System.String |
propName |
|
AddTimeIndex(StatInfo)
Declaration
public void AddTimeIndex(StatInfo info)
Parameters
CountStat(String, Single, Double, Int32)
Returns count for stat
. For ICountStat it will use sum of value in Count property, otherwise it will return count of records. If you need info for several users you should avoid use it, use CountStatPerPlayer instead.
Declaration
public float CountStat(string stat, float time, double withinSeconds, int userID)
Parameters
Type |
Name |
Description |
System.String |
stat |
|
System.Single |
time |
|
System.Double |
withinSeconds |
|
System.Int32 |
userID |
|
Returns
Type |
Description |
System.Single |
|
CountStat(Type, Single, Double, Int32)
Returns count for stat
. For ICountStat it will use sum of value in Count property, otherwise it will return count of records. If you need info for several users you should avoid use it, use CountStatPerPlayer instead.
Declaration
public float CountStat(Type stat, float time, double withinSeconds, int userID)
Parameters
Type |
Name |
Description |
System.Type |
stat |
|
System.Single |
time |
|
System.Double |
withinSeconds |
|
System.Int32 |
userID |
|
Returns
Type |
Description |
System.Single |
|
CountStatPerPlayer(String, Single, Double)
Returns a dictionary userId -> value of stat for all users existed. Usefull if you need data for every user, this will be much faster than run CountStat user by user.
Declaration
public Dictionary<int, float> CountStatPerPlayer(string stat, float time, double withinSeconds)
Parameters
Type |
Name |
Description |
System.String |
stat |
|
System.Single |
time |
|
System.Double |
withinSeconds |
|
Returns
Type |
Description |
System.Collections.Generic.Dictionary<System.Int32, System.Single> |
|
CountStatPerPlayer(Type, Single, Double)
Declaration
public Dictionary<int, float> CountStatPerPlayer(Type stat, float time, double withinSeconds)
Parameters
Type |
Name |
Description |
System.Type |
stat |
|
System.Single |
time |
|
System.Double |
withinSeconds |
|
Returns
Type |
Description |
System.Collections.Generic.Dictionary<System.Int32, System.Single> |
|
DeltaValue(String, Int32)
Declaration
public float DeltaValue(string collection, int time)
Parameters
Type |
Name |
Description |
System.String |
collection |
|
System.Int32 |
time |
|
Returns
Type |
Description |
System.Single |
|
Dispose()
Declaration
Dispose(Boolean)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type |
Name |
Description |
System.Boolean |
disposing |
|
Finalize()
Declaration
protected override void Finalize()
Flush()
Declaration
GetCategory()
Declaration
public string GetCategory()
Returns
Type |
Description |
System.String |
|
GetDisplayText()
Declaration
public string GetDisplayText()
Returns
Type |
Description |
System.String |
|
GetEditObject()
Declaration
public object GetEditObject()
Returns
Type |
Description |
System.Object |
|
GetStatus()
Declaration
public string GetStatus()
Returns
Type |
Description |
System.String |
|
Initialize(TimedTask)
Declaration
public void Initialize(TimedTask timer)
Parameters
MostRecentValue(String)
Declaration
public float MostRecentValue(string collection)
Parameters
Type |
Name |
Description |
System.String |
collection |
|
Returns
Type |
Description |
System.Single |
|
OnEditObjectChanged(Object, String)
Declaration
public void OnEditObjectChanged(object o, string param)
Parameters
Type |
Name |
Description |
System.Object |
o |
|
System.String |
param |
|
QueryCollection<T>(String)
Declaration
public List<T> QueryCollection<T>(string collectionName)
Parameters
Type |
Name |
Description |
System.String |
collectionName |
|
Returns
Type |
Description |
System.Collections.Generic.List<T> |
|
Type Parameters
QueryFirstBefore(String, Int32)
Returns TimeValue recorded before or at time
.
Declaration
public TimeValue QueryFirstBefore(string collectionName, int time)
Parameters
Type |
Name |
Description |
System.String |
collectionName |
|
System.Int32 |
time |
|
Returns
QueryNeighbors(String, Int32)
Declaration
public List<TimeValue> QueryNeighbors(string collectionName, int second)
Parameters
Type |
Name |
Description |
System.String |
collectionName |
|
System.Int32 |
second |
|
Returns
Type |
Description |
System.Collections.Generic.List<TimeValue> |
|
QueryRangeGeneric(StatInfo, Int32, Int32)
Declaration
public IEnumerable<BsonDocument> QueryRangeGeneric(StatInfo info, int startingSecond, int endingSecond)
Parameters
Type |
Name |
Description |
StatInfo |
info |
|
System.Int32 |
startingSecond |
|
System.Int32 |
endingSecond |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<LiteDB.BsonDocument> |
|
QueryTimeValueRange(StatInfo, Int32, Int32)
Declaration
public List<TimeValue> QueryTimeValueRange(StatInfo info, int startingSecond, int endingSecond)
Parameters
Type |
Name |
Description |
StatInfo |
info |
|
System.Int32 |
startingSecond |
|
System.Int32 |
endingSecond |
|
Returns
Type |
Description |
System.Collections.Generic.List<TimeValue> |
|
QueryTimeValueRange(String, Int32, Int32)
Declaration
public List<TimeValue> QueryTimeValueRange(string collectionName, int startingSecond, int endingSecond)
Parameters
Type |
Name |
Description |
System.String |
collectionName |
|
System.Int32 |
startingSecond |
|
System.Int32 |
endingSecond |
|
Returns
Type |
Description |
System.Collections.Generic.List<TimeValue> |
|
Record(IStat)
Declaration
public void Record(IStat obj)
Parameters
Type |
Name |
Description |
IStat |
obj |
|
Record(Int32, String, Single)
Do a simple time/value record.
Declaration
public void Record(int time, string collection, float value)
Parameters
Type |
Name |
Description |
System.Int32 |
time |
|
System.String |
collection |
|
System.Single |
value |
|
RecordBulk(IEnumerable<IStat>)
Declaration
public void RecordBulk(IEnumerable<IStat> objs)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<IStat> |
objs |
|
RecordCustom(String, Int32, Single, Int32, Nullable<Single>)
Declaration
public void RecordCustom(string statName, int time, float count, int userId, Nullable<float> value)
Parameters
Type |
Name |
Description |
System.String |
statName |
|
System.Int32 |
time |
|
System.Single |
count |
|
System.Int32 |
userId |
|
System.Nullable<System.Single> |
value |
|
Run()
Declaration
ShutdownAsync()
Declaration
public Task ShutdownAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Implements
System.IDisposable