mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-12 03:46:49 +00:00
Fix Memory Issues (#4)
* Fix a couple of protection scans (possible mem issues) * Don't open the file contents on path scan for antimodchip * IS-CAB intermediate filtering to reduce scan times * Update NuGet version
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
@@ -11,8 +12,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
if (Path.GetFileName(file) == "CDSPlayer.app")
|
||||
{
|
||||
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
using (var sr = new StreamReader(fs))
|
||||
using (var sr = new StreamReader(file, Encoding.Default))
|
||||
{
|
||||
return "Cactus Data Shield " + sr.ReadLine().Substring(3) + "(" + sr.ReadLine() + ")";
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
@@ -26,28 +27,19 @@ namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
foreach (string file in files)
|
||||
{
|
||||
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
using (var sr = new StreamReader(fs))
|
||||
// Load the current file content
|
||||
string fileContent = null;
|
||||
using (StreamReader sr = new StreamReader(file, Encoding.Default))
|
||||
{
|
||||
string fileContent = sr.ReadToEnd();
|
||||
string protection = CheckContents(path, fileContent);
|
||||
if (!string.IsNullOrWhiteSpace(protection))
|
||||
return protection;
|
||||
fileContent = sr.ReadToEnd();
|
||||
}
|
||||
|
||||
string protection = CheckContents(path, fileContent);
|
||||
if (!string.IsNullOrWhiteSpace(protection))
|
||||
return protection;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (var fs = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
using (var sr = new StreamReader(fs))
|
||||
{
|
||||
string fileContent = sr.ReadToEnd();
|
||||
string protection = CheckContents(path, fileContent);
|
||||
if (!string.IsNullOrWhiteSpace(protection))
|
||||
return protection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user