Mercurial > repos > IBBoard.WarFoundry.API
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:520818033bb6 |
---|---|
1 using System; | |
2 using System.Collections.Generic; | |
3 | |
4 namespace IBBoard.WarFoundry.API.Objects | |
5 { | |
6 /// <summary> | |
7 /// Summary description for SystemStats. | |
8 /// </summary> | |
9 public class SystemStats | |
10 { | |
11 private Dictionary<string, StatSlot> stats; | |
12 private string id; | |
13 | |
14 public SystemStats(string statsID, StatSlot[] statSlots) | |
15 { | |
16 id = statsID; | |
17 stats = new Dictionary<string, StatSlot>(); | |
18 | |
19 foreach (StatSlot slot in statSlots) | |
20 { | |
21 slot.SystemStats = this; | |
22 stats[slot.Name] = slot; | |
23 } | |
24 } | |
25 | |
26 public StatSlot[] StatSlots | |
27 { | |
28 get | |
29 { | |
30 StatSlot[] slots = new StatSlot[stats.Count]; | |
31 stats.Values.CopyTo(slots, 0); | |
32 return slots; | |
33 } | |
34 } | |
35 | |
36 public StatSlot this[string key] | |
37 { | |
38 get | |
39 { | |
40 StatSlot slot = null; | |
41 stats.TryGetValue(key, out slot); | |
42 return slot; | |
43 } | |
44 } | |
45 | |
46 public int SlotCount | |
47 { | |
48 get { return stats.Count; } | |
49 } | |
50 | |
51 public string ID | |
52 { | |
53 get { return id; } | |
54 } | |
55 } | |
56 } |