Remove the "irc", "press-media" and "tools" directories.
[reactos.git] / irc / TechBot / CHMLibrary / TOCItem.cs
diff --git a/irc/TechBot/CHMLibrary/TOCItem.cs b/irc/TechBot/CHMLibrary/TOCItem.cs
deleted file mode 100644 (file)
index 8f6b7f9..0000000
+++ /dev/null
@@ -1,494 +0,0 @@
-using System;\r
-using System.IO;\r
-using System.Collections;\r
-using System.Windows.Forms;\r
-\r
-using HtmlHelp.ChmDecoding;\r
-\r
-namespace HtmlHelp\r
-{\r
-       /// <summary>\r
-       /// The class <c>TOCItem</c> implements a toc-entry item\r
-       /// </summary>\r
-       public sealed class TOCItem\r
-       {\r
-               /// <summary>\r
-               /// Constant for standard folder (closed) image index (HH2 image list)\r
-               /// </summary>\r
-               public const int STD_FOLDER_HH2 = 4;\r
-               /// <summary>\r
-               /// Constant for standard folder (opened) image index (HH2 image list)\r
-               /// </summary>\r
-               public const int STD_FOLDER_OPEN_HH2 = 6;\r
-               /// <summary>\r
-               /// Constant for standard file image index (HH2 image list)\r
-               /// </summary>\r
-               public const int STD_FILE_HH2 = 16;\r
-\r
-               /// <summary>\r
-               /// Constant for standard folder (closed) image index (HH1 image list)\r
-               /// </summary>\r
-               public const int STD_FOLDER_HH1 = 0;\r
-               /// <summary>\r
-               /// Constant for standard folder (opened) image index (HH1 image list)\r
-               /// </summary>\r
-               public const int STD_FOLDER_OPEN_HH1 = 1;\r
-               /// <summary>\r
-               /// Constant for standard file image index (HH1 image list)\r
-               /// </summary>\r
-               public const int STD_FILE_HH1 = 10;\r
-\r
-               /// <summary>\r
-               /// Internal flag specifying the data extraction mode used for this item\r
-               /// </summary>\r
-               private DataMode _tocMode = DataMode.TextBased;\r
-               /// <summary>\r
-               /// Internal member storing the offset (only used in binary tocs)\r
-               /// </summary>\r
-               private int _offset = 0;\r
-               /// <summary>\r
-               /// Internal member storing the offset of the next item(only used in binary tocs)\r
-               /// </summary>\r
-               private int _offsetNext = 0;\r
-               /// <summary>\r
-               /// Internal member storing a merge link. \r
-               /// If the target file is in the merged files list of the CHM,\r
-               /// this item will be replaced with the target TOC or Topic, if not it will \r
-               /// be removed from TOC.\r
-               /// </summary>\r
-               private string _mergeLink = "";\r
-               /// <summary>\r
-               /// Internal member storing the toc name\r
-               /// </summary>\r
-               private string _name = "";\r
-               /// <summary>\r
-               /// Internal member storing the toc loca (content file)\r
-               /// </summary>\r
-               private string _local = "";\r
-               /// <summary>\r
-               /// Internal member storing all associated information type strings\r
-               /// </summary>\r
-               private ArrayList _infoTypeStrings = new ArrayList();\r
-               /// <summary>\r
-               /// Internal member storing the associated chm file\r
-               /// </summary>\r
-               private string _chmFile = "";\r
-               /// <summary>\r
-               /// Internal member storing the image index\r
-               /// </summary>\r
-               private int _imageIndex = -1;\r
-               /// <summary>\r
-               /// Internal member storing the offset of the associated topic entry (for binary tocs)\r
-               /// </summary>\r
-               private int _topicOffset = -1;\r
-               /// <summary>\r
-               /// Internal member storing the toc children\r
-               /// </summary>\r
-               private ArrayList _children = new ArrayList();\r
-               /// <summary>\r
-               /// Internal member storing the parameter collection\r
-               /// </summary>\r
-               private Hashtable _otherParams = new Hashtable();\r
-               /// <summary>\r
-               /// Internal member storing the associated chmfile object\r
-               /// </summary>\r
-               private CHMFile _associatedFile = null;\r
-               /// <summary>\r
-               /// Parent item\r
-               /// </summary>\r
-               private TOCItem _parent=null;\r
-\r
-               /// <summary>\r
-               /// Holds a pointer to the next item in the TOC\r
-               /// </summary>\r
-               public TOCItem Next=null;\r
-\r
-               /// <summary>\r
-               /// Holds a pointer to the previous item in the TOC\r
-               /// </summary>\r
-               public TOCItem Prev=null;\r
-\r
-               /// <summary>\r
-               /// Holds a pointer to the TreeNode where this TOC Item is used\r
-               /// </summary>\r
-               public System.Windows.Forms.TreeNode treeNode=null;\r
-\r
-               /// <summary>\r
-               /// Constructor of the class used during text-based data extraction\r
-               /// </summary>\r
-               /// <param name="name">name of the item</param>\r
-               /// <param name="local">local content file</param>\r
-               /// <param name="ImageIndex">image index</param>\r
-               /// <param name="chmFile">associated chm file</param>\r
-               public TOCItem(string name, string local, int ImageIndex, string chmFile)\r
-               {\r
-                       _tocMode = DataMode.TextBased;\r
-                       _name = name;\r
-                       _local = local;\r
-                       _imageIndex = ImageIndex;\r
-                       _chmFile = chmFile;\r
-               }\r
-\r
-               /// <summary>\r
-               /// Constructor of the class used during binary data extraction\r
-               /// </summary>\r
-               /// <param name="topicOffset">offset of the associated topic entry</param>\r
-               /// <param name="ImageIndex">image index to use</param>\r
-               /// <param name="associatedFile">associated chm file</param>\r
-               public TOCItem(int topicOffset, int ImageIndex, CHMFile associatedFile)\r
-               {\r
-                       _tocMode = DataMode.Binary;\r
-                       _associatedFile = associatedFile;\r
-                       _chmFile = associatedFile.ChmFilePath;\r
-                       _topicOffset = topicOffset;\r
-                       _imageIndex = ImageIndex;\r
-               }\r
-\r
-               /// <summary>\r
-               /// Standard constructor\r
-               /// </summary>\r
-               public TOCItem()\r
-               {\r
-               }\r
-\r
-               #region Data dumping\r
-               /// <summary>\r
-               /// Dump the class data to a binary writer\r
-               /// </summary>\r
-               /// <param name="writer">writer to write the data</param>\r
-               /// <param name="writeFilename">true if the chmfile name should be written</param>\r
-               internal void Dump(ref BinaryWriter writer, bool writeFilename)\r
-               {\r
-                       writer.Write((int)_tocMode);\r
-                       writer.Write(_topicOffset);\r
-                       writer.Write(_name);\r
-\r
-                       if((_tocMode == DataMode.TextBased)||(_topicOffset<0))\r
-                       {\r
-                               writer.Write(_local);\r
-                       }\r
-\r
-                       writer.Write(_imageIndex);\r
-\r
-                       writer.Write(_mergeLink);\r
-\r
-                       if(writeFilename)\r
-                               writer.Write(_chmFile);\r
-\r
-                       writer.Write(_infoTypeStrings.Count);\r
-\r
-                       for(int i=0; i<_infoTypeStrings.Count; i++)\r
-                               writer.Write( (_infoTypeStrings[i]).ToString() );\r
-\r
-                       writer.Write(_children.Count);\r
-\r
-                       for(int i=0; i<_children.Count; i++)\r
-                       {\r
-                               TOCItem child = ((TOCItem)(_children[i]));\r
-                               child.Dump(ref writer, writeFilename);\r
-                       }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Dump the class data to a binary writer\r
-               /// </summary>\r
-               /// <param name="writer">writer to write the data</param>\r
-               internal void Dump(ref BinaryWriter writer)\r
-               {\r
-                       Dump(ref writer, false);\r
-               }\r
-\r
-               /// <summary>\r
-               /// Reads the object data from a dump store\r
-               /// </summary>\r
-               /// <param name="reader">reader to read the data</param>\r
-               /// <param name="readFilename">true if the chmfile name should be read</param>\r
-               internal void ReadDump(ref BinaryReader reader, bool readFilename)\r
-               {\r
-                       int i=0;\r
-                       _tocMode = (DataMode)reader.ReadInt32();\r
-                       _topicOffset = reader.ReadInt32();\r
-                       _name = reader.ReadString();\r
-\r
-                       if((_tocMode == DataMode.TextBased)||(_topicOffset<0))\r
-                       {\r
-                               _local = reader.ReadString();\r
-                       }\r
-                       \r
-                       _imageIndex = reader.ReadInt32();\r
-\r
-                       _mergeLink = reader.ReadString();\r
-\r
-                       if(readFilename)\r
-                               _chmFile = reader.ReadString();\r
-\r
-                       int nCnt = reader.ReadInt32();\r
-\r
-                       for(i=0; i<nCnt; i++)\r
-                       {\r
-                               string sIT = reader.ReadString();\r
-                               _infoTypeStrings.Add(sIT);\r
-                       }\r
-\r
-                       nCnt = reader.ReadInt32();\r
-\r
-                       if(_associatedFile != null)\r
-                               _chmFile = _associatedFile.ChmFilePath;\r
-\r
-                       for(i=0; i<nCnt; i++)\r
-                       {\r
-                               TOCItem child = new TOCItem();\r
-                               child.AssociatedFile = _associatedFile;\r
-\r
-                               child.ReadDump(ref reader, readFilename);\r
-\r
-                               if(_associatedFile != null)\r
-                                       child.ChmFile = _associatedFile.ChmFilePath;\r
-                               else if(!readFilename)\r
-                                       child.ChmFile = _chmFile;\r
-                               child.Parent = this;\r
-\r
-                               _children.Add(child);\r
-\r
-                               if(child.MergeLink.Length > 0)\r
-                                       _associatedFile.MergLinks.Add(child);\r
-                       }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Reads the object data from a dump store\r
-               /// </summary>\r
-               /// <param name="reader">reader to read the data</param>\r
-               internal void ReadDump(ref BinaryReader reader)\r
-               {\r
-                       ReadDump(ref reader, false);\r
-               }\r
-               #endregion\r
-\r
-               /// <summary>\r
-               /// Gets/Sets the data extraction mode with which this item was created.\r
-               /// </summary>\r
-               internal DataMode TocMode\r
-               {\r
-                       get { return _tocMode; }\r
-                       set { _tocMode = value; }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Gets/Sets the offset of the associated topic entry\r
-               /// </summary>\r
-               internal int TopicOffset\r
-               {\r
-                       get { return _topicOffset; }\r
-                       set { _topicOffset = value; }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Gets/Sets the associated CHMFile instance\r
-               /// </summary>\r
-               internal CHMFile AssociatedFile\r
-               {\r
-                       get { return _associatedFile; }\r
-                       set \r
-                       { \r
-                               _associatedFile = value; \r
-                       }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Gets/Sets the offset of the item.\r
-               /// </summary>\r
-               /// <remarks>Only used in binary tocs</remarks>\r
-               internal int Offset\r
-               {\r
-                       get     { return _offset; }\r
-                       set     { _offset = value; }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Gets/Sets the offset of the next item.\r
-               /// </summary>\r
-               /// <remarks>Only used in binary tocs</remarks>\r
-               internal int OffsetNext\r
-               {\r
-                       get     { return _offsetNext; }\r
-                       set     { _offsetNext = value; }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Gets the ArrayList which holds all information types/categories this item is associated\r
-               /// </summary>\r
-               internal ArrayList InfoTypeStrings\r
-               {\r
-                       get { return _infoTypeStrings; }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Gets/Sets the parent of this item\r
-               /// </summary>\r
-               public TOCItem Parent\r
-               {\r
-                       get { return _parent; }\r
-                       set { _parent = value; }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Gets/Sets the mergelink for this item. \r
-               /// <b>You should not set the mergedlink by your own !</b>\r
-               /// This is only for loading merged CHMs.\r
-               /// </summary>\r
-               public string MergeLink\r
-               {\r
-                       get { return _mergeLink; }\r
-                       set { _mergeLink = value; }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Gets/Sets the name of the item\r
-               /// </summary>\r
-               public string Name\r
-               {\r
-                       get     \r
-                       { \r
-                               if(_mergeLink.Length > 0)\r
-                                       return "";\r
-\r
-                               if(_name.Length <= 0)\r
-                               {\r
-                                       if((_tocMode == DataMode.Binary )&&(_associatedFile!=null))\r
-                                       {\r
-                                               if( _topicOffset >= 0)\r
-                                               {\r
-                                                       TopicEntry te = (TopicEntry) (_associatedFile.TopicsFile[_topicOffset]);\r
-                                                       if(te != null)\r
-                                                       {\r
-                                                               return te.Title;\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               }\r
-\r
-                               return _name; \r
-                       }\r
-                       set     \r
-                       { \r
-                               _name = value; \r
-                       }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Gets/Sets the local of the item\r
-               /// </summary>\r
-               public string Local\r
-               {\r
-                       get     \r
-                       { \r
-                               if(_mergeLink.Length > 0)\r
-                                       return "";\r
-\r
-                               if(_local.Length <= 0)\r
-                               {\r
-                                       if((_tocMode == DataMode.Binary )&&(_associatedFile!=null))\r
-                                       {\r
-                                               if( _topicOffset >= 0)\r
-                                               {\r
-                                                       TopicEntry te = (TopicEntry) (_associatedFile.TopicsFile[_topicOffset]);\r
-                                                       if(te != null)\r
-                                                       {\r
-                                                               return te.Locale;\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               }\r
-\r
-                               return _local; \r
-                       }\r
-                       set     { _local = value; }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Gets/Sets the chm file\r
-               /// </summary>\r
-               public string ChmFile\r
-               {\r
-                       get     \r
-                       { \r
-                               if(_associatedFile!=null)\r
-                                       return _associatedFile.ChmFilePath;\r
-\r
-                               return _chmFile; \r
-                       }\r
-                       set     { _chmFile = value; }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Gets the url for the webbrowser for this file\r
-               /// </summary>\r
-               public string Url\r
-               {\r
-                       get\r
-                       {\r
-                               string sL = Local;\r
-\r
-                               if( (sL.ToLower().IndexOf("http://") >= 0) ||\r
-                                       (sL.ToLower().IndexOf("https://") >= 0) ||\r
-                                       (sL.ToLower().IndexOf("mailto:") >= 0) ||\r
-                                       (sL.ToLower().IndexOf("ftp://") >= 0) || \r
-                                       (sL.ToLower().IndexOf("ms-its:") >= 0))\r
-                                       return sL;\r
-\r
-                               return HtmlHelpSystem.UrlPrefix + ChmFile + "::/" + sL;\r
-                       }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Gets/Sets the image index of the item\r
-               /// </summary>\r
-               /// <remarks>Set this to -1 for a default icon</remarks>\r
-               public int ImageIndex\r
-               {\r
-                       get     \r
-                       { \r
-                               if( _imageIndex == -1)\r
-                               {\r
-                                       int nFolderAdd = 0;\r
-\r
-                                       if((_associatedFile != null) && (_associatedFile.ImageTypeFolder))\r
-                                       {\r
-                                               // get the value which should be added, to display folders instead of books\r
-                                               if(HtmlHelpSystem.UseHH2TreePics) \r
-                                                       nFolderAdd = 8;\r
-                                               else\r
-                                                       nFolderAdd = 4;\r
-                                       }\r
-                                       \r
-\r
-                                       if( _children.Count > 0)\r
-                                               return (HtmlHelpSystem.UseHH2TreePics ? (STD_FOLDER_HH2+nFolderAdd) : (STD_FOLDER_HH1+nFolderAdd));\r
-\r
-                                       return (HtmlHelpSystem.UseHH2TreePics ? STD_FILE_HH2 : STD_FILE_HH1);\r
-                               }\r
-                               return _imageIndex; \r
-                       }\r
-                       set     { _imageIndex = value; }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Gets/Sets the children of this item.\r
-               /// </summary>\r
-               /// <remarks>Each entry in the ArrayList is of type TOCItem</remarks>\r
-               public ArrayList Children\r
-               {\r
-                       get { return _children; }\r
-                       set { _children = value; }\r
-               }\r
-\r
-               /// <summary>\r
-               /// Gets the internal hashtable storing all params\r
-               /// </summary>\r
-               public Hashtable Params\r
-               {\r
-                       get { return _otherParams; }\r
-               }\r
-       }\r
-}\r