public override void OnPopulate() { _originalHeaders.Clear(); ARCFileHeader *entry = Header->First; for (int i = 0; i < Header->_numFiles; i++, entry = entry->Next) { DataSource source = new DataSource(entry->Data, entry->Length); ResourceNode createdNode = entry->Length == 0 ? null : NodeFactory.FromSource(this, source); if (createdNode == null) { createdNode = new ARCEntryNode(); createdNode.Initialize(this, source); } _originalHeaders.Add(createdNode, *entry); } }
public override void OnPopulate() { U8Entry * first = Header->Entries; uint count = first->_dataLength - 1; U8Entry * entry = first + 1; sbyte * table = (sbyte *)entry + count * 12; List <U8EntryNode> nodes = new List <U8EntryNode>(); U8EntryNode e = null; for (int i = 0; i < count; i++) { if (entry->isFolder) { e = new U8FolderNode() { _u8Index = i, _name = new String(table + (int)entry->_stringOffset) }; e._name = new String(table + (int)entry->_stringOffset); e._u8Index = i; e._u8Parent = (int)entry->_dataOffset; e._u8FirstNotChild = (int)entry->_dataLength; e._u8Type = (int)entry->_type; e.Initialize(this, entry, 12); nodes.Add(e); } else { DataSource source = new DataSource((VoidPtr)Header + entry->_dataOffset, (int)entry->_dataLength); if ((entry->_dataLength == 0) || (e = NodeFactory.FromSource(this, source) as U8EntryNode) == null) { e = new ARCEntryNode(); } e._name = new String(table + (int)entry->_stringOffset); e._u8Index = i; e._u8Parent = -1; e._u8FirstNotChild = -1; e._u8Type = (int)entry->_type; e.Initialize(this, source); nodes.Add(e); } entry++; } foreach (U8EntryNode x in nodes) { if (x._u8Type == 1) { if (x._u8Parent == 0) { x.Parent = this; } else if (x._u8Parent < nodes.Count) { x.Parent = nodes[x._u8Parent - 1]; } U8EntryNode t = null; if (x._u8Index + 1 < nodes.Count) { t = nodes[x._u8Index + 1]; } while (t != null) { t.Parent = x; if (t._u8Index + 1 < nodes.Count && t.ChildEndIndex != nodes[t._u8Index + 1]._u8Index) { t = nodes[t._u8Index + 1]; } else { t = null; } } } } IsDirty = false; //Clear up changes from parent reassignments }