mirror of
https://github.com/claunia/libexeinfo.git
synced 2025-12-16 19:14:24 +00:00
Refactor class names.
This commit is contained in:
@@ -33,10 +33,10 @@ namespace exeinfo
|
||||
mzHdr = (libexeinfo.MZ.Header)Marshal.PtrToStructure(hdrPtr, typeof(libexeinfo.MZ.Header));
|
||||
Marshal.FreeHGlobal(hdrPtr);
|
||||
|
||||
if(mzHdr.signature == libexeinfo.MZ.Consts.Signature)
|
||||
if(mzHdr.signature == libexeinfo.MZ.Signature)
|
||||
{
|
||||
recognized = true;
|
||||
libexeinfo.MZ.Info.PrintInfo(mzHdr);
|
||||
libexeinfo.MZ.PrintInfo(mzHdr);
|
||||
|
||||
if (mzHdr.new_offset < exeFs.Length)
|
||||
{
|
||||
@@ -49,10 +49,10 @@ namespace exeinfo
|
||||
neHdr = (libexeinfo.NE.Header)Marshal.PtrToStructure(hdrPtr, typeof(libexeinfo.NE.Header));
|
||||
Marshal.FreeHGlobal(hdrPtr);
|
||||
|
||||
if (neHdr.signature == libexeinfo.NE.Consts.Signature)
|
||||
if (neHdr.signature == libexeinfo.NE.Signature)
|
||||
{
|
||||
libexeinfo.NE.Info.PrintInfo(neHdr);
|
||||
libexeinfo.NE.ResourceTable resources = libexeinfo.NE.Info.GetResources(exeFs, mzHdr.new_offset, neHdr.resource_table_offset);
|
||||
libexeinfo.NE.PrintInfo(neHdr);
|
||||
libexeinfo.NE.ResourceTable resources = libexeinfo.NE.GetResources(exeFs, mzHdr.new_offset, neHdr.resource_table_offset);
|
||||
foreach(libexeinfo.NE.ResourceType type in resources.types)
|
||||
{
|
||||
if((type.id & 0x7FFF) == (int)libexeinfo.NE.ResourceTypes.RT_VERSION)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
namespace libexeinfo.MZ
|
||||
namespace libexeinfo
|
||||
{
|
||||
public class Consts
|
||||
public partial class MZ
|
||||
{
|
||||
public const ushort Signature = 0x5A4D;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
namespace libexeinfo.MZ
|
||||
namespace libexeinfo
|
||||
{
|
||||
public class Info
|
||||
public partial class MZ
|
||||
{
|
||||
public static void PrintInfo(Header header)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace libexeinfo.MZ
|
||||
namespace libexeinfo
|
||||
{
|
||||
public partial class MZ
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct Header
|
||||
@@ -29,9 +31,10 @@ namespace libexeinfo.MZ
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct RelocationTableEntry
|
||||
public struct RelocationTableEntry
|
||||
{
|
||||
public ushort offset;
|
||||
public ushort segment;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
namespace libexeinfo.NE
|
||||
namespace libexeinfo
|
||||
{
|
||||
public static class Consts
|
||||
public partial class NE
|
||||
{
|
||||
public const ushort Signature = 0x454E;
|
||||
public static readonly string FixedFileInfo = "VS_VERSION_INFO";
|
||||
public static readonly string FixedFileInfoSig = "VS_VERSION_INFO";
|
||||
public static readonly string StringFileInfo = "StringFileInfo";
|
||||
|
||||
public static string IdToName(ushort id)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
namespace libexeinfo.NE
|
||||
namespace libexeinfo
|
||||
{
|
||||
public partial class NE
|
||||
{
|
||||
[Flags]
|
||||
public enum ProgramFlags : byte
|
||||
@@ -158,3 +160,4 @@ namespace libexeinfo.NE
|
||||
VFT2_FONT_VECTOR = 0x00000002,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,9 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace libexeinfo.NE
|
||||
namespace libexeinfo
|
||||
{
|
||||
public class Info
|
||||
public partial class NE
|
||||
{
|
||||
public static void PrintInfo(Header header)
|
||||
{
|
||||
@@ -190,7 +190,7 @@ namespace libexeinfo.NE
|
||||
table.types[t].name = Encoding.ASCII.GetString(str);
|
||||
}
|
||||
else
|
||||
table.types[t].name = Consts.IdToName(table.types[t].id);
|
||||
table.types[t].name = IdToName(table.types[t].id);
|
||||
|
||||
for (int r = 0; r < table.types[t].resources.Length; r++)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace libexeinfo.NE
|
||||
namespace libexeinfo
|
||||
{
|
||||
public partial class NE
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential/*, Pack = 2*/)]
|
||||
public struct Header
|
||||
@@ -97,3 +99,4 @@ namespace libexeinfo.NE
|
||||
public uint dwFileDateLS;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,9 @@ using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace libexeinfo.NE
|
||||
namespace libexeinfo
|
||||
{
|
||||
public partial class NE
|
||||
{
|
||||
public class Version
|
||||
{
|
||||
@@ -130,7 +132,7 @@ namespace libexeinfo.NE
|
||||
|
||||
void DecodeNode(VersionNode node, string parent, string grandparent)
|
||||
{
|
||||
if (node.szName == Consts.FixedFileInfo)
|
||||
if (node.szName == FixedFileInfoSig)
|
||||
{
|
||||
IntPtr infoPtr = Marshal.AllocHGlobal(node.cbData);
|
||||
Marshal.Copy(node.rgbData, 0, infoPtr, node.cbData);
|
||||
@@ -148,13 +150,13 @@ namespace libexeinfo.NE
|
||||
fileDate = DateTime.FromFileTime(info.dwFileDateMS * 0x100000000 + info.dwFileDateLS);
|
||||
}
|
||||
|
||||
if (parent == Consts.StringFileInfo)
|
||||
if (parent == StringFileInfo)
|
||||
{
|
||||
Dictionary<string, string> strings = new Dictionary<string, string>();
|
||||
StringsByLanguage.Add(node.szName, strings);
|
||||
}
|
||||
|
||||
if (grandparent == Consts.StringFileInfo)
|
||||
if (grandparent == StringFileInfo)
|
||||
{
|
||||
if (StringsByLanguage.TryGetValue(parent, out Dictionary<string, string> strings))
|
||||
{
|
||||
@@ -314,3 +316,4 @@ namespace libexeinfo.NE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user