private void ParseRequirements() { ReqPro40.Requirements rpxReqColl; ReqPro40.Requirement___v6 rpxReq; ReqPro40.Relationship reqRelParent; int nReqCount; ReqTreeNode tnPackage; ReqTreeNode reqMyTreeNode; List <ReqTreeNode> reqUnassigned; Dictionary <int, ReqTreeNode> dictReq; int i = 0; reqUnassigned = new List <ReqTreeNode>(); dictReq = new Dictionary <int, ReqTreeNode>(); cb.ShowProgressReqPkgTree(0, 0, 0, 0, "Identifying Requirements"); rpxReqColl = rpxProject.GetRequirements("*", ReqPro40.enumRequirementsLookups.eReqsLookup_All, ReqPro40.enumRequirementsWeights.eReqWeight_Medium, ReqPro40.enumRequirementFlags.eReqFlag_Empty, 1000, 8); ReqProRequirementPrx.RPXReqColl = rpxReqColl; nReqCount = rpxReqColl.Count; cb.ShowProgressReqPkgTree(0, 0, nReqCount, 0, nReqCount + " Requirements identified"); foreach (object o in rpxReqColl) { Tracer tracer = new Tracer("Req (Key: " + o + ") from Req Coll"); rpxReq = (ReqPro40.Requirement___v6)rpxReqColl[o, ReqPro40.enumRequirementLookups.eReqLookup_Key]; tracer.Stop("Req " + rpxReq.get_Tag(ReqPro40.enumTagFormat.eTagFormat_Tag) + " got via eReqLookup_Key from Requirements Collection"); try { i++; cb.ShowProgressReqPkgTree(0, 0, 0, i, null); tnPackage = (ReqTreeNode)dictPackage[rpxReq.PackageKey]; reqMyTreeNode = new ReqTreeNode (rpxReq.get_Tag(ReqPro40.enumTagFormat.eTagFormat_Tag) + ": " + rpxReq.Name, rpxReq.key, ReqTreeNode.eReqTreeNodeType.eTreeNodeReq); if (rpxReq.IsRoot) { if (tnPackage != null) { tnPackage.Add(ref reqMyTreeNode); } dictReq.Add(rpxReq.key, reqMyTreeNode); } else { //Tracer tr = new Tracer("Parent of " + reqMyTreeNode.Text + " discovering"); // performance is too low for that step :-( //reqRelParent = rpxReq.get_Parent(ReqPro40.enumRequirementsWeights.eReqWeight_Medium); //reqMyTreeNode.Parent = reqRelParent.SourceKey; //reqUnassigned.Add(reqMyTreeNode); //tr.Stop("Parent of " + reqMyTreeNode.Text + " discovered"); if (tnPackage != null) { tnPackage.Add(ref reqMyTreeNode); } dictReq.Add(rpxReq.key, reqMyTreeNode); } } catch (Exception) { } } Tracer trCleanup = new Tracer("Cleanup Children Requirements"); while (reqUnassigned.Count > 0) { for (int j = 0; j < reqUnassigned.Count; j++) { reqMyTreeNode = reqUnassigned[j]; if (dictReq.ContainsKey(reqMyTreeNode.Parent)) { tnPackage = dictReq[reqMyTreeNode.Parent]; tnPackage.Add(ref reqMyTreeNode); dictReq.Add(reqMyTreeNode.Key, reqMyTreeNode); reqUnassigned.Remove(reqMyTreeNode); j--; } } } trCleanup.Stop("Cleanup Children Requirements"); cb.ShowProgressReqPkgTree(0, 0, 0, 0, i + " Requirements inserted"); cb.ShowProgressReqPkgTree(0, 0, 0, 0, null); }