Maybe fix #1483 re: drag+drop
This commit is contained in:
parent
be13c08959
commit
df97ef3dfe
|
@ -2587,20 +2587,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormDragDrop(object sender, DragEventArgs e)
|
private void FormDragDrop(object sender, DragEventArgs e)
|
||||||
{
|
=> PathsFromDragDrop = (string[]) e.Data.GetData(DataFormats.FileDrop);
|
||||||
Sound.StopSound();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FormDragDrop_internal(e);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
ShowMessageBox(owner: null, $"Exception on drag and drop:\n{ex}");
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Sound.StartSound();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,7 +214,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormDragDrop_internal(DragEventArgs e)
|
private string[] PathsFromDragDrop;
|
||||||
|
|
||||||
|
private void FormDragDrop_internal()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Refactor, moving the loading of particular files into separate functions that can
|
* Refactor, moving the loading of particular files into separate functions that can
|
||||||
|
@ -243,7 +245,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
* Make that order easy to change in the code, heavily suggesting ROM and playback as first and last respectively.
|
* Make that order easy to change in the code, heavily suggesting ROM and playback as first and last respectively.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
|
||||||
Dictionary<LoadOrdering, List<FileInformation>> sortedFiles = new Dictionary<LoadOrdering, List<FileInformation>>();
|
Dictionary<LoadOrdering, List<FileInformation>> sortedFiles = new Dictionary<LoadOrdering, List<FileInformation>>();
|
||||||
|
|
||||||
// Initialize the dictionary's lists.
|
// Initialize the dictionary's lists.
|
||||||
|
@ -252,7 +253,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
sortedFiles.Add(value, new List<FileInformation>());
|
sortedFiles.Add(value, new List<FileInformation>());
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessFileList(filePaths.Select(EmuHawkUtil.ResolveShortcut), ref sortedFiles);
|
ProcessFileList(PathsFromDragDrop.Select(EmuHawkUtil.ResolveShortcut), ref sortedFiles);
|
||||||
|
|
||||||
// For each of the different types of item, if there are no items of that type, skip them.
|
// For each of the different types of item, if there are no items of that type, skip them.
|
||||||
// If there is exactly one of that type of item, load it.
|
// If there is exactly one of that type of item, load it.
|
||||||
|
|
|
@ -2247,6 +2247,19 @@ namespace BizHawk.Client.EmuHawk
|
||||||
ScreenSaver.ResetTimerPeriodically();
|
ScreenSaver.ResetTimerPeriodically();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PathsFromDragDrop is not null) this.DoWithTempMute(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FormDragDrop_internal();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ShowMessageBox(owner: null, $"Exception on drag and drop:\n{ex}");
|
||||||
|
}
|
||||||
|
PathsFromDragDrop = null;
|
||||||
|
});
|
||||||
|
|
||||||
List<string[]> todo = new();
|
List<string[]> todo = new();
|
||||||
lock (_singleInstanceForwardedArgs)
|
lock (_singleInstanceForwardedArgs)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue