diff --git a/BurnOutSharp.Builders/SGA.cs b/BurnOutSharp.Builders/SGA.cs index 3afa785b..8cb7c90a 100644 --- a/BurnOutSharp.Builders/SGA.cs +++ b/BurnOutSharp.Builders/SGA.cs @@ -3,20 +3,12 @@ using System.IO; using System.Text; using BurnOutSharp.Models.SGA; using BurnOutSharp.Utilities; +using static BurnOutSharp.Models.SGA.Constants; namespace BurnOutSharp.Builders { public static class SGA { - #region Constants - - /// - /// Length of a SGA checksum in bytes - /// - public const int HL_SGA_CHECKSUM_LENGTH = 0x00008000; - - #endregion - #region Byte Data /// @@ -101,7 +93,7 @@ namespace BurnOutSharp.Builders // TODO: Use marshalling here instead of building byte[] signatureBytes = data.ReadBytes(8); string signature = Encoding.ASCII.GetString(signatureBytes); - if (signature != "_ARCHIVE") + if (signature != SignatureString) return null; ushort majorVersion = data.ReadUInt16(); diff --git a/BurnOutSharp.Models/SGA/Constants.cs b/BurnOutSharp.Models/SGA/Constants.cs new file mode 100644 index 00000000..fde9fa18 --- /dev/null +++ b/BurnOutSharp.Models/SGA/Constants.cs @@ -0,0 +1,16 @@ +namespace BurnOutSharp.Models.SGA +{ + public static class Constants + { + public static readonly byte[] SignatureBytes = new byte[] { 0x5f, 0x41, 0x52, 0x43, 0x48, 0x49, 0x56, 0x45 }; + + public const string SignatureString = "_ARCHIVE"; + + public const ulong SignatureUInt64 = 0x455649484352415f; + + /// + /// Length of a SGA checksum in bytes + /// + public const int HL_SGA_CHECKSUM_LENGTH = 0x00008000; + } +} \ No newline at end of file