protected override bool AcceptTagElement(DefineBitsJPEG3Tag tag, XElement element) { switch (element.Name.LocalName) { case "alpha": tag.BitmapAlphaData = XBinary.FromXml(element.Element("data")); break; default: return(false); } return(true); }
/// <summary> /// Accepts xml element during parsing. /// </summary> /// <param name="tag">Tag to accept element</param> /// <param name="element">Element to be accepted.</param> protected void AcceptElement(T tag, XElement element) { switch (element.Name.LocalName) { case REST_ELEM: tag.RestData = Convert.FromBase64String(element.Value); break; case DATA_TAG: var data = XBinary.FromXml(element.Element("data")); SetData(tag, data); break; default: var handled = AcceptTagElement(tag, element); if (!handled) { throw new FormatException("Invalid element " + element.Name.LocalName); } break; } }
ActionBase IActionVisitor <XElement, ActionBase> .Visit(ActionUnknown action, XElement xAction) { action.Data = XBinary.FromXml(xAction.Element("data")); return(action); }