public static MSG_ADD_ACCESSSPEC 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_ADD_ACCESSSPEC msgAddAccessspec = new MSG_ADD_ACCESSSPEC(); try { msgAddAccessspec.MSG_ID = Convert.ToUInt32(XmlUtil.GetNodeAttrValue(documentElement, "MessageID")); } catch { } try { XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "AccessSpec", nsmgr); if (xmlNodes != null) { if (xmlNodes.Count != 0) { msgAddAccessspec.AccessSpec = PARAM_AccessSpec.FromXmlNode(xmlNodes[0]); } } } catch { } return(msgAddAccessspec); }
public static MSG_GET_ACCESSSPECS_RESPONSE 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_GET_ACCESSSPECS_RESPONSE accessspecsResponse = new MSG_GET_ACCESSSPECS_RESPONSE(); try { accessspecsResponse.MSG_ID = Convert.ToUInt32(XmlUtil.GetNodeAttrValue(documentElement, "MessageID")); } catch { } try { XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "LLRPStatus", nsmgr); if (xmlNodes != null) { if (xmlNodes.Count != 0) { accessspecsResponse.LLRPStatus = PARAM_LLRPStatus.FromXmlNode(xmlNodes[0]); } } } catch { } try { XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "AccessSpec", nsmgr); if (xmlNodes != null) { if (xmlNodes.Count != 0) { accessspecsResponse.AccessSpec = new PARAM_AccessSpec[xmlNodes.Count]; for (int i = 0; i < xmlNodes.Count; ++i) { accessspecsResponse.AccessSpec[i] = PARAM_AccessSpec.FromXmlNode(xmlNodes[i]); } } } } catch { } return(accessspecsResponse); }
public static MSG_GET_ACCESSSPECS_RESPONSE FromBitArray( ref BitArray bit_array, ref int cursor, int length) { if (cursor > length) { return((MSG_GET_ACCESSSPECS_RESPONSE)null); } ArrayList arrayList1 = new ArrayList(); MSG_GET_ACCESSSPECS_RESPONSE accessspecsResponse = new MSG_GET_ACCESSSPECS_RESPONSE(); cursor += 6; if ((int)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 10) != (int)accessspecsResponse.msgType) { cursor -= 16; return((MSG_GET_ACCESSSPECS_RESPONSE)null); } accessspecsResponse.msgLen = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32); accessspecsResponse.msgID = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32); accessspecsResponse.LLRPStatus = PARAM_LLRPStatus.FromBitArray(ref bit_array, ref cursor, length); ArrayList arrayList2 = new ArrayList(); PARAM_AccessSpec paramAccessSpec; while ((paramAccessSpec = PARAM_AccessSpec.FromBitArray(ref bit_array, ref cursor, length)) != null) { arrayList2.Add((object)paramAccessSpec); } if (arrayList2.Count > 0) { accessspecsResponse.AccessSpec = new PARAM_AccessSpec[arrayList2.Count]; for (int index = 0; index < arrayList2.Count; ++index) { accessspecsResponse.AccessSpec[index] = (PARAM_AccessSpec)arrayList2[index]; } } return(accessspecsResponse); }
public static MSG_ADD_ACCESSSPEC FromBitArray( ref BitArray bit_array, ref int cursor, int length) { if (cursor > length) { return((MSG_ADD_ACCESSSPEC)null); } ArrayList arrayList = new ArrayList(); MSG_ADD_ACCESSSPEC msgAddAccessspec = new MSG_ADD_ACCESSSPEC(); cursor += 6; if ((int)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 10) != (int)msgAddAccessspec.msgType) { cursor -= 16; return((MSG_ADD_ACCESSSPEC)null); } msgAddAccessspec.msgLen = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32); msgAddAccessspec.msgID = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32); msgAddAccessspec.AccessSpec = PARAM_AccessSpec.FromBitArray(ref bit_array, ref cursor, length); return(msgAddAccessspec); }