public void LoadXML(string sFileName) { XmlDocument docXML = new XmlDocument(); bool bFirst = true; docXML.Load(sFileName); _stFiles.Clear(); foreach (XmlNode node in docXML.SelectNodes("QVCSLog/Files/File")) { stFile newTable = new stFile(); newTable.sFileName = node.SelectSingleNode("Name").InnerText; newTable.sPath = node.SelectSingleNode("Path").InnerText; newTable.stHistorys=new List<stHistory>() ; newTable.stLabels =new List<stLabel>() ; foreach (XmlNode fieldnode in node.SelectNodes("Historys/History")) { stHistory newHistory = new stHistory(); newHistory.sLabel = fieldnode.SelectSingleNode("Label").InnerText; newHistory.sRevision = fieldnode.SelectSingleNode("Revision").InnerText; newHistory.sDescription = fieldnode.SelectSingleNode("Description").InnerText; newHistory.sCheckedInBy = fieldnode.SelectSingleNode("CheckedInBy").InnerText; newTable.stHistorys.Add(newHistory); } foreach (XmlNode labelnode in node.SelectNodes("Labels/Label")) { stLabel newLabel = new stLabel(); newLabel.sLabel = labelnode.SelectSingleNode("Name").InnerText; newLabel.sRevision = labelnode.SelectSingleNode("Revision").InnerText; newTable.stLabels.Add(newLabel); } if (bFirst == true) { _stLabels = newTable.stLabels; bFirst = false; } _stFiles.Add(newTable); } }
private void ReadLog(string sPath , string sFileName, bool bAddToLabels) { List<stHistory> stHistorys = new List<stHistory>(); List<stLabel> stLabels = new List<stLabel>(); bool bProcessingLabels = false; bool bProcessingRevision = false; bool bProcessingDescription = false; string sError; string sResponse; sResponse = CommandLineHelper.Run(@"C:\QVCSBin\qlog ","\""+ sFileName +"\"" , out sError, sPath); if (sError.Length > 0 || (sResponse.Length < 50 && sResponse.Contains( " not found!")==false)) { //sResponse = sResponse; } string sCurrentRevision = ""; string sCurrentDescription = ""; string sCheckedInBy = ""; string lastLabel = ""; /* * Labels: Revision 1.47 labeled by *Name* as 'Utilinet_S00237-05.05.E22' Revision 1.50 labeled by *Name* as 'S00244-05.05.D62' Revision 1.50 labeled by *Name* as 'U14 init version' Revision 1.47 labeled by *Name* as 'Utilinet_S00237- * * ------------------------------------------- Revision 1.50: created by *Name* Last file edit: 4/04/2013 3:08:40 PM Revision inserted: 4/04/2013 3:10:42 PM Compressed from: 169376 to 48983 Description: Removed LoadProf.c from U1300 and added DynamicLP.c */ foreach (string sLine in sResponse.Split('\n')) { if (sLine.Trim().StartsWith("Labels:")) { bProcessingLabels = true; } if (sLine.Trim().StartsWith("Description:")) { bProcessingLabels = false; } if (sLine.Trim().StartsWith("-------------------------------------------")) { if (bProcessingDescription == true) { stHistory newHistory = new stHistory(); newHistory.sDescription = sCurrentDescription; newHistory.sRevision = sCurrentRevision; newHistory.sCheckedInBy = sCheckedInBy; newHistory.sLabel = ""; foreach (stLabel stlab in stLabels) { if (stlab.sRevision == newHistory.sRevision) { newHistory.sLabel = stlab.sLabel; lastLabel = stlab.sLabel; } } if (newHistory.sLabel=="") { newHistory.sLabel = lastLabel; } sCurrentRevision = ""; stHistorys.Add(newHistory); } bProcessingRevision = true; bProcessingDescription = false; } if (bProcessingLabels == true && sLine.Trim().Length > "Revision ".Length) { int iRevisionEnd = sLine.Trim().IndexOf(' ', "Revision ".Length); int iLabelEnd = sLine.Trim().LastIndexOf('\''); int iLabelStart = sLine.Trim().LastIndexOf('\'', iLabelEnd - 1); int i = 0; bool bFound = false; stLabel newLabel = new stLabel(); newLabel.sLabel = sLine.Trim().Substring(iLabelStart + 1, iLabelEnd - iLabelStart - 1); newLabel.sRevision = sLine.Trim().Substring("Revision ".Length, iRevisionEnd - "Revision ".Length); foreach (stLabel stlab in _stLabels) { if (newLabel.sLabel.Trim().CompareTo (stlab.sLabel.Trim())>0) { i++; } if (stlab.sLabel.Trim() == newLabel.sLabel.Trim()) { bFound = true; } } if (bFound == false) { if (bAddToLabels == true) { _stLabels.Add(newLabel); _lastFileName = sPath + sFileName; } } stLabels.Add(newLabel); } if (bProcessingDescription == true) { sCurrentDescription += sLine + "\r\n"; } if (bProcessingRevision == true) { bProcessingLabels = false; if (sLine.Trim().StartsWith("Revision ") && sLine.StartsWith("Revision inserted:") == false) { int iRevisionEnd = sLine.Trim().IndexOf(' ', "Revision ".Length); int iCheckedInStart = sLine.Trim().IndexOf ("created by "); sCurrentRevision = sLine.Trim().Substring("Revision ".Length, iRevisionEnd - "Revision ".Length - 1); sCheckedInBy = sLine.Trim().Substring(iCheckedInStart + "created by ".Length); } if (sLine.Trim().StartsWith("Description:")) { sCurrentDescription = ""; bProcessingDescription = true; } } } if (bProcessingDescription == true) { stHistory newHistory = new stHistory(); newHistory.sDescription = sCurrentDescription; newHistory.sRevision = sCurrentRevision; newHistory.sCheckedInBy = sCheckedInBy; newHistory.sLabel = ""; foreach (stLabel stlab in stLabels) { if (stlab.sRevision == newHistory.sRevision) { newHistory.sLabel = stlab.sLabel; } } sCurrentRevision = ""; stHistorys.Add(newHistory); } bProcessingRevision = true; bProcessingDescription = false; stFile newFile=new stFile(); newFile.sFileName = sFileName; newFile.sPath = sPath; newFile.stHistorys = stHistorys; newFile.stLabels = stLabels; _stFiles.Add(newFile); }