Skip to content

Commit be69c52

Browse files
committed
Reduce unnecessary complexity
1 parent 6fdbdd9 commit be69c52

File tree

6 files changed

+0
-97
lines changed

6 files changed

+0
-97
lines changed

BinaryObjectScanner/FileType/Executable.cs

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,6 @@ namespace BinaryObjectScanner.FileType
1717
/// </summary>
1818
public class Executable : IDetectable
1919
{
20-
#region Properties
21-
22-
/// <summary>
23-
/// Determines if game engines are counted as detected protections or not
24-
/// </summary>
25-
public bool IncludeGameEngines { get; set; }
26-
27-
/// <summary>
28-
/// Determines if packers are counted as detected protections or not
29-
/// </summary>
30-
public bool IncludePackers { get; set; }
31-
32-
#endregion
33-
3420
/// <inheritdoc/>
3521
public string? Detect(string file, bool includeDebug)
3622
{
@@ -192,14 +178,6 @@ public IDictionary<IContentCheck, string> RunContentChecks(string? file, Stream
192178
if (string.IsNullOrEmpty(protection))
193179
return;
194180

195-
// If we are filtering on game engines
196-
if (CheckIfGameEngine(checkClass) && !IncludeGameEngines)
197-
return;
198-
199-
// If we are filtering on packers
200-
if (CheckIfPacker(checkClass) && !IncludePackers)
201-
return;
202-
203181
protections.Append(checkClass, protection);
204182
});
205183

@@ -230,14 +208,6 @@ public IDictionary<U, string> RunExecutableChecks<T, U>(string file, T exe, List
230208
if (string.IsNullOrEmpty(protection))
231209
return;
232210

233-
// If we are filtering on game engines
234-
if (CheckIfGameEngine(checkClass) && !IncludeGameEngines)
235-
return;
236-
237-
// If we are filtering on packers
238-
if (CheckIfPacker(checkClass) && !IncludePackers)
239-
return;
240-
241211
protections.Append(checkClass, protection);
242212
});
243213

@@ -348,27 +318,5 @@ private static ProtectionDictionary PerformExtractableCheck<T>(IExtractableExecu
348318
}
349319

350320
#endregion
351-
352-
#region Helpers
353-
354-
/// <summary>
355-
/// Check to see if an implementation is a game engine using reflection
356-
/// </summary>
357-
/// <param name="impl">Implementation that was last used to check</param>
358-
private static bool CheckIfGameEngine(object impl)
359-
{
360-
return impl.GetType().Namespace?.ToLowerInvariant()?.Contains("gameengine") ?? false;
361-
}
362-
363-
/// <summary>
364-
/// Check to see if an implementation is a packer using reflection
365-
/// </summary>
366-
/// <param name="impl">Implementation that was last used to check</param>
367-
private static bool CheckIfPacker(object impl)
368-
{
369-
return impl.GetType().Namespace?.ToLowerInvariant()?.Contains("packer") ?? false;
370-
}
371-
372-
#endregion
373321
}
374322
}

BinaryObjectScanner/Options.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,6 @@ public class Options
1515
/// </summary>
1616
public bool ScanContents { get; set; }
1717

18-
/// <summary>
19-
/// Determines if game engines are counted as detected protections or not
20-
/// </summary>
21-
public bool ScanGameEngines { get; set; }
22-
23-
/// <summary>
24-
/// Determines if packers are counted as detected protections or not
25-
/// </summary>
26-
public bool ScanPackers { get; set; }
27-
2818
/// <summary>
2919
/// Determines if path matches are used or not
3020
/// </summary>

BinaryObjectScanner/Packer/WiseInstaller.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using System.IO;
44
using BinaryObjectScanner.Interfaces;
5-
using SabreTools.IO.Extensions;
65
using SabreTools.Matching;
76
using SabreTools.Matching.Content;
87
using SabreTools.Serialization.Wrappers;

BinaryObjectScanner/Scanner.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,11 @@ public class Scanner
3030
/// </summary>
3131
/// <param name="scanArchives">Enable scanning archive contents</param>
3232
/// <param name="scanContents">Enable including content detections in output</param>
33-
/// <param name="scanGameEngines">Enable including game engines in output</param>
34-
/// <param name="scanPackers">Enable including packers in output</param>
3533
/// <param name="scanPaths">Enable including path detections in output</param>
3634
/// <param name="includeDebug">Enable including debug information</param>
3735
/// <param name="fileProgress">Optional progress callback</param>
3836
public Scanner(bool scanArchives,
3937
bool scanContents,
40-
bool scanGameEngines,
41-
bool scanPackers,
4238
bool scanPaths,
4339
bool includeDebug,
4440
IProgress<ProtectionProgress>? fileProgress = null)
@@ -47,8 +43,6 @@ public Scanner(bool scanArchives,
4743
{
4844
ScanArchives = scanArchives,
4945
ScanContents = scanContents,
50-
ScanGameEngines = scanGameEngines,
51-
ScanPackers = scanPackers,
5246
ScanPaths = scanPaths,
5347
IncludeDebug = includeDebug,
5448
};
@@ -273,9 +267,6 @@ private ProtectionDictionary GetInternalProtections(string fileName, Stream stre
273267
// If we have an executable, it needs to bypass normal handling
274268
if (detectable is Executable executable)
275269
{
276-
executable.IncludeGameEngines = _options.ScanGameEngines;
277-
executable.IncludePackers = _options.ScanPackers;
278-
279270
var subProtections = executable.DetectDict(stream, fileName, GetProtections, _options.IncludeDebug);
280271
protections.Append(subProtections);
281272
}

ProtectionScan/Options.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,6 @@ internal sealed class Options
2929
/// Scan file contents during protection scanning
3030
/// </summary>
3131
public bool ScanContents { get; private set; } = true;
32-
33-
/// <summary>
34-
/// Scan game engines during protection scanning
35-
/// </summary>
36-
public bool ScanGameEngines { get; private set; } = true;
37-
38-
/// <summary>
39-
/// Scan packers during protection scanning
40-
/// </summary>
41-
public bool ScanPackers { get; private set; } = true;
42-
4332
/// <summary>
4433
/// Scan file paths during protection scanning
4534
/// </summary>
@@ -85,16 +74,6 @@ internal sealed class Options
8574
options.ScanContents = false;
8675
break;
8776

88-
case "-ng":
89-
case "--no-game-engines":
90-
options.ScanGameEngines = false;
91-
break;
92-
93-
case "-np":
94-
case "--no-packers":
95-
options.ScanPackers = false;
96-
break;
97-
9877
case "-ns":
9978
case "--no-paths":
10079
options.ScanPaths = false;
@@ -130,8 +109,6 @@ public static void DisplayHelp()
130109
Console.WriteLine("-d, --debug Enable debug mode");
131110
Console.WriteLine("-nc, --no-contents Disable scanning for content checks");
132111
Console.WriteLine("-na, --no-archives Disable scanning archives");
133-
Console.WriteLine("-ng, --no-game-engines Disable scanning for game engines");
134-
Console.WriteLine("-np, --no-packers Disable scanning for packers");
135112
Console.WriteLine("-ns, --no-paths Disable scanning for path checks");
136113
}
137114
}

ProtectionScan/Program.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ static void Main(string[] args)
3434
var scanner = new Scanner(
3535
options.ScanArchives,
3636
options.ScanContents,
37-
options.ScanGameEngines,
38-
options.ScanPackers,
3937
options.ScanPaths,
4038
options.Debug,
4139
fileProgress);

0 commit comments

Comments
 (0)