/// <summary> /// Fills the property of this struct that has the correct name with the information contained in the member-XElement. /// </summary> /// <param name="member">The member element storing the information.</param> /// <returns>Whether it was successful or not.</returns> protected override bool parseXml(XElement member) { var value = getMemberValueElement(member); switch (getMemberName(member)) { case "CurrentGameInfos": if (!currentGameInfos.ParseXml(value)) { return(false); } break; case "NextGameInfos": if (!nextGameInfos.ParseXml(value)) { return(false); } break; default: return(false); } return(true); }
/// <summary> /// Fills the Returned or Fault information from the given method response data. /// <para/> /// This makes IsCompleted true and the method call has to be Reset before using this again. /// </summary> /// <param name="xElement">The XElement containing the method response.</param> /// <returns>Whether it was successful or not.</returns> public bool ParseResponseXml(XElement xElement) { if (!xElement.Name.LocalName.Equals(XmlRpcElements.MethodResponseElement) || xElement.Elements().Count() != 1) { return(false); } XElement child = xElement.Elements().First(); if (child.Elements().Count() != 1 || (!child.Name.LocalName.Equals(XmlRpcElements.ParamsElement) && !child.Name.LocalName.Equals(XmlRpcElements.FaultElement))) { return(false); } XElement value = child.Elements().First().Elements().First(); if (value == null) { return(false); } switch (child.Name.LocalName) { case XmlRpcElements.ParamsElement: if (!returned.ParseXml(value)) { return(false); } HadFault = false; break; case XmlRpcElements.FaultElement: if (!fault.ParseXml(value)) { return(false); } HadFault = true; break; default: return(false); } return(true); }