diff --git a/SabreTools.Core/ArrayExtensions.cs b/SabreTools.Core/ArrayExtensions.cs index e5d632af..4de08c59 100644 --- a/SabreTools.Core/ArrayExtensions.cs +++ b/SabreTools.Core/ArrayExtensions.cs @@ -11,5 +11,29 @@ namespace SabreTools.Core { return array == null || array.Length == 0; } + + //// + /// Returns if the first byte array starts with the second array + /// + public static bool StartsWith(this byte[] arr1, byte[] arr2, bool exact = false) + { + // If we have any invalid inputs, we return false + if (arr1 == null || arr2 == null + || arr1.Length == 0 || arr2.Length == 0 + || arr2.Length > arr1.Length + || (exact && arr1.Length != arr2.Length)) + { + return false; + } + + // Otherwise, loop through and see + for (int i = 0; i < arr2.Length; i++) + { + if (arr1[i] != arr2[i]) + return false; + } + + return true; + } } } \ No newline at end of file diff --git a/SabreTools.Core/Tools/Utilities.cs b/SabreTools.Core/Tools/Utilities.cs index 26f2b4ff..a4daab70 100644 --- a/SabreTools.Core/Tools/Utilities.cs +++ b/SabreTools.Core/Tools/Utilities.cs @@ -111,33 +111,5 @@ namespace SabreTools.Core.Tools _ => false, }; } - - //// - /// Returns if the first byte array starts with the second array - /// - /// First byte array to compare - /// Second byte array to compare - /// True if the input arrays should match exactly, false otherwise (default) - /// True if the first byte array starts with the second, false otherwise - public static bool StartsWith(this byte[] arr1, byte[] arr2, bool exact = false) - { - // If we have any invalid inputs, we return false - if (arr1 == null || arr2 == null - || arr1.Length == 0 || arr2.Length == 0 - || arr2.Length > arr1.Length - || (exact && arr1.Length != arr2.Length)) - { - return false; - } - - // Otherwise, loop through and see - for (int i = 0; i < arr2.Length; i++) - { - if (arr1[i] != arr2[i]) - return false; - } - - return true; - } } } diff --git a/SabreTools.FileTypes/Aaru/AaruFormat.cs b/SabreTools.FileTypes/Aaru/AaruFormat.cs index 8f33eb2d..2c0cef97 100644 --- a/SabreTools.FileTypes/Aaru/AaruFormat.cs +++ b/SabreTools.FileTypes/Aaru/AaruFormat.cs @@ -1,7 +1,6 @@ using System.IO; using System.Text; - -using SabreTools.Core.Tools; +using SabreTools.Core; using SabreTools.IO; namespace SabreTools.FileTypes.Aaru diff --git a/SabreTools.FileTypes/BaseFile.cs b/SabreTools.FileTypes/BaseFile.cs index 201e6ba5..f9afb10c 100644 --- a/SabreTools.FileTypes/BaseFile.cs +++ b/SabreTools.FileTypes/BaseFile.cs @@ -2,7 +2,6 @@ using System.IO; using System.Linq; using System.Threading.Tasks; - using SabreTools.Core; using SabreTools.Core.Tools; using SabreTools.FileTypes.Aaru;