From 283672e90904aa4ec24a23d3dfd52aa04f285f65 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 28 Dec 2022 14:02:09 -0800 Subject: [PATCH] Add and use NCF constants --- BurnOutSharp.Builders/NCF.cs | 31 +----------------- BurnOutSharp.Models/GCF/Enums.cs | 5 +++ BurnOutSharp.Models/NCF/DirectoryEntry.cs | 2 +- BurnOutSharp.Models/NCF/Enums.cs | 38 +++++++++++++++++++++++ 4 files changed, 45 insertions(+), 31 deletions(-) create mode 100644 BurnOutSharp.Models/NCF/Enums.cs diff --git a/BurnOutSharp.Builders/NCF.cs b/BurnOutSharp.Builders/NCF.cs index 8e9ebfe4..9153bcb0 100644 --- a/BurnOutSharp.Builders/NCF.cs +++ b/BurnOutSharp.Builders/NCF.cs @@ -8,35 +8,6 @@ namespace BurnOutSharp.Builders { public static class NCF { - #region Constants - - /// - /// The item is a file. - /// - public const int HL_NCF_FLAG_FILE = 0x00004000; - - /// - /// The item is encrypted. - /// - public const int HL_NCF_FLAG_ENCRYPTED = 0x00000100; - - /// - /// Backup the item before overwriting it. - /// - public const int HL_NCF_FLAG_BACKUP_LOCAL = 0x00000040; - - /// - /// The item is to be copied to the disk. - /// - public const int HL_NCF_FLAG_COPY_LOCAL = 0x0000000a; - - /// - /// Don't overwrite the item if copying it to the disk and the item already exis - /// - public const int HL_NCF_FLAG_COPY_LOCAL_NO_OVERWRITE = 0x00000001; - - #endregion - #region Byte Data /// @@ -390,7 +361,7 @@ namespace BurnOutSharp.Builders directoryEntry.NameOffset = data.ReadUInt32(); directoryEntry.ItemSize = data.ReadUInt32(); directoryEntry.ChecksumIndex = data.ReadUInt32(); - directoryEntry.DirectoryFlags = data.ReadUInt32(); + directoryEntry.DirectoryFlags = (HL_NCF_FLAG)data.ReadUInt32(); directoryEntry.ParentIndex = data.ReadUInt32(); directoryEntry.NextIndex = data.ReadUInt32(); directoryEntry.FirstIndex = data.ReadUInt32(); diff --git a/BurnOutSharp.Models/GCF/Enums.cs b/BurnOutSharp.Models/GCF/Enums.cs index 70cb773b..12249b27 100644 --- a/BurnOutSharp.Models/GCF/Enums.cs +++ b/BurnOutSharp.Models/GCF/Enums.cs @@ -5,6 +5,11 @@ namespace BurnOutSharp.Models.GCF [Flags] public enum HL_GCF_FLAG : uint { + /// + /// Folder + /// + HL_GCF_FLAG_FOLDER = 0x00000000, + /// /// Don't overwrite the item if copying it to the disk and the item already exists. /// diff --git a/BurnOutSharp.Models/NCF/DirectoryEntry.cs b/BurnOutSharp.Models/NCF/DirectoryEntry.cs index 4f14273c..887787f3 100644 --- a/BurnOutSharp.Models/NCF/DirectoryEntry.cs +++ b/BurnOutSharp.Models/NCF/DirectoryEntry.cs @@ -26,7 +26,7 @@ namespace BurnOutSharp.Models.NCF /// /// Flags for the directory item. (0x00000000 == Folder). /// - public uint DirectoryFlags; + public HL_NCF_FLAG DirectoryFlags; /// /// Index of the parent directory item. (0xFFFFFFFF == None). diff --git a/BurnOutSharp.Models/NCF/Enums.cs b/BurnOutSharp.Models/NCF/Enums.cs new file mode 100644 index 00000000..ff19c491 --- /dev/null +++ b/BurnOutSharp.Models/NCF/Enums.cs @@ -0,0 +1,38 @@ +using System; + +namespace BurnOutSharp.Models.NCF +{ + [Flags] + public enum HL_NCF_FLAG : uint + { + /// + /// Folder + /// + HL_NCF_FLAG_FOLDER = 0x00000000, + + /// + /// Don't overwrite the item if copying it to the disk and the item already exis + /// + HL_NCF_FLAG_COPY_LOCAL_NO_OVERWRITE = 0x00000001, + + /// + /// The item is to be copied to the disk. + /// + HL_NCF_FLAG_COPY_LOCAL = 0x0000000a, + + /// + /// Backup the item before overwriting it. + /// + HL_NCF_FLAG_BACKUP_LOCAL = 0x00000040, + + /// + /// The item is encrypted. + /// + HL_NCF_FLAG_ENCRYPTED = 0x00000100, + + /// + /// The item is a file. + /// + HL_NCF_FLAG_FILE = 0x00004000, + } +} \ No newline at end of file