diff --git a/BinaryObjectScanner.ASN1/BinaryObjectScanner.ASN1.csproj b/BinaryObjectScanner.ASN1/BinaryObjectScanner.ASN1.csproj
index b0118480..11866e1e 100644
--- a/BinaryObjectScanner.ASN1/BinaryObjectScanner.ASN1.csproj
+++ b/BinaryObjectScanner.ASN1/BinaryObjectScanner.ASN1.csproj
@@ -24,4 +24,8 @@
+
+
+
+
diff --git a/BinaryObjectScanner.ASN1/TypeLengthValue.cs b/BinaryObjectScanner.ASN1/TypeLengthValue.cs
index dbd48c6b..10d93f11 100644
--- a/BinaryObjectScanner.ASN1/TypeLengthValue.cs
+++ b/BinaryObjectScanner.ASN1/TypeLengthValue.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
namespace BinaryObjectScanner.ASN1
{
diff --git a/BinaryObjectScanner.Builders/AACS.cs b/BinaryObjectScanner.Builders/AACS.cs
index 1e6ceadb..5865287d 100644
--- a/BinaryObjectScanner.Builders/AACS.cs
+++ b/BinaryObjectScanner.Builders/AACS.cs
@@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.AACS;
namespace BinaryObjectScanner.Builders
@@ -186,7 +186,7 @@ namespace BinaryObjectScanner.Builders
var subsetDifference = new SubsetDifference();
subsetDifference.Mask = data.ReadByteValue();
- subsetDifference.Number = data.ReadUInt32BE();
+ subsetDifference.Number = data.ReadUInt32BigEndian();
subsetDifferences.Add(subsetDifference);
}
@@ -257,7 +257,7 @@ namespace BinaryObjectScanner.Builders
// Cache the current offset
long initialOffset = data.Position - 4;
- record.Span = data.ReadUInt32BE();
+ record.Span = data.ReadUInt32BigEndian();
// Create the offset list
var offsets = new List();
@@ -265,7 +265,7 @@ namespace BinaryObjectScanner.Builders
// Try to parse the offsets
while (data.Position < initialOffset + length)
{
- uint offset = data.ReadUInt32BE();
+ uint offset = data.ReadUInt32BigEndian();
offsets.Add(offset);
}
@@ -291,8 +291,8 @@ namespace BinaryObjectScanner.Builders
record.RecordType = type;
record.RecordLength = length;
- record.MediaKeyBlockType = (MediaKeyBlockType)data.ReadUInt32BE();
- record.VersionNumber = data.ReadUInt32BE();
+ record.MediaKeyBlockType = (MediaKeyBlockType)data.ReadUInt32BigEndian();
+ record.VersionNumber = data.ReadUInt32BigEndian();
return record;
}
@@ -317,7 +317,7 @@ namespace BinaryObjectScanner.Builders
// Cache the current offset
long initialOffset = data.Position - 4;
- record.TotalNumberOfEntries = data.ReadUInt32BE();
+ record.TotalNumberOfEntries = data.ReadUInt32BigEndian();
// Create the signature blocks list
var blocks = new List();
@@ -328,13 +328,13 @@ namespace BinaryObjectScanner.Builders
{
var block = new DriveRevocationSignatureBlock();
- block.NumberOfEntries = data.ReadUInt32BE();
+ block.NumberOfEntries = data.ReadUInt32BigEndian();
block.EntryFields = new DriveRevocationListEntry[block.NumberOfEntries];
for (int i = 0; i < block.EntryFields.Length; i++)
{
var entry = new DriveRevocationListEntry();
- entry.Range = data.ReadUInt16BE();
+ entry.Range = data.ReadUInt16BigEndian();
entry.DriveID = data.ReadBytes(6);
block.EntryFields[i] = entry;
@@ -378,7 +378,7 @@ namespace BinaryObjectScanner.Builders
// Cache the current offset
long initialOffset = data.Position - 4;
- record.TotalNumberOfEntries = data.ReadUInt32BE();
+ record.TotalNumberOfEntries = data.ReadUInt32BigEndian();
// Create the signature blocks list
var blocks = new List();
@@ -389,13 +389,13 @@ namespace BinaryObjectScanner.Builders
{
var block = new HostRevocationSignatureBlock();
- block.NumberOfEntries = data.ReadUInt32BE();
+ block.NumberOfEntries = data.ReadUInt32BigEndian();
block.EntryFields = new HostRevocationListEntry[block.NumberOfEntries];
for (int i = 0; i < block.EntryFields.Length; i++)
{
var entry = new HostRevocationListEntry();
- entry.Range = data.ReadUInt16BE();
+ entry.Range = data.ReadUInt16BigEndian();
entry.HostID = data.ReadBytes(6);
block.EntryFields[i] = entry;
diff --git a/BinaryObjectScanner.Builders/BDPlus.cs b/BinaryObjectScanner.Builders/BDPlus.cs
index a5b5d88b..f5ef3799 100644
--- a/BinaryObjectScanner.Builders/BDPlus.cs
+++ b/BinaryObjectScanner.Builders/BDPlus.cs
@@ -1,6 +1,6 @@
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.BDPlus;
using static SabreTools.Models.BDPlus.Constants;
@@ -73,7 +73,7 @@ namespace BinaryObjectScanner.Builders
return null;
svm.Unknown1 = data.ReadBytes(5);
- svm.Year = data.ReadUInt16BE();
+ svm.Year = data.ReadUInt16BigEndian();
svm.Month = data.ReadByteValue();
if (svm.Month < 1 || svm.Month > 12)
return null;
diff --git a/BinaryObjectScanner.Builders/BFPK.cs b/BinaryObjectScanner.Builders/BFPK.cs
index 337d7ccf..5ca1563f 100644
--- a/BinaryObjectScanner.Builders/BFPK.cs
+++ b/BinaryObjectScanner.Builders/BFPK.cs
@@ -1,6 +1,6 @@
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.BFPK;
using static SabreTools.Models.BFPK.Constants;
diff --git a/BinaryObjectScanner.Builders/BSP.cs b/BinaryObjectScanner.Builders/BSP.cs
index ba86685f..f9982db3 100644
--- a/BinaryObjectScanner.Builders/BSP.cs
+++ b/BinaryObjectScanner.Builders/BSP.cs
@@ -1,7 +1,7 @@
using System.IO;
using System.Linq;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.BSP;
using static SabreTools.Models.BSP.Constants;
diff --git a/BinaryObjectScanner.Builders/BinaryObjectScanner.Builders.csproj b/BinaryObjectScanner.Builders/BinaryObjectScanner.Builders.csproj
index e929642e..afee8414 100644
--- a/BinaryObjectScanner.Builders/BinaryObjectScanner.Builders.csproj
+++ b/BinaryObjectScanner.Builders/BinaryObjectScanner.Builders.csproj
@@ -25,6 +25,7 @@
+
diff --git a/BinaryObjectScanner.Builders/CFB.cs b/BinaryObjectScanner.Builders/CFB.cs
index e7410d93..fb37ff07 100644
--- a/BinaryObjectScanner.Builders/CFB.cs
+++ b/BinaryObjectScanner.Builders/CFB.cs
@@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.CFB;
using static SabreTools.Models.CFB.Constants;
diff --git a/BinaryObjectScanner.Builders/Extensions.cs b/BinaryObjectScanner.Builders/Extensions.cs
index f083cbeb..acaff1bb 100644
--- a/BinaryObjectScanner.Builders/Extensions.cs
+++ b/BinaryObjectScanner.Builders/Extensions.cs
@@ -4,7 +4,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
namespace BinaryObjectScanner.Builders
{
diff --git a/BinaryObjectScanner.Builders/GCF.cs b/BinaryObjectScanner.Builders/GCF.cs
index a35c5966..6df569cd 100644
--- a/BinaryObjectScanner.Builders/GCF.cs
+++ b/BinaryObjectScanner.Builders/GCF.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.GCF;
namespace BinaryObjectScanner.Builders
diff --git a/BinaryObjectScanner.Builders/InstallShieldCabinet.cs b/BinaryObjectScanner.Builders/InstallShieldCabinet.cs
index f1fb680e..f86c6201 100644
--- a/BinaryObjectScanner.Builders/InstallShieldCabinet.cs
+++ b/BinaryObjectScanner.Builders/InstallShieldCabinet.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.InstallShieldCabinet;
using static SabreTools.Models.InstallShieldCabinet.Constants;
diff --git a/BinaryObjectScanner.Builders/LinearExecutable.cs b/BinaryObjectScanner.Builders/LinearExecutable.cs
index 8146a887..1d2f9f33 100644
--- a/BinaryObjectScanner.Builders/LinearExecutable.cs
+++ b/BinaryObjectScanner.Builders/LinearExecutable.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.LinearExecutable;
using static SabreTools.Models.LinearExecutable.Constants;
diff --git a/BinaryObjectScanner.Builders/MSDOS.cs b/BinaryObjectScanner.Builders/MSDOS.cs
index 1cc9a902..c86ba05b 100644
--- a/BinaryObjectScanner.Builders/MSDOS.cs
+++ b/BinaryObjectScanner.Builders/MSDOS.cs
@@ -1,6 +1,6 @@
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.MSDOS;
using static SabreTools.Models.MSDOS.Constants;
diff --git a/BinaryObjectScanner.Builders/MicrosoftCabinet.cs b/BinaryObjectScanner.Builders/MicrosoftCabinet.cs
index debf9f8c..5d08e952 100644
--- a/BinaryObjectScanner.Builders/MicrosoftCabinet.cs
+++ b/BinaryObjectScanner.Builders/MicrosoftCabinet.cs
@@ -1,6 +1,6 @@
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.MicrosoftCabinet;
using static SabreTools.Models.MicrosoftCabinet.Constants;
diff --git a/BinaryObjectScanner.Builders/MoPaQ.cs b/BinaryObjectScanner.Builders/MoPaQ.cs
index 7c50ddb6..6ebb9f59 100644
--- a/BinaryObjectScanner.Builders/MoPaQ.cs
+++ b/BinaryObjectScanner.Builders/MoPaQ.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.MoPaQ;
using static SabreTools.Models.MoPaQ.Constants;
diff --git a/BinaryObjectScanner.Builders/N3DS.cs b/BinaryObjectScanner.Builders/N3DS.cs
index 207da72b..8e399d4e 100644
--- a/BinaryObjectScanner.Builders/N3DS.cs
+++ b/BinaryObjectScanner.Builders/N3DS.cs
@@ -2,6 +2,7 @@ using System;
using System.IO;
using System.Text;
using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.N3DS;
using static SabreTools.Models.N3DS.Constants;
diff --git a/BinaryObjectScanner.Builders/NCF.cs b/BinaryObjectScanner.Builders/NCF.cs
index 90bfe71d..8a8aeec3 100644
--- a/BinaryObjectScanner.Builders/NCF.cs
+++ b/BinaryObjectScanner.Builders/NCF.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.NCF;
namespace BinaryObjectScanner.Builders
diff --git a/BinaryObjectScanner.Builders/NewExecutable.cs b/BinaryObjectScanner.Builders/NewExecutable.cs
index 804d6e71..ce465c12 100644
--- a/BinaryObjectScanner.Builders/NewExecutable.cs
+++ b/BinaryObjectScanner.Builders/NewExecutable.cs
@@ -2,7 +2,7 @@
using System.IO;
using System.Linq;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.NewExecutable;
using static SabreTools.Models.NewExecutable.Constants;
diff --git a/BinaryObjectScanner.Builders/Nitro.cs b/BinaryObjectScanner.Builders/Nitro.cs
index 09a1b6a1..9d6f7ec2 100644
--- a/BinaryObjectScanner.Builders/Nitro.cs
+++ b/BinaryObjectScanner.Builders/Nitro.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.Nitro;
namespace BinaryObjectScanner.Builders
diff --git a/BinaryObjectScanner.Builders/PAK.cs b/BinaryObjectScanner.Builders/PAK.cs
index 6bd8fc8f..bf293d52 100644
--- a/BinaryObjectScanner.Builders/PAK.cs
+++ b/BinaryObjectScanner.Builders/PAK.cs
@@ -1,6 +1,6 @@
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.PAK;
using static SabreTools.Models.PAK.Constants;
diff --git a/BinaryObjectScanner.Builders/PFF.cs b/BinaryObjectScanner.Builders/PFF.cs
index 57ed71e0..bdad2b8b 100644
--- a/BinaryObjectScanner.Builders/PFF.cs
+++ b/BinaryObjectScanner.Builders/PFF.cs
@@ -1,6 +1,6 @@
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.PFF;
using static SabreTools.Models.PFF.Constants;
diff --git a/BinaryObjectScanner.Builders/PlayJ.cs b/BinaryObjectScanner.Builders/PlayJ.cs
index 402f5c22..e4c17aaf 100644
--- a/BinaryObjectScanner.Builders/PlayJ.cs
+++ b/BinaryObjectScanner.Builders/PlayJ.cs
@@ -1,6 +1,6 @@
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.PlayJ;
using static SabreTools.Models.PlayJ.Constants;
diff --git a/BinaryObjectScanner.Builders/PortableExecutable.cs b/BinaryObjectScanner.Builders/PortableExecutable.cs
index 3b3d8bd7..9db56222 100644
--- a/BinaryObjectScanner.Builders/PortableExecutable.cs
+++ b/BinaryObjectScanner.Builders/PortableExecutable.cs
@@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using System.Text;
using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.PortableExecutable;
using static SabreTools.Models.PortableExecutable.Constants;
diff --git a/BinaryObjectScanner.Builders/Quantum.cs b/BinaryObjectScanner.Builders/Quantum.cs
index cd10553d..0526c7d8 100644
--- a/BinaryObjectScanner.Builders/Quantum.cs
+++ b/BinaryObjectScanner.Builders/Quantum.cs
@@ -1,6 +1,6 @@
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.Quantum;
using static SabreTools.Models.Quantum.Constants;
diff --git a/BinaryObjectScanner.Builders/SGA.cs b/BinaryObjectScanner.Builders/SGA.cs
index 5cc97639..26d713cc 100644
--- a/BinaryObjectScanner.Builders/SGA.cs
+++ b/BinaryObjectScanner.Builders/SGA.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.SGA;
using static SabreTools.Models.SGA.Constants;
diff --git a/BinaryObjectScanner.Builders/VBSP.cs b/BinaryObjectScanner.Builders/VBSP.cs
index 3216d938..c4ca53ec 100644
--- a/BinaryObjectScanner.Builders/VBSP.cs
+++ b/BinaryObjectScanner.Builders/VBSP.cs
@@ -1,6 +1,6 @@
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.VBSP;
using static SabreTools.Models.VBSP.Constants;
diff --git a/BinaryObjectScanner.Builders/VPK.cs b/BinaryObjectScanner.Builders/VPK.cs
index 0a227932..4a4087dd 100644
--- a/BinaryObjectScanner.Builders/VPK.cs
+++ b/BinaryObjectScanner.Builders/VPK.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.VPK;
using static SabreTools.Models.VPK.Constants;
diff --git a/BinaryObjectScanner.Builders/WAD.cs b/BinaryObjectScanner.Builders/WAD.cs
index 91582fa6..374194a6 100644
--- a/BinaryObjectScanner.Builders/WAD.cs
+++ b/BinaryObjectScanner.Builders/WAD.cs
@@ -1,6 +1,6 @@
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.WAD;
using static SabreTools.Models.WAD.Constants;
diff --git a/BinaryObjectScanner.Builders/XZP.cs b/BinaryObjectScanner.Builders/XZP.cs
index 71673474..87fcc827 100644
--- a/BinaryObjectScanner.Builders/XZP.cs
+++ b/BinaryObjectScanner.Builders/XZP.cs
@@ -1,6 +1,6 @@
using System.IO;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.XZP;
using static SabreTools.Models.XZP.Constants;
diff --git a/BinaryObjectScanner.Compression/BinaryObjectScanner.Compression.csproj b/BinaryObjectScanner.Compression/BinaryObjectScanner.Compression.csproj
index 2ddd15a6..1ba72e38 100644
--- a/BinaryObjectScanner.Compression/BinaryObjectScanner.Compression.csproj
+++ b/BinaryObjectScanner.Compression/BinaryObjectScanner.Compression.csproj
@@ -35,6 +35,7 @@
+
diff --git a/BinaryObjectScanner.Compression/LZ.cs b/BinaryObjectScanner.Compression/LZ.cs
index 45c51bce..50d50314 100644
--- a/BinaryObjectScanner.Compression/LZ.cs
+++ b/BinaryObjectScanner.Compression/LZ.cs
@@ -1,7 +1,7 @@
using System.IO;
using System.Linq;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using SabreTools.Models.Compression.LZ;
using static SabreTools.Models.Compression.LZ.Constants;
diff --git a/BinaryObjectScanner.Packer/BinaryObjectScanner.Packer.csproj b/BinaryObjectScanner.Packer/BinaryObjectScanner.Packer.csproj
index f8081b17..b9d248f6 100644
--- a/BinaryObjectScanner.Packer/BinaryObjectScanner.Packer.csproj
+++ b/BinaryObjectScanner.Packer/BinaryObjectScanner.Packer.csproj
@@ -21,6 +21,7 @@
+
diff --git a/BinaryObjectScanner.Packer/WiseInstaller.cs b/BinaryObjectScanner.Packer/WiseInstaller.cs
index 85349e26..42fac0ad 100644
--- a/BinaryObjectScanner.Packer/WiseInstaller.cs
+++ b/BinaryObjectScanner.Packer/WiseInstaller.cs
@@ -4,8 +4,8 @@ using System.IO;
using System.Linq;
using BinaryObjectScanner.Interfaces;
using BinaryObjectScanner.Matching;
-using BinaryObjectScanner.Utilities;
using BinaryObjectScanner.Wrappers;
+using SabreTools.IO;
using Wise = WiseUnpacker.WiseUnpacker;
namespace BinaryObjectScanner.Packer
diff --git a/BinaryObjectScanner.Protection/BinaryObjectScanner.Protection.csproj b/BinaryObjectScanner.Protection/BinaryObjectScanner.Protection.csproj
index a6022398..60ebf33a 100644
--- a/BinaryObjectScanner.Protection/BinaryObjectScanner.Protection.csproj
+++ b/BinaryObjectScanner.Protection/BinaryObjectScanner.Protection.csproj
@@ -27,7 +27,7 @@
-
+
diff --git a/BinaryObjectScanner.Protection/Macrovision.cs b/BinaryObjectScanner.Protection/Macrovision.cs
index 8cf1d023..c4e913b7 100644
--- a/BinaryObjectScanner.Protection/Macrovision.cs
+++ b/BinaryObjectScanner.Protection/Macrovision.cs
@@ -7,6 +7,7 @@ using BinaryObjectScanner.Interfaces;
using BinaryObjectScanner.Matching;
using BinaryObjectScanner.Utilities;
using BinaryObjectScanner.Wrappers;
+using SabreTools.IO;
namespace BinaryObjectScanner.Protection
{
diff --git a/BinaryObjectScanner.Utilities/BinaryObjectScanner.Utilities.csproj b/BinaryObjectScanner.Utilities/BinaryObjectScanner.Utilities.csproj
index b8ae3dbd..6ed435c5 100644
--- a/BinaryObjectScanner.Utilities/BinaryObjectScanner.Utilities.csproj
+++ b/BinaryObjectScanner.Utilities/BinaryObjectScanner.Utilities.csproj
@@ -24,4 +24,8 @@
+
+
+
+
diff --git a/BinaryObjectScanner.Utilities/BitStream.cs b/BinaryObjectScanner.Utilities/BitStream.cs
index c91d98e5..3d78cbd6 100644
--- a/BinaryObjectScanner.Utilities/BitStream.cs
+++ b/BinaryObjectScanner.Utilities/BitStream.cs
@@ -1,5 +1,6 @@
using System.Collections;
using System.IO;
+using SabreTools.IO;
namespace BinaryObjectScanner.Utilities
{
diff --git a/BinaryObjectScanner.Utilities/Extensions.cs b/BinaryObjectScanner.Utilities/Extensions.cs
index 57f95dfd..1ba210d3 100644
--- a/BinaryObjectScanner.Utilities/Extensions.cs
+++ b/BinaryObjectScanner.Utilities/Extensions.cs
@@ -1,10 +1,6 @@
using System;
using System.Collections;
using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
namespace BinaryObjectScanner.Utilities
{
@@ -185,371 +181,5 @@ namespace BinaryObjectScanner.Utilities
}
#endregion
-
- #region Byte Array Reading
-
- ///
- /// Read a byte and increment the pointer to an array
- ///
- public static byte ReadByte(this byte[] content, ref int offset)
- {
- return content[offset++];
- }
-
- ///
- /// Read a byte array and increment the pointer to an array
- ///
- public static byte[] ReadBytes(this byte[] content, ref int offset, int count)
- {
- // If there's an invalid byte count, don't do anything
- if (count <= 0)
- return null;
-
- byte[] buffer = new byte[count];
- Array.Copy(content, offset, buffer, 0, Math.Min(count, content.Length - offset));
- offset += count;
- return buffer;
- }
-
- ///
- /// Read an sbyte and increment the pointer to an array
- ///
- public static sbyte ReadSByte(this byte[] content, ref int offset)
- {
- return (sbyte)content[offset++];
- }
-
- ///
- /// Read a char and increment the pointer to an array
- ///
- public static char ReadChar(this byte[] content, ref int offset)
- {
- return (char)content[offset++];
- }
-
- ///
- /// Read a short and increment the pointer to an array
- ///
- public static short ReadInt16(this byte[] content, ref int offset)
- {
- short value = BitConverter.ToInt16(content, offset);
- offset += 2;
- return value;
- }
-
- ///
- /// Read a ushort and increment the pointer to an array
- ///
- public static ushort ReadUInt16(this byte[] content, ref int offset)
- {
- ushort value = BitConverter.ToUInt16(content, offset);
- offset += 2;
- return value;
- }
-
- ///
- /// Read a int and increment the pointer to an array
- ///
- public static int ReadInt32(this byte[] content, ref int offset)
- {
- int value = BitConverter.ToInt32(content, offset);
- offset += 4;
- return value;
- }
-
- ///
- /// Read a uint and increment the pointer to an array
- ///
- public static uint ReadUInt32(this byte[] content, ref int offset)
- {
- uint value = BitConverter.ToUInt32(content, offset);
- offset += 4;
- return value;
- }
-
- ///
- /// Read a long and increment the pointer to an array
- ///
- public static long ReadInt64(this byte[] content, ref int offset)
- {
- long value = BitConverter.ToInt64(content, offset);
- offset += 8;
- return value;
- }
-
- ///
- /// Read a ulong and increment the pointer to an array
- ///
- public static ulong ReadUInt64(this byte[] content, ref int offset)
- {
- ulong value = BitConverter.ToUInt64(content, offset);
- offset += 8;
- return value;
- }
-
- ///
- /// Read a Guid from the stream
- ///
- public static Guid ReadGuid(this byte[] content, ref int offset)
- {
- byte[] buffer = new byte[16];
- Array.Copy(content, offset, buffer, 0, 16);
- offset += 16;
- return new Guid(buffer);
- }
-
- ///
- /// Read a null-terminated string from the stream
- ///
- public static string ReadString(this byte[] content, ref int offset) => content.ReadString(ref offset, Encoding.Default);
-
- ///
- /// Read a null-terminated string from the stream
- ///
- public static string ReadString(this byte[] content, ref int offset, Encoding encoding)
- {
- if (offset >= content.Length)
- return null;
-
- byte[] nullTerminator = encoding.GetBytes(new char[] { '\0' });
- int charWidth = nullTerminator.Length;
-
- List keyChars = new List();
- while (offset < content.Length)
- {
- char c = encoding.GetChars(content, offset, charWidth)[0];
- keyChars.Add(c);
- offset += charWidth;
-
- if (c == '\0')
- break;
- }
-
- return new string(keyChars.ToArray()).TrimEnd('\0');
- }
-
- #endregion
-
- #region Stream Reading
-
- ///
- /// Read a byte from the stream
- ///
- public static byte ReadByteValue(this Stream stream)
- {
- byte[] buffer = new byte[1];
- stream.Read(buffer, 0, 1);
- return buffer[0];
- }
-
- ///
- /// Read a byte array from the stream
- ///
- public static byte[] ReadBytes(this Stream stream, int count)
- {
- // If there's an invalid byte count, don't do anything
- if (count <= 0)
- return null;
-
- byte[] buffer = new byte[count];
- stream.Read(buffer, 0, count);
- return buffer;
- }
-
- ///
- /// Read an sbyte from the stream
- ///
- public static sbyte ReadSByte(this Stream stream)
- {
- byte[] buffer = new byte[1];
- stream.Read(buffer, 0, 1);
- return (sbyte)buffer[0];
- }
-
- ///
- /// Read a character from the stream
- ///
- public static char ReadChar(this Stream stream)
- {
- byte[] buffer = new byte[1];
- stream.Read(buffer, 0, 1);
- return (char)buffer[0];
- }
-
- ///
- /// Read a short from the stream
- ///
- public static short ReadInt16(this Stream stream)
- {
- byte[] buffer = new byte[2];
- stream.Read(buffer, 0, 2);
- return BitConverter.ToInt16(buffer, 0);
- }
-
- ///
- /// Read a short from the stream in big-endian format
- ///
- public static short ReadInt16BE(this Stream stream)
- {
- byte[] buffer = new byte[2];
- stream.Read(buffer, 0, 2);
- Array.Reverse(buffer);
- return BitConverter.ToInt16(buffer, 0);
- }
-
- ///
- /// Read a ushort from the stream
- ///
- public static ushort ReadUInt16(this Stream stream)
- {
- byte[] buffer = new byte[2];
- stream.Read(buffer, 0, 2);
- return BitConverter.ToUInt16(buffer, 0);
- }
-
- ///
- /// Read a ushort from the stream in big-endian format
- ///
- public static ushort ReadUInt16BE(this Stream stream)
- {
- byte[] buffer = new byte[2];
- stream.Read(buffer, 0, 2);
- Array.Reverse(buffer);
- return BitConverter.ToUInt16(buffer, 0);
- }
-
- ///
- /// Read an int from the stream
- ///
- public static int ReadInt32(this Stream stream)
- {
- byte[] buffer = new byte[4];
- stream.Read(buffer, 0, 4);
- return BitConverter.ToInt32(buffer, 0);
- }
-
- ///
- /// Read an int from the stream in big-endian format
- ///
- public static int ReadInt32BE(this Stream stream)
- {
- byte[] buffer = new byte[4];
- stream.Read(buffer, 0, 4);
- Array.Reverse(buffer);
- return BitConverter.ToInt32(buffer, 0);
- }
-
- ///
- /// Read a uint from the stream
- ///
- public static uint ReadUInt32(this Stream stream)
- {
- byte[] buffer = new byte[4];
- stream.Read(buffer, 0, 4);
- return BitConverter.ToUInt32(buffer, 0);
- }
-
- ///
- /// Read a uint from the stream in big-endian format
- ///
- public static uint ReadUInt32BE(this Stream stream)
- {
- byte[] buffer = new byte[4];
- stream.Read(buffer, 0, 4);
- Array.Reverse(buffer);
- return BitConverter.ToUInt32(buffer, 0);
- }
-
- ///
- /// Read a long from the stream
- ///
- public static long ReadInt64(this Stream stream)
- {
- byte[] buffer = new byte[8];
- stream.Read(buffer, 0, 8);
- return BitConverter.ToInt64(buffer, 0);
- }
-
- ///
- /// Read a long from the stream in big-endian format
- ///
- public static long ReadInt64BE(this Stream stream)
- {
- byte[] buffer = new byte[8];
- stream.Read(buffer, 0, 8);
- Array.Reverse(buffer);
- return BitConverter.ToInt64(buffer, 0);
- }
-
- ///
- /// Read a ulong from the stream
- ///
- public static ulong ReadUInt64(this Stream stream)
- {
- byte[] buffer = new byte[8];
- stream.Read(buffer, 0, 8);
- return BitConverter.ToUInt64(buffer, 0);
- }
-
- ///
- /// Read a ulong from the stream in big-endian format
- ///
- public static ulong ReadUInt64BE(this Stream stream)
- {
- byte[] buffer = new byte[8];
- stream.Read(buffer, 0, 8);
- Array.Reverse(buffer);
- return BitConverter.ToUInt64(buffer, 0);
- }
-
- ///
- /// Read a Guid from the stream
- ///
- public static Guid ReadGuid(this Stream stream)
- {
- byte[] buffer = new byte[16];
- stream.Read(buffer, 0, 16);
- return new Guid(buffer);
- }
-
- ///
- /// Read a Guid from the stream in big-endian format
- ///
- public static Guid ReadGuidBE(this Stream stream)
- {
- byte[] buffer = new byte[16];
- stream.Read(buffer, 0, 16);
- Array.Reverse(buffer);
- return new Guid(buffer);
- }
-
- ///
- /// Read a null-terminated string from the stream
- ///
- public static string ReadString(this Stream stream) => stream.ReadString(Encoding.Default);
-
- ///
- /// Read a null-terminated string from the stream
- ///
- public static string ReadString(this Stream stream, Encoding encoding)
- {
- if (stream.Position >= stream.Length)
- return null;
-
- byte[] nullTerminator = encoding.GetBytes(new char[] { '\0' });
- int charWidth = nullTerminator.Length;
-
- List tempBuffer = new List();
-
- byte[] buffer = new byte[charWidth];
- while (stream.Position < stream.Length && stream.Read(buffer, 0, charWidth) != 0 && !buffer.SequenceEqual(nullTerminator))
- {
- tempBuffer.AddRange(buffer);
- }
-
- return encoding.GetString(tempBuffer.ToArray());
- }
-
- #endregion
}
}
\ No newline at end of file
diff --git a/BinaryObjectScanner.Wrappers/BinaryObjectScanner.Wrappers.csproj b/BinaryObjectScanner.Wrappers/BinaryObjectScanner.Wrappers.csproj
index 75bad52c..dff863a1 100644
--- a/BinaryObjectScanner.Wrappers/BinaryObjectScanner.Wrappers.csproj
+++ b/BinaryObjectScanner.Wrappers/BinaryObjectScanner.Wrappers.csproj
@@ -27,6 +27,7 @@
+
diff --git a/BinaryObjectScanner.Wrappers/PortableExecutable.cs b/BinaryObjectScanner.Wrappers/PortableExecutable.cs
index cd22bc32..99073b54 100644
--- a/BinaryObjectScanner.Wrappers/PortableExecutable.cs
+++ b/BinaryObjectScanner.Wrappers/PortableExecutable.cs
@@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using System.Xml;
using BinaryObjectScanner.ASN1;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using static BinaryObjectScanner.Builders.Extensions;
namespace BinaryObjectScanner.Wrappers
diff --git a/BinaryObjectScanner.Wrappers/VPK.cs b/BinaryObjectScanner.Wrappers/VPK.cs
index 43f37d6c..c5766c56 100644
--- a/BinaryObjectScanner.Wrappers/VPK.cs
+++ b/BinaryObjectScanner.Wrappers/VPK.cs
@@ -2,7 +2,7 @@ using System;
using System.IO;
using System.Linq;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
using static SabreTools.Models.VPK.Constants;
namespace BinaryObjectScanner.Wrappers
diff --git a/BinaryObjectScanner.Wrappers/WrapperBase.cs b/BinaryObjectScanner.Wrappers/WrapperBase.cs
index fe628aa7..f318a8ed 100644
--- a/BinaryObjectScanner.Wrappers/WrapperBase.cs
+++ b/BinaryObjectScanner.Wrappers/WrapperBase.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
-using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
namespace BinaryObjectScanner.Wrappers
{
diff --git a/BinaryObjectScanner.Wrappers/WrapperFactory.cs b/BinaryObjectScanner.Wrappers/WrapperFactory.cs
index 34639a40..7df6cde2 100644
--- a/BinaryObjectScanner.Wrappers/WrapperFactory.cs
+++ b/BinaryObjectScanner.Wrappers/WrapperFactory.cs
@@ -2,6 +2,7 @@
using System.IO;
using BinaryObjectScanner.Matching;
using BinaryObjectScanner.Utilities;
+using SabreTools.IO;
namespace BinaryObjectScanner.Wrappers
{
diff --git a/Test/Extractor.cs b/Test/Extractor.cs
index 2e3ea6c4..ea967759 100644
--- a/Test/Extractor.cs
+++ b/Test/Extractor.cs
@@ -6,6 +6,7 @@ using BinaryObjectScanner.Compression;
using BinaryObjectScanner.Utilities;
using BinaryObjectScanner.Wrappers;
using OpenMcdf;
+using SabreTools.IO;
using SharpCompress.Archives;
using SharpCompress.Archives.GZip;
using SharpCompress.Archives.Rar;
diff --git a/Test/Printer.cs b/Test/Printer.cs
index 0caa448c..9b1aa803 100644
--- a/Test/Printer.cs
+++ b/Test/Printer.cs
@@ -3,6 +3,7 @@ using System.IO;
using System.Text;
using BinaryObjectScanner.Utilities;
using BinaryObjectScanner.Wrappers;
+using SabreTools.IO;
namespace Test
{
diff --git a/Test/Test.csproj b/Test/Test.csproj
index e6742626..e5fd49f4 100644
--- a/Test/Test.csproj
+++ b/Test/Test.csproj
@@ -18,6 +18,7 @@
+