protected override void endTag(string tag) { if (elementStack.Count != 0) { if ((tag.CompareTo("Check") == 0 && elementStack.Peek().CompareTo("Check") == 0) || (tag.CompareTo("UpdateData") == 0 && elementStack.Peek().CompareTo("UpdateData") == 0)) { elementStack.Pop(); if (this.tempRiskFactor == RiskFactor.NULL || this.tempRiskFactor == RiskFactor.NA) { initialize(); return; } if (!String.IsNullOrEmpty(tempTableString)) { while (tempTableString[tempTableString.Length - 1] == '\n') { tempTableString = tempTableString.Substring(0, tempTableString.Length - 1); } tempDescription += "\nTable: \n" + tempTableString; } MBSADataEntry entry = null; if (String.IsNullOrEmpty(tempReferenceLink)) { entry = new MBSADataEntry(tempPluginName, tempIpList, tempDescription, 1, this.tempRiskFactor, tempCveList, tempBidList, tempOsvdbList); } else { entry = new MBSADataEntry(tempPluginName, tempIpList, tempDescription, 1, this.tempRiskFactor, tempReferenceLink, tempCveList, tempBidList, tempOsvdbList); } if (entry.isValid()) { tempRecord.mbsaAddEntry(entry); //tempCounter++; //String tempString = ""; //tempString += "pluginName: " + tempPluginName + "\n"; //tempString += "hostName: " + hostName + "\n"; //tempString += "description: " + description + "\n"; //tempString += "riskFactor: " + RiskFactorFunction.getEnumString(this.defaultRiskFactor) + "\n"; //tempString += "referenceLink: " + tempReferenceLink + "\n"; //tempString += "cveList: " + entry.getCve() + "\n"; //tempString += "bidList: " + entry.getBid() + "\n"; //tempString += "osvdbList: " + entry.getOsvdb() + "\n"; //tempString += "\n" + "\n"; //MessageBox.Show(tempCounter.ToString() + "\n" + tempString); } initialize(); } else if (tag.CompareTo("Detail") == 0 && elementStack.Peek().CompareTo("Detail") == 0) { tableHeader.Clear(); elementStack.Pop(); } else if (tag.CompareTo("Head") == 0 && elementStack.Peek().CompareTo("Head") == 0) { if (tableHeader.Count != 0) { for (int i = 0; i < tableHeader.Count; i++) { if (i != 0) { tempTableString += ",\t"; } tempTableString += tableHeader[i]; } tempTableString += "\n"; } elementStack.Pop(); tableHeader.Clear(); } else if (tag.CompareTo("Row") == 0 && elementStack.Peek().CompareTo("Row") == 0) { elementStack.Pop(); for (int i = 0; i < tableRow.Count; i++) { if (i != 0) { tempTableString += ",\t"; } tempTableString += tableRow[i]; } tempTableString += "\n"; tableRow.Clear(); } else if (elementStack.Peek().CompareTo(tag) == 0) { elementStack.Pop(); } } }
/// <summary> /// This is the endTag method. /// It is used to handle the end tag from the XML file. /// </summary> /// <param name="tag">xml end tag name</param> protected override void endTag(string tag) { if (elementStack.Count != 0) { if ((tag.CompareTo("Check") == 0 && elementStack.Peek().CompareTo("Check") == 0) || (tag.CompareTo("UpdateData") == 0 && elementStack.Peek().CompareTo("UpdateData") == 0)) { if (tempPluginName == "") { elementStack.Pop(); initialize(); return; } elementStack.Pop(); //if (this.tempRiskFactor == RiskFactor.NULL || this.tempRiskFactor == RiskFactor.NA) { // initialize(); // return; //} if (!String.IsNullOrEmpty(tempTableString)) { while (tempTableString[tempTableString.Length - 1] == '\n') { tempTableString = tempTableString.Substring(0, tempTableString.Length - 1); } tempDescription += "\nTable: \n" + tempTableString; } MBSADataEntry entry = null; //if (String.IsNullOrEmpty(tempReferenceLink)) { entry = new MBSADataEntry(tempPluginName, tempIpList, tempDescription, tempUpdateDataSeverity, this.tempRiskFactor, tempCveList, tempBidList, tempOsvdbList, tempFileName, tempCheckID, tempCheckGrade, tempCheckType, tempCheckCat, tempCheckRank, tempCheckName, tempCheckURL1, tempCheckURL2, tempCheckGroupID, tempCheckGroupName, tempDetailText, tempUpdateDataIsInstalled, tempUpdateDataRestartRequired, tempUpdateDataID, tempUpdateDataGUID, tempUpdateDataBulletinID, tempUpdateDataKBID, tempUpdateDataType, tableHeader, tableRowData, tempUpdateDataInformationURL, tempUpdateDataDownloadURL, tempReferenceLink); //else { // entry = new MBSADataEntry(tempPluginName, // tempIpList, // tempDescription, // tempUpdateDataSeverity, // this.tempRiskFactor, // tempReferenceLink, // tempCveList, // tempBidList, // tempOsvdbList); //} if (entry.isValid()) { tempRecord.mbsaAddEntry(entry); //tempCounter++; //String tempString = ""; //tempString += "pluginName: " + tempPluginName + "\n"; //tempString += "hostName: " + hostName + "\n"; //tempString += "description: " + description + "\n"; //tempString += "riskFactor: " + RiskFactorFunction.getEnumString(this.defaultRiskFactor) + "\n"; //tempString += "referenceLink: " + tempReferenceLink + "\n"; //tempString += "cveList: " + entry.getCve() + "\n"; //tempString += "bidList: " + entry.getBid() + "\n"; //tempString += "osvdbList: " + entry.getOsvdb() + "\n"; //tempString += "\n" + "\n"; //MessageBox.Show(tempCounter.ToString() + "\n" + tempString); } initialize(); } else if (tag.CompareTo("Detail") == 0 && elementStack.Peek().CompareTo("Detail") == 0) { //tableHeader.Clear(); elementStack.Pop(); } else if (tag.CompareTo("Head") == 0 && elementStack.Peek().CompareTo("Head") == 0) { if (tableHeader.Count != 0) { for (int i = 0; i < tableHeader.Count; i++) { if (i != 0) { tempTableString += ",\t"; } tempTableString += tableHeader[i]; } tempTableString += "\n"; } elementStack.Pop(); //tableHeader.Clear(); //clear at end of an entry } else if (tag.CompareTo("Row") == 0 && elementStack.Peek().CompareTo("Row") == 0) { elementStack.Pop(); for (int i = 0; i < tableRow.Count; i++) { if (i != 0) { tempTableString += ",\t"; } tempTableString += tableRow[i]; } tempTableString += "\n"; tableRow.Clear(); } else if (elementStack.Peek().CompareTo(tag) == 0) { elementStack.Pop(); } } }