From ac072618c446bb1fb27eca8359e93a3bb7b2afea Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 28 May 2024 00:15:43 -0400 Subject: [PATCH] Remove unused byte array helper methods --- CHANGELIST.md | 1 + MPF.Core/Utilities/Tools.cs | 60 ------------------------------------- 2 files changed, 1 insertion(+), 60 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index 17a5e68d..d5cee8de 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -119,6 +119,7 @@ - Move ProcessingQueue to Frontend - Move LogLevel enum to Frontend - Create ProcessingTool and move some methods +- Remove unused byte array helper methods ### 3.1.9a (2024-05-21) diff --git a/MPF.Core/Utilities/Tools.cs b/MPF.Core/Utilities/Tools.cs index ab81f541..09861848 100644 --- a/MPF.Core/Utilities/Tools.cs +++ b/MPF.Core/Utilities/Tools.cs @@ -10,66 +10,6 @@ namespace MPF.Core.Utilities { #region Byte Arrays - /// - /// Search for a byte array in another array - /// - public static bool Contains(this byte[] stack, byte[] needle, out int position, int start = 0, int end = -1) - { - // Initialize the found position to -1 - position = -1; - - // If either array is null or empty, we can't do anything - if (stack == null || stack.Length == 0 || needle == null || needle.Length == 0) - return false; - - // If the needle array is larger than the stack array, it can't be contained within - if (needle.Length > stack.Length) - return false; - - // If start or end are not set properly, set them to defaults - if (start < 0) - start = 0; - if (end < 0) - end = stack.Length - needle.Length; - - for (int i = start; i < end; i++) - { - if (stack.EqualAt(needle, i)) - { - position = i; - return true; - } - } - - return false; - } - - /// - /// See if a byte array starts with another - /// - public static bool StartsWith(this byte[] stack, byte[] needle) - { - return stack.Contains(needle, out int _, start: 0, end: 1); - } - - /// - /// Get if a stack at a certain index is equal to a needle - /// - private static bool EqualAt(this byte[] stack, byte[] needle, int index) - { - // If we're too close to the end of the stack, return false - if (needle.Length >= stack.Length - index) - return false; - - for (int i = 0; i < needle.Length; i++) - { - if (stack[i + index] != needle[i]) - return false; - } - - return true; - } - /// /// Converts a hex string into a byte array ///