void WriteResourceDirectoryEntry(ResourceDirectoryEntry rde) { GotoOffset(rde.Offset); if (rde.IdentifiedByName) { m_writer.Write((uint)rde.Name.Offset | 0x80000000); WriteResourceDirectoryString(rde.Name); } else { m_writer.Write((uint)rde.ID); } if (rde.Child is ResourceDirectoryTable) { m_writer.Write((uint)rde.Child.Offset | 0x80000000); WriteResourceDirectoryTable(rde.Child as ResourceDirectoryTable); } else { m_writer.Write(rde.Child.Offset); WriteResourceDataEntry(rde.Child as ResourceDataEntry); } RestoreOffset(); }
ResourceDirectoryEntry ReadDirectoryEntry() { uint name = m_reader.ReadUInt32(); uint child = m_reader.ReadUInt32(); ResourceDirectoryEntry rde; if ((name & 0x80000000) != 0) { rde = new ResourceDirectoryEntry(ReadDirectoryString((int)name & 0x7fffffff), GetOffset()); } else { rde = new ResourceDirectoryEntry((int)name & 0x7fffffff, GetOffset()); } long pos = m_reader.BaseStream.Position; m_reader.BaseStream.Position = child & 0x7fffffff; if ((child & 0x80000000) != 0) { rde.Child = ReadDirectoryTable(); } else { rde.Child = ReadDataEntry(); } m_reader.BaseStream.Position = pos; return(rde); }