/// <summary> /// Creates and parses a message contained in some instructions. /// </summary> /// <param name="ins"></param> /// <param name="body"></param> static void InterpretMessage(CheckBase ins, XmlNodeList body) { if (body != null ) { Message message = new Message(); foreach (XmlNode node in body) { switch (node.Name) { case "#text": // a nameless text node message.AddText(node.Value); break; case "data": message.AddDataRef(XmlFiler.getAttribute(node,"of"),ins); break; case "beep": message.AddSound(CreateBeep(node)); break; case "sound": message.AddSound(CreateSound(node)); break; } } ins.Message = message; } }
/// <summary> /// Creates and parses a message contained in some instructions. /// </summary> /// <param name="ins"></param> /// <param name="body"></param> protected void InterpretMessage(XmlNodeList body) { if (body != null) { Message message = new Message(); foreach (XmlNode node in body) { switch (node.Name) { case "#text": // a nameless text node message.AddText(node.Value); break; case "data": message.AddDataRef(XmlFiler.getAttribute(node, "of"), this); break; case "beep": message.AddSound(new Beep()); break; case "sound": string frequency = XmlFiler.getAttribute(node, "frequency"); string duration = XmlFiler.getAttribute(node, "duration"); m_log.isTrue(frequency != null && duration != null, makeNameTag() + "Sound instruction must have a frequency and duration."); Sound sound = null; try { sound = new Sound(Convert.ToUInt32(frequency), Convert.ToUInt32(duration)); } catch { m_log.fail(makeNameTag() + "Sound instruction must have a frequency and duration in milliseconds."); } message.AddSound(sound); break; } } Message = message; } }