Pass MainForm as IDialogParent through to movie importers
This commit is contained in:
parent
2fad61e4b5
commit
3249ae202e
|
@ -9,7 +9,12 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public interface IMovieImport
|
||||
{
|
||||
ImportResult Import(IMovieSession session, IEmulator emulator, string path, Config config);
|
||||
ImportResult Import(
|
||||
IDialogParent dialogParent,
|
||||
IMovieSession session,
|
||||
IEmulator emulator,
|
||||
string path,
|
||||
Config config);
|
||||
}
|
||||
|
||||
internal abstract class MovieImporter : IMovieImport
|
||||
|
@ -18,8 +23,16 @@ namespace BizHawk.Client.Common
|
|||
protected const string Md5 = "MD5";
|
||||
protected const string MovieOrigin = "MovieOrigin";
|
||||
|
||||
public ImportResult Import(IMovieSession session, IEmulator emulator, string path, Config config)
|
||||
protected IDialogParent _dialogParent;
|
||||
|
||||
public ImportResult Import(
|
||||
IDialogParent dialogParent,
|
||||
IMovieSession session,
|
||||
IEmulator emulator,
|
||||
string path,
|
||||
Config config)
|
||||
{
|
||||
_dialogParent = dialogParent;
|
||||
SourceFile = new FileInfo(path);
|
||||
Config = config;
|
||||
|
||||
|
|
|
@ -31,7 +31,12 @@ namespace BizHawk.Client.Common
|
|||
);
|
||||
|
||||
// Attempt to import another type of movie file into a movie object.
|
||||
public static ImportResult ImportFile(IMovieSession session, IEmulator emulator, string path, Config config)
|
||||
public static ImportResult ImportFile(
|
||||
IDialogParent dialogParent,
|
||||
IMovieSession session,
|
||||
IEmulator emulator,
|
||||
string path,
|
||||
Config config)
|
||||
{
|
||||
string ext = Path.GetExtension(path) ?? "";
|
||||
var importerType = ImporterForExtension(ext);
|
||||
|
@ -48,7 +53,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
return importer == null
|
||||
? ImportResult.Error($"No importer found for file type {ext}")
|
||||
: importer.Import(session, emulator, path, config);
|
||||
: importer.Import(dialogParent, session, emulator, path, config);
|
||||
}
|
||||
|
||||
private static Type ImporterForExtension(string ext)
|
||||
|
|
|
@ -3994,7 +3994,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void ProcessMovieImport(string fn, bool start)
|
||||
{
|
||||
var result = MovieImport.ImportFile(MovieSession, Emulator, fn, Config);
|
||||
var result = MovieImport.ImportFile(this, MovieSession, Emulator, fn, Config);
|
||||
|
||||
if (result.Errors.Any())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue