From ed26e6611ad2e690611071f69deff856de0b7814 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 11 Feb 2022 12:59:37 -0800 Subject: [PATCH] Cap X360 directory check to 500MB (fixes #362) --- CHANGELIST.md | 1 + MPF.Core/Data/Drive.cs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index af5cb7f2..84f3e275 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -6,6 +6,7 @@ - Fix DVD layer finding corner case - Fix failing module tests - Add option to limit region and language selections +- Cap X360 directory check to 500MB ### 2.3 (2022-02-05) - Start overhauling Redump information pulling, again diff --git a/MPF.Core/Data/Drive.cs b/MPF.Core/Data/Drive.cs index 557e77ad..912b9488 100644 --- a/MPF.Core/Data/Drive.cs +++ b/MPF.Core/Data/Drive.cs @@ -45,6 +45,11 @@ namespace MPF.Core.Data /// public bool MarkedActive => driveInfo?.IsReady ?? false; + /// + /// Represents the total size of the drive + /// + public long TotalSize => driveInfo?.TotalSize ?? default; + /// /// Media label as read by Windows /// @@ -279,7 +284,8 @@ namespace MPF.Core.Data try { if (Directory.Exists(Path.Combine(drivePath, "$SystemUpdate")) - && Directory.EnumerateFiles(Path.Combine(drivePath, "$SystemUpdate")).Any()) + && Directory.EnumerateFiles(Path.Combine(drivePath, "$SystemUpdate")).Any() + && this.TotalSize <= 500_000_000) { return RedumpSystem.MicrosoftXbox360; }