mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-18 23:05:11 +00:00
Add and use GCF constants
This commit is contained in:
@@ -8,40 +8,6 @@ namespace BurnOutSharp.Builders
|
||||
{
|
||||
public static class GCF
|
||||
{
|
||||
#region Constants
|
||||
|
||||
/// <summary>
|
||||
/// The item is a file.
|
||||
/// </summary>
|
||||
public const int HL_GCF_FLAG_FILE = 0x00004000;
|
||||
|
||||
/// <summary>
|
||||
/// The item is encrypted.
|
||||
/// </summary>
|
||||
public const int HL_GCF_FLAG_ENCRYPTED = 0x00000100;
|
||||
|
||||
/// <summary>
|
||||
/// Backup the item before overwriting it.
|
||||
/// </summary>
|
||||
public const int HL_GCF_FLAG_BACKUP_LOCAL = 0x00000040;
|
||||
|
||||
/// <summary>
|
||||
/// The item is to be copied to the disk.
|
||||
/// </summary>
|
||||
public const int HL_GCF_FLAG_COPY_LOCAL = 0x0000000A;
|
||||
|
||||
/// <summary>
|
||||
/// Don't overwrite the item if copying it to the disk and the item already exists.
|
||||
/// </summary>
|
||||
public const int HL_GCF_FLAG_COPY_LOCAL_NO_OVERWRITE = 0x00000001;
|
||||
|
||||
/// <summary>
|
||||
/// The maximum data allowed in a 32 bit checksum.
|
||||
/// </summary>
|
||||
public const int HL_GCF_CHECKSUM_LENGTH = 0x00008000;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Byte Data
|
||||
|
||||
/// <summary>
|
||||
@@ -602,7 +568,7 @@ namespace BurnOutSharp.Builders
|
||||
directoryEntry.NameOffset = data.ReadUInt32();
|
||||
directoryEntry.ItemSize = data.ReadUInt32();
|
||||
directoryEntry.ChecksumIndex = data.ReadUInt32();
|
||||
directoryEntry.DirectoryFlags = data.ReadUInt32();
|
||||
directoryEntry.DirectoryFlags = (HL_GCF_FLAG)data.ReadUInt32();
|
||||
directoryEntry.ParentIndex = data.ReadUInt32();
|
||||
directoryEntry.NextIndex = data.ReadUInt32();
|
||||
directoryEntry.FirstIndex = data.ReadUInt32();
|
||||
|
||||
10
BurnOutSharp.Models/GCF/Constants.cs
Normal file
10
BurnOutSharp.Models/GCF/Constants.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace BurnOutSharp.Models.GCF
|
||||
{
|
||||
public static class Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// The maximum data allowed in a 32 bit checksum.
|
||||
/// </summary>
|
||||
public const int HL_GCF_CHECKSUM_LENGTH = 0x00008000;
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ namespace BurnOutSharp.Models.GCF
|
||||
/// <summary>
|
||||
/// Flags for the directory item. (0x00000000 == Folder).
|
||||
/// </summary>
|
||||
public uint DirectoryFlags;
|
||||
public HL_GCF_FLAG DirectoryFlags;
|
||||
|
||||
/// <summary>
|
||||
/// Index of the parent directory item. (0xFFFFFFFF == None).
|
||||
|
||||
33
BurnOutSharp.Models/GCF/Enums.cs
Normal file
33
BurnOutSharp.Models/GCF/Enums.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
|
||||
namespace BurnOutSharp.Models.GCF
|
||||
{
|
||||
[Flags]
|
||||
public enum HL_GCF_FLAG : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// Don't overwrite the item if copying it to the disk and the item already exists.
|
||||
/// </summary>
|
||||
HL_GCF_FLAG_COPY_LOCAL_NO_OVERWRITE = 0x00000001,
|
||||
|
||||
/// <summary>
|
||||
/// The item is to be copied to the disk.
|
||||
/// </summary>
|
||||
HL_GCF_FLAG_COPY_LOCAL = 0x0000000A,
|
||||
|
||||
/// <summary>
|
||||
/// Backup the item before overwriting it.
|
||||
/// </summary>
|
||||
HL_GCF_FLAG_BACKUP_LOCAL = 0x00000040,
|
||||
|
||||
/// <summary>
|
||||
/// The item is encrypted.
|
||||
/// </summary>
|
||||
HL_GCF_FLAG_ENCRYPTED = 0x00000100,
|
||||
|
||||
/// <summary>
|
||||
/// The item is a file.
|
||||
/// </summary>
|
||||
HL_GCF_FLAG_FILE = 0x00004000,
|
||||
}
|
||||
}
|
||||
@@ -320,14 +320,14 @@ namespace BurnOutSharp.Wrappers
|
||||
var directoryMapEntry = DirectoryMapEntries[i];
|
||||
|
||||
// If we have a directory, skip for now
|
||||
if ((directoryEntry.DirectoryFlags & Builders.GCF.HL_GCF_FLAG_FILE) == 0)
|
||||
if (!directoryEntry.DirectoryFlags.HasFlag(Models.GCF.HL_GCF_FLAG.HL_GCF_FLAG_FILE))
|
||||
continue;
|
||||
|
||||
// Otherwise, start building the file info
|
||||
var fileInfo = new FileInfo()
|
||||
{
|
||||
Size = directoryEntry.ItemSize,
|
||||
Encrypted = (directoryEntry.DirectoryFlags & Builders.GCF.HL_GCF_FLAG_ENCRYPTED) != 0,
|
||||
Encrypted = directoryEntry.DirectoryFlags.HasFlag(Models.GCF.HL_GCF_FLAG.HL_GCF_FLAG_ENCRYPTED),
|
||||
};
|
||||
var pathParts = new List<string> { directoryEntry.Name };
|
||||
var blockEntries = new List<Models.GCF.BlockEntry>();
|
||||
|
||||
Reference in New Issue
Block a user