4 namespace HtmlHelp.ChmDecoding
7 /// The class <c>UrlTableEntry</c> stores data for an URL-Table entry
9 internal sealed class UrlTableEntry
12 /// Internal member storing the offset of this entry
14 private int _entryOffset = 0;
16 /// Internal member storing a unique id
18 private uint _uniqueID = 0;
20 /// Internal member storing the topics index
22 private int _topicsIndex = 0;
24 /// Internal member storing the offset in the urlstr table
26 private int _urlStrOffset = 0;
28 /// Internal member storing the associated chmfile object
30 private CHMFile _associatedFile = null;
33 /// Constructor of the class
35 /// <param name="uniqueID">unique id</param>
36 /// <param name="entryOffset">offset of the entry</param>
37 /// <param name="topicIndex">topic index</param>
38 /// <param name="urlstrOffset">urlstr offset for filename</param>
39 public UrlTableEntry(uint uniqueID, int entryOffset, int topicIndex, int urlstrOffset) : this(uniqueID, entryOffset, topicIndex, urlstrOffset, null)
44 /// Constructor of the class
46 /// <param name="uniqueID">unique id</param>
47 /// <param name="entryOffset">offset of the entry</param>
48 /// <param name="topicIndex">topic index</param>
49 /// <param name="urlstrOffset">urlstr offset for filename</param>
50 /// <param name="associatedFile">associated chm file</param>
51 internal UrlTableEntry(uint uniqueID, int entryOffset, int topicIndex, int urlstrOffset, CHMFile associatedFile)
54 _entryOffset = entryOffset;
55 _topicsIndex = topicIndex;
56 _urlStrOffset = urlstrOffset;
57 _associatedFile = associatedFile;
61 /// Standard constructor
63 internal UrlTableEntry()
69 /// Dump the class data to a binary writer
71 /// <param name="writer">writer to write the data</param>
72 internal void Dump(ref BinaryWriter writer)
74 writer.Write( _urlStrOffset );
75 writer.Write( _entryOffset );
76 writer.Write( _topicsIndex );
77 writer.Write( _urlStrOffset );
81 /// Reads the object data from a dump store
83 /// <param name="reader">reader to read the data</param>
84 internal void ReadDump(ref BinaryReader reader)
86 _urlStrOffset = reader.ReadInt32();
87 _entryOffset = reader.ReadInt32();
88 _topicsIndex = reader.ReadInt32();
89 _urlStrOffset = reader.ReadInt32();
93 /// Sets the associated CHMFile instance
95 /// <param name="associatedFile">instance to set</param>
96 internal void SetCHMFile(CHMFile associatedFile)
98 _associatedFile = associatedFile;
103 /// Gets the unique id of the entry
105 internal uint UniqueID
107 get {return _uniqueID; }
111 /// Gets the offset of the entry
113 internal int EntryOffset
115 get {return _entryOffset; }
119 /// Gets the topics index
121 internal int TopicIndex
123 get {return _topicsIndex; }
127 /// Gets the urlstr offset
129 internal int UrlstrOffset
131 get { return _urlStrOffset; }
135 /// Gets the url of the entry
141 if(_associatedFile == null)
144 if(_associatedFile.UrlstrFile == null)
147 string sTemp = (string)_associatedFile.UrlstrFile.GetURLatOffset( _urlStrOffset );
157 /// Gets the associated topic for this url entry
159 internal TopicEntry Topic
163 if(_associatedFile == null)
166 if(_associatedFile.TopicsFile == null)
169 TopicEntry tentry = _associatedFile.TopicsFile[ _topicsIndex*16 ];