view api/Objects/SystemStatsSet.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
line wrap: on
line source

using System;
using System.Collections.Generic;

namespace IBBoard.WarFoundry.API.Objects
{
	public class SystemStatsSet
	{
		private Dictionary<string, SystemStats> statsMap;
		public SystemStatsSet(Dictionary<string, SystemStats> stats)
		{
			statsMap = stats;
		}
		
		public SystemStats this[string key]
		{
			get { return statsMap[key]; }
		
			set
			{
				if (statsMap.ContainsKey(key))
				{
					statsMap[key] = value;
				}
				else
				{
					throw new ArgumentException("Key must already exist for values to be set");
				}
			}
		}
		
		public string[] GetSystemStatsIDs()
		{
			string[] ids = new string[statsMap.Count];
			statsMap.Keys.CopyTo(ids, 0);
			return ids;
		}
	}
}