ClanList.cs

src/Clans/ClanList.cs · 1.6 KB

From the archive Arthea-src-1.0.zip

Download the archive   « Back to the archive contents

#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 Arthea.Environment;

namespace Arthea.Clans
{
    /// <summary>
    /// Implementation of a clan list.
    /// </summary>
    public class ClanList : List<Clan>
    {
        #region [rgn] Constructors (1)

        /// <summary>
        /// Initializes a new instance of the <see cref="ClanList"/> class.
        /// </summary>
        public ClanList()
        {
            Log.Info("Loading clans...");

            Add(new LythranClan());
        }

        #endregion [rgn]

        #region [rgn] Methods (2)

        // [rgn] Public Methods (2)

        /// <summary>
        /// Finds the name.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public Clan FindName(String name)
        {
            if (!name) return null;

            return Find(delegate(Clan clan) { return name == clan.Name; });
        }

        /// <summary>
        /// Saves this instance.
        /// </summary>
        public void Save()
        {
            foreach (Clan clan in this)
            {
                Persistance.Save(Paths.ClanDir + Persistance.MakeFileName(clan.Name), clan.Members);
            }
        }

        #endregion [rgn]
    }
}

Site Stats

Snippets: 1791
Codebases: 571