/// <summary> /// コンストラクタ /// </summary> public LineCondition() { Regex = null; Replace = null; Effect = new LineEffect(); Action = new LineAction(); }
/// <summary> /// 読み込み /// </summary> /// <param name="conditionElement"></param> public void Load( XmlElement conditionElement ) { // 属性 foreach( XmlAttribute attribute in conditionElement.Attributes ) { var attributeName = attribute.Name.ToLower(); switch( attributeName ) { case "regex": Regex = new Regex( attribute.Value ); break; case "replace": Replace = attribute.Value; break; default: Debug.Assert( false, "未知の属性 attributeName={0}", attributeName ); break; } } // 要素 foreach( XmlNode childNode in conditionElement.ChildNodes ) { var elementName = childNode.Name.ToLower(); switch( elementName ) { case "effect": Effect = new LineEffect(); Effect.Load( childNode as XmlElement ); break; case "action": Action = new LineAction(); Action.Load( childNode as XmlElement ); break; default: Debug.Assert( false, "未知の要素 elementName={0}", elementName ); break; } } }