Mercurial > repos > IBBoard.WarFoundry.API
diff api/Objects/SystemStats.cs @ 0:520818033bb6
Initial commit of WarFoundry code
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Fri, 19 Dec 2008 15:57:51 +0000 |
parents | |
children | 607c3232d689 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/api/Objects/SystemStats.cs Fri Dec 19 15:57:51 2008 +0000 @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; + +namespace IBBoard.WarFoundry.API.Objects +{ + /// <summary> + /// Summary description for SystemStats. + /// </summary> + public class SystemStats + { + private Dictionary<string, StatSlot> stats; + private string id; + + public SystemStats(string statsID, StatSlot[] statSlots) + { + id = statsID; + stats = new Dictionary<string, StatSlot>(); + + foreach (StatSlot slot in statSlots) + { + slot.SystemStats = this; + stats[slot.Name] = slot; + } + } + + public StatSlot[] StatSlots + { + get + { + StatSlot[] slots = new StatSlot[stats.Count]; + stats.Values.CopyTo(slots, 0); + return slots; + } + } + + public StatSlot this[string key] + { + get + { + StatSlot slot = null; + stats.TryGetValue(key, out slot); + return slot; + } + } + + public int SlotCount + { + get { return stats.Count; } + } + + public string ID + { + get { return id; } + } + } +}