Merge branch 'master' of github.com:alcexhim/UniversalEditor
This commit is contained in:
commit
c152cc4e9c
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UniversalEditor Version="4.0">
|
||||
<Associations>
|
||||
<Association>
|
||||
<Filters>
|
||||
<Filter Title="WinHelp documentation file">
|
||||
<FileNameFilters>
|
||||
<FileNameFilter>*.hlp</FileNameFilter>
|
||||
</FileNameFilters>
|
||||
<MagicByteSequences>
|
||||
<MagicByteSequence>
|
||||
<MagicByte Type="HexString">3F5F0300</MagicByte>
|
||||
</MagicByteSequence>
|
||||
</MagicByteSequences>
|
||||
</Filter>
|
||||
</Filters>
|
||||
<ObjectModels>
|
||||
<ObjectModel TypeName="UniversalEditor.ObjectModels.Help.Compiled.CompiledHelpObjectModel" />
|
||||
<!-- <ObjectModel TypeName="UniversalEditor.ObjectModels.FileSystem.FileSystemObjectModel" /> -->
|
||||
</ObjectModels>
|
||||
<DataFormats>
|
||||
<DataFormat TypeName="UniversalEditor.DataFormats.Help.Compiled.WinHelp.HLPDataFormat" />
|
||||
<!-- <DataFormat TypeName="UniversalEditor.DataFormats.FileSystem.BPlus.BPlusFileSystemDataFormat" /> -->
|
||||
</DataFormats>
|
||||
</Association>
|
||||
</Associations>
|
||||
</UniversalEditor>
|
||||
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UniversalEditor Version="4.0">
|
||||
<Associations>
|
||||
<Association>
|
||||
<Filters>
|
||||
<Filter Title="B+ file system">
|
||||
<MagicByteSequences>
|
||||
<MagicByteSequence>
|
||||
<MagicByte Type="HexString">3F5F0300</MagicByte>
|
||||
</MagicByteSequence>
|
||||
</MagicByteSequences>
|
||||
</Filter>
|
||||
</Filters>
|
||||
<ObjectModels>
|
||||
<ObjectModel TypeName="UniversalEditor.ObjectModels.FileSystem.FileSystemObjectModel" />
|
||||
</ObjectModels>
|
||||
<DataFormats>
|
||||
<DataFormat TypeName="UniversalEditor.DataFormats.FileSystem.BPlus.BPlusFileSystemDataFormat" />
|
||||
</DataFormats>
|
||||
</Association>
|
||||
</Associations>
|
||||
</UniversalEditor>
|
||||
@ -106,7 +106,6 @@
|
||||
<Content Include="Extensions\FileSystem\Associations\ARC.uexml" />
|
||||
<Content Include="Extensions\FileSystem\Associations\Archive.uexml" />
|
||||
<Content Include="Extensions\FileSystem\Associations\ARJ.uexml" />
|
||||
<Content Include="Extensions\FileSystem\Associations\BPlus.uexml" />
|
||||
<Content Include="Extensions\FileSystem\Associations\CFL.uexml" />
|
||||
<Content Include="Extensions\FileSystem\Associations\BinHex.uexml" />
|
||||
<Content Include="Extensions\FileSystem\Associations\CPIO.uexml" />
|
||||
@ -670,6 +669,9 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Extensions\SoftwareDeveloper\Associations\ExecutableObjectModel\RelocatableObject.uexml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Extensions\DocumentationWriter\Associations\WinHelp.uexml" />
|
||||
</ItemGroup>
|
||||
<Target Name="Build">
|
||||
<Copy SourceFiles="@(Content)" DestinationFiles="@(Content->'$(OutputPath)%(RelativeDir)%(Filename)%(Extension)')" />
|
||||
</Target>
|
||||
|
||||
@ -143,6 +143,35 @@ namespace UniversalEditor
|
||||
/// </summary>
|
||||
public DataFormatReference.DataFormatReferenceCollection DataFormats { get { return mvarDataFormats; } }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append('[');
|
||||
for (int i = 0; i < mvarFilters.Count; i++)
|
||||
{
|
||||
sb.Append(mvarFilters[i].Title);
|
||||
if (i < mvarFilters.Count - 1) sb.Append(", ");
|
||||
}
|
||||
sb.Append(']');
|
||||
sb.Append(' ');
|
||||
sb.Append('{');
|
||||
for (int i = 0; i < mvarObjectModels.Count; i++)
|
||||
{
|
||||
sb.Append(mvarObjectModels[i].TypeName);
|
||||
if (i < mvarObjectModels.Count - 1) sb.Append(", ");
|
||||
}
|
||||
sb.Append('}');
|
||||
sb.Append(' ');
|
||||
sb.Append('(');
|
||||
for (int i = 0; i < mvarDataFormats.Count; i++)
|
||||
{
|
||||
sb.Append(mvarDataFormats[i].TypeName);
|
||||
if (i < mvarDataFormats.Count - 1) sb.Append(", ");
|
||||
}
|
||||
sb.Append(')');
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static Association[] FromCriteria(AssociationCriteria ac)
|
||||
{
|
||||
List<Association> associations = new List<Association>();
|
||||
|
||||
@ -9,6 +9,23 @@ namespace UniversalEditor.UserInterface
|
||||
private static System.Collections.Specialized.StringCollection mvarTemporaryFileNames = new System.Collections.Specialized.StringCollection();
|
||||
private static string mvarTemporaryFilePath = null;
|
||||
|
||||
private static string SanitizeFileName(string FileName)
|
||||
{
|
||||
if (String.IsNullOrEmpty(FileName)) return "_";
|
||||
string[] invalidCharacters = new string[]
|
||||
{
|
||||
"\\", "/", ":", "*", "\"", "<", ">", "?", "|"
|
||||
};
|
||||
foreach (string invalidCharacter in invalidCharacters)
|
||||
{
|
||||
FileName = FileName.Replace(invalidCharacter, "_");
|
||||
}
|
||||
|
||||
// Check twice because we might have encountered a filename consisting solely of invalid chars (weird, but possible)
|
||||
if (String.IsNullOrEmpty(FileName)) return "_";
|
||||
return FileName;
|
||||
}
|
||||
|
||||
public static string CreateTemporaryFile(string FileName, byte[] FileData = null)
|
||||
{
|
||||
if (mvarTemporaryFilePath == null) throw new InvalidOperationException();
|
||||
@ -17,6 +34,7 @@ namespace UniversalEditor.UserInterface
|
||||
System.IO.Directory.CreateDirectory(mvarTemporaryFilePath);
|
||||
}
|
||||
|
||||
FileName = SanitizeFileName(FileName);
|
||||
FileName = System.IO.Path.GetFileName(FileName);
|
||||
|
||||
string filePath = mvarTemporaryFilePath + System.IO.Path.DirectorySeparatorChar.ToString() + FileName;
|
||||
|
||||
@ -20,6 +20,8 @@ namespace UniversalEditor.DataFormats.FileSystem.BPlus
|
||||
{
|
||||
_dfr = base.MakeReferenceInternal();
|
||||
_dfr.Capabilities.Add(typeof(FileSystemObjectModel), DataFormatCapabilities.All);
|
||||
_dfr.Sources.Add("Based on documentation contributed by M. Winterhoff, Pete Davis, Holger Haase, and Bent Lynggaard.");
|
||||
_dfr.Sources.Add("http://sourceforge.net/projects/helpdeco/");
|
||||
}
|
||||
return _dfr;
|
||||
}
|
||||
|
||||
@ -0,0 +1,352 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using UniversalEditor.Accessors;
|
||||
using UniversalEditor.IO;
|
||||
|
||||
using UniversalEditor.DataFormats.FileSystem.BPlus;
|
||||
|
||||
using UniversalEditor.ObjectModels.FileSystem;
|
||||
using UniversalEditor.ObjectModels.Help.Compiled;
|
||||
|
||||
namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp
|
||||
{
|
||||
/// <summary>
|
||||
/// The Windows Help (WinHelp) HLP data format. Much of the framework for reading these files is contained in BPlusFileSystemDataFormat, since the container file format
|
||||
/// itself is remarkably generic (albeit unused, as far as I can tell, apart from WinHelp files), but WinHelp-specific stuff is here.
|
||||
/// </summary>
|
||||
public class HLPDataFormat : BPlusFileSystemDataFormat
|
||||
{
|
||||
private static DataFormatReference _dfr = null;
|
||||
protected override DataFormatReference MakeReferenceInternal()
|
||||
{
|
||||
if (_dfr == null)
|
||||
{
|
||||
_dfr = new DataFormatReference(GetType());
|
||||
_dfr.Capabilities.Add(typeof(CompiledHelpObjectModel), DataFormatCapabilities.All);
|
||||
}
|
||||
return _dfr;
|
||||
}
|
||||
|
||||
protected override void BeforeLoadInternal(Stack<ObjectModel> objectModels)
|
||||
{
|
||||
base.BeforeLoadInternal(objectModels);
|
||||
objectModels.Push(new FileSystemObjectModel());
|
||||
}
|
||||
protected override void AfterLoadInternal(Stack<ObjectModel> objectModels)
|
||||
{
|
||||
base.AfterLoadInternal(objectModels);
|
||||
|
||||
FileSystemObjectModel fsom = (objectModels.Pop() as FileSystemObjectModel);
|
||||
CompiledHelpObjectModel help = (objectModels.Pop() as CompiledHelpObjectModel);
|
||||
|
||||
bool compressed = false;
|
||||
int topicBlockSize = 0;
|
||||
|
||||
#region System Header
|
||||
{
|
||||
File fileSystem = fsom.Files["|SYSTEM"];
|
||||
byte[] dataSystem = fileSystem.GetData();
|
||||
|
||||
MemoryAccessor maSystem = new MemoryAccessor(dataSystem);
|
||||
Reader readerSystem = new Reader(maSystem);
|
||||
|
||||
Internal.SYSTEMHEADER systemHeader = ReadSYSTEMHEADER(readerSystem);
|
||||
|
||||
if (systemHeader.Version.Minor <= 16)
|
||||
{
|
||||
// not compressed
|
||||
compressed = false;
|
||||
topicBlockSize = 2048;
|
||||
}
|
||||
else if (systemHeader.Version.Minor > 16)
|
||||
{
|
||||
if (systemHeader.Flags == Internal.SystemHeaderFlags.None)
|
||||
{
|
||||
compressed = false;
|
||||
topicBlockSize = 4096;
|
||||
}
|
||||
else if (systemHeader.Flags == Internal.SystemHeaderFlags.CompressedLZ77TopicBlockSize4k)
|
||||
{
|
||||
compressed = true;
|
||||
topicBlockSize = 4096;
|
||||
}
|
||||
else if (systemHeader.Flags == Internal.SystemHeaderFlags.CompressedLZ77TopicBlockSize2k)
|
||||
{
|
||||
compressed = true;
|
||||
topicBlockSize = 2048;
|
||||
}
|
||||
}
|
||||
|
||||
if (systemHeader.Version.Minor <= 16)
|
||||
{
|
||||
// help file title follows SYSTEMHEADER
|
||||
string helpFileTitle = readerSystem.ReadNullTerminatedString();
|
||||
}
|
||||
else
|
||||
{
|
||||
// If Minor is above 16, one or more SYSTEMREC records follow instead up to the internal end of the |SYSTEM file:
|
||||
while (!readerSystem.EndOfStream)
|
||||
{
|
||||
Internal.SYSTEMRECORD systemRecord = ReadSYSTEMRECORD(readerSystem);
|
||||
switch (systemRecord.RecordType)
|
||||
{
|
||||
case Internal.SystemRecordType.Title:
|
||||
{
|
||||
help.Title = System.Text.Encoding.Default.GetString(systemRecord.Data).TrimNull();
|
||||
break;
|
||||
}
|
||||
case Internal.SystemRecordType.Copyright:
|
||||
{
|
||||
help.Copyright = System.Text.Encoding.Default.GetString(systemRecord.Data).TrimNull();
|
||||
break;
|
||||
}
|
||||
case Internal.SystemRecordType.Contents:
|
||||
{
|
||||
int topicOffset = BitConverter.ToInt32(systemRecord.Data, 0);
|
||||
break;
|
||||
}
|
||||
case Internal.SystemRecordType.Config:
|
||||
{
|
||||
string macro = System.Text.Encoding.Default.GetString(systemRecord.Data).TrimNull();
|
||||
// help.Macros.Add(macro);
|
||||
break;
|
||||
}
|
||||
case Internal.SystemRecordType.Icon:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case Internal.SystemRecordType.Window:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case Internal.SystemRecordType.Citation:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case Internal.SystemRecordType.LanguageID:
|
||||
{
|
||||
MemoryAccessor maSystemRecord = new MemoryAccessor(systemRecord.Data);
|
||||
Reader readerSystemRecord = new Reader(maSystemRecord);
|
||||
ushort[] langaugeIDs = readerSystemRecord.ReadUInt16Array((int)((double)systemRecord.Data.Length / 2));
|
||||
break;
|
||||
}
|
||||
case Internal.SystemRecordType.TableOfContents:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case Internal.SystemRecordType.CharacterSet:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Font File
|
||||
{
|
||||
File file = fsom.Files["|FONT"];
|
||||
byte[] data = file.GetData();
|
||||
|
||||
MemoryAccessor ma = new MemoryAccessor(data);
|
||||
Reader reader = new Reader(ma);
|
||||
|
||||
Internal.FONTHEADER fontHeader = ReadFONTHEADER(reader);
|
||||
List<string> faceNames = new List<string>();
|
||||
reader.Seek(fontHeader.FacenamesOffset, SeekOrigin.Begin);
|
||||
int faceNameLength = (int)((double)(fontHeader.DescriptorsOffset - fontHeader.FacenamesOffset) / fontHeader.NumFacenames);
|
||||
for (int i = 0; i < fontHeader.NumFacenames; i++)
|
||||
{
|
||||
string faceName = reader.ReadFixedLengthString(faceNameLength).TrimNull();
|
||||
faceNames.Add(faceName);
|
||||
}
|
||||
|
||||
if (fontHeader.FacenamesOffset >= 12)
|
||||
{
|
||||
// Multimedia MVB files use different structures to store font descriptors. Assume this structure for descriptors if FacenamesOffset is at least 12.
|
||||
// If this kind of descriptor is used, any metric is given in twips.
|
||||
}
|
||||
else
|
||||
{
|
||||
List<Internal.OLDFONT> listFonts = new List<Internal.OLDFONT>();
|
||||
|
||||
// At DescriptorsOffset is an array located describing all fonts used in the help file.
|
||||
// If this kind of descriptor appears in a help file, any metric value is given in HalfPoints.
|
||||
reader.Seek(fontHeader.DescriptorsOffset, SeekOrigin.Begin);
|
||||
for (int i = 0; i < fontHeader.NumDescriptors; i++)
|
||||
{
|
||||
Internal.OLDFONT font = ReadOLDFONT(reader);
|
||||
listFonts.Add(font);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Topic File
|
||||
{
|
||||
File file = fsom.Files["|TOPIC"];
|
||||
byte[] data = file.GetData();
|
||||
|
||||
MemoryAccessor ma = new MemoryAccessor(data);
|
||||
Reader reader = new Reader(ma);
|
||||
|
||||
Internal.TOPICBLOCKHEADER topicBlockHeader = ReadTOPICBLOCKHEADER(reader);
|
||||
|
||||
while (!reader.EndOfStream)
|
||||
{
|
||||
Internal.TOPICLINK topicLink = ReadTOPICLINK(reader);
|
||||
|
||||
switch (topicLink.RecordType)
|
||||
{
|
||||
case Internal.TopicLinkRecordType.TopicHeader:
|
||||
{
|
||||
Internal.TOPICHEADER topicHeader = ReadTOPICHEADER(reader);
|
||||
|
||||
// The LinkData2 of Topic RecordType 2 contains NUL terminated strings. The first string is the topic title, the next strings contain all macros to be
|
||||
// executed on opening this topic (specified using the ! footnote).
|
||||
string datastr = reader.ReadFixedLengthString(topicLink.DataLen2);
|
||||
string[] datastrs = datastr.Split(new char[] { '\0' });
|
||||
|
||||
string topicTitle = datastrs[0];
|
||||
List<string> macros = new List<string>();
|
||||
for (int i = 1; i < datastrs.Length; i++)
|
||||
{
|
||||
macros.Add(datastrs[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Internal.TopicLinkRecordType.Display31:
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
// end of character formatting. proceed with next ParagraphInfo if RecordType is 0x23, else you are done
|
||||
string value = reader.ReadNullTerminatedString();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
private Internal.TOPICHEADER ReadTOPICHEADER(Reader reader)
|
||||
{
|
||||
Internal.TOPICHEADER item = new Internal.TOPICHEADER();
|
||||
item.BlockSize = reader.ReadInt32();
|
||||
item.BrowseSequencePreviousTopic = reader.ReadInt32();
|
||||
item.BrowseSequenceNextTopic = reader.ReadInt32();
|
||||
item.TopicNum = reader.ReadInt32();
|
||||
item.NonScrollingRegionOffset = reader.ReadInt32();
|
||||
item.ScrollingRegionOffset = reader.ReadInt32();
|
||||
item.NextTopic = reader.ReadInt32();
|
||||
return item;
|
||||
}
|
||||
|
||||
private Internal.TOPICLINK ReadTOPICLINK(Reader reader)
|
||||
{
|
||||
Internal.TOPICLINK item = new Internal.TOPICLINK();
|
||||
item.BlockSize = reader.ReadInt32();
|
||||
item.DataLen2 = reader.ReadInt32();
|
||||
item.PrevBlock = reader.ReadInt32();
|
||||
item.NextBlock = reader.ReadInt32();
|
||||
item.DataLen1 = reader.ReadInt32();
|
||||
item.RecordType = (Internal.TopicLinkRecordType)reader.ReadByte();
|
||||
return item;
|
||||
}
|
||||
|
||||
private Internal.TOPICBLOCKHEADER ReadTOPICBLOCKHEADER(Reader reader)
|
||||
{
|
||||
Internal.TOPICBLOCKHEADER item = new Internal.TOPICBLOCKHEADER();
|
||||
item.LastTopicLink = reader.ReadInt32();
|
||||
item.FirstTopicLink = reader.ReadInt32();
|
||||
item.LastTopicHeader = reader.ReadInt32();
|
||||
return item;
|
||||
}
|
||||
|
||||
private Internal.OLDFONT ReadOLDFONT(Reader reader)
|
||||
{
|
||||
Internal.OLDFONT item = new Internal.OLDFONT();
|
||||
item.Attributes = (Internal.FontAttributes)reader.ReadByte();
|
||||
item.HalfPoints = reader.ReadByte(); // PointSize * 2
|
||||
item.FontFamily = (Internal.FontFamily)reader.ReadByte();
|
||||
item.FacenameIndex = reader.ReadUInt16();
|
||||
item.ForegroundColor = reader.ReadBytes(3);
|
||||
item.BackgroundColor = reader.ReadBytes(3);
|
||||
return item;
|
||||
}
|
||||
|
||||
private Internal.FONTHEADER ReadFONTHEADER(Reader reader)
|
||||
{
|
||||
Internal.FONTHEADER item = new Internal.FONTHEADER();
|
||||
item.NumFacenames = reader.ReadUInt16();
|
||||
item.NumDescriptors = reader.ReadUInt16();
|
||||
item.FacenamesOffset = reader.ReadUInt16();
|
||||
item.DescriptorsOffset = reader.ReadUInt16();
|
||||
if (item.FacenamesOffset >= 12)
|
||||
{
|
||||
item.NumStyles = reader.ReadUInt16();
|
||||
item.StyleOffset = reader.ReadUInt16();
|
||||
if (item.FacenamesOffset >= 16)
|
||||
{
|
||||
item.NumCharMapTables = reader.ReadUInt16();
|
||||
item.CharMapTableOffset = reader.ReadUInt16();
|
||||
}
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
private Internal.SYSTEMHEADER ReadSYSTEMHEADER(Reader reader)
|
||||
{
|
||||
Internal.SYSTEMHEADER item = new Internal.SYSTEMHEADER();
|
||||
|
||||
short magic = reader.ReadInt16();
|
||||
if (magic != 0x036C) throw new InvalidDataFormatException("|SYSTEM header does not begin with { 0x6C, 0x03 }");
|
||||
|
||||
short minorVersion = reader.ReadInt16();
|
||||
short majorVersion = reader.ReadInt16();
|
||||
item.Version = new Version(majorVersion, minorVersion);
|
||||
|
||||
int GenDate = reader.ReadInt32();
|
||||
item.GenDate = time_tToDateTime(GenDate);
|
||||
item.Flags = (Internal.SystemHeaderFlags)reader.ReadUInt16();
|
||||
|
||||
return item;
|
||||
}
|
||||
private Internal.SYSTEMRECORD ReadSYSTEMRECORD(Reader reader)
|
||||
{
|
||||
Internal.SYSTEMRECORD item = new Internal.SYSTEMRECORD();
|
||||
item.RecordType = (Internal.SystemRecordType)reader.ReadUInt16();
|
||||
item.DataSize = reader.ReadUInt16();
|
||||
item.Data = reader.ReadBytes(item.DataSize);
|
||||
return item;
|
||||
}
|
||||
|
||||
private DateTime time_tToDateTime(int time_t)
|
||||
{
|
||||
// hory shet
|
||||
// http://blogs.msdn.com/b/brada/archive/2003/07/30/50205.aspx
|
||||
long win32FileTime = 10000000 * (long)time_t + 116444736000000000;
|
||||
return DateTime.FromFileTimeUtc(win32FileTime);
|
||||
}
|
||||
protected override void BeforeSaveInternal(Stack<ObjectModel> objectModels)
|
||||
{
|
||||
base.BeforeSaveInternal(objectModels);
|
||||
|
||||
CompiledHelpObjectModel help = (objectModels.Pop() as CompiledHelpObjectModel);
|
||||
FileSystemObjectModel fsom = new FileSystemObjectModel();
|
||||
|
||||
objectModels.Push(fsom);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp.Internal
|
||||
{
|
||||
public struct FONTHEADER
|
||||
{
|
||||
/// <summary>
|
||||
/// Number of face names
|
||||
/// </summary>
|
||||
public ushort NumFacenames;
|
||||
/// <summary>
|
||||
/// Number of font descriptors
|
||||
/// </summary>
|
||||
public ushort NumDescriptors;
|
||||
/// <summary>
|
||||
/// Start of array of face names relative to &NumFacenames
|
||||
/// </summary>
|
||||
public ushort FacenamesOffset;
|
||||
/// <summary>
|
||||
/// Start of array of font descriptors relative to &NumFacenames
|
||||
/// </summary>
|
||||
public ushort DescriptorsOffset;
|
||||
|
||||
// only if FacenamesOffset >= 12
|
||||
/// <summary>
|
||||
/// Number of style descriptors
|
||||
/// </summary>
|
||||
public ushort NumStyles;
|
||||
/// <summary>
|
||||
/// Start of array of style descriptors relative to &NumFacenames
|
||||
/// </summary>
|
||||
public ushort StyleOffset;
|
||||
|
||||
// only if FacenamesOffset >= 16
|
||||
/// <summary>
|
||||
/// Number of character mapping tables
|
||||
/// </summary>
|
||||
public ushort NumCharMapTables;
|
||||
/// <summary>
|
||||
/// Start of array of character mapping table names relative to &NumFacenames
|
||||
/// </summary>
|
||||
public ushort CharMapTableOffset;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp.Internal
|
||||
{
|
||||
[Flags()]
|
||||
public enum FontAttributes : byte
|
||||
{
|
||||
None = 0x00,
|
||||
Bold = 0x01,
|
||||
Italic = 0x02,
|
||||
Underline = 0x04,
|
||||
Strikeout = 0x08,
|
||||
DoubleUnderline = 0x10,
|
||||
SmallCaps = 0x20
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp.Internal
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a different order than FF_ROMAN, FF_SWISS, etc. of Windows!
|
||||
/// </summary>
|
||||
public enum FontFamily : byte
|
||||
{
|
||||
Modern = 0x01,
|
||||
Roman = 0x02,
|
||||
Swiss = 0x03,
|
||||
Tech = 0x03,
|
||||
Nil = 0x03,
|
||||
Script = 0x04,
|
||||
Decor = 0x05
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp.Internal
|
||||
{
|
||||
public struct OLDFONT
|
||||
{
|
||||
public FontAttributes Attributes;
|
||||
public byte HalfPoints;
|
||||
public FontFamily FontFamily;
|
||||
public ushort FacenameIndex;
|
||||
/// <summary>
|
||||
/// RGB values of foreground
|
||||
/// </summary>
|
||||
public byte[] ForegroundColor;
|
||||
/// <summary>
|
||||
/// Unused background RGB Values
|
||||
/// </summary>
|
||||
public byte[] BackgroundColor;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp.Internal
|
||||
{
|
||||
public struct SYSTEMHEADER
|
||||
{
|
||||
public Version Version;
|
||||
public DateTime GenDate;
|
||||
public SystemHeaderFlags Flags;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp.Internal
|
||||
{
|
||||
public struct SYSTEMRECORD
|
||||
{
|
||||
public int SavePos;
|
||||
public int Remaining;
|
||||
public SystemRecordType RecordType;
|
||||
public ushort DataSize;
|
||||
public byte[] Data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp.Internal
|
||||
{
|
||||
[Flags()]
|
||||
public enum SystemHeaderFlags
|
||||
{
|
||||
None = 0,
|
||||
CompressedLZ77TopicBlockSize4k = 4,
|
||||
CompressedLZ77TopicBlockSize2k = 8
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp.Internal
|
||||
{
|
||||
public enum SystemRecordType : ushort
|
||||
{
|
||||
/// <summary>
|
||||
/// Help file title
|
||||
/// </summary>
|
||||
Title = 1,
|
||||
/// <summary>
|
||||
/// Copyright notice shown in AboutBox
|
||||
/// </summary>
|
||||
Copyright = 2,
|
||||
/// <summary>
|
||||
/// Topic offset of starting topic
|
||||
/// </summary>
|
||||
Contents = 3,
|
||||
/// <summary>
|
||||
/// All macros executed on opening
|
||||
/// </summary>
|
||||
Config = 4,
|
||||
/// <summary>
|
||||
/// See WIN31WH on icon file format
|
||||
/// </summary>
|
||||
Icon = 5,
|
||||
/// <summary>
|
||||
/// Windows defined in the HPJ-file; Viewer 2.0 Windows defined in MVP-file
|
||||
/// </summary>
|
||||
Window = 6,
|
||||
/// <summary>
|
||||
/// The Citation printed
|
||||
/// </summary>
|
||||
Citation = 8,
|
||||
/// <summary>
|
||||
/// Language ID, Windows 95 (HCW 4.00)
|
||||
/// </summary>
|
||||
LanguageID = 9,
|
||||
/// <summary>
|
||||
/// CNT file name, Windows 95 (HCW 4.00)
|
||||
/// </summary>
|
||||
TableOfContents = 10,
|
||||
/// <summary>
|
||||
/// Charset, Windows 95 (HCW 4.00)
|
||||
/// </summary>
|
||||
CharacterSet = 11,
|
||||
/// <summary>
|
||||
/// Default dialog font, Windows 95 (HCW 4.00); Multimedia Help Files dtypes
|
||||
/// </summary>
|
||||
DefaultDialogFontOrFTIndex = 12,
|
||||
/// <summary>
|
||||
/// Defined GROUPs, Multimedia Help File
|
||||
/// </summary>
|
||||
Groups = 13,
|
||||
/// <summary>
|
||||
/// Separators, Windows 95 (HCW 4.00); Multimedia Help Files
|
||||
/// </summary>
|
||||
IndexSeparatorsOrKeyIndex = 14,
|
||||
/// <summary>
|
||||
/// Defined language, Multimedia Help Files
|
||||
/// </summary>
|
||||
Language = 18,
|
||||
/// <summary>
|
||||
/// Defined DLLMAPS, Multimedia Help Files
|
||||
/// </summary>
|
||||
DLLMaps = 19
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp.Internal
|
||||
{
|
||||
public struct TOPICBLOCKHEADER
|
||||
{
|
||||
/// <summary>
|
||||
/// Points to last TOPICLINK in previous block
|
||||
/// </summary>
|
||||
public int LastTopicLink;
|
||||
/// <summary>
|
||||
/// Points to first TOPICLINK in this block
|
||||
/// </summary>
|
||||
public int FirstTopicLink;
|
||||
/// <summary>
|
||||
/// Points to TOPICLINK of last TOPICHEADER
|
||||
/// </summary>
|
||||
public int LastTopicHeader;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp.Internal
|
||||
{
|
||||
public struct TOPICHEADER
|
||||
{
|
||||
/// <summary>
|
||||
/// Size of topic, including internal topic links
|
||||
/// </summary>
|
||||
public int BlockSize;
|
||||
/// <summary>
|
||||
/// Topic offset for prev topic in browse sequence
|
||||
/// </summary>
|
||||
public int BrowseSequencePreviousTopic;
|
||||
/// <summary>
|
||||
/// Topic offset for next topic in browse sequence
|
||||
/// </summary>
|
||||
public int BrowseSequenceNextTopic;
|
||||
/// <summary>
|
||||
/// Topic number
|
||||
/// </summary>
|
||||
public int TopicNum;
|
||||
/// <summary>
|
||||
/// Start of non-scrolling region (topic offset) or -1
|
||||
/// </summary>
|
||||
public int NonScrollingRegionOffset;
|
||||
/// <summary>
|
||||
/// Start of scrolling region (topic offset)
|
||||
/// </summary>
|
||||
public int ScrollingRegionOffset;
|
||||
/// <summary>
|
||||
/// Start of next type 2 record
|
||||
/// </summary>
|
||||
public int NextTopic;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp.Internal
|
||||
{
|
||||
public struct TOPICLINK
|
||||
{
|
||||
/// <summary>
|
||||
/// Size of this link + LinkData1 + LinkData2
|
||||
/// </summary>
|
||||
public int BlockSize;
|
||||
/// <summary>
|
||||
/// Length of decompressed LinkData2
|
||||
/// </summary>
|
||||
public int DataLen2;
|
||||
/// <summary>
|
||||
/// Windows 3.0 (HC30): number of bytes the TOPICLINK of the previous block is located before this TOPICLINK, that is the block size of the previous TOPICLINK plus
|
||||
/// eventually skipped TOPICBLOCKHEADER.
|
||||
/// Windows 3.1 (HC31): TOPICPOS of previous TOPICLINK
|
||||
/// </summary>
|
||||
public int PrevBlock;
|
||||
/// <summary>
|
||||
/// Windows 3.0 (HC30): number of bytes the TOPICLINK of the next block is located behind this block, including skipped TOPICBLOCKHEADER.
|
||||
/// Windows 3.1 (HC31): TOPICPOS of next TOPICLINK
|
||||
/// </summary>
|
||||
public int NextBlock;
|
||||
/// <summary>
|
||||
/// includes size of TOPICLINK
|
||||
/// </summary>
|
||||
public int DataLen1;
|
||||
public TopicLinkRecordType RecordType;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.DataFormats.Help.Compiled.WinHelp.Internal
|
||||
{
|
||||
public enum TopicLinkRecordType : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// Version 3.0 displayable information
|
||||
/// </summary>
|
||||
Display30 = 0x01,
|
||||
/// <summary>
|
||||
/// Topic header information
|
||||
/// </summary>
|
||||
TopicHeader = 0x02,
|
||||
/// <summary>
|
||||
/// Version 3.1 displayable information
|
||||
/// </summary>
|
||||
Display31 = 0x20,
|
||||
/// <summary>
|
||||
/// Version 3.1 table
|
||||
/// </summary>
|
||||
Table31 = 0x23
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.ObjectModels.Help.Compiled
|
||||
{
|
||||
public class CompiledHelpObjectModel : ObjectModel
|
||||
{
|
||||
private static ObjectModelReference _omr = null;
|
||||
protected override ObjectModelReference MakeReferenceInternal()
|
||||
{
|
||||
if (_omr == null)
|
||||
{
|
||||
_omr = base.MakeReferenceInternal();
|
||||
_omr.Title = "WinHelp compiled documentation file";
|
||||
_omr.Path = new string[] { "Documentation Writer", "Compiled Documentation" };
|
||||
}
|
||||
return _omr;
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
|
||||
public override void CopyTo(ObjectModel where)
|
||||
{
|
||||
}
|
||||
|
||||
private string mvarTitle = String.Empty;
|
||||
public string Title { get { return mvarTitle; } set { mvarTitle = value; } }
|
||||
|
||||
private string mvarCopyright = String.Empty;
|
||||
public string Copyright { get { return mvarCopyright; } set { mvarCopyright = value; } }
|
||||
}
|
||||
}
|
||||
@ -60,6 +60,19 @@
|
||||
<Compile Include="DataFormats\FileSystem\Microsoft\WindowsImage\WIMResourceHeaderDiskFlags.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\Microsoft\WindowsImage\WIMResourceHeaderDiskShort.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\Microsoft\WindowsImage\WIMStreamEntry.cs" />
|
||||
<Compile Include="DataFormats\Help\Compiled\WinHelp\HLPDataFormat.cs" />
|
||||
<Compile Include="DataFormats\Help\Compiled\WinHelp\Internal\FontAttributes.cs" />
|
||||
<Compile Include="DataFormats\Help\Compiled\WinHelp\Internal\FontFamily.cs" />
|
||||
<Compile Include="DataFormats\Help\Compiled\WinHelp\Internal\FONTHEADER.cs" />
|
||||
<Compile Include="DataFormats\Help\Compiled\WinHelp\Internal\OLDFONT.cs" />
|
||||
<Compile Include="DataFormats\Help\Compiled\WinHelp\Internal\SYSTEMHEADER.cs" />
|
||||
<Compile Include="DataFormats\Help\Compiled\WinHelp\Internal\SystemHeaderFlags.cs" />
|
||||
<Compile Include="DataFormats\Help\Compiled\WinHelp\Internal\SYSTEMRECORD.cs" />
|
||||
<Compile Include="DataFormats\Help\Compiled\WinHelp\Internal\SystemRecordType.cs" />
|
||||
<Compile Include="DataFormats\Help\Compiled\WinHelp\Internal\TOPICBLOCKHEADER.cs" />
|
||||
<Compile Include="DataFormats\Help\Compiled\WinHelp\Internal\TOPICHEADER.cs" />
|
||||
<Compile Include="DataFormats\Help\Compiled\WinHelp\Internal\TOPICLINK.cs" />
|
||||
<Compile Include="DataFormats\Help\Compiled\WinHelp\Internal\TopicLinkRecordType.cs" />
|
||||
<Compile Include="DataFormats\Help\TableOfContents\V3\H1TDataFormat.cs" />
|
||||
<Compile Include="DataFormats\Shortcut\Microsoft\LNKDataFlags.cs" />
|
||||
<Compile Include="DataFormats\Shortcut\Microsoft\LNKDataFormat.cs" />
|
||||
@ -67,6 +80,7 @@
|
||||
<Compile Include="DataFormats\Shortcut\Microsoft\LNKHotkey.cs" />
|
||||
<Compile Include="DataFormats\Shortcut\Microsoft\LNKLocationFlags.cs" />
|
||||
<Compile Include="DataFormats\Shortcut\Microsoft\LNKWindowState.cs" />
|
||||
<Compile Include="ObjectModels\Help\Compiled\CompiledHelpObjectModel.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="DataFormats\Text\Formatted\XPS\XPSDataFormat.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user