public static MSG_RO_ACCESS_REPORT FromString(string str) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(str); XmlNode documentElement = (XmlNode)xmlDocument.DocumentElement; XmlNamespaceManager nsmgr = new XmlNamespaceManager(documentElement.OwnerDocument.NameTable); nsmgr.AddNamespace("", "http://www.llrp.org/ltk/schema/core/encoding/xml/1.0"); nsmgr.AddNamespace("llrp", "http://www.llrp.org/ltk/schema/core/encoding/xml/1.0"); MSG_RO_ACCESS_REPORT msgRoAccessReport = new MSG_RO_ACCESS_REPORT(); try { msgRoAccessReport.MSG_ID = Convert.ToUInt32(XmlUtil.GetNodeAttrValue(documentElement, "MessageID")); } catch { } try { XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "TagReportData", nsmgr); if (xmlNodes != null) { if (xmlNodes.Count != 0) { msgRoAccessReport.TagReportData = new PARAM_TagReportData[xmlNodes.Count]; for (int i = 0; i < xmlNodes.Count; ++i) { msgRoAccessReport.TagReportData[i] = PARAM_TagReportData.FromXmlNode(xmlNodes[i]); } } } } catch { } try { XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "RFSurveyReportData", nsmgr); if (xmlNodes != null) { if (xmlNodes.Count != 0) { msgRoAccessReport.RFSurveyReportData = new PARAM_RFSurveyReportData[xmlNodes.Count]; for (int i = 0; i < xmlNodes.Count; ++i) { msgRoAccessReport.RFSurveyReportData[i] = PARAM_RFSurveyReportData.FromXmlNode(xmlNodes[i]); } } } } catch { } try { ArrayList nodeCustomChildren = XmlUtil.GetXmlNodeCustomChildren(documentElement, nsmgr); if (nodeCustomChildren != null) { for (int index = 0; index < nodeCustomChildren.Count; ++index) { ICustom_Parameter customParameter = CustomParamDecodeFactory.DecodeXmlNodeToCustomParameter((XmlNode)nodeCustomChildren[index]); if (customParameter != null) { msgRoAccessReport.AddCustomParameter(customParameter); } } } } catch { } return(msgRoAccessReport); }
public static MSG_RO_ACCESS_REPORT FromBitArray( ref BitArray bit_array, ref int cursor, int length) { if (cursor > length) { return((MSG_RO_ACCESS_REPORT)null); } ArrayList arrayList1 = new ArrayList(); MSG_RO_ACCESS_REPORT msgRoAccessReport = new MSG_RO_ACCESS_REPORT(); cursor += 6; if ((int)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 10) != (int)msgRoAccessReport.msgType) { cursor -= 16; return((MSG_RO_ACCESS_REPORT)null); } msgRoAccessReport.msgLen = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32); msgRoAccessReport.msgID = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32); ArrayList arrayList2 = new ArrayList(); PARAM_TagReportData paramTagReportData; while ((paramTagReportData = PARAM_TagReportData.FromBitArray(ref bit_array, ref cursor, length)) != null) { arrayList2.Add((object)paramTagReportData); } if (arrayList2.Count > 0) { msgRoAccessReport.TagReportData = new PARAM_TagReportData[arrayList2.Count]; for (int index = 0; index < arrayList2.Count; ++index) { msgRoAccessReport.TagReportData[index] = (PARAM_TagReportData)arrayList2[index]; } } ArrayList arrayList3 = new ArrayList(); PARAM_RFSurveyReportData surveyReportData; while ((surveyReportData = PARAM_RFSurveyReportData.FromBitArray(ref bit_array, ref cursor, length)) != null) { arrayList3.Add((object)surveyReportData); } if (arrayList3.Count > 0) { msgRoAccessReport.RFSurveyReportData = new PARAM_RFSurveyReportData[arrayList3.Count]; for (int index = 0; index < arrayList3.Count; ++index) { msgRoAccessReport.RFSurveyReportData[index] = (PARAM_RFSurveyReportData)arrayList3[index]; } } int num; bool flag; do { num = cursor; flag = false; ICustom_Parameter customParameter = CustomParamDecodeFactory.DecodeCustomParameter(ref bit_array, ref cursor, length); if (customParameter != null && msgRoAccessReport.AddCustomParameter(customParameter)) { flag = true; } }while (flag); cursor = num; return(msgRoAccessReport); }