#region Arthea License /*********************************************************************** * Arthea MUD by R. Jennings (2007) http://arthea.googlecode.com/ * * By using this code you comply with the Artistic and GPLv2 Licenses. * ***********************************************************************/ #endregion using System.Collections.Generic; using System.IO; using Arthea.Environment; namespace Arthea.Continents { /// <summary> /// Implementation of a continent list. /// </summary> public class ContinentList : List<Continent> { #region [rgn] Methods (3) // [rgn] Public Methods (3) /// <summary> /// Finds the name. /// </summary> /// <param name="name">The name.</param> /// <returns>a continent</returns> public Continent FindName(String name) { if (!name) return null; return Find(delegate(Continent c) { return name == c.Name; }); } /// <summary> /// Loads this instance. /// </summary> public void Load() { Clear(); foreach (FileInfo fi in Persistance.GetDirectoryXmlFiles(Paths.ContinentDir)) { Log.Info("Loading continent {0}...", fi.Name); Continent continent = Persistance.Load<Continent>(fi.FullName); continent.FileName = fi.Name; Add(continent); } Lists.Areas.Load(); } /// <summary> /// Saves this instance. /// </summary> public void Save() { foreach (Continent continent in this) { continent.Save(); } } #endregion [rgn] } }