From 20ea1b44271e821bf843ff27f4a83c33a9fa6fd7 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 30 Oct 2020 09:02:48 -0700 Subject: [PATCH] Fix formatting --- BurnOutSharp/FileType/Executable.cs | 8 ++++---- BurnOutSharp/ProtectionType/NSIS.cs | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/BurnOutSharp/FileType/Executable.cs b/BurnOutSharp/FileType/Executable.cs index 0eb9ef87..d61510ab 100644 --- a/BurnOutSharp/FileType/Executable.cs +++ b/BurnOutSharp/FileType/Executable.cs @@ -172,12 +172,12 @@ namespace BurnOutSharp.FileType protection = LaserLock.CheckContents(file, fileContent, includePosition); if (!string.IsNullOrWhiteSpace(protection)) protections.Add(protection); - - // NSIS - protection = NSIS.CheckContents(fileContent, includePosition); + + // NSIS + protection = NSIS.CheckContents(fileContent, includePosition); if (!string.IsNullOrWhiteSpace(protection)) protections.Add(protection); - + // PE Compact protection = PECompact.CheckContents(fileContent, includePosition); if (!string.IsNullOrWhiteSpace(protection)) diff --git a/BurnOutSharp/ProtectionType/NSIS.cs b/BurnOutSharp/ProtectionType/NSIS.cs index 1287aeff..674dd535 100644 --- a/BurnOutSharp/ProtectionType/NSIS.cs +++ b/BurnOutSharp/ProtectionType/NSIS.cs @@ -12,36 +12,36 @@ namespace BurnOutSharp.ProtectionType byte[] check = new byte[] { 0x4e, 0x75, 0x6c, 0x6c, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x20, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d }; if (fileContent.Contains(check, out int position)) { - string version = GetVersion(fileContent, position); + string version = GetVersion(fileContent, position); return $"NSIS {version}" + (includePosition ? $" (Index {position})" : string.Empty); } - - // NullsoftInst - check = new byte[] { 0x4e, 0x75, 0x6c, 0x6c, 0x73, 0x6f, 0x66, 0x74, 0x49, 0x6e, 0x73, 0x74 }; + + // NullsoftInst + check = new byte[] { 0x4e, 0x75, 0x6c, 0x6c, 0x73, 0x6f, 0x66, 0x74, 0x49, 0x6e, 0x73, 0x74 }; if (fileContent.Contains(check, out position)) { return $"NSIS" + (includePosition ? $" (Index {position})" : string.Empty); } - + return null; } - - private static string GetVersion(byte[] fileContent, int index) + + private static string GetVersion(byte[] fileContent, int index) { try { index += 24; - if (fileContent[index] != 'v') - return "(Unknown Version)"; - var versionBytes = new ReadOnlySpan(fileContent, index, 16).ToArray(); - var onlyVersion = versionBytes.TakeWhile(b => b != '<').ToArray(); - string versionString = Encoding.ASCII.GetString(onlyVersion); - return versionString; + if (fileContent[index] != 'v') + return "(Unknown Version)"; + + var versionBytes = new ReadOnlySpan(fileContent, index, 16).ToArray(); + var onlyVersion = versionBytes.TakeWhile(b => b != '<').ToArray(); + return Encoding.ASCII.GetString(onlyVersion); } catch { return "(Unknown Version)"; } - } + } } } \ No newline at end of file