/// <summary> /// Gets the singleton. /// </summary> //public static DataLengthParser Singleton //{ // get // { // return Instance; // } //} /// <summary> /// The get data length. /// </summary> /// <param name="eventTreeNode"> /// The event tree node. /// </param> /// <param name="isUsingBinding"> /// The is Using Binding. /// </param> /// <returns> /// The <see cref="int"/>. /// </returns> public int GetDataLength(IConfigNodeWrapper eventTreeNode, ref bool isUsingBinding) { string dataLengthAttribute = eventTreeNode.ConfigurationNode.GetAttribute("DataLength"); if (null != dataLengthAttribute) { if (dataLengthAttribute.IndexOf("Binding", StringComparison.Ordinal) > 0) { isUsingBinding = true; return(this.bindingDataLengthParserImpl.GetDataLength(eventTreeNode)); } else { isUsingBinding = false; return(this.commonDataLengthParserImpl.GetDataLength(eventTreeNode)); } } else { int dataTypeLenth = DataTypeUtility.GetDataTypeLength(eventTreeNode.ConfigurationNode.GetAttribute("DataType")); if (dataTypeLenth < 1) { return(0); } return(dataTypeLenth); } }
public void GetBindingNodeTest() { var eventRootNode = new Mock <IConfigNodeWrapper>(); var eventNode1 = new Mock <IConfigNodeWrapper>(); var eventNode2 = new Mock <IConfigNodeWrapper>(); var eventNode3 = new Mock <IConfigNodeWrapper>(); var eventNode4 = new Mock <IConfigNodeWrapper>(); eventRootNode.Setup(p => p.Parent).Returns((IConfigNodeWrapper)null); eventRootNode.Setup(p => p.Children).Returns( new List <IConfigNodeWrapper> { eventNode1.Object, eventNode2.Object }); eventNode1.Setup(p => p.Parent).Returns(eventRootNode.Object); eventNode2.Setup(p => p.Parent).Returns(eventRootNode.Object); eventNode1.Setup(p => p.Children).Returns( new List <IConfigNodeWrapper> { eventNode3.Object, eventNode4.Object }); eventNode3.Setup(p => p.Parent).Returns(eventNode1.Object); eventNode4.Setup(p => p.Parent).Returns(eventNode1.Object); var configNodeOfNode3 = new Mock <IConfigNode>(); configNodeOfNode3.Setup(p => p.Id).Returns("MsgDirection"); eventNode3.Setup(p => p.ConfigurationNode).Returns(configNodeOfNode3.Object); IConfigNodeWrapper bindingNode = BindingHelper.GetBindingNode(eventNode2.Object, "{Binding MsgDirection}"); Assert.AreSame(bindingNode, eventNode3.Object); }
/// <summary> /// The get data length. /// </summary> /// <param name="eventTreeNode"> /// The event tree node. /// </param> /// <returns> /// The <see cref="int"/>. /// </returns> public int GetDataLength(IConfigNodeWrapper eventTreeNode) { try { int dataLength = 1; string dataLengthAttribute = eventTreeNode.ConfigurationNode.GetAttribute("DataLength"); if (!string.IsNullOrEmpty(dataLengthAttribute)) { dataLength = Convert.ToInt32(dataLengthAttribute); } // int dataTypeLenth = DataTypeUtility.GetDataTypeLength(eventTreeNode.ConfigurationNode.GetAttribute("DataType")); // if (-1 == dataTypeLenth) // { // return -1; // }* dataTypeLenth return(dataLength); } catch (Exception ex) { Log.Error("GetDataLength error,message = " + ex.Message); return(-1); } }
/// <summary> /// 合并消息体 /// </summary> /// <param name="root"></param> /// <param name="result"></param> /// <param name="level"></param> private void ExportBodyToXml(IConfigNodeWrapper root, ref string result, int level) { if (root != null) { string spaces = ""; for (int i = 0; i < level; i++) { spaces += ' '; } /* * string key; * if (string.IsNullOrEmpty(root.Id)) * { * key = "defaultKey"; * } * else * { * key = root.Id; * }*/ // result += spaces + string.Format("<{0}>\r\n", key); result += spaces + string.Format(" {0}\r\n", root.DisplayContent); level++; foreach (var child in root.Children) { ExportBodyToXml(child, ref result, level); } // result += spaces + string.Format("</{0}>\r\n", key); } }
/// <summary> /// The get children display content. /// </summary> /// <param name="parentNode"> /// The parent node. /// </param> /// <param name="content"> /// The content. /// </param> private void GetChildrenDisplayContent(IConfigNodeWrapper parentNode, ref string content) { content += parentNode.DisplayContent; foreach (var eventTreeNode in parentNode.Children) { this.GetChildrenDisplayContent(eventTreeNode, ref content); } }
/// <summary> /// The initialize value. /// </summary> /// <param name="memoryStream"> /// The memory stream. /// </param> public override void InitializeValue(System.IO.Stream memoryStream, string btsversion) { if (this.childrenBackup == null) { this.childrenBackup = new IConfigNodeWrapper[this.Children.Count]; this.Children.CopyTo(this.childrenBackup, 0); } // 需要重新生成符合要求的树 IConfigNodeWrapper rootNode = this; while (null != rootNode.Parent) { rootNode = rootNode.Parent; } string totalNumId = this.ConfigurationNode.GetAttribute("TotalNum"); int struNum; if (Int32.TryParse(totalNumId, out struNum) == false) { IConfigNodeWrapper totalNumNode = rootNode.GetChildNodeById(totalNumId); struNum = Convert.ToInt32(totalNumNode.Value); } this.Children.Clear(); // remove this node from parent if (struNum == 0) { this.displayContent = string.Empty; } else { string tempContent = this.ConfigurationNode.GetAttribute("Describe"); for (int i = 0; i < struNum; i++) { IConfigNodeWrapper singleStructRootNode = new EventTreeBodyStructNode( tempContent, this.Id, i); foreach (var childBackup in this.childrenBackup) { IConfigNodeWrapper childNode = childBackup.Clone(); singleStructRootNode.Children.Add(childNode); childNode.Parent = singleStructRootNode; } this.Children.Add(singleStructRootNode); } base.InitializeValue(memoryStream, btsversion); } }
/// <summary> /// The get binding node. /// </summary> /// <param name="currentNode"> /// The current node. /// </param> /// <param name="bindingAttribute"> /// The binding name. /// </param> /// <returns> /// The <see cref="IConfigNodeWrapper"/>. /// </returns> public static IConfigNodeWrapper GetBindingNode(IConfigNodeWrapper currentNode, string bindingAttribute) { IConfigNodeWrapper rootNode = currentNode; while (rootNode.Parent != null) { rootNode = rootNode.Parent; } var bindingRegex = new Regex(@"{Binding (\w+)\s*}", RegexOptions.IgnoreCase); Match m = bindingRegex.Match(bindingAttribute); if (m.Success) { string bindingNodeId = m.Groups[1].Value; IConfigNodeWrapper bindingTreeNode = GetBindingNodeFromDescendant(rootNode, bindingNodeId); if (bindingTreeNode == null) { Log.Error( string.Format( "没有找到DataLength的绑定节点,Id = {0},{1}", currentNode.ConfigurationNode.Id, bindingAttribute)); return(null); } return(bindingTreeNode); } else { if (bindingAttribute.Contains("*") && bindingAttribute.Contains("Binding")) { int lenxx = "Binding".Length; string bindingNodeId = bindingAttribute.Substring(lenxx + 1, bindingAttribute.IndexOf("*") - lenxx - 1).Trim(); IConfigNodeWrapper bindingTreeNode = GetBindingNodeFromDescendant(rootNode, bindingNodeId); if (bindingTreeNode == null) { Log.Error( string.Format( "没有找到DataLength的绑定节点,Id = {0},{1}", currentNode.ConfigurationNode.Id, bindingAttribute)); return(null); } return(bindingTreeNode); } } return(null); }
private void ExportBodyToXml(IConfigNodeWrapper root, ref string result, int level) { if (root != null) { string spaces = ""; for (int i = 0; i < level; i++) { spaces += ' '; } result += spaces + string.Format(" {0}\n", root.DisplayContent); level++; foreach (var child in root.Children) { ExportBodyToXml(child, ref result, level); } } }
/// <summary> /// The get binding node from descendant. /// </summary> /// <param name="currentNode"> /// The current Node. /// </param> /// <param name="bindingNodeId"> /// The binding node id. /// </param> /// <returns> /// The <see cref="IConfigNodeWrapper"/>. /// </returns> private static IConfigNodeWrapper GetBindingNodeFromDescendant(IConfigNodeWrapper currentNode, string bindingNodeId) { if (currentNode == null) { return(null); } if (null != currentNode.ConfigurationNode) { if (currentNode.ConfigurationNode.Id == bindingNodeId) { return(currentNode); } } return(currentNode.Children.Select(child => GetBindingNodeFromDescendant(child, bindingNodeId)).FirstOrDefault(bindingNode => null != bindingNode)); }
/// <summary> /// The get data length. /// </summary> /// <param name="eventTreeNode"> /// The event tree node. /// </param> /// <returns> /// The <see cref="uint"/>. /// </returns> public int GetDataLength(IConfigNodeWrapper eventTreeNode) { string dataLengthAttribute = eventTreeNode.ConfigurationNode.GetAttribute("DataLength"); try { IConfigNodeWrapper bindingTreeNode = BindingHelper.GetBindingNode(eventTreeNode, dataLengthAttribute); if (dataLengthAttribute.Contains("*") == false) { if (null != bindingTreeNode) { // get the binding data length int dataLength = Convert.ToInt32(bindingTreeNode.Value); return(dataLength); } } else { if (null != bindingTreeNode) { // get the binding data length int dataLength = Convert.ToInt32(bindingTreeNode.Value); string strscaler = dataLengthAttribute.Substring(dataLengthAttribute.IndexOf("*") + 1, dataLengthAttribute.IndexOf("}") - dataLengthAttribute.IndexOf("*") - 1).Trim(); int scaler = Convert.ToInt32(strscaler); return(dataLength * scaler); } } Log.Error(string.Format("binding syntax error,Id = {0},{1}", eventTreeNode.ConfigurationNode.Id, dataLengthAttribute)); return(-1); } catch (Exception ex) { Log.Error("GetDataLength error,message = " + ex.Message); return(-1); } }
/// <summary> /// The get message direction. /// </summary> /// <param name="evt"> /// The event id. /// </param> /// <param name="messageSource"> /// The message source. /// </param> /// <param name="messageDestination"> /// The message destination. /// </param> public void GetMessageDirection(IEvent evt, out string messageSource, out string messageDestination, out string msgname) { lock (this) { messageSource = string.Empty; messageDestination = string.Empty; msgname = string.Empty; IConfigNode eventConfigBodyNode = ConfigurationManager.Singleton.GetEventConfiguration(evt.Version).GetEventBodyNodeById( evt.EventIdentifier); if (eventConfigBodyNode == null) { return; } string messageDirectionAttribute = eventConfigBodyNode.GetAttribute("MsgDirection"); string messageDirection = messageDirectionAttribute; msgname = eventConfigBodyNode.GetAttribute("Describe"); if (messageDirectionAttribute.IndexOf("{", StringComparison.Ordinal) >= 0) { var bindingRegex = new Regex(@"{Binding (\w+)\s*}", RegexOptions.IgnoreCase); Match m = bindingRegex.Match(messageDirectionAttribute); IConfigNodeWrapper rootEventTreeNode = SecondaryParser.Singleton.Parse(evt); if (rootEventTreeNode == null) { Log.Error("GetMessageDirection,rootEventTreeNode is null."); return; } if (m.Groups.Count < 1) { Log.Error("No match!!!!!"); return; } messageDirection = rootEventTreeNode.GetChildNodeById(m.Groups[1].Value).ValueDescription; string[] directionInfos = messageDirection.Split('{', '}'); if (directionInfos.Length > 1) { messageDirection = directionInfos[1].Trim('{', '}'); } rootEventTreeNode.Dispose(); } if (messageDirection.Contains("->")) { /*类似"EPC->eNB"的处理*/ var stringSeparators = new[] { "->" }; var splitResult = messageDirection.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries); /*EPC->eNB拆分后为两个字串*/ if (splitResult.Length >= 2) { messageSource = splitResult[0].Trim(); messageDestination = splitResult[1].Trim(); } else { Log.Error(string.Format(@"Event消息方向填写错误,{0}", messageDirectionAttribute)); } } } }
private Event ParseEvent(byte[] eventsBuffer, string version) { var memoryStream = new MemoryStream(eventsBuffer); string timeCircleReport = String.Empty; string strDateTime; DateTime dtStart; dtStart = DateTime.Now; strDateTime = dtStart.ToString("yyyy-MM-dd hh:mm:ss.fff"); Event evt = null; try { evt = new Event() { HostNeid = 1, TimeStamp = "", Version = "1.3.06659", ParsingId = 1, LogFileId = 1, //DisplayIndex = this.eventIndex++, IsMarked = false, TickTime = ConvertTimeStamp.Singleton.ConvertTimeStampToUlong(strDateTime, 0), }; bool binitRet = evt.InitializePersistentData(memoryStream, version); if (evt.EventName != null && (evt.EventName.Equals("SYS_HL_TIME_ADJUST") || evt.EventName.Equals("SYS_L2_TIME_ADJUST"))) { timeCircleReport = ""; //evt.Delete(); return(null); } } catch (Exception exp) { MyLog.Log("ParseEvent EXP:" + exp.StackTrace); //throw; } if (evt == null) { return(null); } string evtNameForUeType = evt.EventName; /**/ if (evtNameForUeType.Equals("S1 Initial Context Setup Request") || evtNameForUeType.Equals("UECapabilityInformation")) { var rootNode = SecondaryParser.Singleton.GetExpandNodeQuote(evt); if (rootNode != null) { var paraNode = rootNode.GetChildNodeById("Data[]"); if (paraNode != null) { var displayContent = paraNode.DisplayContent; try { string ueType = String.Empty; if (evtNameForUeType.Equals("S1 Initial Context Setup Request")) { ueType = this.FindValueFromTarget(displayContent, "UERadioCapability"); } else if (evtNameForUeType.Equals("UECapabilityInformation")) { ueType = this.FindValueFromTarget(displayContent, "ueCapabilityRAT-Container"); } if (!string.IsNullOrEmpty(ueType)) { int startPosition = ueType.LastIndexOf(')') + 1; int endPosition = ueType.LastIndexOf('\''); int ueTypeLength = endPosition - startPosition; ueType = ueType.Substring(startPosition, ueTypeLength); evt.UeType = CDLBrowser.Parser.Configuration.ConfigurationManager.Singleton.GetUeTypeConfiguration(). GetUeTypeByCapabilityStr(ueType); } } catch (Exception ex) { } } } } /**/ // FilteredAddEvent(evt); evt.DisplayIndex++; IConfigNodeWrapper bodyNode = SecondaryParser.Singleton.GetExpandNodeQuote(evt); if (bodyNode != null) { string msgbody = ""; ExportBodyToXml(bodyNode, ref msgbody, 0); evt.MsgBody = msgbody; evt.InitOtherParams(); } return(evt); }
/// <summary> /// The initialize persistent data. /// </summary> /// <param name="stream"> /// The stream. /// </param> public bool InitializePersistentData(MemoryStream stream, string fileVersion) { lock (parseLock) { long startPosition = stream.Position; this.Version = fileVersion; EventParser eventParser = EventParserManager.Instance.GetParser(fileVersion); eventParser.Parse(stream); IConfigNodeWrapper boardTypeNode = eventParser.GetEventTreeHeadNode("Rsv"); if (boardTypeNode != null) { string strBoardType = boardTypeNode.Value.ToString(); int boardType = 0; if (Int32.TryParse(strBoardType, out boardType)) { // sctd/scte板卡都按scte处理 if (boardType == 0x8d || boardType == 0xb2) { boardType = 0x8d; } string finalVersion = string.Format("{0}.{1}", fileVersion, boardType); if (boardType > 0 && System.IO.File.Exists(GetEventConfigFilePath(finalVersion))) { if (EventParserManager.Instance.GetParser(finalVersion) == null) { EventParser parser = new EventParser(); parser.Version = finalVersion; EventParserManager.Instance.AddEventParser(parser.Version, parser); } //覆盖Version 否则解析消息体会出问题 this.Version = finalVersion; } } } string strdtlength = eventParser.GetEventTreeHeadNode("DataLength").Value.ToString(); int dtlength; if (Int32.TryParse(strdtlength, out dtlength) == false) { System.Diagnostics.Debug.WriteLine("datalength is error."); } if (dtlength == 0) { long tmplength = stream.Position; stream.Position = startPosition; dtlength = (int)(tmplength - startPosition); var raws = new byte[dtlength]; stream.Read(raws, 0, dtlength); this.RawData = raws; return(false); } // finally read row data........in case exception stream may never goto end. stream.Position = startPosition; dtlength = (int)(dtlength < stream.Length - startPosition ? dtlength : stream.Length - startPosition); var rowdata = new byte[dtlength]; stream.Read(rowdata, 0, dtlength); this.RawData = rowdata; // if message using binding,need parse all string strtime = (string)eventParser.GetEventTreeHeadNode("Time").Value.ToString(); int tmval; if (Int32.TryParse(strtime, out tmval) == false) { System.Diagnostics.Debug.WriteLine("time is invalid."); this.HalfSubFrameNo = 0; } this.HalfSubFrameNo = tmval; //added by zhuwentian begin if (BTSVersionsManager.HasVersion(Version) == true) { if (eventParser.GetEventTreeHeadNode("Pad[2]") != null && eventParser.GetEventTreeHeadNode("Pad[2]").Value != null) { string strpad = eventParser.GetEventTreeHeadNode("Pad[2]").Value.ToString(); uint pad = 0; if (UInt32.TryParse(strpad, out pad) == false) { System.Diagnostics.Debug.WriteLine("pad[2] is invalid."); } this.padarry = pad; } } //added by zhuwentian end string strtype = eventParser.GetEventTreeHeadNode("EventType").Value.ToString(); int evtype; if (Int32.TryParse(strtype, out evtype) == false) { System.Diagnostics.Debug.WriteLine("EventType is invalid."); } this.EventIdentifier = evtype; string messageSource; string messageDestination; string evtname; eventParser.GetMessageDirection(this, out messageSource, out messageDestination, out evtname); this.MessageSource = messageSource; this.MessageDestination = messageDestination; if (!string.IsNullOrEmpty(evtname)) { this.EventName = evtname; } // 2015-05-07 lixiang start if (null != eventParser.GetEventTreeHeadNode("Time2") && null != eventParser.GetEventTreeHeadNode("Time3")) { string strTime2 = eventParser.GetEventTreeHeadNode("Time2").Value.ToString(); int evTime2 = 0; if (Int32.TryParse(strTime2, out evTime2) == false) { System.Diagnostics.Debug.WriteLine("Time2 is invalid."); } string strTime3 = eventParser.GetEventTreeHeadNode("Time3").Value.ToString(); uint evTime3 = 0; if (UInt32.TryParse(strTime3, out evTime3) == false) { System.Diagnostics.Debug.WriteLine("Time3 is invalid."); } string tempTimeStamp; ulong ticks; if (changeTime(evTime2, evTime3, out tempTimeStamp, out ticks)) { this.TimeStamp = tempTimeStamp; //不设置会导致统计有问题 this.TickTime = ticks; } } string strprot = eventParser.GetEventTreeHeadNode("InterfaceType").Value.ToString(); uint uiprot; if (UInt32.TryParse(strprot, out uiprot) == false) { System.Diagnostics.Debug.WriteLine("interfacetype is invalid."); } this.Protocol = OffLineProtocolInfoManager.GetSingleton().GetProtocolName(uiprot); ushort ilcellid; if (UInt16.TryParse(eventParser.GetEventTreeHeadNode("LocalCellID").Value.ToString(), out ilcellid) == false) { System.Diagnostics.Debug.WriteLine("localcellid is invalid."); this.LocalCellId = 0; } this.LocalCellId = ilcellid; ushort icellueind; if (UInt16.TryParse(eventParser.GetEventTreeHeadNode("CellUEIndex").Value.ToString(), out icellueind) == false) { System.Diagnostics.Debug.WriteLine("cellueindex is invalid."); this.CellUeId = 255; } this.CellUeId = icellueind; ushort cellid; if (UInt16.TryParse(eventParser.GetEventTreeHeadNode("CellID").Value.ToString(), out cellid) == false) { System.Diagnostics.Debug.WriteLine("cellid is invalid."); this.CellId = 255; } this.CellId = cellid; return(true); } }
/// <summary> /// The initialize value. /// </summary> /// <param name="memoryStream"> /// The memory Stream. /// </param> // public virtual void InitializeValue(Stream memoryStream) // { // try // { // //Debug.Assert(null != this.ConfigurationNode || this.Children.Count > 0, "event tree node ,must have a configuration node"); // if (this.ConfigurationNode == null || ConfigurationNode.Children.Count == 0) // { // Log.Error("node id = " + this.Id + ", ConfigurationNode == null."); // } // // not a leaf node // if (this.children.Count > 0) // { // foreach (var child in this.Children) // { // if (null != child) // { // child.InitializeValue(memoryStream); // } // } // } // else // { // if (this.Id == "CellInfo") // { // IConfigNodeWrapper FileVer = this.Parent.GetChildNodeById("FileVer"); // if (FileVer != null) // { // string strfileVer = FileVer.Value.ToString(); // // if (strfileVer != "2") // { // Log.Info("This is used for special version!"); // return; // } // // } // // } // // if (this.isDataLengthUsingBinding) // { // // this.dataLength = new DataLengthParser().GetDataLength(this, ref this.isDataLengthUsingBinding); // if (this.dataLength < 1) // { // Log.Error("InitializeValue data length get error!"); // return; // } // } // // var dataBuffer = new byte[this.dataLength]; // memoryStream.Read(dataBuffer, 0, this.dataLength); // var configurationNode = this.ConfigurationNode; // if (configurationNode != null) // { // // this.Value = ConvertUtil.Singleton.ConvertByteArrayToDataTypeObject( // configurationNode.GetAttribute("DataType"), dataBuffer); // // } // } // } // catch (Exception ex) // { // Log.Error(string.Format("InitializeValue erro msg ={0}", ex.Message)); // } // } // public virtual void InitializeValue(FileStream stream) // { // InitializeValue(stream, ""); // } // public virtual void InitializeValue(FileStream stream, string btsVersion) // { // Debug.Assert(null != this.ConfigurationNode, "event tree node ,must have a configuration node"); // if (this.ConfigurationNode == null) // { // Log.Error("event tree node ,must have a configuration node"); // return; // } // // // not a leaf node // if (this.children.Count > 0) // { // foreach (var child in this.Children) // { // if (null != child) // { // child.InitializeValue(stream, btsVersion); // } // } // } // else // { // // if (this.Id == "CellInfo") // { // IConfigNodeWrapper FileVer = this.Parent.GetChildNodeById("FileVer"); // if (FileVer != null) // { // string strfileVer = FileVer.Value.ToString(); // //如果等于2,表示电信专项版本,需要截取 // if (strfileVer != "2") // { // Log.Info("This is used for special version!"); // return; // } // } // } // if (this.isDataLengthUsingBinding) // { // this.dataLength = new DataLengthParser().GetDataLength(this, ref this.isDataLengthUsingBinding); // if (this.dataLength < 1) // { // Log.Error("InitializeValue data length get error!"); // return; // } // } // // var dataBuffer = new byte[this.dataLength]; // stream.Read(dataBuffer, 0, this.dataLength); // //this.Value = ConvertUtil.Singleton.ConvertByteArrayToDataTypeObject( // // this.ConfigurationNode.GetAttribute("DataType"), dataBuffer); // // var configurationNode = this.ConfigurationNode; // if (configurationNode != null) // { // if (BTSVersionsManager.HasVersion(btsVersion)) // { // this.Value = ConvertUtilLittleEnd.Singleton.ConvertByteArrayToDataTypeObject( // configurationNode.GetAttribute("DataType"), dataBuffer); // } // else // { // this.Value = ConvertUtil.Singleton.ConvertByteArrayToDataTypeObject( // configurationNode.GetAttribute("DataType"), dataBuffer); // } // } // } // } /// <summary> /// The initialize value. /// </summary> /// <param name="memoryStream"> /// The memory Stream. /// </param> public virtual void InitializeValue(Stream memoryStream, string btsVersion) { try { Debug.Assert(null != this.ConfigurationNode || this.Children.Count > 0, "event tree node ,must have a configuration node"); // not a leaf node if (this.children.Count > 0) { foreach (var child in this.Children) { if (null != child) { child.InitializeValue(memoryStream, btsVersion); } } } else { if (this.Id == "CellInfo") { IConfigNodeWrapper FileVer = this.Parent.GetChildNodeById("FileVer"); if (FileVer != null) { string strfileVer = FileVer.Value.ToString(); if (strfileVer != "2") { Log.Info("This is used for special version!"); return; } } } if (this.isDataLengthUsingBinding) { this.dataLength = new DataLengthParser().GetDataLength(this, ref this.isDataLengthUsingBinding); if (this.dataLength < 1) { Log.Error("InitializeValue data length get error!"); return; } } var dataBuffer = new byte[this.dataLength]; memoryStream.Read(dataBuffer, 0, this.dataLength); var configurationNode = this.ConfigurationNode; if (configurationNode != null) { if (BTSVersionsManager.HasVersion(btsVersion)) { this.Value = ConvertUtilLittleEnd.Singleton.ConvertByteArrayToDataTypeObject( configurationNode.GetAttribute("DataType"), dataBuffer); } else { this.Value = ConvertUtil.Singleton.ConvertByteArrayToDataTypeObject( configurationNode.GetAttribute("DataType"), dataBuffer); } } } } catch (Exception ex) { Log.Error(string.Format("InitializeValue erro msg ={0}", ex.Message)); } }