mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-23 07:14:57 +00:00
Add extensions based on external need
This commit is contained in:
@@ -21,23 +21,29 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public CFFILE[]? Files => Model.Files;
|
||||
|
||||
/// <inheritdoc cref="CFHEADER.FileCount"/>
|
||||
public int FileCount => Model.Header?.FileCount ?? 0;
|
||||
public int FileCount => Header?.FileCount ?? 0;
|
||||
|
||||
/// <inheritdoc cref="Cabinet.Folders"/>
|
||||
public CFFOLDER[]? Folders => Model.Folders;
|
||||
|
||||
/// <inheritdoc cref="CFHEADER.FolderCount"/>
|
||||
public int FolderCount => Model.Header?.FolderCount ?? 0;
|
||||
public int FolderCount => Header?.FolderCount ?? 0;
|
||||
|
||||
/// <inheritdoc cref="Cabinet.Header"/>
|
||||
public CFHEADER? Header => Model.Header;
|
||||
|
||||
/// <inheritdoc cref="CFHEADER.CabinetNext"/>
|
||||
public string? CabinetNext => Header?.CabinetNext;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the next cabinet header
|
||||
/// </summary>
|
||||
/// <remarks>Only used in multi-file</remarks>
|
||||
public MicrosoftCabinet? Next { get; set; }
|
||||
|
||||
/// <inheritdoc cref="CFHEADER.CabinetPrev"/>
|
||||
public string? CabinetPrev => Header?.CabinetPrev;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the next previous header
|
||||
/// </summary>
|
||||
@@ -298,7 +304,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
return null;
|
||||
|
||||
// Seek to the first part of the cabinet set
|
||||
while (current.Header.CabinetPrev != null)
|
||||
while (current.CabinetPrev != null)
|
||||
{
|
||||
// Attempt to open the previous cabinet
|
||||
var prev = current.OpenPrevious(filename);
|
||||
@@ -313,7 +319,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
var start = current;
|
||||
|
||||
// Read in the cabinet parts sequentially
|
||||
while (current.Header.CabinetNext != null)
|
||||
while (current.CabinetNext != null)
|
||||
{
|
||||
// Open the next cabinet and try to parse
|
||||
var next = current.OpenNext(filename);
|
||||
@@ -344,7 +350,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
filename = Path.GetFullPath(filename);
|
||||
|
||||
// Get if the cabinet has a next part
|
||||
string? next = Header.CabinetNext;
|
||||
string? next = CabinetNext;
|
||||
if (string.IsNullOrEmpty(next))
|
||||
return null;
|
||||
|
||||
@@ -372,7 +378,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
filename = Path.GetFullPath(filename);
|
||||
|
||||
// Get if the cabinet has a previous part
|
||||
string? prev = Header.CabinetPrev;
|
||||
string? prev = CabinetPrev;
|
||||
if (string.IsNullOrEmpty(prev))
|
||||
return null;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace SabreTools.Serialization.Wrappers
|
||||
@@ -12,6 +13,25 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#endregion
|
||||
|
||||
#region Extension Properties
|
||||
|
||||
/// <inheritdoc cref="Models.NewExecutable.Executable.Header"/>
|
||||
public Models.NewExecutable.ExecutableHeader? Header => Model.Header;
|
||||
|
||||
/// <inheritdoc cref="Models.NewExecutable.Executable.ImportedNameTable"/>
|
||||
public Dictionary<ushort, Models.NewExecutable.ImportedNameTableEntry>? ImportedNameTable => Model.ImportedNameTable;
|
||||
|
||||
/// <inheritdoc cref="Models.NewExecutable.Executable.NonResidentNameTable"/>
|
||||
public Models.NewExecutable.NonResidentNameTableEntry[]? NonResidentNameTable => Model.NonResidentNameTable;
|
||||
|
||||
/// <inheritdoc cref="Models.NewExecutable.Executable.ResidentNameTable"/>
|
||||
public Models.NewExecutable.ResidentNameTableEntry[]? ResidentNameTable => Model.ResidentNameTable;
|
||||
|
||||
/// <inheritdoc cref="Models.NewExecutable.Executable.Stub"/>
|
||||
public Models.MSDOS.Executable? Stub => Model.Stub;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -17,6 +17,9 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region Extension Properties
|
||||
|
||||
/// <inheritdoc cref="Models.PortableExecutable.Executable.COFFFileHeader"/>
|
||||
public Models.PortableExecutable.COFFFileHeader? COFFFileHeader => Model.COFFFileHeader;
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary of debug data
|
||||
/// </summary>
|
||||
@@ -85,6 +88,9 @@ namespace SabreTools.Serialization.Wrappers
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Models.PortableExecutable.Executable.ExportTable"/>
|
||||
public Models.PortableExecutable.ExportTable? ExportTable => Model.ExportTable;
|
||||
|
||||
/// <summary>
|
||||
/// Header padding data, if it exists
|
||||
/// </summary>
|
||||
@@ -181,6 +187,9 @@ namespace SabreTools.Serialization.Wrappers
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Models.PortableExecutable.Executable.ImportTable"/>
|
||||
public Models.PortableExecutable.ImportTable? ImportTable => Model.ImportTable;
|
||||
|
||||
/// <inheritdoc cref="Models.PortableExecutable.Executable.OptionalHeader"/>
|
||||
public Models.PortableExecutable.OptionalHeader? OptionalHeader => Model.OptionalHeader;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public long CompressedDataOffset => Model.CompressedDataOffset;
|
||||
|
||||
/// <inheritdoc cref="Header.FileCount"/>
|
||||
public ushort FileCount => Model.Header?.FileCount ?? 0;
|
||||
public ushort FileCount => Header?.FileCount ?? 0;
|
||||
|
||||
/// <inheritdoc cref="Archive.FileList"/>
|
||||
public FileDescriptor[] FileList => Model.FileList ?? [];
|
||||
|
||||
Reference in New Issue
Block a user