// Copyright (c) 2007 Omer Rauchwerger (a.k.a rauchy) (omer@rauchy.net) // All rights reserved. // // This file is part of Regionerate. // // This program is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 3 of the License, // or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see . using System.Xml; namespace Rauchy.Regionerate.Shared.Components.Rendering { /// /// A textual sign which can be embedded in strings and later be identified in them. /// public abstract class Symbol { #region Methods (3)  // Public Methods (3)  /// /// Embeds the textual chariteristics of this inside the specified text. /// /// The provided text with the embedded in it. public abstract string Embed( string text ); /// /// Determines whether the textual chariteristics of this are embedded in the specified text. /// public abstract bool IsEmbeddedIn( string text ); /// /// Parses the specified and constructs a out of it. /// /// The requested which is declared in the provided Xml node. public static Symbol Parse( XmlNode xmlNode ) { if ( xmlNode[ "Prefix" ] != null ) { XmlNode prefixNode = xmlNode[ "Prefix" ]; string value = prefixNode.Attributes[ "Value" ].Value; return new Prefix( value ); } else if ( xmlNode[ "Wrapper" ] != null ) { XmlNode wrapperNode = xmlNode[ "Wrapper" ]; string prefix = wrapperNode.Attributes[ "Prefix" ].Value; string suffix = wrapperNode.Attributes[ "Suffix" ].Value; return new Wrapper( prefix, suffix ); } else // (xmlNode["HiddenDragon" != null) { return new HiddenDragon(); } } #endregion Methods  } }