From efe144313be1a13500706ed2790f8189aa4e678d Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 12 Nov 2024 23:29:53 -0500 Subject: [PATCH] Fix build --- BinaryObjectScanner/FileType/SGA.cs | 2 +- BinaryObjectScanner/Protection/JoWood.cs | 5 +--- BinaryObjectScanner/Protection/LaserLok.cs | 27 +++------------------- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/BinaryObjectScanner/FileType/SGA.cs b/BinaryObjectScanner/FileType/SGA.cs index 8c70191c..ccabfda9 100644 --- a/BinaryObjectScanner/FileType/SGA.cs +++ b/BinaryObjectScanner/FileType/SGA.cs @@ -162,7 +162,7 @@ namespace BinaryObjectScanner.FileType filename = Path.Combine(filename, parentNames[i]); } #else - filename = Path.Combine(parentNames); + filename = Path.Combine([.. parentNames]); #endif // Get the file offset diff --git a/BinaryObjectScanner/Protection/JoWood.cs b/BinaryObjectScanner/Protection/JoWood.cs index f8d6de03..e9580e0d 100644 --- a/BinaryObjectScanner/Protection/JoWood.cs +++ b/BinaryObjectScanner/Protection/JoWood.cs @@ -73,13 +73,10 @@ namespace BinaryObjectScanner.Protection return null; int position = positions[0]; -#if NET20 || NET35 || NET40 + byte[] versionBytes = new byte[8]; Array.Copy(fileContent, position + 67, versionBytes, 0, 8); char[] version = Array.ConvertAll(versionBytes, b => (char)b); -#else - char[] version = new ArraySegment(fileContent, position + 67, 8).Select(b => (char)b).ToArray(); -#endif return new string(version); } } diff --git a/BinaryObjectScanner/Protection/LaserLok.cs b/BinaryObjectScanner/Protection/LaserLok.cs index fbd0caa8..0c81095c 100644 --- a/BinaryObjectScanner/Protection/LaserLok.cs +++ b/BinaryObjectScanner/Protection/LaserLok.cs @@ -168,7 +168,7 @@ namespace BinaryObjectScanner.Protection if (versionTwo) { int index = position + 14; -#if NET20 || NET35 || NET40 + byte[] temp = new byte[2]; Array.Copy(sectionContent, index, temp, 0, 2); day = new string(Array.ConvertAll(temp, b => (char)b)); @@ -178,18 +178,11 @@ namespace BinaryObjectScanner.Protection index += 3; Array.Copy(sectionContent, index, temp, 0, 2); year = "20" + new string(Array.ConvertAll(temp, b => (char)b)); -#else - day = new string(new ArraySegment(sectionContent, index, 2).Select(b => (char)b).ToArray()); - index += 3; - month = new string(new ArraySegment(sectionContent, index, 2).Select(b => (char)b).ToArray()); - index += 3; - year = "20" + new string(new ArraySegment(sectionContent, index, 2).Select(b => (char)b).ToArray()); -#endif } else { int index = position + 13; -#if NET20 || NET35 || NET40 + byte[] temp = new byte[2]; Array.Copy(sectionContent, index, temp, 0, 2); day = new string(Array.ConvertAll(temp, b => (char)b)); @@ -199,13 +192,6 @@ namespace BinaryObjectScanner.Protection index += 3; Array.Copy(sectionContent, index, temp, 0, 2); year = "20" + new string(Array.ConvertAll(temp, b => (char)b)); -#else - day = new string(new ArraySegment(sectionContent, index, 2).Select(b => (char)b).ToArray()); - index += 3; - month = new string(new ArraySegment(sectionContent, index, 2).Select(b => (char)b).ToArray()); - index += 3; - year = "20" + new string(new ArraySegment(sectionContent, index, 2).Select(b => (char)b).ToArray()); -#endif } return $"(Build {year}-{month}-{day})"; @@ -217,13 +203,9 @@ namespace BinaryObjectScanner.Protection if (sectionContent == null) return null; -#if NET20 || NET35 || NET40 byte[] temp = new byte[4]; Array.Copy(sectionContent, position + 76, temp, 0, 4); return new string(Array.ConvertAll(temp, b => (char)b)); -#else - return new string(new ArraySegment(sectionContent, position + 76, 4).Select(b => (char)b).ToArray()); -#endif } public static string? GetVersion16Bit(string firstMatchedString, IEnumerable? files) @@ -238,13 +220,10 @@ namespace BinaryObjectScanner.Protection private static string GetVersion16Bit(byte[] fileContent) { -#if NET20 || NET35 || NET40 byte[] temp = new byte[7]; Array.Copy(fileContent, 71, temp, 0, 7); char[] version = Array.ConvertAll(temp, b => (char)b); -#else - char[] version = new ArraySegment(fileContent, 71, 7).Select(b => (char)b).ToArray(); -#endif + if (char.IsNumber(version[0]) && char.IsNumber(version[2]) && char.IsNumber(version[3])) { if (char.IsNumber(version[5]) && char.IsNumber(version[6]))