mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-02-04 13:45:28 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
055fcbbde7 | ||
|
|
a2e00e3945 | ||
|
|
7338640635 |
@@ -54,6 +54,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="CaseInsensitiveDictionary.cs" />
|
||||
<Compile Include="EVORE.cs" />
|
||||
<Compile Include="Progress.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ProtectionFind.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<package >
|
||||
<metadata>
|
||||
<id>BurnOutSharp</id>
|
||||
<version>1.03.6</version>
|
||||
<version>1.03.7</version>
|
||||
<title>BurnOutSharp</title>
|
||||
<authors>Matt Nadareski, Gernot Knippen</authors>
|
||||
<owners>Matt Nadareski, Gernot Knippen</owners>
|
||||
|
||||
16
BurnOutSharp/Progress.cs
Normal file
16
BurnOutSharp/Progress.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace BurnOutSharp
|
||||
{
|
||||
public class Progress
|
||||
{
|
||||
public string Filename { get; private set; }
|
||||
public float Percentage { get; private set; }
|
||||
public string Protection { get; private set; }
|
||||
|
||||
public Progress(string filename, float percentage, string protection)
|
||||
{
|
||||
this.Filename = filename;
|
||||
this.Percentage = percentage;
|
||||
this.Protection = protection;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.03.6")]
|
||||
[assembly: AssemblyFileVersion("1.03.6.0")]
|
||||
[assembly: AssemblyVersion("1.03.7")]
|
||||
[assembly: AssemblyFileVersion("1.03.7.0")]
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace BurnOutSharp
|
||||
/// Scan a path to find any known copy protection(s)
|
||||
/// </summary>
|
||||
/// <param name="path">Path to scan for protection(s)</param>
|
||||
/// <param name="progress">Optional progress indicator that will return a float in the range from 0 to 1</param>
|
||||
/// <returns>Dictionary of filename to protection mappings, if possible</returns>
|
||||
/// <remarks>
|
||||
/// TODO: Sector scanning?
|
||||
@@ -51,10 +52,13 @@ namespace BurnOutSharp
|
||||
/// - The Bongle (http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm)
|
||||
/// - The Copy-Protected CD (http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm)
|
||||
/// </remarks>
|
||||
public static Dictionary<string, string> Scan(string path)
|
||||
public static Dictionary<string, string> Scan(string path, IProgress<Progress> progress = null)
|
||||
{
|
||||
var protections = new Dictionary<string, string>();
|
||||
|
||||
// Checkpoint
|
||||
progress?.Report(new Progress(null, 0, null));
|
||||
|
||||
// Create mappings for checking against
|
||||
var mappings = CreateFilenameProtectionMapping();
|
||||
|
||||
@@ -73,6 +77,9 @@ namespace BurnOutSharp
|
||||
string protectionname = ScanInFile(path)?.Replace("" + (char)0x00, "");
|
||||
if (!String.IsNullOrEmpty(protectionname))
|
||||
protections[path] = protectionname;
|
||||
|
||||
// Checkpoint
|
||||
progress?.Report(new Progress(path, 1, protectionname));
|
||||
}
|
||||
// If we have a directory
|
||||
else if (Directory.Exists(path))
|
||||
@@ -97,8 +104,11 @@ namespace BurnOutSharp
|
||||
protections[path] = "Zzxzz";
|
||||
|
||||
// Loop through all files and scan them
|
||||
foreach (string file in files)
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
{
|
||||
// Get the current file
|
||||
string file = files[i];
|
||||
|
||||
// If the file is in the list of known files, add that to the protections found
|
||||
if (mappings.ContainsKey(Path.GetFileName(file)))
|
||||
protections[file] = mappings[Path.GetFileName(file)];
|
||||
@@ -111,6 +121,9 @@ namespace BurnOutSharp
|
||||
string protectionname = ScanInFile(file)?.Replace("" + (char)0x00, "");
|
||||
if (!String.IsNullOrEmpty(protectionname))
|
||||
protections[file] = protectionname;
|
||||
|
||||
// Checkpoint
|
||||
progress?.Report(new Progress(file, i / files.Length, protectionname));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user