using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace UniversalEditor.ObjectModels.Executable.ResourceBlocks { /// /// Specifies the general type of file. /// [Flags()] public enum VersionFileType : uint { /// /// The file type is unknown to Windows. /// Unknown = 0x00000000, /// /// The file contains an application. /// Application = 0x00000001, /// /// The file contains a dynamic-link library (DLL). /// DynamicLinkLibrary = 0x00000002, /// /// The file contains a device driver. If dwFileType is VFT_DRV, dwFileSubtype contains a more specific description of the driver. /// DeviceDriver = 0x00000003, /// /// The file contains a font. If dwFileType is VFT_FONT, dwFileSubtype contains a more specific description of the font file. /// Font = 0x00000004, /// /// The file contains a virtual device driver. /// VirtualDeviceDriver = 0x00000005, /// /// Unknown purpose. /// Reserved = 0x00000006, /// /// The file contains a static-link library. /// StaticLibrary = 0x00000007 } /// /// Specifies the function of the file. The possible values depend on the value of /// . If is /// , contains the virtual device identifier /// included in the virtual device control block. /// [Flags()] public enum VersionFileSubType : uint { /// /// The driver or font type is unknown by Windows. /// Unknown = 0x00000000, /// /// The file contains a printer driver or a raster font. /// DriverPrinter = 0x00000001, /// /// The file contains a keyboard driver or a vector font. /// DriverKeyboard = 0x00000002, /// /// The file contains a language driver or a TrueType font. /// DriverLanguage = 0x00000003, /// /// The file contains a display driver. /// DriverDisplay = 0x00000004, /// /// The file contains a mouse driver. /// DriverMouse = 0x00000005, /// /// The file contains a network driver. /// DriverNetwork = 0x00000006, /// /// The file contains a system driver. /// DriverSystem = 0x00000007, /// /// The file contains an installable driver. /// DriverInstallable = 0x00000008, /// /// The file contains a sound driver. /// DriverSound = 0x00000009, /// /// The file contains a communications driver. /// DriverCommunications = 0x0000000A, /// /// The file contains an input method driver. /// DriverInputMethod = 0x0000000B, /// /// The file contains a versioned printer driver. /// DriverPrinterVersioned = 0x0000000C, /// /// The file contains a printer driver or a raster font. /// FontRaster = 0x00000001, /// /// The file contains a keyboard driver or a vector font. /// FontVector = 0x00000002, /// /// The file contains a language driver or a TrueType font. /// FontTrueType = 0x00000003 } /// /// Specifies the operating system for which this file was designed. /// [Flags()] public enum VersionOperatingSystem : uint { /// /// The operating system for which the file was designed is unknown to Windows. /// Unknown = 0x00000000, /// /// The file was designed for MS-DOS. /// DOS = 0x00010000, /// /// The file was designed for Windows NT. /// WindowsNT = 0x00040000, /// /// The file was designed for 16-bit Windows. /// Windows16 = 0x00000001, /// /// The file was designed for the Win32 API. /// Windows32 = 0x00000004, /// /// The file was designed for 16-bit OS/2. /// OS216 = 0x00020000, /// /// The file was designed for 32-bit OS/2. /// OS232 = 0x00030000, /// /// The file was designed for 16-bit Presentation Manager. /// PresentationManager16 = 0x00000002, /// /// The file was designed for 32-bit Presentation Manager. /// PresentationManager32 = 0x00000003 } /// /// Contains a bitmask that specifies the Boolean attributes of the file. /// [Flags()] public enum VersionFileAttributes : uint { /// /// The file has no version flags set. /// None = 0x00, /// /// The file contains debugging information or is compiled with debugging features enabled. /// DebugMode = 0x01, /// /// The file has been modified and is not identical to the original shipping file of the same /// version number. /// Patched = 0x04, /// /// The file is a development version, not a commercially released product. /// PreRelease = 0x02, /// /// The file was not built using standard release procedures. If this flag is set, the /// StringFileInfo structure should contain a PrivateBuild entry. /// PrivateBuild = 0x08, /// /// The file's version structure was created dynamically; therefore, some of the members in /// this structure may be empty or incorrect. This flag should never be set in a file's /// VS_VERSION_INFO data. /// InformationInferred = 0x10, /// /// The file was built by the original company using standard release procedures but is a variation /// of the normal file of the same version number. If this flag is set, the StringFileInfo structure /// should contain a SpecialBuild entry. /// SpecialBuild = 0x20 } public abstract class VersionResourceChildBlock { public class VersionResourceChildBlockCollection : System.Collections.ObjectModel.Collection { } } public class VersionResourceFixedFileInfoBlock { private bool mvarEnabled = true; public bool Enabled { get { return mvarEnabled; } set { mvarEnabled = value; } } private Version mvarStructureVersion = new Version(); public Version StructureVersion { get { return mvarStructureVersion; } set { mvarStructureVersion = value; } } private Version mvarFileVersion = new Version(); public Version FileVersion { get { return mvarFileVersion; } set { mvarFileVersion = value; } } private Version mvarProductVersion = new Version(); public Version ProductVersion { get { return mvarProductVersion; } set { mvarProductVersion = value; } } private VersionFileAttributes mvarFileAttributes = VersionFileAttributes.None; /// /// Contains a bitmask that specifies the Boolean attributes of the file. /// public VersionFileAttributes FileAttributes { get { return mvarFileAttributes; } set { mvarFileAttributes = value; } } private VersionFileAttributes mvarValidFileAttributes = VersionFileAttributes.None; /// /// Contains a bitmask that specifies the valid Boolean attributes of the file. An attribute is valid only if it was defined when the file was created. /// public VersionFileAttributes ValidFileAttributes { get { return mvarValidFileAttributes; } set { mvarValidFileAttributes = value; } } private VersionOperatingSystem mvarOperatingSystem = VersionOperatingSystem.Unknown; /// /// Specifies the operating system for which this file was designed. /// public VersionOperatingSystem OperatingSystem { get { return mvarOperatingSystem; } set { mvarOperatingSystem = value; } } private VersionFileType mvarFileType = VersionFileType.Unknown; /// /// Specifies the general type of file. /// public VersionFileType FileType { get { return mvarFileType; } set { mvarFileType = value; } } private VersionFileSubType mvarFileSubType = VersionFileSubType.Unknown; /// /// Specifies the function of the file. The possible values depend on the value of /// . If is /// , contains the virtual device identifier /// included in the virtual device control block. /// public VersionFileSubType FileSubType { get { return mvarFileSubType; } set { mvarFileSubType = value; } } private DateTime mvarFileDate = DateTime.Now; public DateTime FileDate { get { return mvarFileDate; } set { mvarFileDate = value; } } } public class VersionResourceStringFileInfoBlockLanguage { public class VersionResourceStringFileInfoBlockEntryCollection : System.Collections.ObjectModel.Collection { } private int mvarLanguageID = 0; public int LanguageID { get { return mvarLanguageID; } set { mvarLanguageID = value; } } private VersionResourceStringTableEntry.VersionResourceStringTableEntryCollection mvarStringTableEntries = new VersionResourceStringTableEntry.VersionResourceStringTableEntryCollection(); public VersionResourceStringTableEntry.VersionResourceStringTableEntryCollection StringTableEntries { get { return mvarStringTableEntries; } } public override string ToString() { return "0x" + mvarLanguageID.ToString("x"); } } public class VersionResourceStringTableEntry { public class VersionResourceStringTableEntryCollection : System.Collections.ObjectModel.Collection { } private string mvarName = String.Empty; public string Name { get { return mvarName; } set { mvarName = value; } } private string mvarValue = String.Empty; public string Value { get { return mvarValue; } set { mvarValue = value; } } public override string ToString() { return mvarName + ": \"" + mvarValue + "\""; } } public class VersionResourceStringFileInfoBlock : VersionResourceChildBlock { private VersionResourceStringFileInfoBlockLanguage.VersionResourceStringFileInfoBlockEntryCollection mvarEntries = new VersionResourceStringFileInfoBlockLanguage.VersionResourceStringFileInfoBlockEntryCollection(); public VersionResourceStringFileInfoBlockLanguage.VersionResourceStringFileInfoBlockEntryCollection Entries { get { return mvarEntries; } } public override string ToString() { return "StringFileInfo"; } } public class VersionResourceVarFileInfoBlockEntry { public class VersionResourceVarFileInfoBlockEntryCollection : System.Collections.ObjectModel.Collection { } private List mvarValues = new List(); public List Values { get { return mvarValues; } } public override string ToString() { return "Translation"; } } public class VersionResourceVarFileInfoBlock : VersionResourceChildBlock { private VersionResourceVarFileInfoBlockEntry.VersionResourceVarFileInfoBlockEntryCollection mvarEntries = new VersionResourceVarFileInfoBlockEntry.VersionResourceVarFileInfoBlockEntryCollection(); public VersionResourceVarFileInfoBlockEntry.VersionResourceVarFileInfoBlockEntryCollection Entries { get { return mvarEntries; } } public override string ToString() { return "VarFileInfo"; } } /// /// Represents a Version resource in an executable file (VS_VERSION_INFO on Windows). /// public class VersionResourceBlock : ExecutableResourceBlock { private ExecutableResourceType mvarType = ExecutableResourceType.Version; public override ExecutableResourceType Type { get { return mvarType; } } private VersionResourceFixedFileInfoBlock mvarFixedFileInfo = new VersionResourceFixedFileInfoBlock(); public VersionResourceFixedFileInfoBlock FixedFileInfo { get { return mvarFixedFileInfo; } } private VersionResourceChildBlock.VersionResourceChildBlockCollection mvarChildBlocks = new VersionResourceChildBlock.VersionResourceChildBlockCollection(); public VersionResourceChildBlock.VersionResourceChildBlockCollection ChildBlocks { get { return mvarChildBlocks; } } public override object Clone() { VersionResourceBlock clone = new VersionResourceBlock(); return clone; } } }