/// ------------------------------------------------------------------------------------ /// <summary> /// Loads the specified tree node collection with all the string groups and their /// localizable string ids. /// </summary> /// ------------------------------------------------------------------------------------ public void LoadGroupNodes(TreeNodeCollection topCollection) { TmxDocument.Body.TransUnits.Sort(TuComparer); LeafNodeList.Clear(); foreach (var tu in GetTranslationUnitsForTree()) { string id = GetBaseId(tu.Id); if (tu.GetPropValue(kNoLongerUsedPropTag) != null) { continue; } var groupChain = ParseGroupAndId(GetGroup(tu.Id), id); var nodeKey = String.Empty; var nodeCollection = topCollection; LocTreeNode <TMXDocument> newNode; for (int i = groupChain.Count - 1; i > 0; i--) { nodeKey = (nodeKey + "." + groupChain[i]).TrimStart('.'); var nodes = nodeCollection.Find(nodeKey, true); if (nodes.Length > 0) { nodeCollection = nodes[0].Nodes; } else { newNode = new LocTreeNode <TMXDocument>(OwningManager, groupChain[i], null, nodeKey); nodeCollection.Add(newNode); nodeCollection = newNode.Nodes; } } nodeKey = nodeKey + ("." + groupChain[0]).TrimStart('.'); newNode = new LocTreeNode <TMXDocument>(OwningManager, groupChain[0], id, nodeKey); nodeCollection.Add(newNode); LeafNodeList.Add(newNode); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Loads the specified tree node collection with all the string groups and their /// localizable string ids. /// </summary> /// ------------------------------------------------------------------------------------ public void LoadGroupNodes(TreeNodeCollection topCollection) { LeafNodeList.Clear(); foreach (var tu in GetTranslationUnitsForTree()) { string id = GetBaseId(tu.Id); var groupChain = ParseGroupAndId(GetGroup(tu.Id), id); var nodeKey = string.Empty; var nodeCollection = topCollection; LocTreeNode <XLiffDocument> newNode; for (int i = groupChain.Count - 1; i > 0; i--) { nodeKey = (nodeKey + "." + groupChain[i]).TrimStart('.'); var nodes = nodeCollection.Find(nodeKey, true); if (nodes.Length > 0) { nodeCollection = nodes[0].Nodes; } else { newNode = new LocTreeNode <XLiffDocument>(OwningManager, groupChain[i], null, nodeKey); nodeCollection.Add(newNode); nodeCollection = newNode.Nodes; } } nodeKey = nodeKey + ("." + groupChain[0]).TrimStart('.'); newNode = new LocTreeNode <XLiffDocument>(OwningManager, groupChain[0], id, nodeKey); nodeCollection.Add(newNode); LeafNodeList.Add(newNode); } }