public static PARAM_ROSpec FromXmlNode(XmlNode node) { string val; PARAM_ROSpec param = new PARAM_ROSpec(); val = XmlUtil.GetNodeValue(node, "ROSpecID"); param.ROSpecID = Convert.ToUInt32(val); val = XmlUtil.GetNodeValue(node, "Priority"); param.Priority = Convert.ToByte(val); val = XmlUtil.GetNodeValue(node, "CurrentState"); param.CurrentState = ( ENUM_ROSpecState)Enum.Parse(typeof( ENUM_ROSpecState), val); try { XmlNodeList xnl = XmlUtil.GetXmlNodes(node, "ROBoundarySpec"); if (null != xnl) { if (xnl.Count != 0) param.ROBoundarySpec = PARAM_ROBoundarySpec.FromXmlNode(xnl[0]); } } catch { } { param.SpecParameter = new UNION_SpecParameter(); try { { XmlNodeList xnl = XmlUtil.GetXmlNodes(node, "AISpec"); if (xnl.Count != 0) { for (int i = 0; i < xnl.Count; i++) param.SpecParameter.Add(PARAM_AISpec.FromXmlNode(xnl[i])); } } { XmlNodeList xnl = XmlUtil.GetXmlNodes(node, "RFSurveySpec"); if (xnl.Count != 0) { for (int i = 0; i < xnl.Count; i++) param.SpecParameter.Add(PARAM_RFSurveySpec.FromXmlNode(xnl[i])); } } { XmlNodeList xnl = XmlUtil.GetXmlNodes(node, "Custom"); if (xnl.Count != 0) { for (int i = 0; i < xnl.Count; i++) { ICustom_Parameter custom = CustomParamDecodeFactory.DecodeXmlNodeToCustomParameter(xnl[i]); if (custom != null) param.SpecParameter.Add(custom); } } } } catch { } } try { XmlNodeList xnl = XmlUtil.GetXmlNodes(node, "ROReportSpec"); if (null != xnl) { if (xnl.Count != 0) param.ROReportSpec = PARAM_ROReportSpec.FromXmlNode(xnl[0]); } } catch { } return param; }
public new static PARAM_ROSpec FromBitArray(ref BitArray bit_array, ref int cursor, int length) { if (cursor >= length) return null; int field_len = 0; object obj_val; int parameter_len = 0; ArrayList param_list = new ArrayList(); PARAM_ROSpec param = new PARAM_ROSpec(); int param_type = 0; if (bit_array[cursor]) param.tvCoding = true; if (param.tvCoding) { cursor++; param_type = (int)(UInt64)Util.CalculateVal(ref bit_array, ref cursor, 7); if (param_type != param.TypeID) { cursor -= 8; return null; } } else { cursor += 6; param_type = (int)(UInt64)Util.CalculateVal(ref bit_array, ref cursor, 10); if (param_type != param.TypeID) { cursor -= 16; return null; } param.length = (UInt16)(int)Util.DetermineFieldLength(ref bit_array, ref cursor); } if (cursor > length) throw new Exception("Input data is not complete message"); field_len = 32; Util.ConvertBitArrayToObj(ref bit_array, ref cursor, out obj_val, typeof(UInt32), field_len); param.ROSpecID = (UInt32)obj_val; if (cursor > length) throw new Exception("Input data is not complete message"); field_len = 8; Util.ConvertBitArrayToObj(ref bit_array, ref cursor, out obj_val, typeof(byte), field_len); param.Priority = (byte)obj_val; if (cursor > length) throw new Exception("Input data is not complete message"); field_len = 8; Util.ConvertBitArrayToObj(ref bit_array, ref cursor, out obj_val, typeof(UInt32), field_len); param.CurrentState = ( ENUM_ROSpecState)(UInt32)obj_val; param.ROBoundarySpec = PARAM_ROBoundarySpec.FromBitArray(ref bit_array, ref cursor, length); PARAM_AISpec _param_AISpec = PARAM_AISpec.FromBitArray(ref bit_array, ref cursor, length); if (_param_AISpec != null) { param.SpecParameter.Add(_param_AISpec); while ((_param_AISpec = PARAM_AISpec.FromBitArray(ref bit_array, ref cursor, length)) != null) param.SpecParameter.Add(_param_AISpec); } PARAM_RFSurveySpec _param_RFSurveySpec = PARAM_RFSurveySpec.FromBitArray(ref bit_array, ref cursor, length); if (_param_RFSurveySpec != null) { param.SpecParameter.Add(_param_RFSurveySpec); while ((_param_RFSurveySpec = PARAM_RFSurveySpec.FromBitArray(ref bit_array, ref cursor, length)) != null) param.SpecParameter.Add(_param_RFSurveySpec); } ICustom_Parameter sub_custom = CustomParamDecodeFactory.DecodeCustomParameter(ref bit_array, ref cursor, length); if (sub_custom != null) { param.SpecParameter.Add(sub_custom); while ((sub_custom = CustomParamDecodeFactory.DecodeCustomParameter(ref bit_array, ref cursor, length)) != null) param.SpecParameter.Add(sub_custom); } param.ROReportSpec = PARAM_ROReportSpec.FromBitArray(ref bit_array, ref cursor, length); return param; }