Update BinaryObjectScanner to 3.4.0

This commit is contained in:
Matt Nadareski
2025-09-22 10:15:40 -04:00
parent e280745eee
commit 0fb8bf5c29
11 changed files with 95 additions and 19 deletions

View File

@@ -25,6 +25,7 @@
- Update redumper to b655
- Support new versioning format in redumper (fuzz6001)
- Add RedumperRefineSectorMode setting
- Update BinaryObjectScanner to 3.4.0
### 3.3.3 (2025-07-18)

View File

@@ -14,6 +14,7 @@ namespace MPF.Frontend.Test.Tools
List<string> protections =
[
"Anything Else Protection",
"[Access issue when opening file",
"[Exception opening file",
];

View File

@@ -410,7 +410,12 @@ namespace MPF.Frontend
/// </summary>
/// <param name="mediaType">MediaType for specialized dumping parameters</param>
/// <param name="progress">Optional result progress callback</param>
public async Task<ResultEventArgs> Run(MediaType? mediaType, IProgress<ResultEventArgs>? progress = null)
public async Task<ResultEventArgs> Run(MediaType? mediaType,
#if NET20 || NET35 || NET40
BinaryObjectScanner.IProgress<ResultEventArgs>? progress = null)
#else
IProgress<ResultEventArgs>? progress = null)
#endif
{
// If we don't have parameters
if (_executionContext == null)
@@ -419,9 +424,15 @@ namespace MPF.Frontend
// Build default console progress indicators if none exist
if (progress == null)
{
#if NET20 || NET35 || NET40
var temp = new BinaryObjectScanner.Progress<ResultEventArgs>();
temp.ProgressChanged += ConsoleLogger.ProgressUpdated;
progress = temp;
#else
var temp = new Progress<ResultEventArgs>();
temp.ProgressChanged += ConsoleLogger.ProgressUpdated;
progress = temp;
#endif
}
// Check that we have the basics for dumping
@@ -455,8 +466,13 @@ namespace MPF.Frontend
/// <param name="seedInfo">A seed SubmissionInfo object that contains user data</param>
/// <returns>Result instance with the outcome</returns>
public async Task<ResultEventArgs> VerifyAndSaveDumpOutput(
#if NET20 || NET35 || NET40
BinaryObjectScanner.IProgress<ResultEventArgs>? resultProgress = null,
BinaryObjectScanner.IProgress<ProtectionProgress>? protectionProgress = null,
#else
IProgress<ResultEventArgs>? resultProgress = null,
IProgress<ProtectionProgress>? protectionProgress = null,
#endif
ProcessUserInfoDelegate? processUserInfo = null,
SubmissionInfo? seedInfo = null)
{
@@ -464,6 +480,20 @@ namespace MPF.Frontend
return ResultEventArgs.Failure("Error! Current configuration is not supported!");
// Build default console progress indicators if none exist
#if NET20 || NET35 || NET40
if (resultProgress == null)
{
var temp = new BinaryObjectScanner.Progress<ResultEventArgs>();
temp.ProgressChanged += ConsoleLogger.ProgressUpdated;
resultProgress = temp;
}
if (protectionProgress == null)
{
var temp = new BinaryObjectScanner.Progress<ProtectionProgress>();
temp.ProgressChanged += ConsoleLogger.ProgressUpdated;
protectionProgress = temp;
}
#else
if (resultProgress == null)
{
var temp = new Progress<ResultEventArgs>();
@@ -476,6 +506,7 @@ namespace MPF.Frontend
temp.ProgressChanged += ConsoleLogger.ProgressUpdated;
protectionProgress = temp;
}
#endif
resultProgress.Report(ResultEventArgs.Success("Gathering submission information... please wait!"));

View File

@@ -31,7 +31,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BinaryObjectScanner" Version="3.3.4" />
<PackageReference Include="BinaryObjectScanner" Version="3.4.0" />
<PackageReference Include="LibIRD" Version="1.0.0" />
<PackageReference Include="Microsoft.Management.Infrastructure" Version="3.0.0" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
<PackageReference Include="Microsoft.Net.Http" Version="2.2.29" Condition="$(TargetFramework.StartsWith(`net452`))" />

View File

@@ -72,9 +72,13 @@ namespace MPF.Frontend.Tools
/// <param name="options">Options object that determines what to scan</param>
/// <param name="progress">Optional progress callback</param>
/// <returns>Set of all detected copy protections with an optional error string</returns>
public static async Task<ProtectionDictionary> RunProtectionScanOnPath(string path,
public static async Task<Dictionary<string, List<string>>> RunProtectionScanOnPath(string path,
Options options,
#if NET20 || NET35 || NET40
BinaryObjectScanner.IProgress<ProtectionProgress>? progress = null)
#else
IProgress<ProtectionProgress>? progress = null)
#endif
{
#if NET40
var found = await Task.Factory.StartNew(() =>
@@ -97,9 +101,6 @@ namespace MPF.Frontend.Tools
if (found == null || found.Count == 0)
return [];
// Filter out any empty protections
found.ClearEmptyKeys();
// Return the filtered set of protections
return found;
}
@@ -109,7 +110,7 @@ namespace MPF.Frontend.Tools
/// </summary>
/// <param name="protections">Dictionary of file to list of protection mappings</param>
/// <returns>Detected protections, if any</returns>
public static string? FormatProtections(ProtectionDictionary? protections)
public static string? FormatProtections(Dictionary<string, List<string>>? protections)
{
// If the filtered list is empty in some way, return
if (protections == null)
@@ -200,7 +201,12 @@ namespace MPF.Frontend.Tools
// EXCEPTIONS
if (foundProtections.Exists(p => p.StartsWith("[Exception opening file")))
{
foundProtections = foundProtections.FindAll(p => !p.StartsWith("[Exception opening file"));
foundProtections = foundProtections.FindAll(p => !p.StartsWith("[Exception opening file") && !p.StartsWith("[Access issue when opening file"));
foundProtections.Add("Exception occurred while scanning [RESCAN NEEDED]");
}
if (foundProtections.Exists(p => p.StartsWith("[Access issue when opening file")))
{
foundProtections = foundProtections.FindAll(p => !p.StartsWith("[Exception opening file") && !p.StartsWith("[Access issue when opening file"));
foundProtections.Add("Exception occurred while scanning [RESCAN NEEDED]");
}

View File

@@ -48,8 +48,13 @@ namespace MPF.Frontend.Tools
MediaType? mediaType,
Options options,
BaseProcessor processor,
#if NET20 || NET35 || NET40
BinaryObjectScanner.IProgress<ResultEventArgs>? resultProgress = null,
BinaryObjectScanner.IProgress<ProtectionProgress>? protectionProgress = null)
#else
IProgress<ResultEventArgs>? resultProgress = null,
IProgress<ProtectionProgress>? protectionProgress = null)
#endif
{
// Split the output path for easier use
var outputDirectory = Path.GetDirectoryName(outputPath);
@@ -112,7 +117,7 @@ namespace MPF.Frontend.Tools
{
resultProgress?.Report(ResultEventArgs.Success("Running copy protection scan... this might take a while!"));
ProtectionDictionary? protections = null;
Dictionary<string, List<string>>? protections = null;
try
{
if (options.ScanForProtection && drive?.Name != null)
@@ -154,7 +159,11 @@ namespace MPF.Frontend.Tools
/// <param name="resultProgress">Optional result progress callback</param>
public async static Task<bool> FillFromRedump(Options options,
SubmissionInfo info,
#if NET20 || NET35 || NET40
BinaryObjectScanner.IProgress<ResultEventArgs>? resultProgress = null)
#else
IProgress<ResultEventArgs>? resultProgress = null)
#endif
{
// If information should not be pulled at all
if (!options.RetrieveMatchInformation)
@@ -998,7 +1007,7 @@ namespace MPF.Frontend.Tools
/// <summary>
/// Set a comment field if it doesn't already have a value
/// </summary>
private static void SetCommentFieldIfNotExists(SubmissionInfo info, SiteCode key, Drive? drive, Func<Drive?, string?> valueFunc)
private static void SetCommentFieldIfNotExists(SubmissionInfo info, SiteCode key, Drive? drive, System.Func<Drive?, string?> valueFunc)
{
// If the field has a valid value, skip
if (CommentFieldExists(info, key, out _))
@@ -1032,7 +1041,14 @@ namespace MPF.Frontend.Tools
/// <summary>
/// Set a content field if it doesn't already have a value
/// </summary>
private static void SetContentFieldIfNotExists(SubmissionInfo info, SiteCode key, Drive? drive, Func<Drive?, string?> valueFunc)
private static void SetContentFieldIfNotExists(SubmissionInfo info,
SiteCode key,
Drive? drive,
#if NET20
BinaryObjectScanner.Func<Drive?, string?> valueFunc)
#else
Func<Drive?, string?> valueFunc)
#endif
{
// If the field has a valid value, skip
if (ContentFieldExists(info, key, out _))
@@ -1047,7 +1063,13 @@ namespace MPF.Frontend.Tools
/// <summary>
/// Set the version if it doesn't already have a value
/// </summary>
private static void SetVersionIfNotExists(SubmissionInfo info, Drive? drive, Func<Drive?, string?> valueFunc)
private static void SetVersionIfNotExists(SubmissionInfo info,
Drive? drive,
#if NET20
BinaryObjectScanner.Func<Drive?, string?> valueFunc)
#else
Func<Drive?, string?> valueFunc)
#endif
{
// If the version already exists, skip
if (!string.IsNullOrEmpty(info.VersionAndEditions!.Version))
@@ -1062,7 +1084,7 @@ namespace MPF.Frontend.Tools
/// </summary>
/// <param name="oldDict">ProtectionDictionary to format</param>
/// <returns>Reformatted dictionary on success, empty on error</returns>
private static Dictionary<string, List<string>?> ReformatProtectionDictionary(ProtectionDictionary? oldDict)
private static Dictionary<string, List<string>?> ReformatProtectionDictionary(Dictionary<string, List<string>>? oldDict)
{
// Null or empty protections return empty
if (oldDict == null || oldDict.Count == 0)

View File

@@ -407,10 +407,17 @@ namespace MPF.Frontend.ViewModels
DisableEventHandlers();
// Get progress indicators
#if NET20 || NET35 || NET40
var resultProgress = new BinaryObjectScanner.Progress<ResultEventArgs>();
resultProgress.ProgressChanged += ProgressUpdated;
var protectionProgress = new BinaryObjectScanner.Progress<ProtectionProgress>();
protectionProgress.ProgressChanged += ProgressUpdated;
#else
var resultProgress = new Progress<ResultEventArgs>();
resultProgress.ProgressChanged += ProgressUpdated;
var protectionProgress = new Progress<ProtectionProgress>();
protectionProgress.ProgressChanged += ProgressUpdated;
#endif
// Populate an environment
var env = new DumpEnvironment(Options,

View File

@@ -53,7 +53,11 @@ namespace MPF.Frontend.ViewModels
/// T4 - true for inquiry, false otherwise
/// TResult - true for positive, false for negative, null for neutral
/// </remarks>
#if NET20
private BinaryObjectScanner.Func<string, string, int, bool, bool?>? _displayUserMessage;
#else
private Func<string, string, int, bool, bool?>? _displayUserMessage;
#endif
/// <summary>
/// Detected media type, distinct from the selected one
@@ -595,7 +599,11 @@ namespace MPF.Frontend.ViewModels
/// </summary>
public void Init(
Action<LogLevel, string> loggerAction,
#if NET20
BinaryObjectScanner.Func<string, string, int, bool, bool?> displayUserMessage,
#else
Func<string, string, int, bool, bool?> displayUserMessage,
#endif
ProcessUserInfoDelegate processUserInfo)
{
// Set the callbacks
@@ -1639,7 +1647,7 @@ namespace MPF.Frontend.ViewModels
if (!File.Exists(catalogjs))
return RedumpSystem.MicrosoftXboxOne;
SabreTools.Models.Xbox.Catalog? catalog = SabreTools.Serialization.Deserializers.Catalog.DeserializeFile(catalogjs);
SabreTools.Models.Xbox.Catalog? catalog = new SabreTools.Serialization.Deserializers.Catalog().Deserialize(catalogjs);
if (catalog != null && catalog.Version != null && catalog.Packages != null)
{
if (!double.TryParse(catalog.Version, out double version))

View File

@@ -409,7 +409,7 @@ namespace MPF.Processors
cueSheet.Files = [.. cueFiles];
if (cueSheet != null && cueSheet != default)
{
var ms = SabreTools.Serialization.Serializers.CueSheet.SerializeStream(cueSheet);
var ms = new SabreTools.Serialization.Serializers.CueSheet().Serialize(cueSheet);
if (ms == null)
return null;

View File

@@ -34,14 +34,14 @@
<ItemGroup>
<PackageReference Include="SabreTools.Hashing" Version="1.5.0" />
<PackageReference Include="SabreTools.IO" Version="1.7.2" />
<PackageReference Include="SabreTools.IO" Version="1.7.3" />
<PackageReference Include="SabreTools.Matching" Version="1.6.0" />
<PackageReference Include="SabreTools.Models" Version="1.7.1" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.7.2" />
<PackageReference Include="SabreTools.Serialization" Version="1.9.0" />
<PackageReference Include="SabreTools.Serialization" Version="1.9.5" />
<PackageReference Include="System.IO.Compression" Version="4.3.0" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`))" />
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="9.0.4" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="9.0.9" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
</ItemGroup>
</Project>

View File

@@ -133,7 +133,7 @@ namespace MPF.Processors
{
try
{
return SabreTools.Serialization.Deserializers.PIC.DeserializeFile(pic);
return new SabreTools.Serialization.Deserializers.PIC().Deserialize(pic);
}
catch
{