private void AnalysisOutputXML(string outXML) { try { DateTime now = DateTime.Now; XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(outXML); XmlNode xmlNodes = xmlDocument.SelectSingleNode("//BusRoutes"); if (xmlNodes == null) { ErrorMsg errorMsg = new ErrorMsg("SeparateAndSticky", "AnalysisOutputXML", "") { ErrorText = "返回的xml错误,不包含BusRoutes节点" }; this.logHelper.WriteError(errorMsg); } else { bool flag = false; string value = ""; string str = ""; int num = 0; int num1 = 0; string value1 = ""; foreach (XmlElement childNode in xmlNodes.ChildNodes) { value = childNode.Attributes["id"].Value; XmlElement itemOf = (XmlElement)childNode.GetElementsByTagName("Buses")[0]; if (itemOf == null) { continue; } foreach (XmlElement xmlElement in itemOf.ChildNodes) { str = xmlElement.Attributes["simNum"].Value; value1 = xmlElement.Attributes["lineId"].Value; if (xmlElement.Attributes["frontAlarmType"].Value != "0" && (this.htAlarmList[string.Concat(str, "-0")] == null || now.Subtract(Convert.ToDateTime(this.htAlarmList[string.Concat(str, "-0")])).TotalSeconds >= (double)this.AlarmInterval)) { flag = true; num = Convert.ToInt32(xmlElement.Attributes["frontAlarmType"].Value); this.htAlarmList[string.Concat(str, "-0")] = now; } if (xmlElement.Attributes["backAlarmType"].Value != "0" && (this.htAlarmList[string.Concat(str, "-1")] == null || now.Subtract(Convert.ToDateTime(this.htAlarmList[string.Concat(str, "-1")])).TotalSeconds >= (double)this.AlarmInterval)) { flag = true; num1 = Convert.ToInt32(xmlElement.Attributes["backAlarmType"].Value); this.htAlarmList[string.Concat(str, "-1")] = now; } if (!flag) { continue; } flag = false; this.ltAlarmBus.Add(AlarmBus.getAlarmBus(value, str, num, num1, value1)); } } } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg1 = new ErrorMsg("SeparateAndSticky", "AnalysisOutputXML", string.Concat("解析返回的xml错误,", exception.Message)); this.logHelper.WriteError(errorMsg1); } }