private SkeletonKey BuildKeyTree() { SkeletonKey root = null; foreach (var keyRoot in _keys) { var current = root; //need to make sure root key name is at beginning of each var segs = keyRoot.KeyPath.Split('\\'); var withVals = keyRoot.AddValues; foreach (var seg in segs) { if (seg == segs.Last()) { withVals = keyRoot.AddValues; } if (root == null) { root = new SkeletonKey(seg, seg, withVals); current = root; continue; } if (current.KeyName == segs.First() && seg == segs.First()) { continue; } if (current.Subkeys.Any(t => t.KeyName == seg)) { current = current.Subkeys.Single(t => t.KeyName == seg); continue; } if (seg == segs.Last()) { withVals = keyRoot.AddValues; } var sk = new SkeletonKey($"{current.KeyPath}\\{seg}", seg, withVals); current.Subkeys.Add(sk); current = sk; } } return(root); }
private int ProcessSkeletonTree(SkeletonKey treeKey) { //call processSkel for treekey.treepath //call for each subkey in subkeys //drop addsubkeys param as you will only ever be adding a key as found in tk.subkeys or keypath //this is where we need to build a list of subkey offsets so we can adjust SubkeyCountStableOffset and SubkeyListsStableCellIndex //once we know these and write it, jump to location of key and update accordingly Debug.WriteLine($"Processing {treeKey.KeyPath}. AddValues: {treeKey.AddValues}"); foreach (var skeletonKey in treeKey.Subkeys) { ProcessSkeletonTree(skeletonKey); } var key = _hive.GetKey(treeKey.KeyPath); var parentOffset = ProcessKey(key, -1, treeKey.AddValues, true); return(parentOffset); }