Combine remaining Core into Frontend

This commit is contained in:
Matt Nadareski
2024-05-28 14:12:36 -04:00
parent 3137a543a7
commit d349ef8a9d
24 changed files with 64 additions and 80 deletions

View File

@@ -154,6 +154,7 @@
- Remove unused reporter delegate
- Move StringEventArgs to Frontend
- Decouple execution contexts from Options class
- Combine remaining Core into Frontend
### 3.1.9a (2024-05-21)

View File

@@ -1,7 +1,6 @@
using System;
using System.IO;
using BinaryObjectScanner;
using MPF.Core;
using MPF.Frontend;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.Web;

View File

@@ -1,46 +0,0 @@
namespace MPF.Core
{
/// <summary>
/// Program that is being used to dump media
/// </summary>
public enum InternalProgram
{
NONE = 0,
// Dumping support
Aaru,
DiscImageCreator,
Redumper,
// Verification support only
CleanRip,
PS3CFW,
UmdImageCreator,
XboxBackupCreator,
}
/// <summary>
/// Drive read method option
/// </summary>
public enum RedumperReadMethod
{
NONE = 0,
BE,
D8,
BE_CDDA,
}
/// <summary>
/// Drive sector order option
/// </summary>
public enum RedumperSectorOrder
{
NONE = 0,
DATA_C2_SUB,
DATA_SUB_C2,
DATA_SUB,
DATA_C2,
}
}

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MPF.Core;
namespace MPF.Frontend.ComboBoxItems
{

View File

@@ -8,7 +8,6 @@ using System.Threading.Tasks;
using BinaryObjectScanner;
using MPF.ExecutionContexts;
using MPF.Processors;
using MPF.Core;
using Newtonsoft.Json;
using SabreTools.RedumpLib;
using SabreTools.RedumpLib.Data;
@@ -50,7 +49,7 @@ namespace MPF.Frontend
/// <summary>
/// Options object representing user-defined options
/// </summary>
private readonly Core.Options _options;
private readonly Frontend.Options _options;
/// <summary>
/// Processor object representing how to process the outputs
@@ -118,7 +117,7 @@ namespace MPF.Frontend
/// <param name="type"></param>
/// <param name="internalProgram"></param>
/// <param name="parameters"></param>
public DumpEnvironment(Core.Options options,
public DumpEnvironment(Frontend.Options options,
string outputPath,
Drive? drive,
RedumpSystem? system,

View File

@@ -5,7 +5,6 @@ using System.Collections.Generic;
using System.Collections.Concurrent;
#endif
using System.Reflection;
using MPF.Core;
using SabreTools.RedumpLib.Data;
namespace MPF.Frontend

View File

@@ -11,6 +11,25 @@ namespace MPF.Frontend
Removable,
}
/// <summary>
/// Program that is being used to dump media
/// </summary>
public enum InternalProgram
{
NONE = 0,
// Dumping support
Aaru,
DiscImageCreator,
Redumper,
// Verification support only
CleanRip,
PS3CFW,
UmdImageCreator,
XboxBackupCreator,
}
/// <summary>
/// Log level for output
/// </summary>
@@ -21,4 +40,29 @@ namespace MPF.Frontend
ERROR,
SECRET,
}
/// <summary>
/// Drive read method option
/// </summary>
public enum RedumperReadMethod
{
NONE = 0,
BE,
D8,
BE_CDDA,
}
/// <summary>
/// Drive sector order option
/// </summary>
public enum RedumperSectorOrder
{
NONE = 0,
DATA_C2_SUB,
DATA_SUB_C2,
DATA_SUB,
DATA_C2,
}
}

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using SabreTools.RedumpLib.Data;
namespace MPF.Core
namespace MPF.Frontend
{
public class Options
{

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using MPF.Core;
using Newtonsoft.Json;
using SabreTools.RedumpLib;
using SabreTools.RedumpLib.Data;

View File

@@ -20,7 +20,7 @@ namespace MPF.Frontend
/// <param name="progress">Optional progress callback</param>
/// <returns>Detected copy protection(s) if possible, null on error</returns>
public static async Task<(string?, Dictionary<string, List<string>>?)> GetCopyProtection(Drive? drive,
Core.Options options,
Frontend.Options options,
IProgress<ProtectionProgress>? progress = null)
{
if (options.ScanForProtection && drive?.Name != null)
@@ -40,7 +40,7 @@ namespace MPF.Frontend
/// <param name="progress">Optional progress callback</param>
/// <returns>Set of all detected copy protections with an optional error string</returns>
public static async Task<(Dictionary<string, List<string>>?, string?)> RunProtectionScanOnPath(string path,
Core.Options options,
Frontend.Options options,
IProgress<ProtectionProgress>? progress = null)
{
try

View File

@@ -5,7 +5,6 @@ using System.Linq;
using System.Threading.Tasks;
using BinaryObjectScanner;
using MPF.Processors;
using MPF.Core;
using SabreTools.RedumpLib;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.Web;
@@ -44,7 +43,7 @@ namespace MPF.Frontend
Drive? drive,
RedumpSystem? system,
MediaType? mediaType,
Core.Options options,
Frontend.Options options,
BaseProcessor processor,
IProgress<ResultEventArgs>? resultProgress = null,
IProgress<ProtectionProgress>? protectionProgress = null)
@@ -149,9 +148,9 @@ namespace MPF.Frontend
/// <param name="info">Existing SubmissionInfo object to fill</param>
/// <param name="resultProgress">Optional result progress callback</param>
#if NET40
public static bool FillFromRedump(Core.Options options, SubmissionInfo info, IProgress<ResultEventArgs>? resultProgress = null)
public static bool FillFromRedump(Frontend.Options options, SubmissionInfo info, IProgress<ResultEventArgs>? resultProgress = null)
#else
public async static Task<bool> FillFromRedump(Core.Options options, SubmissionInfo info, IProgress<ResultEventArgs>? resultProgress = null)
public async static Task<bool> FillFromRedump(Frontend.Options options, SubmissionInfo info, IProgress<ResultEventArgs>? resultProgress = null)
#endif
{
// If no username is provided

View File

@@ -5,7 +5,6 @@ using System.IO;
using System.Linq;
using System.Threading.Tasks;
using BinaryObjectScanner;
using MPF.Core;
using MPF.Frontend.ComboBoxItems;
using SabreTools.RedumpLib.Data;
@@ -21,11 +20,11 @@ namespace MPF.Frontend.ViewModels
/// <summary>
/// Access to the current options
/// </summary>
public Core.Options Options
public Frontend.Options Options
{
get => _options;
}
private readonly Core.Options _options;
private readonly Frontend.Options _options;
/// <summary>
/// Indicates if SelectionChanged events can be executed

View File

@@ -1,7 +1,6 @@
using System;
using System.ComponentModel;
using System.IO;
using MPF.Core;
using MPF.Processors;
namespace MPF.Frontend.ViewModels

View File

@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using MPF.Core;
using MPF.Frontend.ComboBoxItems;
using SabreTools.RedumpLib.Data;

View File

@@ -6,7 +6,6 @@ using System.Linq;
using System.Threading.Tasks;
using BinaryObjectScanner;
using MPF.Frontend.ComboBoxItems;
using MPF.Core;
using SabreTools.IO;
using SabreTools.RedumpLib.Data;
@@ -19,7 +18,7 @@ namespace MPF.Frontend.ViewModels
/// <summary>
/// Access to the current options
/// </summary>
public Core.Options Options
public Frontend.Options Options
{
get => _options;
set
@@ -28,7 +27,7 @@ namespace MPF.Frontend.ViewModels
OptionsLoader.SaveToConfig(_options);
}
}
private Core.Options _options;
private Frontend.Options _options;
/// <summary>
/// Indicates if SelectionChanged events can be executed
@@ -963,13 +962,13 @@ namespace MPF.Frontend.ViewModels
/// </summary>
/// <param name="savedSettings">Indicates if the settings were saved or not</param>
/// <param name="newOptions">Options representing the new, saved values</param>
public void UpdateOptions(bool savedSettings, Core.Options? newOptions)
public void UpdateOptions(bool savedSettings, Frontend.Options? newOptions)
{
// Get which options to save
var optionsToSave = savedSettings ? newOptions : Options;
// Ensure the first run flag is unset
var continuingOptions = new Core.Options(optionsToSave) { FirstRun = false };
var continuingOptions = new Frontend.Options(optionsToSave) { FirstRun = false };
this.Options = continuingOptions;
// If settings were changed, reinitialize the UI

View File

@@ -2,7 +2,6 @@
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using MPF.Core;
using MPF.Frontend.ComboBoxItems;
using SabreTools.RedumpLib.Web;

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using MPF.Core;
using MPF.Frontend;
using Xunit;

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MPF.Core;
using SabreTools.RedumpLib.Data;
using Xunit;

View File

@@ -1,5 +1,4 @@
using MPF.Core;
using MPF.Frontend;
using MPF.Frontend;
using SabreTools.RedumpLib.Data;
using Xunit;

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using MPF.Core;
using MPF.ExecutionContexts.DiscImageCreator;
using MPF.Frontend;
using SabreTools.RedumpLib.Data;
using Xunit;

View File

@@ -1,7 +1,7 @@
using System;
using System.Globalization;
using System.Windows.Data;
using MPF.Core;
using MPF.Frontend;
using MPF.Frontend.ComboBoxItems;
using SabreTools.RedumpLib.Data;

View File

@@ -5,7 +5,6 @@ using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Threading;
using MPF.Core;
using MPF.Frontend;
#pragma warning disable IDE1006 // Naming Styles

View File

@@ -1,7 +1,7 @@
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using MPF.Core;
using MPF.Frontend;
using MPF.Frontend.ViewModels;
using MPF.UI.UserControls;
using SabreTools.RedumpLib.Data;

View File

@@ -4,7 +4,7 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using MPF.Core;
using MPF.Frontend;
using MPF.Frontend.ViewModels;
using WPFCustomMessageBox;