using System; using System.Collections.Generic; namespace Substrate.Core { /// /// A callback function to open a world and return it as an instance of a concrete derivative of . /// /// The path to the directory of the world to open. /// An instance of a concrete derivative of . public delegate NbtWorld OpenWorldCallback (string path); /// /// Event arugments and response data for any handlers trying to determine if they can open a given world. /// public class OpenWorldEventArgs : EventArgs { private List _handlers; private string _path; /// /// Create a new instance of event arguments. /// /// The path to the directory of a world. public OpenWorldEventArgs (string path) : base() { _path = path; _handlers = new List(); } /// /// Gets the path to the directory of a world being investigated. /// public string Path { get { return _path; } } /// /// Adds an delegate that can open a world and return a corresponding object. /// /// The delegate to return to the code that raised the event. public void AddHandler (OpenWorldCallback callback) { _handlers.Add(callback); } internal int HandlerCount { get { return _handlers.Count; } } internal ICollection Handlers { get { return _handlers; } } } }