diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Help/Compiled/WinHelp/HLPDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Help/Compiled/WinHelp/HLPDataFormat.cs
index c80abe71..dc174b5d 100644
--- a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Help/Compiled/WinHelp/HLPDataFormat.cs
+++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Help/Compiled/WinHelp/HLPDataFormat.cs
@@ -197,7 +197,6 @@ namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp
while (!reader.EndOfStream)
{
Internal.TOPICLINK topicLink = ReadTOPICLINK(reader);
-
switch (topicLink.RecordType)
{
case Internal.TopicLinkRecordType.TopicHeader:
@@ -218,20 +217,78 @@ namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp
break;
}
case Internal.TopicLinkRecordType.Display31:
+ case Internal.TopicLinkRecordType.Table31:
{
// TODO: test with putty.hlp
- byte unknown1 = reader.ReadByte();
- byte unknown2 = reader.ReadByte();
- ushort id = reader.ReadUInt16();
- ushort flags = reader.ReadUInt16(); // unknownfollows, spacingabovefollows, rightindentfollows, etc.
- byte[] blahblah = reader.ReadBytes(7);
-
- ushort sanityCheck0xFF = reader.ReadUInt16();
- if (sanityCheck0xFF == 0xFF)
+ if (topicLink.RecordType == Internal.TopicLinkRecordType.Display31 || topicLink.RecordType == Internal.TopicLinkRecordType.Table31)
{
- // end of character formatting. proceed with next ParagraphInfo if RecordType is 0x23, else you are done
- string value = reader.ReadNullTerminatedString();
+ int TopicSize = ReadCompressedInt32(reader);
+ ushort TopicLength = ReadCompressedUInt16(reader);
}
+
+ if (topicLink.RecordType == Internal.TopicLinkRecordType.Table31)
+ {
+ short column = reader.ReadInt16(); // -1 if end of topic, don't continue
+ short unknown = reader.ReadInt16();
+ byte always0 = reader.ReadByte();
+ }
+
+ byte unknown01 = reader.ReadByte();
+ byte unknown02 = reader.ReadByte();
+ ushort id = reader.ReadUInt16();
+ Internal.TopicLinkDisplay31Flags flags = (Internal.TopicLinkDisplay31Flags)reader.ReadUInt16();
+
+ if ((flags & Internal.TopicLinkDisplay31Flags.UnknownFollows) == Internal.TopicLinkDisplay31Flags.UnknownFollows)
+ {
+ // read compressed long Unknown
+ }
+ if ((flags & Internal.TopicLinkDisplay31Flags.SpacingAboveFollows) == Internal.TopicLinkDisplay31Flags.SpacingAboveFollows)
+ {
+ // read compressed short SpacingAbove
+ }
+ if ((flags & Internal.TopicLinkDisplay31Flags.SpacingBelowFollows) == Internal.TopicLinkDisplay31Flags.SpacingBelowFollows)
+ {
+
+ }
+ if ((flags & Internal.TopicLinkDisplay31Flags.SpacingLinesFollows) == Internal.TopicLinkDisplay31Flags.SpacingLinesFollows)
+ {
+ short spacingLines = ReadCompressedInt16(reader);
+ }
+ if ((flags & Internal.TopicLinkDisplay31Flags.LeftIndentFollows) == Internal.TopicLinkDisplay31Flags.LeftIndentFollows)
+ {
+
+ }
+ if ((flags & Internal.TopicLinkDisplay31Flags.RightIndentFollows) == Internal.TopicLinkDisplay31Flags.RightIndentFollows)
+ {
+ short rightIndent = ReadCompressedInt16(reader);
+ }
+ if ((flags & Internal.TopicLinkDisplay31Flags.FirstLineIndentFollows) == Internal.TopicLinkDisplay31Flags.FirstLineIndentFollows)
+ {
+
+ }
+ if ((flags & Internal.TopicLinkDisplay31Flags.BorderInfoFollows) == Internal.TopicLinkDisplay31Flags.BorderInfoFollows)
+ {
+ Internal.TopicLinkDisplay31BorderStyle borderStyle = (Internal.TopicLinkDisplay31BorderStyle)reader.ReadByte();
+ short borderWidth = reader.ReadInt16();
+ }
+ if ((flags & Internal.TopicLinkDisplay31Flags.TabInfoFollows) == Internal.TopicLinkDisplay31Flags.TabInfoFollows)
+ {
+ // compressed short TabStopCount
+ // ... da fuq?
+ }
+
+ Internal.TopicLinkDisplay31Opcode opcode = (Internal.TopicLinkDisplay31Opcode)reader.ReadUInt16();
+ while (opcode != Internal.TopicLinkDisplay31Opcode.EndOfCharacterFormatting)
+ {
+ switch (opcode)
+ {
+ }
+ opcode = (Internal.TopicLinkDisplay31Opcode)reader.ReadUInt16();
+ }
+
+ // end of character formatting. proceed with next ParagraphInfo if RecordType is 0x23, else you are done
+ string value = reader.ReadNullTerminatedString();
+
break;
}
}
@@ -240,6 +297,67 @@ namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp
#endregion
}
+ private ushort ReadCompressedUInt16(Reader reader)
+ {
+ // A compressed unsigned short is made of a single byte. Divide by two to get the value if it's even.
+ // Divide by two and add 128 times the value of the next byte if it's odd.
+ ushort retval = 0;
+ retval = (ushort)reader.ReadByte();
+ if ((retval % 2) == 0)
+ {
+ retval = (ushort)((double)retval / 2);
+ }
+ else
+ {
+ ushort retval2 = (ushort)reader.ReadByte();
+ retval = (ushort)(((double)retval / 2) + (128 * retval2));
+ }
+ return retval;
+ }
+
+ private int ReadCompressedInt32(Reader reader)
+ {
+ int retval = 0;
+ // A compressed signed long is made of a 2 byte value. Divide by two and subtract 16384 to get its
+ // value if it's even. Divide by two, add 32768 times the value of the next 2 bytes and subtract
+ // 67108864 if it's odd.
+ retval = (int)reader.ReadInt16();
+ if ((retval % 2) == 0)
+ {
+ retval = (int)(((double)retval / 2) - 16384);
+ }
+ else
+ {
+ int retval2 = (int)reader.ReadInt16();
+ retval = (int)((((double)retval / 2) + (32768 * retval2)) - 67108864);
+ }
+ return retval;
+ }
+
+
+ private static short ReadCompressedInt16(Reader reader)
+ {
+ short retval = 0;
+ // A compressed signed short is made of a single byte. Divide by two and subtract 64 to get the value
+ // if it's even. Divide by two, add 128 times the value of the next byte and subtract 16384 if it's
+ // odd.
+ retval = (short)reader.ReadByte();
+ if ((retval % 2) == 0)
+ {
+ // compressedShortValue is even, divide by two to get the value
+ retval = (short)(((double)retval / 2) - 64);
+ }
+ else
+ {
+ short retval2 = (short)reader.ReadByte();
+ retval = (short)((((double)retval / 2) + (128 * retval2)) - 16384);
+ }
+ return retval;
+ }
+
+ // A compressed unsigned long is made of a 2 byte value. Divide by two to get its value if it's even.
+ // Divide by two and add 32768 times the value of the next 2 bytes if it's odd.
+
private Internal.TOPICHEADER ReadTOPICHEADER(Reader reader)
{
Internal.TOPICHEADER item = new Internal.TOPICHEADER();
diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Help/Compiled/WinHelp/Internal/TopicLinkDisplay31BorderStyle.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Help/Compiled/WinHelp/Internal/TopicLinkDisplay31BorderStyle.cs
new file mode 100644
index 00000000..2402e520
--- /dev/null
+++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Help/Compiled/WinHelp/Internal/TopicLinkDisplay31BorderStyle.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp.Internal
+{
+ public enum TopicLinkDisplay31BorderStyle : byte
+ {
+ None = 0x00,
+ Box = 0x01,
+ Top = 0x02,
+ Left = 0x04,
+ Bottom = 0x08,
+ Right = 0x10,
+ Thick = 0x20,
+ Double = 0x40,
+ Unknown = 0x80
+ }
+}
diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Help/Compiled/WinHelp/Internal/TopicLinkDisplay31Flags.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Help/Compiled/WinHelp/Internal/TopicLinkDisplay31Flags.cs
new file mode 100644
index 00000000..85ed8ecd
--- /dev/null
+++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Help/Compiled/WinHelp/Internal/TopicLinkDisplay31Flags.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp.Internal
+{
+ [Flags()]
+ public enum TopicLinkDisplay31Flags : ushort
+ {
+ None = 0x0000,
+ UnknownFollows = 0x0001,
+ SpacingAboveFollows = 0x0002,
+ SpacingBelowFollows = 0x0004,
+ SpacingLinesFollows = 0x0008,
+ LeftIndentFollows = 0x0010,
+ RightIndentFollows = 0x0020,
+ FirstLineIndentFollows = 0x0040,
+ Unused1 = 0x0080,
+ BorderInfoFollows = 0x0100,
+ TabInfoFollows = 0x0200,
+ RightAlignedParagraph = 0x0400,
+ CenterAlignedParagraph = 0x0800
+ }
+}
diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Help/Compiled/WinHelp/Internal/TopicLinkDisplay31Opcode.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Help/Compiled/WinHelp/Internal/TopicLinkDisplay31Opcode.cs
new file mode 100644
index 00000000..65813982
--- /dev/null
+++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Help/Compiled/WinHelp/Internal/TopicLinkDisplay31Opcode.cs
@@ -0,0 +1,144 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp.Internal
+{
+ public enum TopicLinkDisplay31Opcode
+ {
+ None = 0x00,
+ ///
+ /// long vfldNumber 0 = {vfld} n = {vfld n}
+ ///
+ VFldNumber = 0x20,
+ ///
+ /// short dtypeNumber 0 = {dtype} n = {dtype n}
+ ///
+ DTypeNumber = 0x21,
+ ///
+ /// short FontNumber index into Descriptor array of internal |FONT file
+ ///
+ FontNumber = 0x80,
+ ///
+ /// No firstlineindent / spacingabove on next paragraph
+ ///
+ LineBreak = 0x81,
+ ///
+ /// Next paragraph has same Paragraphinfo as this one
+ ///
+ EndOfParagraph = 0x82,
+ ///
+ /// Jump to next tab stop
+ ///
+ Tab = 0x83,
+ PictureCenter = 0x86,
+ PictureLeft = 0x87,
+ PictureRight = 0x88,
+ HotspotEnd = 0x89,
+
+ NonBreakingSpace = 0x8B,
+ NonBreakingHyphen = 0x8C,
+
+ ///
+ /// short Length; char MacroString[Length - 3];
+ ///
+ Macro = 0xC8,
+ ///
+ /// short Length; char MacroString[Length - 3];
+ ///
+ MacroWithoutFontChange = 0xCC,
+
+ ///
+ /// Popup jump
+ /// TOPICOFFSET TopicOffset
+ ///
+ PopupJump0xE0 = 0xE0,
+ ///
+ /// Topic jump
+ /// TOPICOFFSET TopicOffset
+ ///
+ TopicJump0xE1 = 0xE1,
+ ///
+ /// Popup jump
+ /// TOPICOFFSET TopicOffset
+ ///
+ PopupJump0xE2 = 0xE2,
+ ///
+ /// Topic jump
+ /// TOPICOFFSET TopicOffset
+ ///
+ PopupJump0xE3 = 0xE3,
+
+
+ ///
+ /// Popup jump without font change
+ /// TOPICOFFSET TopicOffset
+ ///
+ PopupJumpWithoutFontChange = 0xE6,
+ ///
+ /// Topic jump without font change
+ /// TOPICOFFSET TopicOffset
+ ///
+ TopicJumpWithoutFontChange = 0xE7,
+
+
+ ///
+ /// Popup jump into external file
+ /// short SizeOfFollowingStruct
+ /// struct
+ /// {
+ /// unsigned char Type 0, 1, 4 or 6
+ /// TOPICOFFSET TopicOffset
+ /// unsigned char WindowNumber only if Type = 1
+ /// STRINGZ NameOfExternalFile only if Type = 4 or 6
+ /// STRINGZ WindowName only if Type = 6
+ /// }
+ ///
+ PopupJumpIntoExternalFile = 0xEA,
+ ///
+ /// Popup jump into external file without font change
+ /// short SizeOfFollowingStruct
+ /// struct
+ /// {
+ /// unsigned char Type 0, 1, 4 or 6
+ /// TOPICOFFSET TopicOffset
+ /// unsigned char WindowNumber only if Type = 1
+ /// STRINGZ NameOfExternalFile only if Type = 4 or 6
+ /// STRINGZ WindowName only if Type = 6
+ /// }
+ ///
+ PopupJumpIntoExternalFileWithoutFontChange = 0xEB,
+ ///
+ /// Topic jump into external file / secondary window
+ /// short SizeOfFollowingStruct
+ /// struct
+ /// {
+ /// unsigned char Type 0, 1, 4 or 6
+ /// TOPICOFFSET TopicOffset
+ /// unsigned char WindowNumber only if Type = 1
+ /// STRINGZ NameOfExternalFile only if Type = 4 or 6
+ /// STRINGZ WindowName only if Type = 6
+ /// }
+ ///
+ TopicJumpIntoExternalFileSecondaryWindow = 0xEE,
+ ///
+ /// Topic jump into external file / secondary window without font change
+ /// short SizeOfFollowingStruct
+ /// struct
+ /// {
+ /// unsigned char Type 0, 1, 4 or 6
+ /// TOPICOFFSET TopicOffset
+ /// unsigned char WindowNumber only if Type = 1
+ /// STRINGZ NameOfExternalFile only if Type = 4 or 6
+ /// STRINGZ WindowName only if Type = 6
+ /// }
+ ///
+ TopicJumpIntoExternalFileSecondaryWindowWithoutFontChange = 0xEF,
+
+ ///
+ /// End of character formatting. Proceed with next Paragraphinfo if RecordType is 0x23, else you are done.
+ ///
+ EndOfCharacterFormatting = 0xFF
+ }
+}
diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/UniversalEditor.Plugins.Microsoft.csproj b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/UniversalEditor.Plugins.Microsoft.csproj
index 48fdf23d..a678186f 100644
--- a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/UniversalEditor.Plugins.Microsoft.csproj
+++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/UniversalEditor.Plugins.Microsoft.csproj
@@ -72,6 +72,9 @@
+
+
+