// not working right now. public static void GetITMs(Record root, Merged orig) { var q = from currRecord in FindRecords(root).AsParallel() where currRecord.IsIdentical(orig.FindRecord(currRecord.Id)) select currRecord; var itms = q.OrderBy(r => r.RecordType).ThenBy(r => r.Id).ToArray(); }
// assumes all IDs were deleted by PerformDeletes. public static void PerformUDRs(Record root, Merged master, IEnumerable <uint> ids) { foreach (uint id in ids) { Record orig = master.FindRecord(id); orig = new Record(orig) { Parent = orig.Parent }; orig.Flags |= BethesdaRecordFlags.InitiallyDisabled; if (orig.RecordType == ACHR || orig.RecordType == ACRE) { orig.Flags |= BethesdaRecordFlags.PersistentReference; } if (orig.Flags.HasFlag(BethesdaRecordFlags.PersistentReference) && orig.Parent.GroupType != BethesdaGroupType.CellPersistentChildren) { Record wrldParent = null; // persistent children of the HIGHEST cell in the world while (orig.Parent != null) { Record rrrr = orig.Parent.Parent; if (rrrr.RecordType == WRLD) { wrldParent = rrrr; } orig.Parent = rrrr.Parent; } orig.Parent = wrldParent.Subgroups .Single(g => g.GroupType == BethesdaGroupType.WorldChildren) .Records .Single(r => r.RecordType == CELL) .Subgroups .Single(g => g.GroupType == BethesdaGroupType.CellChildren) .Records .Single() .Subgroups .Single(g => g.GroupType == BethesdaGroupType.CellPersistentChildren); } bool isPersistent = orig.Flags.HasFlag(BethesdaRecordFlags.PersistentReference); if (!isPersistent) { Field dataField = orig.Fields.Find(f => f.FieldType == DATA); if (dataField == null) { orig.Fields.Add(dataField = new Field { FieldType = DATA, Payload = new byte[24] }); } MBitConverter.Set(dataField.Payload, 8, 3337248768); } Field xespField = orig.Fields.Find(f => f.FieldType == XESP); if (xespField == null) { orig.Fields.Add(xespField = new Field { FieldType = XESP, Payload = new byte[8] }); } MBitConverter.Set(xespField.Payload, 0, (uint)0x14); MBitConverter.Set(xespField.Payload, 4, (uint)0x01); orig.CompressedFieldData = null; MergeInto(orig, root); } }